| 1 |
var wp; |
| 2 |
(wp ||= {}).formatLibrary = (() => { |
| 3 |
var __create = Object.create; |
| 4 |
var __defProp = Object.defineProperty; |
| 5 |
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; |
| 6 |
var __getOwnPropNames = Object.getOwnPropertyNames; |
| 7 |
var __getProtoOf = Object.getPrototypeOf; |
| 8 |
var __hasOwnProp = Object.prototype.hasOwnProperty; |
| 9 |
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, { |
| 10 |
get: (a, b) => (typeof require !== "undefined" ? require : a)[b] |
| 11 |
}) : x)(function(x) { |
| 12 |
if (typeof require !== "undefined") return require.apply(this, arguments); |
| 13 |
throw Error('Dynamic require of "' + x + '" is not supported'); |
| 14 |
}); |
| 15 |
var __commonJS = (cb, mod) => function __require2() { |
| 16 |
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; |
| 17 |
}; |
| 18 |
var __export = (target, all) => { |
| 19 |
for (var name16 in all) |
| 20 |
__defProp(target, name16, { get: all[name16], enumerable: true }); |
| 21 |
}; |
| 22 |
var __copyProps = (to, from, except, desc) => { |
| 23 |
if (from && typeof from === "object" || typeof from === "function") { |
| 24 |
for (let key of __getOwnPropNames(from)) |
| 25 |
if (!__hasOwnProp.call(to, key) && key !== except) |
| 26 |
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); |
| 27 |
} |
| 28 |
return to; |
| 29 |
}; |
| 30 |
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( |
| 31 |
// If the importer is in node compatibility mode or this is not an ESM |
| 32 |
// file that has been converted to a CommonJS file using a Babel- |
| 33 |
// compatible transform (i.e. "__esModule" has not been set), then set |
| 34 |
// "default" to the CommonJS "module.exports" for node compatibility. |
| 35 |
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, |
| 36 |
mod |
| 37 |
)); |
| 38 |
|
| 39 |
// package-external:@wordpress/rich-text |
| 40 |
var require_rich_text = __commonJS({ |
| 41 |
"package-external:@wordpress/rich-text"(exports, module) { |
| 42 |
module.exports = window.wp.richText; |
| 43 |
} |
| 44 |
}); |
| 45 |
|
| 46 |
// package-external:@wordpress/i18n |
| 47 |
var require_i18n = __commonJS({ |
| 48 |
"package-external:@wordpress/i18n"(exports, module) { |
| 49 |
module.exports = window.wp.i18n; |
| 50 |
} |
| 51 |
}); |
| 52 |
|
| 53 |
// package-external:@wordpress/block-editor |
| 54 |
var require_block_editor = __commonJS({ |
| 55 |
"package-external:@wordpress/block-editor"(exports, module) { |
| 56 |
module.exports = window.wp.blockEditor; |
| 57 |
} |
| 58 |
}); |
| 59 |
|
| 60 |
// package-external:@wordpress/element |
| 61 |
var require_element = __commonJS({ |
| 62 |
"package-external:@wordpress/element"(exports, module) { |
| 63 |
module.exports = window.wp.element; |
| 64 |
} |
| 65 |
}); |
| 66 |
|
| 67 |
// package-external:@wordpress/primitives |
| 68 |
var require_primitives = __commonJS({ |
| 69 |
"package-external:@wordpress/primitives"(exports, module) { |
| 70 |
module.exports = window.wp.primitives; |
| 71 |
} |
| 72 |
}); |
| 73 |
|
| 74 |
// vendor-external:react/jsx-runtime |
| 75 |
var require_jsx_runtime = __commonJS({ |
| 76 |
"vendor-external:react/jsx-runtime"(exports, module) { |
| 77 |
module.exports = window.ReactJSXRuntime; |
| 78 |
} |
| 79 |
}); |
| 80 |
|
| 81 |
// package-external:@wordpress/components |
| 82 |
var require_components = __commonJS({ |
| 83 |
"package-external:@wordpress/components"(exports, module) { |
| 84 |
module.exports = window.wp.components; |
| 85 |
} |
| 86 |
}); |
| 87 |
|
| 88 |
// vendor-external:react |
| 89 |
var require_react = __commonJS({ |
| 90 |
"vendor-external:react"(exports, module) { |
| 91 |
module.exports = window.React; |
| 92 |
} |
| 93 |
}); |
| 94 |
|
| 95 |
// vendor-external:react-dom |
| 96 |
var require_react_dom = __commonJS({ |
| 97 |
"vendor-external:react-dom"(exports, module) { |
| 98 |
module.exports = window.ReactDOM; |
| 99 |
} |
| 100 |
}); |
| 101 |
|
| 102 |
// node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js |
| 103 |
var require_use_sync_external_store_shim_development = __commonJS({ |
| 104 |
"node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js"(exports) { |
| 105 |
"use strict"; |
| 106 |
(function() { |
| 107 |
function is(x, y) { |
| 108 |
return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y; |
| 109 |
} |
| 110 |
function useSyncExternalStore$2(subscribe2, getSnapshot2) { |
| 111 |
didWarnOld18Alpha || void 0 === React31.startTransition || (didWarnOld18Alpha = true, console.error( |
| 112 |
"You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release." |
| 113 |
)); |
| 114 |
var value = getSnapshot2(); |
| 115 |
if (!didWarnUncachedGetSnapshot) { |
| 116 |
var cachedValue = getSnapshot2(); |
| 117 |
objectIs(value, cachedValue) || (console.error( |
| 118 |
"The result of getSnapshot should be cached to avoid an infinite loop" |
| 119 |
), didWarnUncachedGetSnapshot = true); |
| 120 |
} |
| 121 |
cachedValue = useState17({ |
| 122 |
inst: { value, getSnapshot: getSnapshot2 } |
| 123 |
}); |
| 124 |
var inst = cachedValue[0].inst, forceUpdate = cachedValue[1]; |
| 125 |
useLayoutEffect3( |
| 126 |
function() { |
| 127 |
inst.value = value; |
| 128 |
inst.getSnapshot = getSnapshot2; |
| 129 |
checkIfSnapshotChanged(inst) && forceUpdate({ inst }); |
| 130 |
}, |
| 131 |
[subscribe2, value, getSnapshot2] |
| 132 |
); |
| 133 |
useEffect12( |
| 134 |
function() { |
| 135 |
checkIfSnapshotChanged(inst) && forceUpdate({ inst }); |
| 136 |
return subscribe2(function() { |
| 137 |
checkIfSnapshotChanged(inst) && forceUpdate({ inst }); |
| 138 |
}); |
| 139 |
}, |
| 140 |
[subscribe2] |
| 141 |
); |
| 142 |
useDebugValue(value); |
| 143 |
return value; |
| 144 |
} |
| 145 |
function checkIfSnapshotChanged(inst) { |
| 146 |
var latestGetSnapshot = inst.getSnapshot; |
| 147 |
inst = inst.value; |
| 148 |
try { |
| 149 |
var nextValue = latestGetSnapshot(); |
| 150 |
return !objectIs(inst, nextValue); |
| 151 |
} catch (error2) { |
| 152 |
return true; |
| 153 |
} |
| 154 |
} |
| 155 |
function useSyncExternalStore$1(subscribe2, getSnapshot2) { |
| 156 |
return getSnapshot2(); |
| 157 |
} |
| 158 |
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error()); |
| 159 |
var React31 = require_react(), objectIs = "function" === typeof Object.is ? Object.is : is, useState17 = React31.useState, useEffect12 = React31.useEffect, useLayoutEffect3 = React31.useLayoutEffect, useDebugValue = React31.useDebugValue, didWarnOld18Alpha = false, didWarnUncachedGetSnapshot = false, shim = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2; |
| 160 |
exports.useSyncExternalStore = void 0 !== React31.useSyncExternalStore ? React31.useSyncExternalStore : shim; |
| 161 |
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error()); |
| 162 |
})(); |
| 163 |
} |
| 164 |
}); |
| 165 |
|
| 166 |
// node_modules/use-sync-external-store/shim/index.js |
| 167 |
var require_shim = __commonJS({ |
| 168 |
"node_modules/use-sync-external-store/shim/index.js"(exports, module) { |
| 169 |
"use strict"; |
| 170 |
if (false) { |
| 171 |
module.exports = null; |
| 172 |
} else { |
| 173 |
module.exports = require_use_sync_external_store_shim_development(); |
| 174 |
} |
| 175 |
} |
| 176 |
}); |
| 177 |
|
| 178 |
// package-external:@wordpress/a11y |
| 179 |
var require_a11y = __commonJS({ |
| 180 |
"package-external:@wordpress/a11y"(exports, module) { |
| 181 |
module.exports = window.wp.a11y; |
| 182 |
} |
| 183 |
}); |
| 184 |
|
| 185 |
// package-external:@wordpress/compose |
| 186 |
var require_compose = __commonJS({ |
| 187 |
"package-external:@wordpress/compose"(exports, module) { |
| 188 |
module.exports = window.wp.compose; |
| 189 |
} |
| 190 |
}); |
| 191 |
|
| 192 |
// package-external:@wordpress/private-apis |
| 193 |
var require_private_apis = __commonJS({ |
| 194 |
"package-external:@wordpress/private-apis"(exports, module) { |
| 195 |
module.exports = window.wp.privateApis; |
| 196 |
} |
| 197 |
}); |
| 198 |
|
| 199 |
// package-external:@wordpress/url |
| 200 |
var require_url = __commonJS({ |
| 201 |
"package-external:@wordpress/url"(exports, module) { |
| 202 |
module.exports = window.wp.url; |
| 203 |
} |
| 204 |
}); |
| 205 |
|
| 206 |
// package-external:@wordpress/html-entities |
| 207 |
var require_html_entities = __commonJS({ |
| 208 |
"package-external:@wordpress/html-entities"(exports, module) { |
| 209 |
module.exports = window.wp.htmlEntities; |
| 210 |
} |
| 211 |
}); |
| 212 |
|
| 213 |
// package-external:@wordpress/data |
| 214 |
var require_data = __commonJS({ |
| 215 |
"package-external:@wordpress/data"(exports, module) { |
| 216 |
module.exports = window.wp.data; |
| 217 |
} |
| 218 |
}); |
| 219 |
|
| 220 |
// packages/format-library/build-module/index.mjs |
| 221 |
var import_rich_text18 = __toESM(require_rich_text(), 1); |
| 222 |
|
| 223 |
// packages/format-library/build-module/bold/index.mjs |
| 224 |
var import_i18n = __toESM(require_i18n(), 1); |
| 225 |
var import_rich_text = __toESM(require_rich_text(), 1); |
| 226 |
var import_block_editor = __toESM(require_block_editor(), 1); |
| 227 |
|
| 228 |
// packages/icons/build-module/icon/index.mjs |
| 229 |
var import_element = __toESM(require_element(), 1); |
| 230 |
var icon_default = (0, import_element.forwardRef)( |
| 231 |
({ icon, size = 24, ...props }, ref) => { |
| 232 |
return (0, import_element.cloneElement)(icon, { |
| 233 |
width: size, |
| 234 |
height: size, |
| 235 |
...props, |
| 236 |
ref |
| 237 |
}); |
| 238 |
} |
| 239 |
); |
| 240 |
|
| 241 |
// packages/icons/build-module/library/button.mjs |
| 242 |
var import_primitives = __toESM(require_primitives(), 1); |
| 243 |
var import_jsx_runtime = __toESM(require_jsx_runtime(), 1); |
| 244 |
var button_default = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_primitives.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_primitives.Path, { d: "M8 12.5h8V11H8v1.5Z M19 6.5H5a2 2 0 0 0-2 2V15a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8.5a2 2 0 0 0-2-2ZM5 8h14a.5.5 0 0 1 .5.5V15a.5.5 0 0 1-.5.5H5a.5.5 0 0 1-.5-.5V8.5A.5.5 0 0 1 5 8Z" }) }); |
| 245 |
|
| 246 |
// packages/icons/build-module/library/chevron-right.mjs |
| 247 |
var import_primitives2 = __toESM(require_primitives(), 1); |
| 248 |
var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1); |
| 249 |
var chevron_right_default = /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_primitives2.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_primitives2.Path, { d: "M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z" }) }); |
| 250 |
|
| 251 |
// packages/icons/build-module/library/code.mjs |
| 252 |
var import_primitives3 = __toESM(require_primitives(), 1); |
| 253 |
var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1); |
| 254 |
var code_default = /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_primitives3.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_primitives3.Path, { d: "M20.8 10.7l-4.3-4.3-1.1 1.1 4.3 4.3c.1.1.1.3 0 .4l-4.3 4.3 1.1 1.1 4.3-4.3c.7-.8.7-1.9 0-2.6zM4.2 11.8l4.3-4.3-1-1-4.3 4.3c-.7.7-.7 1.8 0 2.5l4.3 4.3 1.1-1.1-4.3-4.3c-.2-.1-.2-.3-.1-.4z" }) }); |
| 255 |
|
| 256 |
// packages/icons/build-module/library/color.mjs |
| 257 |
var import_primitives4 = __toESM(require_primitives(), 1); |
| 258 |
var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1); |
| 259 |
var color_default = /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_primitives4.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_primitives4.Path, { d: "M17.2 10.9c-.5-1-1.2-2.1-2.1-3.2-.6-.9-1.3-1.7-2.1-2.6L12 4l-1 1.1c-.6.9-1.3 1.7-2 2.6-.8 1.2-1.5 2.3-2 3.2-.6 1.2-1 2.2-1 3 0 3.4 2.7 6.1 6.1 6.1s6.1-2.7 6.1-6.1c0-.8-.3-1.8-1-3zm-5.1 7.6c-2.5 0-4.6-2.1-4.6-4.6 0-.3.1-1 .8-2.3.5-.9 1.1-1.9 2-3.1.7-.9 1.3-1.7 1.8-2.3.7.8 1.3 1.6 1.8 2.3.8 1.1 1.5 2.2 2 3.1.7 1.3.8 2 .8 2.3 0 2.5-2.1 4.6-4.6 4.6z" }) }); |
| 260 |
|
| 261 |
// packages/icons/build-module/library/format-bold.mjs |
| 262 |
var import_primitives5 = __toESM(require_primitives(), 1); |
| 263 |
var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1); |
| 264 |
var format_bold_default = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_primitives5.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_primitives5.Path, { d: "M14.7 11.3c1-.6 1.5-1.6 1.5-3 0-2.3-1.3-3.4-4-3.4H7v14h5.8c1.4 0 2.5-.3 3.3-1 .8-.7 1.2-1.7 1.2-2.9.1-1.9-.8-3.1-2.6-3.7zm-5.1-4h2.3c.6 0 1.1.1 1.4.4.3.3.5.7.5 1.2s-.2 1-.5 1.2c-.3.3-.8.4-1.4.4H9.6V7.3zm4.6 9c-.4.3-1 .4-1.7.4H9.6v-3.9h2.9c.7 0 1.3.2 1.7.5.4.3.6.8.6 1.5s-.2 1.2-.6 1.5z" }) }); |
| 265 |
|
| 266 |
// packages/icons/build-module/library/format-italic.mjs |
| 267 |
var import_primitives6 = __toESM(require_primitives(), 1); |
| 268 |
var import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1); |
| 269 |
var format_italic_default = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_primitives6.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_primitives6.Path, { d: "M12.5 5L10 19h1.9l2.5-14z" }) }); |
| 270 |
|
| 271 |
// packages/icons/build-module/library/format-strikethrough.mjs |
| 272 |
var import_primitives7 = __toESM(require_primitives(), 1); |
| 273 |
var import_jsx_runtime7 = __toESM(require_jsx_runtime(), 1); |
| 274 |
var format_strikethrough_default = /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_primitives7.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_primitives7.Path, { d: "M9.1 9v-.5c0-.6.2-1.1.7-1.4.5-.3 1.2-.5 2-.5.7 0 1.4.1 2.1.3.7.2 1.4.5 2.1.9l.2-1.9c-.6-.3-1.2-.5-1.9-.7-.8-.1-1.6-.2-2.4-.2-1.5 0-2.7.3-3.6 1-.8.7-1.2 1.5-1.2 2.6V9h2zM20 12H4v1h8.3c.3.1.6.2.8.3.5.2.9.5 1.1.8.3.3.4.7.4 1.2 0 .7-.2 1.1-.8 1.5-.5.3-1.2.5-2.1.5-.8 0-1.6-.1-2.4-.3-.8-.2-1.5-.5-2.2-.8L7 18.1c.5.2 1.2.4 2 .6.8.2 1.6.3 2.4.3 1.7 0 3-.3 3.9-1 .9-.7 1.3-1.6 1.3-2.8 0-.9-.2-1.7-.7-2.2H20v-1z" }) }); |
| 275 |
|
| 276 |
// packages/icons/build-module/library/help.mjs |
| 277 |
var import_primitives8 = __toESM(require_primitives(), 1); |
| 278 |
var import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1); |
| 279 |
var help_default = /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_primitives8.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_primitives8.Path, { d: "M12 4a8 8 0 1 1 .001 16.001A8 8 0 0 1 12 4Zm0 1.5a6.5 6.5 0 1 0-.001 13.001A6.5 6.5 0 0 0 12 5.5Zm.75 11h-1.5V15h1.5v1.5Zm-.445-9.234a3 3 0 0 1 .445 5.89V14h-1.5v-1.25c0-.57.452-.958.917-1.01A1.5 1.5 0 0 0 12 8.75a1.5 1.5 0 0 0-1.5 1.5H9a3 3 0 0 1 3.305-2.984Z" }) }); |
| 280 |
|
| 281 |
// packages/icons/build-module/library/language.mjs |
| 282 |
var import_primitives9 = __toESM(require_primitives(), 1); |
| 283 |
var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1); |
| 284 |
var language_default = /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_primitives9.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_primitives9.Path, { d: "M17.5 10h-1.7l-3.7 10.5h1.7l.9-2.6h3.9l.9 2.6h1.7L17.5 10zm-2.2 6.3 1.4-4 1.4 4h-2.8zm-4.8-3.8c1.6-1.8 2.9-3.6 3.7-5.7H16V5.2h-5.8V3H8.8v2.2H3v1.5h9.6c-.7 1.6-1.8 3.1-3.1 4.6C8.6 10.2 7.8 9 7.2 8H5.6c.6 1.4 1.7 2.9 2.9 4.4l-2.4 2.4c-.3.4-.7.8-1.1 1.2l1 1 1.2-1.2c.8-.8 1.6-1.5 2.3-2.3.8.9 1.7 1.7 2.5 2.5l.6-1.5c-.7-.6-1.4-1.3-2.1-2z" }) }); |
| 285 |
|
| 286 |
// packages/icons/build-module/library/link.mjs |
| 287 |
var import_primitives10 = __toESM(require_primitives(), 1); |
| 288 |
var import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1); |
| 289 |
var link_default = /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_primitives10.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_primitives10.Path, { d: "M10 17.389H8.444A5.194 5.194 0 1 1 8.444 7H10v1.5H8.444a3.694 3.694 0 0 0 0 7.389H10v1.5ZM14 7h1.556a5.194 5.194 0 0 1 0 10.39H14v-1.5h1.556a3.694 3.694 0 0 0 0-7.39H14V7Zm-4.5 6h5v-1.5h-5V13Z" }) }); |
| 290 |
|
| 291 |
// packages/icons/build-module/library/math.mjs |
| 292 |
var import_primitives11 = __toESM(require_primitives(), 1); |
| 293 |
var import_jsx_runtime11 = __toESM(require_jsx_runtime(), 1); |
| 294 |
var math_default = /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_primitives11.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_primitives11.Path, { d: "M11.2 6.8c-.7 0-1.4.5-1.6 1.1l-2.8 7.5-1.2-1.8c-.1-.2-.4-.3-.6-.3H3v1.5h1.6l1.2 1.8c.6.9 1.9.7 2.2-.3l2.9-7.9s.1-.2.2-.2h7.8V6.7h-7.8Zm5.3 3.4-1.9 1.9-1.9-1.9-1.1 1.1 1.9 1.9-1.9 1.9 1.1 1.1 1.9-1.9 1.9 1.9 1.1-1.1-1.9-1.9 1.9-1.9-1.1-1.1Z" }) }); |
| 295 |
|
| 296 |
// packages/icons/build-module/library/subscript.mjs |
| 297 |
var import_primitives12 = __toESM(require_primitives(), 1); |
| 298 |
var import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1); |
| 299 |
var subscript_default = /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_primitives12.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_primitives12.Path, { d: "M16.9 18.3l.8-1.2c.4-.6.7-1.2.9-1.6.2-.4.3-.8.3-1.2 0-.3-.1-.7-.2-1-.1-.3-.4-.5-.6-.7-.3-.2-.6-.3-1-.3s-.8.1-1.1.2c-.3.1-.7.3-1 .6l.2 1.3c.3-.3.5-.5.8-.6s.6-.2.9-.2c.3 0 .5.1.7.2.2.2.2.4.2.7 0 .3-.1.5-.2.8-.1.3-.4.7-.8 1.3L15 19.4h4.3v-1.2h-2.4zM14.1 7.2h-2L9.5 11 6.9 7.2h-2l3.6 5.3L4.7 18h2l2.7-4 2.7 4h2l-3.8-5.5 3.8-5.3z" }) }); |
| 300 |
|
| 301 |
// packages/icons/build-module/library/superscript.mjs |
| 302 |
var import_primitives13 = __toESM(require_primitives(), 1); |
| 303 |
var import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1); |
| 304 |
var superscript_default = /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_primitives13.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_primitives13.Path, { d: "M16.9 10.3l.8-1.3c.4-.6.7-1.2.9-1.6.2-.4.3-.8.3-1.2 0-.3-.1-.7-.2-1-.2-.2-.4-.4-.7-.6-.3-.2-.6-.3-1-.3s-.8.1-1.1.2c-.3.1-.7.3-1 .6l.1 1.3c.3-.3.5-.5.8-.6s.6-.2.9-.2c.3 0 .5.1.7.2.2.2.2.4.2.7 0 .3-.1.5-.2.8-.1.3-.4.7-.8 1.3l-1.8 2.8h4.3v-1.2h-2.2zm-2.8-3.1h-2L9.5 11 6.9 7.2h-2l3.6 5.3L4.7 18h2l2.7-4 2.7 4h2l-3.8-5.5 3.8-5.3z" }) }); |
| 305 |
|
| 306 |
// packages/icons/build-module/library/text-color.mjs |
| 307 |
var import_primitives14 = __toESM(require_primitives(), 1); |
| 308 |
var import_jsx_runtime14 = __toESM(require_jsx_runtime(), 1); |
| 309 |
var text_color_default = /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_primitives14.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_primitives14.Path, { d: "M12.9 6h-2l-4 11h1.9l1.1-3h4.2l1.1 3h1.9L12.9 6zm-2.5 6.5l1.5-4.9 1.7 4.9h-3.2z" }) }); |
| 310 |
|
| 311 |
// packages/format-library/build-module/bold/index.mjs |
| 312 |
var import_jsx_runtime15 = __toESM(require_jsx_runtime(), 1); |
| 313 |
var name = "core/bold"; |
| 314 |
var title = (0, import_i18n.__)("Bold"); |
| 315 |
var bold = { |
| 316 |
name, |
| 317 |
title, |
| 318 |
tagName: "strong", |
| 319 |
className: null, |
| 320 |
edit({ isActive, value, onChange, onFocus, isVisible = true }) { |
| 321 |
function onToggle() { |
| 322 |
onChange((0, import_rich_text.toggleFormat)(value, { type: name, title })); |
| 323 |
} |
| 324 |
function onClick() { |
| 325 |
onChange((0, import_rich_text.toggleFormat)(value, { type: name })); |
| 326 |
onFocus(); |
| 327 |
} |
| 328 |
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [ |
| 329 |
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)( |
| 330 |
import_block_editor.RichTextShortcut, |
| 331 |
{ |
| 332 |
type: "primary", |
| 333 |
character: "b", |
| 334 |
onUse: onToggle |
| 335 |
} |
| 336 |
), |
| 337 |
isVisible && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)( |
| 338 |
import_block_editor.RichTextToolbarButton, |
| 339 |
{ |
| 340 |
name: "bold", |
| 341 |
icon: format_bold_default, |
| 342 |
title, |
| 343 |
onClick, |
| 344 |
isActive, |
| 345 |
shortcutType: "primary", |
| 346 |
shortcutCharacter: "b" |
| 347 |
} |
| 348 |
), |
| 349 |
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)( |
| 350 |
import_block_editor.__unstableRichTextInputEvent, |
| 351 |
{ |
| 352 |
inputType: "formatBold", |
| 353 |
onInput: onToggle |
| 354 |
} |
| 355 |
) |
| 356 |
] }); |
| 357 |
} |
| 358 |
}; |
| 359 |
|
| 360 |
// packages/format-library/build-module/code/index.mjs |
| 361 |
var import_i18n2 = __toESM(require_i18n(), 1); |
| 362 |
var import_rich_text2 = __toESM(require_rich_text(), 1); |
| 363 |
var import_block_editor2 = __toESM(require_block_editor(), 1); |
| 364 |
var import_jsx_runtime16 = __toESM(require_jsx_runtime(), 1); |
| 365 |
var name2 = "core/code"; |
| 366 |
var title2 = (0, import_i18n2.__)("Inline code"); |
| 367 |
var code = { |
| 368 |
name: name2, |
| 369 |
title: title2, |
| 370 |
tagName: "code", |
| 371 |
className: null, |
| 372 |
__unstableInputRule(value) { |
| 373 |
const BACKTICK = "`"; |
| 374 |
const { start, text } = value; |
| 375 |
const characterBefore = text[start - 1]; |
| 376 |
if (characterBefore !== BACKTICK) { |
| 377 |
return value; |
| 378 |
} |
| 379 |
if (start - 2 < 0) { |
| 380 |
return value; |
| 381 |
} |
| 382 |
const indexBefore = text.lastIndexOf(BACKTICK, start - 2); |
| 383 |
if (indexBefore === -1) { |
| 384 |
return value; |
| 385 |
} |
| 386 |
const startIndex = indexBefore; |
| 387 |
const endIndex = start - 2; |
| 388 |
if (startIndex === endIndex) { |
| 389 |
return value; |
| 390 |
} |
| 391 |
value = (0, import_rich_text2.remove)(value, startIndex, startIndex + 1); |
| 392 |
value = (0, import_rich_text2.remove)(value, endIndex, endIndex + 1); |
| 393 |
value = (0, import_rich_text2.applyFormat)(value, { type: name2 }, startIndex, endIndex); |
| 394 |
return value; |
| 395 |
}, |
| 396 |
edit({ value, onChange, onFocus, isActive }) { |
| 397 |
function onClick() { |
| 398 |
onChange((0, import_rich_text2.toggleFormat)(value, { type: name2, title: title2 })); |
| 399 |
onFocus(); |
| 400 |
} |
| 401 |
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [ |
| 402 |
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)( |
| 403 |
import_block_editor2.RichTextShortcut, |
| 404 |
{ |
| 405 |
type: "access", |
| 406 |
character: "x", |
| 407 |
onUse: onClick |
| 408 |
} |
| 409 |
), |
| 410 |
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)( |
| 411 |
import_block_editor2.RichTextToolbarButton, |
| 412 |
{ |
| 413 |
icon: code_default, |
| 414 |
title: title2, |
| 415 |
onClick, |
| 416 |
isActive, |
| 417 |
role: "menuitemcheckbox" |
| 418 |
} |
| 419 |
) |
| 420 |
] }); |
| 421 |
} |
| 422 |
}; |
| 423 |
|
| 424 |
// packages/format-library/build-module/image/index.mjs |
| 425 |
var import_components = __toESM(require_components(), 1); |
| 426 |
|
| 427 |
// node_modules/clsx/dist/clsx.mjs |
| 428 |
function r(e) { |
| 429 |
var t, f, n = ""; |
| 430 |
if ("string" == typeof e || "number" == typeof e) n += e; |
| 431 |
else if ("object" == typeof e) if (Array.isArray(e)) { |
| 432 |
var o = e.length; |
| 433 |
for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f); |
| 434 |
} else for (f in e) e[f] && (n && (n += " "), n += f); |
| 435 |
return n; |
| 436 |
} |
| 437 |
function clsx() { |
| 438 |
for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t); |
| 439 |
return n; |
| 440 |
} |
| 441 |
var clsx_default = clsx; |
| 442 |
|
| 443 |
// node_modules/@base-ui/utils/useControlled.mjs |
| 444 |
var React = __toESM(require_react(), 1); |
| 445 |
|
| 446 |
// node_modules/@base-ui/utils/error.mjs |
| 447 |
var set; |
| 448 |
if (true) { |
| 449 |
set = /* @__PURE__ */ new Set(); |
| 450 |
} |
| 451 |
function error(...messages) { |
| 452 |
if (true) { |
| 453 |
const messageKey = messages.join(" "); |
| 454 |
if (!set.has(messageKey)) { |
| 455 |
set.add(messageKey); |
| 456 |
console.error(`Base UI: ${messageKey}`); |
| 457 |
} |
| 458 |
} |
| 459 |
} |
| 460 |
|
| 461 |
// node_modules/@base-ui/utils/useControlled.mjs |
| 462 |
function useControlled({ |
| 463 |
controlled, |
| 464 |
default: defaultProp, |
| 465 |
name: name16, |
| 466 |
state = "value" |
| 467 |
}) { |
| 468 |
const { |
| 469 |
current: isControlled |
| 470 |
} = React.useRef(controlled !== void 0); |
| 471 |
const [valueState, setValue] = React.useState(defaultProp); |
| 472 |
const value = isControlled ? controlled : valueState; |
| 473 |
if (true) { |
| 474 |
React.useEffect(() => { |
| 475 |
if (isControlled !== (controlled !== void 0)) { |
| 476 |
error([`A component is changing the ${isControlled ? "" : "un"}controlled ${state} state of ${name16} to be ${isControlled ? "un" : ""}controlled.`, "Elements should not switch from uncontrolled to controlled (or vice versa).", `Decide between using a controlled or uncontrolled ${name16} element for the lifetime of the component.`, "The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.", "More info: https://fb.me/react-controlled-components"].join("\n")); |
| 477 |
} |
| 478 |
}, [state, name16, controlled]); |
| 479 |
const { |
| 480 |
current: defaultValue |
| 481 |
} = React.useRef(defaultProp); |
| 482 |
React.useEffect(() => { |
| 483 |
if (!isControlled && serializeToDevModeString(defaultValue) !== serializeToDevModeString(defaultProp)) { |
| 484 |
error([`A component is changing the default ${state} state of an uncontrolled ${name16} after being initialized. To suppress this warning opt to use a controlled ${name16}.`].join("\n")); |
| 485 |
} |
| 486 |
}, [defaultProp]); |
| 487 |
} |
| 488 |
const setValueIfUncontrolled = React.useCallback((newValue) => { |
| 489 |
if (!isControlled) { |
| 490 |
setValue(newValue); |
| 491 |
} |
| 492 |
}, []); |
| 493 |
return [value, setValueIfUncontrolled]; |
| 494 |
} |
| 495 |
function serializeToDevModeString(input) { |
| 496 |
let nextId = 0; |
| 497 |
const seen = /* @__PURE__ */ new WeakMap(); |
| 498 |
try { |
| 499 |
const result = JSON.stringify(input, function replacer(key, value) { |
| 500 |
if (key === "_owner" && this != null && typeof this === "object" && "$$typeof" in this) { |
| 501 |
return void 0; |
| 502 |
} |
| 503 |
if (typeof value === "bigint") { |
| 504 |
return `__bigint__:${value}`; |
| 505 |
} |
| 506 |
if (value !== null && typeof value === "object") { |
| 507 |
const id = seen.get(value); |
| 508 |
if (id !== void 0) { |
| 509 |
return `__object__:${id}`; |
| 510 |
} |
| 511 |
seen.set(value, nextId); |
| 512 |
nextId += 1; |
| 513 |
} |
| 514 |
return value; |
| 515 |
}); |
| 516 |
return result ?? `__top__:${typeof input}`; |
| 517 |
} catch { |
| 518 |
return "__unserializable__"; |
| 519 |
} |
| 520 |
} |
| 521 |
|
| 522 |
// node_modules/@base-ui/utils/safeReact.mjs |
| 523 |
var React2 = __toESM(require_react(), 1); |
| 524 |
var SafeReact = { |
| 525 |
...React2 |
| 526 |
}; |
| 527 |
|
| 528 |
// node_modules/@base-ui/utils/useRefWithInit.mjs |
| 529 |
var React3 = __toESM(require_react(), 1); |
| 530 |
var UNINITIALIZED = {}; |
| 531 |
function useRefWithInit(init, initArg) { |
| 532 |
const ref = React3.useRef(UNINITIALIZED); |
| 533 |
if (ref.current === UNINITIALIZED) { |
| 534 |
ref.current = init(initArg); |
| 535 |
} |
| 536 |
return ref; |
| 537 |
} |
| 538 |
|
| 539 |
// node_modules/@base-ui/utils/useStableCallback.mjs |
| 540 |
var useInsertionEffect = SafeReact.useInsertionEffect; |
| 541 |
var useSafeInsertionEffect = ( |
| 542 |
// React 17 doesn't have useInsertionEffect. |
| 543 |
useInsertionEffect && // Preact replaces useInsertionEffect with useLayoutEffect and fires too late. |
| 544 |
useInsertionEffect !== SafeReact.useLayoutEffect ? useInsertionEffect : (fn) => fn() |
| 545 |
); |
| 546 |
function useStableCallback(callback) { |
| 547 |
const stable = useRefWithInit(createStableCallback).current; |
| 548 |
stable.next = callback; |
| 549 |
useSafeInsertionEffect(stable.effect); |
| 550 |
return stable.trampoline; |
| 551 |
} |
| 552 |
function createStableCallback() { |
| 553 |
const stable = { |
| 554 |
next: void 0, |
| 555 |
callback: assertNotCalled, |
| 556 |
trampoline: (...args) => stable.callback?.(...args), |
| 557 |
effect: () => { |
| 558 |
stable.callback = stable.next; |
| 559 |
} |
| 560 |
}; |
| 561 |
return stable; |
| 562 |
} |
| 563 |
function assertNotCalled() { |
| 564 |
if (true) { |
| 565 |
throw ( |
| 566 |
/* minify-error-disabled */ |
| 567 |
new Error("Base UI: Cannot call an event handler while rendering.") |
| 568 |
); |
| 569 |
} |
| 570 |
} |
| 571 |
|
| 572 |
// node_modules/@base-ui/utils/useIsoLayoutEffect.mjs |
| 573 |
var React4 = __toESM(require_react(), 1); |
| 574 |
var noop = () => { |
| 575 |
}; |
| 576 |
var useIsoLayoutEffect = typeof document !== "undefined" ? React4.useLayoutEffect : noop; |
| 577 |
|
| 578 |
// node_modules/@base-ui/utils/warn.mjs |
| 579 |
var set2; |
| 580 |
if (true) { |
| 581 |
set2 = /* @__PURE__ */ new Set(); |
| 582 |
} |
| 583 |
function warn(...messages) { |
| 584 |
if (true) { |
| 585 |
const messageKey = messages.join(" "); |
| 586 |
if (!set2.has(messageKey)) { |
| 587 |
set2.add(messageKey); |
| 588 |
console.warn(`Base UI: ${messageKey}`); |
| 589 |
} |
| 590 |
} |
| 591 |
} |
| 592 |
|
| 593 |
// node_modules/@base-ui/react/internals/composite/list/CompositeList.mjs |
| 594 |
var React6 = __toESM(require_react(), 1); |
| 595 |
|
| 596 |
// node_modules/@base-ui/react/internals/composite/list/CompositeListContext.mjs |
| 597 |
var React5 = __toESM(require_react(), 1); |
| 598 |
var CompositeListContext = /* @__PURE__ */ React5.createContext({ |
| 599 |
register: () => { |
| 600 |
}, |
| 601 |
unregister: () => { |
| 602 |
}, |
| 603 |
subscribeMapChange: () => { |
| 604 |
return () => { |
| 605 |
}; |
| 606 |
}, |
| 607 |
elementsRef: { |
| 608 |
current: [] |
| 609 |
}, |
| 610 |
nextIndexRef: { |
| 611 |
current: 0 |
| 612 |
} |
| 613 |
}); |
| 614 |
if (true) CompositeListContext.displayName = "CompositeListContext"; |
| 615 |
function useCompositeListContext() { |
| 616 |
return React5.useContext(CompositeListContext); |
| 617 |
} |
| 618 |
|
| 619 |
// node_modules/@base-ui/react/internals/composite/list/CompositeList.mjs |
| 620 |
var import_jsx_runtime17 = __toESM(require_jsx_runtime(), 1); |
| 621 |
function CompositeList(props) { |
| 622 |
const { |
| 623 |
children, |
| 624 |
elementsRef, |
| 625 |
labelsRef, |
| 626 |
onMapChange: onMapChangeProp |
| 627 |
} = props; |
| 628 |
const onMapChange = useStableCallback(onMapChangeProp); |
| 629 |
const nextIndexRef = React6.useRef(0); |
| 630 |
const listeners = useRefWithInit(createListeners).current; |
| 631 |
const map = useRefWithInit(createMap).current; |
| 632 |
const [mapTick, setMapTick] = React6.useState(0); |
| 633 |
const lastTickRef = React6.useRef(mapTick); |
| 634 |
const register = useStableCallback((node, metadata) => { |
| 635 |
map.set(node, metadata ?? null); |
| 636 |
lastTickRef.current += 1; |
| 637 |
setMapTick(lastTickRef.current); |
| 638 |
}); |
| 639 |
const unregister = useStableCallback((node) => { |
| 640 |
map.delete(node); |
| 641 |
lastTickRef.current += 1; |
| 642 |
setMapTick(lastTickRef.current); |
| 643 |
}); |
| 644 |
const sortedMap = React6.useMemo(() => { |
| 645 |
disableEslintWarning(mapTick); |
| 646 |
const newMap = /* @__PURE__ */ new Map(); |
| 647 |
const sortedNodes = Array.from(map.keys()).filter((node) => node.isConnected).sort(sortByDocumentPosition); |
| 648 |
sortedNodes.forEach((node, index) => { |
| 649 |
const metadata = map.get(node) ?? {}; |
| 650 |
newMap.set(node, { |
| 651 |
...metadata, |
| 652 |
index |
| 653 |
}); |
| 654 |
}); |
| 655 |
return newMap; |
| 656 |
}, [map, mapTick]); |
| 657 |
useIsoLayoutEffect(() => { |
| 658 |
if (typeof MutationObserver !== "function" || sortedMap.size === 0) { |
| 659 |
return void 0; |
| 660 |
} |
| 661 |
const mutationObserver = new MutationObserver((entries) => { |
| 662 |
const diff = /* @__PURE__ */ new Set(); |
| 663 |
const updateDiff = (node) => diff.has(node) ? diff.delete(node) : diff.add(node); |
| 664 |
entries.forEach((entry) => { |
| 665 |
entry.removedNodes.forEach(updateDiff); |
| 666 |
entry.addedNodes.forEach(updateDiff); |
| 667 |
}); |
| 668 |
if (diff.size === 0) { |
| 669 |
lastTickRef.current += 1; |
| 670 |
setMapTick(lastTickRef.current); |
| 671 |
} |
| 672 |
}); |
| 673 |
sortedMap.forEach((_, node) => { |
| 674 |
if (node.parentElement) { |
| 675 |
mutationObserver.observe(node.parentElement, { |
| 676 |
childList: true |
| 677 |
}); |
| 678 |
} |
| 679 |
}); |
| 680 |
return () => { |
| 681 |
mutationObserver.disconnect(); |
| 682 |
}; |
| 683 |
}, [sortedMap]); |
| 684 |
useIsoLayoutEffect(() => { |
| 685 |
const shouldUpdateLengths = lastTickRef.current === mapTick; |
| 686 |
if (shouldUpdateLengths) { |
| 687 |
if (elementsRef.current.length !== sortedMap.size) { |
| 688 |
elementsRef.current.length = sortedMap.size; |
| 689 |
} |
| 690 |
if (labelsRef && labelsRef.current.length !== sortedMap.size) { |
| 691 |
labelsRef.current.length = sortedMap.size; |
| 692 |
} |
| 693 |
nextIndexRef.current = sortedMap.size; |
| 694 |
} |
| 695 |
onMapChange(sortedMap); |
| 696 |
}, [onMapChange, sortedMap, elementsRef, labelsRef, mapTick]); |
| 697 |
useIsoLayoutEffect(() => { |
| 698 |
return () => { |
| 699 |
elementsRef.current = []; |
| 700 |
}; |
| 701 |
}, [elementsRef]); |
| 702 |
useIsoLayoutEffect(() => { |
| 703 |
return () => { |
| 704 |
if (labelsRef) { |
| 705 |
labelsRef.current = []; |
| 706 |
} |
| 707 |
}; |
| 708 |
}, [labelsRef]); |
| 709 |
const subscribeMapChange = useStableCallback((fn) => { |
| 710 |
listeners.add(fn); |
| 711 |
return () => { |
| 712 |
listeners.delete(fn); |
| 713 |
}; |
| 714 |
}); |
| 715 |
useIsoLayoutEffect(() => { |
| 716 |
listeners.forEach((l) => l(sortedMap)); |
| 717 |
}, [listeners, sortedMap]); |
| 718 |
const contextValue = React6.useMemo(() => ({ |
| 719 |
register, |
| 720 |
unregister, |
| 721 |
subscribeMapChange, |
| 722 |
elementsRef, |
| 723 |
labelsRef, |
| 724 |
nextIndexRef |
| 725 |
}), [register, unregister, subscribeMapChange, elementsRef, labelsRef, nextIndexRef]); |
| 726 |
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(CompositeListContext.Provider, { |
| 727 |
value: contextValue, |
| 728 |
children |
| 729 |
}); |
| 730 |
} |
| 731 |
function createMap() { |
| 732 |
return /* @__PURE__ */ new Map(); |
| 733 |
} |
| 734 |
function createListeners() { |
| 735 |
return /* @__PURE__ */ new Set(); |
| 736 |
} |
| 737 |
function sortByDocumentPosition(a, b) { |
| 738 |
const position = a.compareDocumentPosition(b); |
| 739 |
if (position & Node.DOCUMENT_POSITION_FOLLOWING || position & Node.DOCUMENT_POSITION_CONTAINED_BY) { |
| 740 |
return -1; |
| 741 |
} |
| 742 |
if (position & Node.DOCUMENT_POSITION_PRECEDING || position & Node.DOCUMENT_POSITION_CONTAINS) { |
| 743 |
return 1; |
| 744 |
} |
| 745 |
return 0; |
| 746 |
} |
| 747 |
function disableEslintWarning(_) { |
| 748 |
} |
| 749 |
|
| 750 |
// node_modules/@base-ui/react/internals/direction-context/DirectionContext.mjs |
| 751 |
var React7 = __toESM(require_react(), 1); |
| 752 |
var DirectionContext = /* @__PURE__ */ React7.createContext(void 0); |
| 753 |
if (true) DirectionContext.displayName = "DirectionContext"; |
| 754 |
function useDirection() { |
| 755 |
const context = React7.useContext(DirectionContext); |
| 756 |
return context?.direction ?? "ltr"; |
| 757 |
} |
| 758 |
|
| 759 |
// node_modules/@base-ui/react/internals/useRenderElement.mjs |
| 760 |
var React10 = __toESM(require_react(), 1); |
| 761 |
|
| 762 |
// node_modules/@base-ui/utils/useMergedRefs.mjs |
| 763 |
function useMergedRefs(a, b, c, d) { |
| 764 |
const forkRef = useRefWithInit(createForkRef).current; |
| 765 |
if (didChange(forkRef, a, b, c, d)) { |
| 766 |
update(forkRef, [a, b, c, d]); |
| 767 |
} |
| 768 |
return forkRef.callback; |
| 769 |
} |
| 770 |
function useMergedRefsN(refs) { |
| 771 |
const forkRef = useRefWithInit(createForkRef).current; |
| 772 |
if (didChangeN(forkRef, refs)) { |
| 773 |
update(forkRef, refs); |
| 774 |
} |
| 775 |
return forkRef.callback; |
| 776 |
} |
| 777 |
function createForkRef() { |
| 778 |
return { |
| 779 |
callback: null, |
| 780 |
cleanup: null, |
| 781 |
refs: [] |
| 782 |
}; |
| 783 |
} |
| 784 |
function didChange(forkRef, a, b, c, d) { |
| 785 |
return forkRef.refs[0] !== a || forkRef.refs[1] !== b || forkRef.refs[2] !== c || forkRef.refs[3] !== d; |
| 786 |
} |
| 787 |
function didChangeN(forkRef, newRefs) { |
| 788 |
return forkRef.refs.length !== newRefs.length || forkRef.refs.some((ref, index) => ref !== newRefs[index]); |
| 789 |
} |
| 790 |
function update(forkRef, refs) { |
| 791 |
forkRef.refs = refs; |
| 792 |
if (refs.every((ref) => ref == null)) { |
| 793 |
forkRef.callback = null; |
| 794 |
return; |
| 795 |
} |
| 796 |
forkRef.callback = (instance) => { |
| 797 |
if (forkRef.cleanup) { |
| 798 |
forkRef.cleanup(); |
| 799 |
forkRef.cleanup = null; |
| 800 |
} |
| 801 |
if (instance != null) { |
| 802 |
const cleanupCallbacks = Array(refs.length).fill(null); |
| 803 |
for (let i = 0; i < refs.length; i += 1) { |
| 804 |
const ref = refs[i]; |
| 805 |
if (ref == null) { |
| 806 |
continue; |
| 807 |
} |
| 808 |
switch (typeof ref) { |
| 809 |
case "function": { |
| 810 |
const refCleanup = ref(instance); |
| 811 |
if (typeof refCleanup === "function") { |
| 812 |
cleanupCallbacks[i] = refCleanup; |
| 813 |
} |
| 814 |
break; |
| 815 |
} |
| 816 |
case "object": { |
| 817 |
ref.current = instance; |
| 818 |
break; |
| 819 |
} |
| 820 |
default: |
| 821 |
} |
| 822 |
} |
| 823 |
forkRef.cleanup = () => { |
| 824 |
for (let i = 0; i < refs.length; i += 1) { |
| 825 |
const ref = refs[i]; |
| 826 |
if (ref == null) { |
| 827 |
continue; |
| 828 |
} |
| 829 |
switch (typeof ref) { |
| 830 |
case "function": { |
| 831 |
const cleanupCallback = cleanupCallbacks[i]; |
| 832 |
if (typeof cleanupCallback === "function") { |
| 833 |
cleanupCallback(); |
| 834 |
} else { |
| 835 |
ref(null); |
| 836 |
} |
| 837 |
break; |
| 838 |
} |
| 839 |
case "object": { |
| 840 |
ref.current = null; |
| 841 |
break; |
| 842 |
} |
| 843 |
default: |
| 844 |
} |
| 845 |
} |
| 846 |
}; |
| 847 |
} |
| 848 |
}; |
| 849 |
} |
| 850 |
|
| 851 |
// node_modules/@base-ui/utils/getReactElementRef.mjs |
| 852 |
var React9 = __toESM(require_react(), 1); |
| 853 |
|
| 854 |
// node_modules/@base-ui/utils/reactVersion.mjs |
| 855 |
var React8 = __toESM(require_react(), 1); |
| 856 |
var majorVersion = parseInt(React8.version, 10); |
| 857 |
function isReactVersionAtLeast(reactVersionToCheck) { |
| 858 |
return majorVersion >= reactVersionToCheck; |
| 859 |
} |
| 860 |
|
| 861 |
// node_modules/@base-ui/utils/getReactElementRef.mjs |
| 862 |
function getReactElementRef(element) { |
| 863 |
if (!/* @__PURE__ */ React9.isValidElement(element)) { |
| 864 |
return null; |
| 865 |
} |
| 866 |
const reactElement = element; |
| 867 |
const propsWithRef = reactElement.props; |
| 868 |
return (isReactVersionAtLeast(19) ? propsWithRef?.ref : reactElement.ref) ?? null; |
| 869 |
} |
| 870 |
|
| 871 |
// node_modules/@base-ui/utils/mergeObjects.mjs |
| 872 |
function mergeObjects(a, b) { |
| 873 |
if (a && !b) { |
| 874 |
return a; |
| 875 |
} |
| 876 |
if (!a && b) { |
| 877 |
return b; |
| 878 |
} |
| 879 |
if (a || b) { |
| 880 |
return { |
| 881 |
...a, |
| 882 |
...b |
| 883 |
}; |
| 884 |
} |
| 885 |
return void 0; |
| 886 |
} |
| 887 |
|
| 888 |
// node_modules/@base-ui/utils/empty.mjs |
| 889 |
function NOOP() { |
| 890 |
} |
| 891 |
var EMPTY_ARRAY = Object.freeze([]); |
| 892 |
var EMPTY_OBJECT = Object.freeze({}); |
| 893 |
|
| 894 |
// node_modules/@base-ui/react/internals/getStateAttributesProps.mjs |
| 895 |
function getStateAttributesProps(state, customMapping) { |
| 896 |
const props = {}; |
| 897 |
for (const key in state) { |
| 898 |
const value = state[key]; |
| 899 |
if (customMapping?.hasOwnProperty(key)) { |
| 900 |
const customProps = customMapping[key](value); |
| 901 |
if (customProps != null) { |
| 902 |
Object.assign(props, customProps); |
| 903 |
} |
| 904 |
continue; |
| 905 |
} |
| 906 |
if (value === true) { |
| 907 |
props[`data-${key.toLowerCase()}`] = ""; |
| 908 |
} else if (value) { |
| 909 |
props[`data-${key.toLowerCase()}`] = value.toString(); |
| 910 |
} |
| 911 |
} |
| 912 |
return props; |
| 913 |
} |
| 914 |
|
| 915 |
// node_modules/@base-ui/react/utils/resolveClassName.mjs |
| 916 |
function resolveClassName(className, state) { |
| 917 |
return typeof className === "function" ? className(state) : className; |
| 918 |
} |
| 919 |
|
| 920 |
// node_modules/@base-ui/react/utils/resolveStyle.mjs |
| 921 |
function resolveStyle(style, state) { |
| 922 |
return typeof style === "function" ? style(state) : style; |
| 923 |
} |
| 924 |
|
| 925 |
// node_modules/@base-ui/react/merge-props/mergeProps.mjs |
| 926 |
var EMPTY_PROPS = {}; |
| 927 |
function mergeProps(a, b, c, d, e) { |
| 928 |
if (!c && !d && !e && !a) { |
| 929 |
return createInitialMergedProps(b); |
| 930 |
} |
| 931 |
let merged = createInitialMergedProps(a); |
| 932 |
if (b) { |
| 933 |
merged = mergeInto(merged, b); |
| 934 |
} |
| 935 |
if (c) { |
| 936 |
merged = mergeInto(merged, c); |
| 937 |
} |
| 938 |
if (d) { |
| 939 |
merged = mergeInto(merged, d); |
| 940 |
} |
| 941 |
if (e) { |
| 942 |
merged = mergeInto(merged, e); |
| 943 |
} |
| 944 |
return merged; |
| 945 |
} |
| 946 |
function mergePropsN(props) { |
| 947 |
if (props.length === 0) { |
| 948 |
return EMPTY_PROPS; |
| 949 |
} |
| 950 |
if (props.length === 1) { |
| 951 |
return createInitialMergedProps(props[0]); |
| 952 |
} |
| 953 |
let merged = createInitialMergedProps(props[0]); |
| 954 |
for (let i = 1; i < props.length; i += 1) { |
| 955 |
merged = mergeInto(merged, props[i]); |
| 956 |
} |
| 957 |
return merged; |
| 958 |
} |
| 959 |
function createInitialMergedProps(inputProps) { |
| 960 |
if (isPropsGetter(inputProps)) { |
| 961 |
return { |
| 962 |
...resolvePropsGetter(inputProps, EMPTY_PROPS) |
| 963 |
}; |
| 964 |
} |
| 965 |
return copyInitialProps(inputProps); |
| 966 |
} |
| 967 |
function mergeInto(merged, inputProps) { |
| 968 |
if (isPropsGetter(inputProps)) { |
| 969 |
return resolvePropsGetter(inputProps, merged); |
| 970 |
} |
| 971 |
return mutablyMergeInto(merged, inputProps); |
| 972 |
} |
| 973 |
function copyInitialProps(inputProps) { |
| 974 |
const copiedProps = { |
| 975 |
...inputProps |
| 976 |
}; |
| 977 |
for (const propName in copiedProps) { |
| 978 |
const propValue = copiedProps[propName]; |
| 979 |
if (isEventHandler(propName, propValue)) { |
| 980 |
copiedProps[propName] = wrapEventHandler(propValue); |
| 981 |
} |
| 982 |
} |
| 983 |
return copiedProps; |
| 984 |
} |
| 985 |
function mutablyMergeInto(mergedProps, externalProps) { |
| 986 |
if (!externalProps) { |
| 987 |
return mergedProps; |
| 988 |
} |
| 989 |
for (const propName in externalProps) { |
| 990 |
const externalPropValue = externalProps[propName]; |
| 991 |
switch (propName) { |
| 992 |
case "style": { |
| 993 |
mergedProps[propName] = mergeObjects(mergedProps.style, externalPropValue); |
| 994 |
break; |
| 995 |
} |
| 996 |
case "className": { |
| 997 |
mergedProps[propName] = mergeClassNames(mergedProps.className, externalPropValue); |
| 998 |
break; |
| 999 |
} |
| 1000 |
default: { |
| 1001 |
if (isEventHandler(propName, externalPropValue)) { |
| 1002 |
mergedProps[propName] = mergeEventHandlers(mergedProps[propName], externalPropValue); |
| 1003 |
} else { |
| 1004 |
mergedProps[propName] = externalPropValue; |
| 1005 |
} |
| 1006 |
} |
| 1007 |
} |
| 1008 |
} |
| 1009 |
return mergedProps; |
| 1010 |
} |
| 1011 |
function isEventHandler(key, value) { |
| 1012 |
const code0 = key.charCodeAt(0); |
| 1013 |
const code1 = key.charCodeAt(1); |
| 1014 |
const code2 = key.charCodeAt(2); |
| 1015 |
return code0 === 111 && code1 === 110 && code2 >= 65 && code2 <= 90 && (typeof value === "function" || typeof value === "undefined"); |
| 1016 |
} |
| 1017 |
function isPropsGetter(inputProps) { |
| 1018 |
return typeof inputProps === "function"; |
| 1019 |
} |
| 1020 |
function resolvePropsGetter(inputProps, previousProps) { |
| 1021 |
if (isPropsGetter(inputProps)) { |
| 1022 |
return inputProps(previousProps); |
| 1023 |
} |
| 1024 |
return inputProps ?? EMPTY_PROPS; |
| 1025 |
} |
| 1026 |
function mergeEventHandlers(ourHandler, theirHandler) { |
| 1027 |
if (!theirHandler) { |
| 1028 |
return ourHandler; |
| 1029 |
} |
| 1030 |
if (!ourHandler) { |
| 1031 |
return wrapEventHandler(theirHandler); |
| 1032 |
} |
| 1033 |
return (...args) => { |
| 1034 |
const event = args[0]; |
| 1035 |
if (isSyntheticEvent(event)) { |
| 1036 |
const baseUIEvent = event; |
| 1037 |
makeEventPreventable(baseUIEvent); |
| 1038 |
const result2 = theirHandler(...args); |
| 1039 |
if (!baseUIEvent.baseUIHandlerPrevented) { |
| 1040 |
ourHandler?.(...args); |
| 1041 |
} |
| 1042 |
return result2; |
| 1043 |
} |
| 1044 |
const result = theirHandler(...args); |
| 1045 |
ourHandler?.(...args); |
| 1046 |
return result; |
| 1047 |
}; |
| 1048 |
} |
| 1049 |
function wrapEventHandler(handler) { |
| 1050 |
if (!handler) { |
| 1051 |
return handler; |
| 1052 |
} |
| 1053 |
return (...args) => { |
| 1054 |
const event = args[0]; |
| 1055 |
if (isSyntheticEvent(event)) { |
| 1056 |
makeEventPreventable(event); |
| 1057 |
} |
| 1058 |
return handler(...args); |
| 1059 |
}; |
| 1060 |
} |
| 1061 |
function makeEventPreventable(event) { |
| 1062 |
event.preventBaseUIHandler = () => { |
| 1063 |
event.baseUIHandlerPrevented = true; |
| 1064 |
}; |
| 1065 |
return event; |
| 1066 |
} |
| 1067 |
function mergeClassNames(ourClassName, theirClassName) { |
| 1068 |
if (theirClassName) { |
| 1069 |
if (ourClassName) { |
| 1070 |
return theirClassName + " " + ourClassName; |
| 1071 |
} |
| 1072 |
return theirClassName; |
| 1073 |
} |
| 1074 |
return ourClassName; |
| 1075 |
} |
| 1076 |
function isSyntheticEvent(event) { |
| 1077 |
return event != null && typeof event === "object" && "nativeEvent" in event; |
| 1078 |
} |
| 1079 |
|
| 1080 |
// node_modules/@base-ui/react/internals/useRenderElement.mjs |
| 1081 |
var import_react = __toESM(require_react(), 1); |
| 1082 |
function useRenderElement(element, componentProps, params = {}) { |
| 1083 |
const renderProp = componentProps.render; |
| 1084 |
const outProps = useRenderElementProps(componentProps, params); |
| 1085 |
if (params.enabled === false) { |
| 1086 |
return null; |
| 1087 |
} |
| 1088 |
const state = params.state ?? EMPTY_OBJECT; |
| 1089 |
return evaluateRenderProp(element, renderProp, outProps, state); |
| 1090 |
} |
| 1091 |
function useRenderElementProps(componentProps, params = {}) { |
| 1092 |
const { |
| 1093 |
className: classNameProp, |
| 1094 |
style: styleProp, |
| 1095 |
render: renderProp |
| 1096 |
} = componentProps; |
| 1097 |
const { |
| 1098 |
state = EMPTY_OBJECT, |
| 1099 |
ref, |
| 1100 |
props, |
| 1101 |
stateAttributesMapping: stateAttributesMapping3, |
| 1102 |
enabled = true |
| 1103 |
} = params; |
| 1104 |
const className = enabled ? resolveClassName(classNameProp, state) : void 0; |
| 1105 |
const style = enabled ? resolveStyle(styleProp, state) : void 0; |
| 1106 |
const stateProps = enabled ? getStateAttributesProps(state, stateAttributesMapping3) : EMPTY_OBJECT; |
| 1107 |
const resolvedProps = enabled && props ? resolveRenderFunctionProps(props) : void 0; |
| 1108 |
const outProps = enabled ? mergeObjects(stateProps, resolvedProps) ?? {} : EMPTY_OBJECT; |
| 1109 |
if (typeof document !== "undefined") { |
| 1110 |
if (!enabled) { |
| 1111 |
useMergedRefs(null, null); |
| 1112 |
} else if (Array.isArray(ref)) { |
| 1113 |
outProps.ref = useMergedRefsN([outProps.ref, getReactElementRef(renderProp), ...ref]); |
| 1114 |
} else { |
| 1115 |
outProps.ref = useMergedRefs(outProps.ref, getReactElementRef(renderProp), ref); |
| 1116 |
} |
| 1117 |
} |
| 1118 |
if (!enabled) { |
| 1119 |
return EMPTY_OBJECT; |
| 1120 |
} |
| 1121 |
if (className !== void 0) { |
| 1122 |
outProps.className = mergeClassNames(outProps.className, className); |
| 1123 |
} |
| 1124 |
if (style !== void 0) { |
| 1125 |
outProps.style = mergeObjects(outProps.style, style); |
| 1126 |
} |
| 1127 |
return outProps; |
| 1128 |
} |
| 1129 |
function resolveRenderFunctionProps(props) { |
| 1130 |
if (Array.isArray(props)) { |
| 1131 |
return mergePropsN(props); |
| 1132 |
} |
| 1133 |
return mergeProps(void 0, props); |
| 1134 |
} |
| 1135 |
var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy"); |
| 1136 |
var COMPONENT_IDENTIFIER_PATTERN = /^[A-Z][A-Za-z0-9$]*$/; |
| 1137 |
var LOWERCASE_CHARACTER_PATTERN = /[a-z]/; |
| 1138 |
function evaluateRenderProp(element, render, props, state) { |
| 1139 |
if (render) { |
| 1140 |
if (typeof render === "function") { |
| 1141 |
if (true) { |
| 1142 |
warnIfRenderPropLooksLikeComponent(render); |
| 1143 |
} |
| 1144 |
return render(props, state); |
| 1145 |
} |
| 1146 |
const mergedProps = mergeProps(props, render.props); |
| 1147 |
mergedProps.ref = props.ref; |
| 1148 |
let newElement = render; |
| 1149 |
if (newElement?.$$typeof === REACT_LAZY_TYPE) { |
| 1150 |
const children = React10.Children.toArray(render); |
| 1151 |
newElement = children[0]; |
| 1152 |
} |
| 1153 |
if (true) { |
| 1154 |
if (!/* @__PURE__ */ React10.isValidElement(newElement)) { |
| 1155 |
throw new Error(["Base UI: The `render` prop was provided an invalid React element as `React.isValidElement(render)` is `false`.", "A valid React element must be provided to the `render` prop because it is cloned with props to replace the default element.", "https://base-ui.com/r/invalid-render-prop"].join("\n")); |
| 1156 |
} |
| 1157 |
} |
| 1158 |
return /* @__PURE__ */ React10.cloneElement(newElement, mergedProps); |
| 1159 |
} |
| 1160 |
if (element) { |
| 1161 |
if (typeof element === "string") { |
| 1162 |
return renderTag(element, props); |
| 1163 |
} |
| 1164 |
} |
| 1165 |
throw new Error(true ? "Base UI: Render element or function are not defined." : formatErrorMessage_default(8)); |
| 1166 |
} |
| 1167 |
function warnIfRenderPropLooksLikeComponent(renderFn) { |
| 1168 |
const functionName = renderFn.name; |
| 1169 |
if (functionName.length === 0) { |
| 1170 |
return; |
| 1171 |
} |
| 1172 |
if (!COMPONENT_IDENTIFIER_PATTERN.test(functionName)) { |
| 1173 |
return; |
| 1174 |
} |
| 1175 |
if (!LOWERCASE_CHARACTER_PATTERN.test(functionName)) { |
| 1176 |
return; |
| 1177 |
} |
| 1178 |
warn(`The \`render\` prop received a function named \`${functionName}\` that starts with an uppercase letter.`, "This usually means a React component was passed directly as `render={Component}`.", "Base UI calls `render` as a plain function, which can break the Rules of Hooks during reconciliation.", "If this is an intentional render callback, rename it to start with a lowercase letter.", "Use `render={<Component />}` or `render={(props) => <Component {...props} />}` instead.", "https://base-ui.com/r/invalid-render-prop"); |
| 1179 |
} |
| 1180 |
function renderTag(Tag, props) { |
| 1181 |
if (Tag === "button") { |
| 1182 |
return /* @__PURE__ */ (0, import_react.createElement)("button", { |
| 1183 |
type: "button", |
| 1184 |
...props, |
| 1185 |
key: props.key |
| 1186 |
}); |
| 1187 |
} |
| 1188 |
if (Tag === "img") { |
| 1189 |
return /* @__PURE__ */ (0, import_react.createElement)("img", { |
| 1190 |
alt: "", |
| 1191 |
...props, |
| 1192 |
key: props.key |
| 1193 |
}); |
| 1194 |
} |
| 1195 |
return /* @__PURE__ */ React10.createElement(Tag, props); |
| 1196 |
} |
| 1197 |
|
| 1198 |
// node_modules/@base-ui/utils/useId.mjs |
| 1199 |
var React11 = __toESM(require_react(), 1); |
| 1200 |
var globalId = 0; |
| 1201 |
function useGlobalId(idOverride, prefix = "mui") { |
| 1202 |
const [defaultId, setDefaultId] = React11.useState(idOverride); |
| 1203 |
const id = idOverride || defaultId; |
| 1204 |
React11.useEffect(() => { |
| 1205 |
if (defaultId == null) { |
| 1206 |
globalId += 1; |
| 1207 |
setDefaultId(`${prefix}-${globalId}`); |
| 1208 |
} |
| 1209 |
}, [defaultId, prefix]); |
| 1210 |
return id; |
| 1211 |
} |
| 1212 |
var maybeReactUseId = SafeReact.useId; |
| 1213 |
function useId(idOverride, prefix) { |
| 1214 |
if (maybeReactUseId !== void 0) { |
| 1215 |
const reactId = maybeReactUseId(); |
| 1216 |
return idOverride ?? (prefix ? `${prefix}-${reactId}` : reactId); |
| 1217 |
} |
| 1218 |
return useGlobalId(idOverride, prefix); |
| 1219 |
} |
| 1220 |
|
| 1221 |
// node_modules/@base-ui/react/internals/useBaseUiId.mjs |
| 1222 |
function useBaseUiId(idOverride) { |
| 1223 |
return useId(idOverride, "base-ui"); |
| 1224 |
} |
| 1225 |
|
| 1226 |
// node_modules/@base-ui/react/internals/reason-parts.mjs |
| 1227 |
var reason_parts_exports = {}; |
| 1228 |
__export(reason_parts_exports, { |
| 1229 |
cancelOpen: () => cancelOpen, |
| 1230 |
chipRemovePress: () => chipRemovePress, |
| 1231 |
clearPress: () => clearPress, |
| 1232 |
closePress: () => closePress, |
| 1233 |
closeWatcher: () => closeWatcher, |
| 1234 |
decrementPress: () => decrementPress, |
| 1235 |
disabled: () => disabled, |
| 1236 |
drag: () => drag, |
| 1237 |
escapeKey: () => escapeKey, |
| 1238 |
focusOut: () => focusOut, |
| 1239 |
imperativeAction: () => imperativeAction, |
| 1240 |
incrementPress: () => incrementPress, |
| 1241 |
initial: () => initial, |
| 1242 |
inputBlur: () => inputBlur, |
| 1243 |
inputChange: () => inputChange, |
| 1244 |
inputClear: () => inputClear, |
| 1245 |
inputPaste: () => inputPaste, |
| 1246 |
inputPress: () => inputPress, |
| 1247 |
itemPress: () => itemPress, |
| 1248 |
keyboard: () => keyboard, |
| 1249 |
linkPress: () => linkPress, |
| 1250 |
listNavigation: () => listNavigation, |
| 1251 |
missing: () => missing, |
| 1252 |
none: () => none, |
| 1253 |
outsidePress: () => outsidePress, |
| 1254 |
pointer: () => pointer, |
| 1255 |
scrub: () => scrub, |
| 1256 |
siblingOpen: () => siblingOpen, |
| 1257 |
swipe: () => swipe, |
| 1258 |
trackPress: () => trackPress, |
| 1259 |
triggerFocus: () => triggerFocus, |
| 1260 |
triggerHover: () => triggerHover, |
| 1261 |
triggerPress: () => triggerPress, |
| 1262 |
wheel: () => wheel, |
| 1263 |
windowResize: () => windowResize |
| 1264 |
}); |
| 1265 |
var none = "none"; |
| 1266 |
var triggerPress = "trigger-press"; |
| 1267 |
var triggerHover = "trigger-hover"; |
| 1268 |
var triggerFocus = "trigger-focus"; |
| 1269 |
var outsidePress = "outside-press"; |
| 1270 |
var itemPress = "item-press"; |
| 1271 |
var closePress = "close-press"; |
| 1272 |
var linkPress = "link-press"; |
| 1273 |
var clearPress = "clear-press"; |
| 1274 |
var chipRemovePress = "chip-remove-press"; |
| 1275 |
var trackPress = "track-press"; |
| 1276 |
var incrementPress = "increment-press"; |
| 1277 |
var decrementPress = "decrement-press"; |
| 1278 |
var inputChange = "input-change"; |
| 1279 |
var inputClear = "input-clear"; |
| 1280 |
var inputBlur = "input-blur"; |
| 1281 |
var inputPaste = "input-paste"; |
| 1282 |
var inputPress = "input-press"; |
| 1283 |
var focusOut = "focus-out"; |
| 1284 |
var escapeKey = "escape-key"; |
| 1285 |
var closeWatcher = "close-watcher"; |
| 1286 |
var listNavigation = "list-navigation"; |
| 1287 |
var keyboard = "keyboard"; |
| 1288 |
var pointer = "pointer"; |
| 1289 |
var drag = "drag"; |
| 1290 |
var wheel = "wheel"; |
| 1291 |
var scrub = "scrub"; |
| 1292 |
var cancelOpen = "cancel-open"; |
| 1293 |
var siblingOpen = "sibling-open"; |
| 1294 |
var disabled = "disabled"; |
| 1295 |
var missing = "missing"; |
| 1296 |
var initial = "initial"; |
| 1297 |
var imperativeAction = "imperative-action"; |
| 1298 |
var swipe = "swipe"; |
| 1299 |
var windowResize = "window-resize"; |
| 1300 |
|
| 1301 |
// node_modules/@base-ui/react/internals/createBaseUIEventDetails.mjs |
| 1302 |
function createChangeEventDetails(reason, event, trigger, customProperties) { |
| 1303 |
let canceled = false; |
| 1304 |
let allowPropagation = false; |
| 1305 |
const custom = customProperties ?? EMPTY_OBJECT; |
| 1306 |
const details = { |
| 1307 |
reason, |
| 1308 |
event: event ?? new Event("base-ui"), |
| 1309 |
cancel() { |
| 1310 |
canceled = true; |
| 1311 |
}, |
| 1312 |
allowPropagation() { |
| 1313 |
allowPropagation = true; |
| 1314 |
}, |
| 1315 |
get isCanceled() { |
| 1316 |
return canceled; |
| 1317 |
}, |
| 1318 |
get isPropagationAllowed() { |
| 1319 |
return allowPropagation; |
| 1320 |
}, |
| 1321 |
trigger, |
| 1322 |
...custom |
| 1323 |
}; |
| 1324 |
return details; |
| 1325 |
} |
| 1326 |
|
| 1327 |
// node_modules/@base-ui/react/internals/useTransitionStatus.mjs |
| 1328 |
var React13 = __toESM(require_react(), 1); |
| 1329 |
|
| 1330 |
// node_modules/@base-ui/utils/useOnMount.mjs |
| 1331 |
var React12 = __toESM(require_react(), 1); |
| 1332 |
var EMPTY = []; |
| 1333 |
function useOnMount(fn) { |
| 1334 |
React12.useEffect(fn, EMPTY); |
| 1335 |
} |
| 1336 |
|
| 1337 |
// node_modules/@base-ui/utils/useAnimationFrame.mjs |
| 1338 |
var EMPTY2 = null; |
| 1339 |
var LAST_RAF = globalThis.requestAnimationFrame; |
| 1340 |
var Scheduler = class { |
| 1341 |
/* This implementation uses an array as a backing data-structure for frame callbacks. |
| 1342 |
* It allows `O(1)` callback cancelling by inserting a `null` in the array, though it |
| 1343 |
* never calls the native `cancelAnimationFrame` if there are no frames left. This can |
| 1344 |
* be much more efficient if there is a call pattern that alterns as |
| 1345 |
* "request-cancel-request-cancel-…". |
| 1346 |
* But in the case of "request-request-…-cancel-cancel-…", it leaves the final animation |
| 1347 |
* frame to run anyway. We turn that frame into a `O(1)` no-op via `callbacksCount`. */ |
| 1348 |
callbacks = []; |
| 1349 |
callbacksCount = 0; |
| 1350 |
nextId = 1; |
| 1351 |
startId = 1; |
| 1352 |
isScheduled = false; |
| 1353 |
tick = (timestamp) => { |
| 1354 |
this.isScheduled = false; |
| 1355 |
const currentCallbacks = this.callbacks; |
| 1356 |
const currentCallbacksCount = this.callbacksCount; |
| 1357 |
this.callbacks = []; |
| 1358 |
this.callbacksCount = 0; |
| 1359 |
this.startId = this.nextId; |
| 1360 |
if (currentCallbacksCount > 0) { |
| 1361 |
for (let i = 0; i < currentCallbacks.length; i += 1) { |
| 1362 |
currentCallbacks[i]?.(timestamp); |
| 1363 |
} |
| 1364 |
} |
| 1365 |
}; |
| 1366 |
request(fn) { |
| 1367 |
const id = this.nextId; |
| 1368 |
this.nextId += 1; |
| 1369 |
this.callbacks.push(fn); |
| 1370 |
this.callbacksCount += 1; |
| 1371 |
const didRAFChange = LAST_RAF !== requestAnimationFrame && (LAST_RAF = requestAnimationFrame, true); |
| 1372 |
if (!this.isScheduled || didRAFChange) { |
| 1373 |
requestAnimationFrame(this.tick); |
| 1374 |
this.isScheduled = true; |
| 1375 |
} |
| 1376 |
return id; |
| 1377 |
} |
| 1378 |
cancel(id) { |
| 1379 |
const index = id - this.startId; |
| 1380 |
if (index < 0 || index >= this.callbacks.length) { |
| 1381 |
return; |
| 1382 |
} |
| 1383 |
this.callbacks[index] = null; |
| 1384 |
this.callbacksCount -= 1; |
| 1385 |
} |
| 1386 |
}; |
| 1387 |
var scheduler = new Scheduler(); |
| 1388 |
var AnimationFrame = class _AnimationFrame { |
| 1389 |
static create() { |
| 1390 |
return new _AnimationFrame(); |
| 1391 |
} |
| 1392 |
static request(fn) { |
| 1393 |
return scheduler.request(fn); |
| 1394 |
} |
| 1395 |
static cancel(id) { |
| 1396 |
return scheduler.cancel(id); |
| 1397 |
} |
| 1398 |
currentId = EMPTY2; |
| 1399 |
/** |
| 1400 |
* Executes `fn` after `delay`, clearing any previously scheduled call. |
| 1401 |
*/ |
| 1402 |
request(fn) { |
| 1403 |
this.cancel(); |
| 1404 |
this.currentId = scheduler.request(() => { |
| 1405 |
this.currentId = EMPTY2; |
| 1406 |
fn(); |
| 1407 |
}); |
| 1408 |
} |
| 1409 |
cancel = () => { |
| 1410 |
if (this.currentId !== EMPTY2) { |
| 1411 |
scheduler.cancel(this.currentId); |
| 1412 |
this.currentId = EMPTY2; |
| 1413 |
} |
| 1414 |
}; |
| 1415 |
disposeEffect = () => { |
| 1416 |
return this.cancel; |
| 1417 |
}; |
| 1418 |
}; |
| 1419 |
function useAnimationFrame() { |
| 1420 |
const timeout = useRefWithInit(AnimationFrame.create).current; |
| 1421 |
useOnMount(timeout.disposeEffect); |
| 1422 |
return timeout; |
| 1423 |
} |
| 1424 |
|
| 1425 |
// node_modules/@base-ui/react/internals/useTransitionStatus.mjs |
| 1426 |
function useTransitionStatus(open, enableIdleState = false, deferEndingState = false) { |
| 1427 |
const [transitionStatus, setTransitionStatus] = React13.useState(open && enableIdleState ? "idle" : void 0); |
| 1428 |
const [mounted, setMounted] = React13.useState(open); |
| 1429 |
if (open && !mounted) { |
| 1430 |
setMounted(true); |
| 1431 |
setTransitionStatus("starting"); |
| 1432 |
} |
| 1433 |
if (!open && mounted && transitionStatus !== "ending" && !deferEndingState) { |
| 1434 |
setTransitionStatus("ending"); |
| 1435 |
} |
| 1436 |
if (!open && !mounted && transitionStatus === "ending") { |
| 1437 |
setTransitionStatus(void 0); |
| 1438 |
} |
| 1439 |
useIsoLayoutEffect(() => { |
| 1440 |
if (!open && mounted && transitionStatus !== "ending" && deferEndingState) { |
| 1441 |
const frame = AnimationFrame.request(() => { |
| 1442 |
setTransitionStatus("ending"); |
| 1443 |
}); |
| 1444 |
return () => { |
| 1445 |
AnimationFrame.cancel(frame); |
| 1446 |
}; |
| 1447 |
} |
| 1448 |
return void 0; |
| 1449 |
}, [open, mounted, transitionStatus, deferEndingState]); |
| 1450 |
useIsoLayoutEffect(() => { |
| 1451 |
if (!open || enableIdleState) { |
| 1452 |
return void 0; |
| 1453 |
} |
| 1454 |
const frame = AnimationFrame.request(() => { |
| 1455 |
setTransitionStatus(void 0); |
| 1456 |
}); |
| 1457 |
return () => { |
| 1458 |
AnimationFrame.cancel(frame); |
| 1459 |
}; |
| 1460 |
}, [enableIdleState, open]); |
| 1461 |
useIsoLayoutEffect(() => { |
| 1462 |
if (!open || !enableIdleState) { |
| 1463 |
return void 0; |
| 1464 |
} |
| 1465 |
if (open && mounted && transitionStatus !== "idle") { |
| 1466 |
setTransitionStatus("starting"); |
| 1467 |
} |
| 1468 |
const frame = AnimationFrame.request(() => { |
| 1469 |
setTransitionStatus("idle"); |
| 1470 |
}); |
| 1471 |
return () => { |
| 1472 |
AnimationFrame.cancel(frame); |
| 1473 |
}; |
| 1474 |
}, [enableIdleState, open, mounted, transitionStatus]); |
| 1475 |
return { |
| 1476 |
mounted, |
| 1477 |
setMounted, |
| 1478 |
transitionStatus |
| 1479 |
}; |
| 1480 |
} |
| 1481 |
|
| 1482 |
// node_modules/@base-ui/react/internals/composite/list/useCompositeListItem.mjs |
| 1483 |
var React14 = __toESM(require_react(), 1); |
| 1484 |
var IndexGuessBehavior = /* @__PURE__ */ (function(IndexGuessBehavior2) { |
| 1485 |
IndexGuessBehavior2[IndexGuessBehavior2["None"] = 0] = "None"; |
| 1486 |
IndexGuessBehavior2[IndexGuessBehavior2["GuessFromOrder"] = 1] = "GuessFromOrder"; |
| 1487 |
return IndexGuessBehavior2; |
| 1488 |
})({}); |
| 1489 |
function useCompositeListItem(params = {}) { |
| 1490 |
const { |
| 1491 |
label, |
| 1492 |
metadata, |
| 1493 |
textRef, |
| 1494 |
indexGuessBehavior, |
| 1495 |
index: externalIndex |
| 1496 |
} = params; |
| 1497 |
const { |
| 1498 |
register, |
| 1499 |
unregister, |
| 1500 |
subscribeMapChange, |
| 1501 |
elementsRef, |
| 1502 |
labelsRef, |
| 1503 |
nextIndexRef |
| 1504 |
} = useCompositeListContext(); |
| 1505 |
const indexRef = React14.useRef(-1); |
| 1506 |
const [index, setIndex] = React14.useState(externalIndex ?? (indexGuessBehavior === IndexGuessBehavior.GuessFromOrder ? () => { |
| 1507 |
if (indexRef.current === -1) { |
| 1508 |
const newIndex = nextIndexRef.current; |
| 1509 |
nextIndexRef.current += 1; |
| 1510 |
indexRef.current = newIndex; |
| 1511 |
} |
| 1512 |
return indexRef.current; |
| 1513 |
} : -1)); |
| 1514 |
const componentRef = React14.useRef(null); |
| 1515 |
const ref = React14.useCallback((node) => { |
| 1516 |
componentRef.current = node; |
| 1517 |
if (index !== -1 && node !== null) { |
| 1518 |
elementsRef.current[index] = node; |
| 1519 |
if (labelsRef) { |
| 1520 |
const isLabelDefined = label !== void 0; |
| 1521 |
labelsRef.current[index] = isLabelDefined ? label : textRef?.current?.textContent ?? node.textContent; |
| 1522 |
} |
| 1523 |
} |
| 1524 |
}, [index, elementsRef, labelsRef, label, textRef]); |
| 1525 |
useIsoLayoutEffect(() => { |
| 1526 |
if (externalIndex != null) { |
| 1527 |
return void 0; |
| 1528 |
} |
| 1529 |
const node = componentRef.current; |
| 1530 |
if (node) { |
| 1531 |
register(node, metadata); |
| 1532 |
return () => { |
| 1533 |
unregister(node); |
| 1534 |
}; |
| 1535 |
} |
| 1536 |
return void 0; |
| 1537 |
}, [externalIndex, register, unregister, metadata]); |
| 1538 |
useIsoLayoutEffect(() => { |
| 1539 |
if (externalIndex != null) { |
| 1540 |
return void 0; |
| 1541 |
} |
| 1542 |
return subscribeMapChange((map) => { |
| 1543 |
const i = componentRef.current ? map.get(componentRef.current)?.index : null; |
| 1544 |
if (i != null) { |
| 1545 |
setIndex(i); |
| 1546 |
} |
| 1547 |
}); |
| 1548 |
}, [externalIndex, subscribeMapChange, setIndex]); |
| 1549 |
return { |
| 1550 |
ref, |
| 1551 |
index |
| 1552 |
}; |
| 1553 |
} |
| 1554 |
|
| 1555 |
// node_modules/@base-ui/react/internals/stateAttributesMapping.mjs |
| 1556 |
var TransitionStatusDataAttributes = /* @__PURE__ */ (function(TransitionStatusDataAttributes2) { |
| 1557 |
TransitionStatusDataAttributes2["startingStyle"] = "data-starting-style"; |
| 1558 |
TransitionStatusDataAttributes2["endingStyle"] = "data-ending-style"; |
| 1559 |
return TransitionStatusDataAttributes2; |
| 1560 |
})({}); |
| 1561 |
var STARTING_HOOK = { |
| 1562 |
[TransitionStatusDataAttributes.startingStyle]: "" |
| 1563 |
}; |
| 1564 |
var ENDING_HOOK = { |
| 1565 |
[TransitionStatusDataAttributes.endingStyle]: "" |
| 1566 |
}; |
| 1567 |
var transitionStatusMapping = { |
| 1568 |
transitionStatus(value) { |
| 1569 |
if (value === "starting") { |
| 1570 |
return STARTING_HOOK; |
| 1571 |
} |
| 1572 |
if (value === "ending") { |
| 1573 |
return ENDING_HOOK; |
| 1574 |
} |
| 1575 |
return null; |
| 1576 |
} |
| 1577 |
}; |
| 1578 |
|
| 1579 |
// node_modules/@base-ui/react/internals/use-button/useButton.mjs |
| 1580 |
var React17 = __toESM(require_react(), 1); |
| 1581 |
|
| 1582 |
// node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs |
| 1583 |
function hasWindow() { |
| 1584 |
return typeof window !== "undefined"; |
| 1585 |
} |
| 1586 |
function getWindow(node) { |
| 1587 |
var _node$ownerDocument; |
| 1588 |
return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window; |
| 1589 |
} |
| 1590 |
function isHTMLElement(value) { |
| 1591 |
if (!hasWindow()) { |
| 1592 |
return false; |
| 1593 |
} |
| 1594 |
return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement; |
| 1595 |
} |
| 1596 |
function isShadowRoot(value) { |
| 1597 |
if (!hasWindow() || typeof ShadowRoot === "undefined") { |
| 1598 |
return false; |
| 1599 |
} |
| 1600 |
return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot; |
| 1601 |
} |
| 1602 |
function getComputedStyle2(element) { |
| 1603 |
return getWindow(element).getComputedStyle(element); |
| 1604 |
} |
| 1605 |
|
| 1606 |
// node_modules/@base-ui/react/internals/composite/root/CompositeRootContext.mjs |
| 1607 |
var React15 = __toESM(require_react(), 1); |
| 1608 |
var CompositeRootContext = /* @__PURE__ */ React15.createContext(void 0); |
| 1609 |
if (true) CompositeRootContext.displayName = "CompositeRootContext"; |
| 1610 |
function useCompositeRootContext(optional = false) { |
| 1611 |
const context = React15.useContext(CompositeRootContext); |
| 1612 |
if (context === void 0 && !optional) { |
| 1613 |
throw new Error(true ? "Base UI: CompositeRootContext is missing. Composite parts must be placed within <Composite.Root>." : formatErrorMessage_default(16)); |
| 1614 |
} |
| 1615 |
return context; |
| 1616 |
} |
| 1617 |
|
| 1618 |
// node_modules/@base-ui/react/utils/useFocusableWhenDisabled.mjs |
| 1619 |
var React16 = __toESM(require_react(), 1); |
| 1620 |
function useFocusableWhenDisabled(parameters) { |
| 1621 |
const { |
| 1622 |
focusableWhenDisabled, |
| 1623 |
disabled: disabled2, |
| 1624 |
composite = false, |
| 1625 |
tabIndex: tabIndexProp = 0, |
| 1626 |
isNativeButton |
| 1627 |
} = parameters; |
| 1628 |
const isFocusableComposite = composite && focusableWhenDisabled !== false; |
| 1629 |
const isNonFocusableComposite = composite && focusableWhenDisabled === false; |
| 1630 |
const props = React16.useMemo(() => { |
| 1631 |
const additionalProps = { |
| 1632 |
// allow Tabbing away from focusableWhenDisabled elements |
| 1633 |
onKeyDown(event) { |
| 1634 |
if (disabled2 && focusableWhenDisabled && event.key !== "Tab") { |
| 1635 |
event.preventDefault(); |
| 1636 |
} |
| 1637 |
} |
| 1638 |
}; |
| 1639 |
if (!composite) { |
| 1640 |
additionalProps.tabIndex = tabIndexProp; |
| 1641 |
if (!isNativeButton && disabled2) { |
| 1642 |
additionalProps.tabIndex = focusableWhenDisabled ? tabIndexProp : -1; |
| 1643 |
} |
| 1644 |
} |
| 1645 |
if (isNativeButton && (focusableWhenDisabled || isFocusableComposite) || !isNativeButton && disabled2) { |
| 1646 |
additionalProps["aria-disabled"] = disabled2; |
| 1647 |
} |
| 1648 |
if (isNativeButton && (!focusableWhenDisabled || isNonFocusableComposite)) { |
| 1649 |
additionalProps.disabled = disabled2; |
| 1650 |
} |
| 1651 |
return additionalProps; |
| 1652 |
}, [composite, disabled2, focusableWhenDisabled, isFocusableComposite, isNonFocusableComposite, isNativeButton, tabIndexProp]); |
| 1653 |
return { |
| 1654 |
props |
| 1655 |
}; |
| 1656 |
} |
| 1657 |
|
| 1658 |
// node_modules/@base-ui/react/internals/use-button/useButton.mjs |
| 1659 |
function useButton(parameters = {}) { |
| 1660 |
const { |
| 1661 |
disabled: disabled2 = false, |
| 1662 |
focusableWhenDisabled, |
| 1663 |
tabIndex = 0, |
| 1664 |
native: isNativeButton = true, |
| 1665 |
composite: compositeProp |
| 1666 |
} = parameters; |
| 1667 |
const elementRef = React17.useRef(null); |
| 1668 |
const compositeRootContext = useCompositeRootContext(true); |
| 1669 |
const isCompositeItem = compositeProp ?? compositeRootContext !== void 0; |
| 1670 |
const { |
| 1671 |
props: focusableWhenDisabledProps |
| 1672 |
} = useFocusableWhenDisabled({ |
| 1673 |
focusableWhenDisabled, |
| 1674 |
disabled: disabled2, |
| 1675 |
composite: isCompositeItem, |
| 1676 |
tabIndex, |
| 1677 |
isNativeButton |
| 1678 |
}); |
| 1679 |
if (true) { |
| 1680 |
React17.useEffect(() => { |
| 1681 |
if (!elementRef.current) { |
| 1682 |
return; |
| 1683 |
} |
| 1684 |
const isButtonTag = isButtonElement(elementRef.current); |
| 1685 |
if (isNativeButton) { |
| 1686 |
if (!isButtonTag) { |
| 1687 |
const ownerStackMessage = SafeReact.captureOwnerStack?.() || ""; |
| 1688 |
const message = "A component that acts as a button expected a native <button> because the `nativeButton` prop is true. Rendering a non-<button> removes native button semantics, which can impact forms and accessibility. Use a real <button> in the `render` prop, or set `nativeButton` to `false`."; |
| 1689 |
error(`${message}${ownerStackMessage}`); |
| 1690 |
} |
| 1691 |
} else if (isButtonTag) { |
| 1692 |
const ownerStackMessage = SafeReact.captureOwnerStack?.() || ""; |
| 1693 |
const message = "A component that acts as a button expected a non-<button> because the `nativeButton` prop is false. Rendering a <button> keeps native behavior while Base UI applies non-native attributes and handlers, which can add unintended extra attributes (such as `role` or `aria-disabled`). Use a non-<button> in the `render` prop, or set `nativeButton` to `true`."; |
| 1694 |
error(`${message}${ownerStackMessage}`); |
| 1695 |
} |
| 1696 |
}, [isNativeButton]); |
| 1697 |
} |
| 1698 |
const updateDisabled = React17.useCallback(() => { |
| 1699 |
const element = elementRef.current; |
| 1700 |
if (!isButtonElement(element)) { |
| 1701 |
return; |
| 1702 |
} |
| 1703 |
if (isCompositeItem && disabled2 && focusableWhenDisabledProps.disabled === void 0 && element.disabled) { |
| 1704 |
element.disabled = false; |
| 1705 |
} |
| 1706 |
}, [disabled2, focusableWhenDisabledProps.disabled, isCompositeItem]); |
| 1707 |
useIsoLayoutEffect(updateDisabled, [updateDisabled]); |
| 1708 |
const getButtonProps = React17.useCallback((externalProps = {}) => { |
| 1709 |
const { |
| 1710 |
onClick: externalOnClick, |
| 1711 |
onMouseDown: externalOnMouseDown, |
| 1712 |
onKeyUp: externalOnKeyUp, |
| 1713 |
onKeyDown: externalOnKeyDown, |
| 1714 |
onPointerDown: externalOnPointerDown, |
| 1715 |
...otherExternalProps |
| 1716 |
} = externalProps; |
| 1717 |
return mergeProps({ |
| 1718 |
onClick(event) { |
| 1719 |
if (disabled2) { |
| 1720 |
event.preventDefault(); |
| 1721 |
return; |
| 1722 |
} |
| 1723 |
externalOnClick?.(event); |
| 1724 |
}, |
| 1725 |
onMouseDown(event) { |
| 1726 |
if (!disabled2) { |
| 1727 |
externalOnMouseDown?.(event); |
| 1728 |
} |
| 1729 |
}, |
| 1730 |
onKeyDown(event) { |
| 1731 |
if (disabled2) { |
| 1732 |
return; |
| 1733 |
} |
| 1734 |
makeEventPreventable(event); |
| 1735 |
externalOnKeyDown?.(event); |
| 1736 |
if (event.baseUIHandlerPrevented) { |
| 1737 |
return; |
| 1738 |
} |
| 1739 |
const isCurrentTarget = event.target === event.currentTarget; |
| 1740 |
const currentTarget = event.currentTarget; |
| 1741 |
const isButton = isButtonElement(currentTarget); |
| 1742 |
const isLink = !isNativeButton && isValidLinkElement(currentTarget); |
| 1743 |
const shouldClick = isCurrentTarget && (isNativeButton ? isButton : !isLink); |
| 1744 |
const isEnterKey = event.key === "Enter"; |
| 1745 |
const isSpaceKey = event.key === " "; |
| 1746 |
const role = currentTarget.getAttribute("role"); |
| 1747 |
const isTextNavigationRole = role?.startsWith("menuitem") || role === "option" || role === "gridcell"; |
| 1748 |
if (isCurrentTarget && isCompositeItem && isSpaceKey) { |
| 1749 |
if (event.defaultPrevented && isTextNavigationRole) { |
| 1750 |
return; |
| 1751 |
} |
| 1752 |
event.preventDefault(); |
| 1753 |
if (isLink || isNativeButton && isButton) { |
| 1754 |
currentTarget.click(); |
| 1755 |
event.preventBaseUIHandler(); |
| 1756 |
} else if (shouldClick) { |
| 1757 |
externalOnClick?.(event); |
| 1758 |
event.preventBaseUIHandler(); |
| 1759 |
} |
| 1760 |
return; |
| 1761 |
} |
| 1762 |
if (shouldClick) { |
| 1763 |
if (!isNativeButton && (isSpaceKey || isEnterKey)) { |
| 1764 |
event.preventDefault(); |
| 1765 |
} |
| 1766 |
if (!isNativeButton && isEnterKey) { |
| 1767 |
externalOnClick?.(event); |
| 1768 |
} |
| 1769 |
} |
| 1770 |
}, |
| 1771 |
onKeyUp(event) { |
| 1772 |
if (disabled2) { |
| 1773 |
return; |
| 1774 |
} |
| 1775 |
makeEventPreventable(event); |
| 1776 |
externalOnKeyUp?.(event); |
| 1777 |
if (event.target === event.currentTarget && isNativeButton && isCompositeItem && isButtonElement(event.currentTarget) && event.key === " ") { |
| 1778 |
event.preventDefault(); |
| 1779 |
return; |
| 1780 |
} |
| 1781 |
if (event.baseUIHandlerPrevented) { |
| 1782 |
return; |
| 1783 |
} |
| 1784 |
if (event.target === event.currentTarget && !isNativeButton && !isCompositeItem && event.key === " ") { |
| 1785 |
externalOnClick?.(event); |
| 1786 |
} |
| 1787 |
}, |
| 1788 |
onPointerDown(event) { |
| 1789 |
if (disabled2) { |
| 1790 |
event.preventDefault(); |
| 1791 |
return; |
| 1792 |
} |
| 1793 |
externalOnPointerDown?.(event); |
| 1794 |
} |
| 1795 |
}, isNativeButton ? { |
| 1796 |
type: "button" |
| 1797 |
} : { |
| 1798 |
role: "button" |
| 1799 |
}, focusableWhenDisabledProps, otherExternalProps); |
| 1800 |
}, [disabled2, focusableWhenDisabledProps, isCompositeItem, isNativeButton]); |
| 1801 |
const buttonRef = useStableCallback((element) => { |
| 1802 |
elementRef.current = element; |
| 1803 |
updateDisabled(); |
| 1804 |
}); |
| 1805 |
return { |
| 1806 |
getButtonProps, |
| 1807 |
buttonRef |
| 1808 |
}; |
| 1809 |
} |
| 1810 |
function isButtonElement(elem) { |
| 1811 |
return isHTMLElement(elem) && elem.tagName === "BUTTON"; |
| 1812 |
} |
| 1813 |
function isValidLinkElement(elem) { |
| 1814 |
return Boolean(elem?.tagName === "A" && elem?.href); |
| 1815 |
} |
| 1816 |
|
| 1817 |
// node_modules/@base-ui/utils/owner.mjs |
| 1818 |
function ownerDocument(node) { |
| 1819 |
return node?.ownerDocument || document; |
| 1820 |
} |
| 1821 |
|
| 1822 |
// node_modules/@base-ui/react/internals/useOpenChangeComplete.mjs |
| 1823 |
var React18 = __toESM(require_react(), 1); |
| 1824 |
|
| 1825 |
// node_modules/@base-ui/react/internals/useAnimationsFinished.mjs |
| 1826 |
var ReactDOM = __toESM(require_react_dom(), 1); |
| 1827 |
|
| 1828 |
// node_modules/@base-ui/react/utils/resolveRef.mjs |
| 1829 |
function resolveRef(maybeRef) { |
| 1830 |
if (maybeRef == null) { |
| 1831 |
return maybeRef; |
| 1832 |
} |
| 1833 |
return "current" in maybeRef ? maybeRef.current : maybeRef; |
| 1834 |
} |
| 1835 |
|
| 1836 |
// node_modules/@base-ui/react/internals/useAnimationsFinished.mjs |
| 1837 |
function useAnimationsFinished(elementOrRef, waitForStartingStyleRemoved = false, treatAbortedAsFinished = true) { |
| 1838 |
const frame = useAnimationFrame(); |
| 1839 |
return useStableCallback((fnToExecute, signal = null) => { |
| 1840 |
frame.cancel(); |
| 1841 |
const element = resolveRef(elementOrRef); |
| 1842 |
if (element == null) { |
| 1843 |
return; |
| 1844 |
} |
| 1845 |
const resolvedElement = element; |
| 1846 |
const done = () => { |
| 1847 |
ReactDOM.flushSync(fnToExecute); |
| 1848 |
}; |
| 1849 |
if (typeof resolvedElement.getAnimations !== "function" || globalThis.BASE_UI_ANIMATIONS_DISABLED) { |
| 1850 |
fnToExecute(); |
| 1851 |
return; |
| 1852 |
} |
| 1853 |
function exec() { |
| 1854 |
Promise.all(resolvedElement.getAnimations().map((animation) => animation.finished)).then(() => { |
| 1855 |
if (!signal?.aborted) { |
| 1856 |
done(); |
| 1857 |
} |
| 1858 |
}).catch(() => { |
| 1859 |
if (treatAbortedAsFinished) { |
| 1860 |
if (!signal?.aborted) { |
| 1861 |
done(); |
| 1862 |
} |
| 1863 |
return; |
| 1864 |
} |
| 1865 |
const currentAnimations = resolvedElement.getAnimations(); |
| 1866 |
if (!signal?.aborted && currentAnimations.length > 0 && currentAnimations.some((animation) => animation.pending || animation.playState !== "finished")) { |
| 1867 |
exec(); |
| 1868 |
} |
| 1869 |
}); |
| 1870 |
} |
| 1871 |
if (waitForStartingStyleRemoved) { |
| 1872 |
const startingStyleAttribute = TransitionStatusDataAttributes.startingStyle; |
| 1873 |
if (!resolvedElement.hasAttribute(startingStyleAttribute)) { |
| 1874 |
frame.request(exec); |
| 1875 |
return; |
| 1876 |
} |
| 1877 |
const attributeObserver = new MutationObserver(() => { |
| 1878 |
if (!resolvedElement.hasAttribute(startingStyleAttribute)) { |
| 1879 |
attributeObserver.disconnect(); |
| 1880 |
exec(); |
| 1881 |
} |
| 1882 |
}); |
| 1883 |
attributeObserver.observe(resolvedElement, { |
| 1884 |
attributes: true, |
| 1885 |
attributeFilter: [startingStyleAttribute] |
| 1886 |
}); |
| 1887 |
signal?.addEventListener("abort", () => attributeObserver.disconnect(), { |
| 1888 |
once: true |
| 1889 |
}); |
| 1890 |
return; |
| 1891 |
} |
| 1892 |
frame.request(exec); |
| 1893 |
}); |
| 1894 |
} |
| 1895 |
|
| 1896 |
// node_modules/@base-ui/react/internals/useOpenChangeComplete.mjs |
| 1897 |
function useOpenChangeComplete(parameters) { |
| 1898 |
const { |
| 1899 |
enabled = true, |
| 1900 |
open, |
| 1901 |
ref, |
| 1902 |
onComplete: onCompleteParam |
| 1903 |
} = parameters; |
| 1904 |
const onComplete = useStableCallback(onCompleteParam); |
| 1905 |
const runOnceAnimationsFinish = useAnimationsFinished(ref, open, false); |
| 1906 |
React18.useEffect(() => { |
| 1907 |
if (!enabled) { |
| 1908 |
return void 0; |
| 1909 |
} |
| 1910 |
const abortController = new AbortController(); |
| 1911 |
runOnceAnimationsFinish(onComplete, abortController.signal); |
| 1912 |
return () => { |
| 1913 |
abortController.abort(); |
| 1914 |
}; |
| 1915 |
}, [enabled, open, onComplete, runOnceAnimationsFinish]); |
| 1916 |
} |
| 1917 |
|
| 1918 |
// node_modules/@base-ui/react/internals/shadowDom.mjs |
| 1919 |
function activeElement(doc) { |
| 1920 |
let element = doc.activeElement; |
| 1921 |
while (element?.shadowRoot?.activeElement != null) { |
| 1922 |
element = element.shadowRoot.activeElement; |
| 1923 |
} |
| 1924 |
return element; |
| 1925 |
} |
| 1926 |
function contains(parent, child) { |
| 1927 |
if (!parent || !child) { |
| 1928 |
return false; |
| 1929 |
} |
| 1930 |
const rootNode = child.getRootNode?.(); |
| 1931 |
if (parent.contains(child)) { |
| 1932 |
return true; |
| 1933 |
} |
| 1934 |
if (rootNode && isShadowRoot(rootNode)) { |
| 1935 |
let next = child; |
| 1936 |
while (next) { |
| 1937 |
if (parent === next) { |
| 1938 |
return true; |
| 1939 |
} |
| 1940 |
next = next.parentNode || next.host; |
| 1941 |
} |
| 1942 |
} |
| 1943 |
return false; |
| 1944 |
} |
| 1945 |
function getTarget(event) { |
| 1946 |
if ("composedPath" in event) { |
| 1947 |
return event.composedPath()[0]; |
| 1948 |
} |
| 1949 |
return event.target; |
| 1950 |
} |
| 1951 |
|
| 1952 |
// node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs |
| 1953 |
var round = Math.round; |
| 1954 |
|
| 1955 |
// node_modules/@base-ui/react/floating-ui-react/utils/composite.mjs |
| 1956 |
function isIndexOutOfListBounds(list, index) { |
| 1957 |
return index < 0 || index >= list.length; |
| 1958 |
} |
| 1959 |
function getMinListIndex(listRef, disabledIndices) { |
| 1960 |
return findNonDisabledListIndex(listRef.current, { |
| 1961 |
disabledIndices |
| 1962 |
}); |
| 1963 |
} |
| 1964 |
function getMaxListIndex(listRef, disabledIndices) { |
| 1965 |
return findNonDisabledListIndex(listRef.current, { |
| 1966 |
decrement: true, |
| 1967 |
startingIndex: listRef.current.length, |
| 1968 |
disabledIndices |
| 1969 |
}); |
| 1970 |
} |
| 1971 |
function findNonDisabledListIndex(list, { |
| 1972 |
startingIndex = -1, |
| 1973 |
decrement = false, |
| 1974 |
disabledIndices, |
| 1975 |
amount = 1 |
| 1976 |
} = {}) { |
| 1977 |
let index = startingIndex; |
| 1978 |
do { |
| 1979 |
index += decrement ? -amount : amount; |
| 1980 |
} while (index >= 0 && index <= list.length - 1 && isListIndexDisabled(list, index, disabledIndices)); |
| 1981 |
return index; |
| 1982 |
} |
| 1983 |
function isListIndexDisabled(list, index, disabledIndices) { |
| 1984 |
const isExplicitlyDisabled = typeof disabledIndices === "function" ? disabledIndices(index) : disabledIndices?.includes(index) ?? false; |
| 1985 |
if (isExplicitlyDisabled) { |
| 1986 |
return true; |
| 1987 |
} |
| 1988 |
const element = list[index]; |
| 1989 |
if (!element) { |
| 1990 |
return false; |
| 1991 |
} |
| 1992 |
if (!isElementVisible(element)) { |
| 1993 |
return true; |
| 1994 |
} |
| 1995 |
return !disabledIndices && (element.hasAttribute("disabled") || element.getAttribute("aria-disabled") === "true"); |
| 1996 |
} |
| 1997 |
function isHiddenByStyles(styles) { |
| 1998 |
return styles.visibility === "hidden" || styles.visibility === "collapse"; |
| 1999 |
} |
| 2000 |
function isElementVisible(element, styles = element ? getComputedStyle2(element) : null) { |
| 2001 |
if (!element || !element.isConnected || !styles || isHiddenByStyles(styles)) { |
| 2002 |
return false; |
| 2003 |
} |
| 2004 |
if (typeof element.checkVisibility === "function") { |
| 2005 |
return element.checkVisibility(); |
| 2006 |
} |
| 2007 |
return styles.display !== "none" && styles.display !== "contents"; |
| 2008 |
} |
| 2009 |
|
| 2010 |
// node_modules/@base-ui/utils/useForcedRerendering.mjs |
| 2011 |
var React19 = __toESM(require_react(), 1); |
| 2012 |
function useForcedRerendering() { |
| 2013 |
const [, setState] = React19.useState({}); |
| 2014 |
return React19.useCallback(() => { |
| 2015 |
setState({}); |
| 2016 |
}, []); |
| 2017 |
} |
| 2018 |
|
| 2019 |
// node_modules/@base-ui/react/internals/composite/composite.mjs |
| 2020 |
var ARROW_UP = "ArrowUp"; |
| 2021 |
var ARROW_DOWN = "ArrowDown"; |
| 2022 |
var ARROW_LEFT = "ArrowLeft"; |
| 2023 |
var ARROW_RIGHT = "ArrowRight"; |
| 2024 |
var HOME = "Home"; |
| 2025 |
var END = "End"; |
| 2026 |
var HORIZONTAL_KEYS = /* @__PURE__ */ new Set([ARROW_LEFT, ARROW_RIGHT]); |
| 2027 |
var HORIZONTAL_KEYS_WITH_EXTRA_KEYS = /* @__PURE__ */ new Set([ARROW_LEFT, ARROW_RIGHT, HOME, END]); |
| 2028 |
var VERTICAL_KEYS = /* @__PURE__ */ new Set([ARROW_UP, ARROW_DOWN]); |
| 2029 |
var VERTICAL_KEYS_WITH_EXTRA_KEYS = /* @__PURE__ */ new Set([ARROW_UP, ARROW_DOWN, HOME, END]); |
| 2030 |
var ARROW_KEYS = /* @__PURE__ */ new Set([...HORIZONTAL_KEYS, ...VERTICAL_KEYS]); |
| 2031 |
var COMPOSITE_KEYS = /* @__PURE__ */ new Set([...ARROW_KEYS, HOME, END]); |
| 2032 |
var SHIFT = "Shift"; |
| 2033 |
var CONTROL = "Control"; |
| 2034 |
var ALT = "Alt"; |
| 2035 |
var META = "Meta"; |
| 2036 |
var MODIFIER_KEYS = /* @__PURE__ */ new Set([SHIFT, CONTROL, ALT, META]); |
| 2037 |
function isInputElement(element) { |
| 2038 |
return isHTMLElement(element) && element.tagName === "INPUT"; |
| 2039 |
} |
| 2040 |
function isNativeInput(element) { |
| 2041 |
if (isInputElement(element) && element.selectionStart != null) { |
| 2042 |
return true; |
| 2043 |
} |
| 2044 |
if (isHTMLElement(element) && element.tagName === "TEXTAREA") { |
| 2045 |
return true; |
| 2046 |
} |
| 2047 |
return false; |
| 2048 |
} |
| 2049 |
function scrollIntoViewIfNeeded(scrollContainer, element, direction, orientation) { |
| 2050 |
if (!scrollContainer || !element || !element.scrollTo) { |
| 2051 |
return; |
| 2052 |
} |
| 2053 |
let targetX = scrollContainer.scrollLeft; |
| 2054 |
let targetY = scrollContainer.scrollTop; |
| 2055 |
const isOverflowingX = scrollContainer.clientWidth < scrollContainer.scrollWidth; |
| 2056 |
const isOverflowingY = scrollContainer.clientHeight < scrollContainer.scrollHeight; |
| 2057 |
if (isOverflowingX && orientation !== "vertical") { |
| 2058 |
const elementOffsetLeft = getOffset(scrollContainer, element, "left"); |
| 2059 |
const containerStyles = getStyles(scrollContainer); |
| 2060 |
const elementStyles = getStyles(element); |
| 2061 |
if (direction === "ltr") { |
| 2062 |
if (elementOffsetLeft + element.offsetWidth + elementStyles.scrollMarginRight > scrollContainer.scrollLeft + scrollContainer.clientWidth - containerStyles.scrollPaddingRight) { |
| 2063 |
targetX = elementOffsetLeft + element.offsetWidth + elementStyles.scrollMarginRight - scrollContainer.clientWidth + containerStyles.scrollPaddingRight; |
| 2064 |
} else if (elementOffsetLeft - elementStyles.scrollMarginLeft < scrollContainer.scrollLeft + containerStyles.scrollPaddingLeft) { |
| 2065 |
targetX = elementOffsetLeft - elementStyles.scrollMarginLeft - containerStyles.scrollPaddingLeft; |
| 2066 |
} |
| 2067 |
} |
| 2068 |
if (direction === "rtl") { |
| 2069 |
if (elementOffsetLeft - elementStyles.scrollMarginRight < scrollContainer.scrollLeft + containerStyles.scrollPaddingLeft) { |
| 2070 |
targetX = elementOffsetLeft - elementStyles.scrollMarginLeft - containerStyles.scrollPaddingLeft; |
| 2071 |
} else if (elementOffsetLeft + element.offsetWidth + elementStyles.scrollMarginRight > scrollContainer.scrollLeft + scrollContainer.clientWidth - containerStyles.scrollPaddingRight) { |
| 2072 |
targetX = elementOffsetLeft + element.offsetWidth + elementStyles.scrollMarginRight - scrollContainer.clientWidth + containerStyles.scrollPaddingRight; |
| 2073 |
} |
| 2074 |
} |
| 2075 |
} |
| 2076 |
if (isOverflowingY && orientation !== "horizontal") { |
| 2077 |
const elementOffsetTop = getOffset(scrollContainer, element, "top"); |
| 2078 |
const containerStyles = getStyles(scrollContainer); |
| 2079 |
const elementStyles = getStyles(element); |
| 2080 |
if (elementOffsetTop - elementStyles.scrollMarginTop < scrollContainer.scrollTop + containerStyles.scrollPaddingTop) { |
| 2081 |
targetY = elementOffsetTop - elementStyles.scrollMarginTop - containerStyles.scrollPaddingTop; |
| 2082 |
} else if (elementOffsetTop + element.offsetHeight + elementStyles.scrollMarginBottom > scrollContainer.scrollTop + scrollContainer.clientHeight - containerStyles.scrollPaddingBottom) { |
| 2083 |
targetY = elementOffsetTop + element.offsetHeight + elementStyles.scrollMarginBottom - scrollContainer.clientHeight + containerStyles.scrollPaddingBottom; |
| 2084 |
} |
| 2085 |
} |
| 2086 |
scrollContainer.scrollTo({ |
| 2087 |
left: targetX, |
| 2088 |
top: targetY, |
| 2089 |
behavior: "auto" |
| 2090 |
}); |
| 2091 |
} |
| 2092 |
function getOffset(ancestor, element, side) { |
| 2093 |
const propName = side === "left" ? "offsetLeft" : "offsetTop"; |
| 2094 |
let result = 0; |
| 2095 |
while (element.offsetParent) { |
| 2096 |
result += element[propName]; |
| 2097 |
if (element.offsetParent === ancestor) { |
| 2098 |
break; |
| 2099 |
} |
| 2100 |
element = element.offsetParent; |
| 2101 |
} |
| 2102 |
return result; |
| 2103 |
} |
| 2104 |
function getStyles(element) { |
| 2105 |
const styles = getComputedStyle(element); |
| 2106 |
return { |
| 2107 |
scrollMarginTop: parseFloat(styles.scrollMarginTop) || 0, |
| 2108 |
scrollMarginRight: parseFloat(styles.scrollMarginRight) || 0, |
| 2109 |
scrollMarginBottom: parseFloat(styles.scrollMarginBottom) || 0, |
| 2110 |
scrollMarginLeft: parseFloat(styles.scrollMarginLeft) || 0, |
| 2111 |
scrollPaddingTop: parseFloat(styles.scrollPaddingTop) || 0, |
| 2112 |
scrollPaddingRight: parseFloat(styles.scrollPaddingRight) || 0, |
| 2113 |
scrollPaddingBottom: parseFloat(styles.scrollPaddingBottom) || 0, |
| 2114 |
scrollPaddingLeft: parseFloat(styles.scrollPaddingLeft) || 0 |
| 2115 |
}; |
| 2116 |
} |
| 2117 |
|
| 2118 |
// node_modules/@base-ui/utils/inertValue.mjs |
| 2119 |
function inertValue(value) { |
| 2120 |
if (isReactVersionAtLeast(19)) { |
| 2121 |
return value; |
| 2122 |
} |
| 2123 |
return value ? "true" : void 0; |
| 2124 |
} |
| 2125 |
|
| 2126 |
// node_modules/@base-ui/react/internals/composite/item/useCompositeItem.mjs |
| 2127 |
var React20 = __toESM(require_react(), 1); |
| 2128 |
function useCompositeItem(params = {}) { |
| 2129 |
const { |
| 2130 |
highlightItemOnHover, |
| 2131 |
highlightedIndex, |
| 2132 |
onHighlightedIndexChange |
| 2133 |
} = useCompositeRootContext(); |
| 2134 |
const { |
| 2135 |
ref, |
| 2136 |
index |
| 2137 |
} = useCompositeListItem(params); |
| 2138 |
const isHighlighted = highlightedIndex === index; |
| 2139 |
const itemRef = React20.useRef(null); |
| 2140 |
const mergedRef = useMergedRefs(ref, itemRef); |
| 2141 |
const compositeProps = { |
| 2142 |
tabIndex: isHighlighted ? 0 : -1, |
| 2143 |
onFocus() { |
| 2144 |
onHighlightedIndexChange(index); |
| 2145 |
}, |
| 2146 |
onMouseMove() { |
| 2147 |
const item = itemRef.current; |
| 2148 |
if (!highlightItemOnHover || !item) { |
| 2149 |
return; |
| 2150 |
} |
| 2151 |
const disabled2 = item.hasAttribute("disabled") || item.ariaDisabled === "true"; |
| 2152 |
if (!isHighlighted && !disabled2) { |
| 2153 |
item.focus(); |
| 2154 |
} |
| 2155 |
} |
| 2156 |
}; |
| 2157 |
return { |
| 2158 |
compositeProps, |
| 2159 |
compositeRef: mergedRef, |
| 2160 |
index |
| 2161 |
}; |
| 2162 |
} |
| 2163 |
|
| 2164 |
// node_modules/@base-ui/react/utils/getCssDimensions.mjs |
| 2165 |
function getCssDimensions(element) { |
| 2166 |
const css = getComputedStyle2(element); |
| 2167 |
let width = parseFloat(css.width) || 0; |
| 2168 |
let height = parseFloat(css.height) || 0; |
| 2169 |
const hasOffset = isHTMLElement(element); |
| 2170 |
const offsetWidth = hasOffset ? element.offsetWidth : width; |
| 2171 |
const offsetHeight = hasOffset ? element.offsetHeight : height; |
| 2172 |
const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight; |
| 2173 |
if (shouldFallback) { |
| 2174 |
width = offsetWidth; |
| 2175 |
height = offsetHeight; |
| 2176 |
} |
| 2177 |
return { |
| 2178 |
width, |
| 2179 |
height |
| 2180 |
}; |
| 2181 |
} |
| 2182 |
|
| 2183 |
// node_modules/@base-ui/utils/isElementDisabled.mjs |
| 2184 |
function isElementDisabled(element) { |
| 2185 |
return element == null || element.hasAttribute("disabled") || element.getAttribute("aria-disabled") === "true"; |
| 2186 |
} |
| 2187 |
|
| 2188 |
// node_modules/@base-ui/react/internals/csp-context/CSPContext.mjs |
| 2189 |
var React21 = __toESM(require_react(), 1); |
| 2190 |
var CSPContext = /* @__PURE__ */ React21.createContext(void 0); |
| 2191 |
if (true) CSPContext.displayName = "CSPContext"; |
| 2192 |
var DEFAULT_CSP_CONTEXT_VALUE = { |
| 2193 |
disableStyleElements: false |
| 2194 |
}; |
| 2195 |
function useCSPContext() { |
| 2196 |
return React21.useContext(CSPContext) ?? DEFAULT_CSP_CONTEXT_VALUE; |
| 2197 |
} |
| 2198 |
|
| 2199 |
// node_modules/@base-ui/react/internals/composite/root/CompositeRoot.mjs |
| 2200 |
var React23 = __toESM(require_react(), 1); |
| 2201 |
|
| 2202 |
// node_modules/@base-ui/react/internals/composite/root/useCompositeRoot.mjs |
| 2203 |
var React22 = __toESM(require_react(), 1); |
| 2204 |
|
| 2205 |
// node_modules/@base-ui/react/internals/composite/constants.mjs |
| 2206 |
var ACTIVE_COMPOSITE_ITEM = "data-composite-item-active"; |
| 2207 |
|
| 2208 |
// node_modules/@base-ui/react/internals/composite/root/useCompositeRoot.mjs |
| 2209 |
var EMPTY_ARRAY2 = []; |
| 2210 |
function useCompositeRoot(params) { |
| 2211 |
const { |
| 2212 |
loopFocus = true, |
| 2213 |
orientation = "both", |
| 2214 |
grid, |
| 2215 |
onLoop, |
| 2216 |
direction, |
| 2217 |
highlightedIndex: externalHighlightedIndex, |
| 2218 |
onHighlightedIndexChange: externalSetHighlightedIndex, |
| 2219 |
rootRef: externalRef, |
| 2220 |
enableHomeAndEndKeys = false, |
| 2221 |
stopEventPropagation = false, |
| 2222 |
disabledIndices, |
| 2223 |
modifierKeys = EMPTY_ARRAY2 |
| 2224 |
} = params; |
| 2225 |
const [internalHighlightedIndex, internalSetHighlightedIndex] = React22.useState(0); |
| 2226 |
const isGrid = grid != null; |
| 2227 |
const rootRef = React22.useRef(null); |
| 2228 |
const mergedRef = useMergedRefs(rootRef, externalRef); |
| 2229 |
const elementsRef = React22.useRef([]); |
| 2230 |
const hasSetDefaultIndexRef = React22.useRef(false); |
| 2231 |
const highlightedIndex = externalHighlightedIndex ?? internalHighlightedIndex; |
| 2232 |
const onHighlightedIndexChange = useStableCallback((index, shouldScrollIntoView = false) => { |
| 2233 |
(externalSetHighlightedIndex ?? internalSetHighlightedIndex)(index); |
| 2234 |
if (shouldScrollIntoView) { |
| 2235 |
const newActiveItem = elementsRef.current[index]; |
| 2236 |
scrollIntoViewIfNeeded(rootRef.current, newActiveItem, direction, orientation); |
| 2237 |
} |
| 2238 |
}); |
| 2239 |
const onMapChange = useStableCallback((map) => { |
| 2240 |
if (map.size === 0 || hasSetDefaultIndexRef.current) { |
| 2241 |
return; |
| 2242 |
} |
| 2243 |
hasSetDefaultIndexRef.current = true; |
| 2244 |
const sortedElements = Array.from(map.keys()); |
| 2245 |
const activeItem = sortedElements.find((compositeElement) => compositeElement?.hasAttribute(ACTIVE_COMPOSITE_ITEM)) ?? null; |
| 2246 |
const activeIndex = activeItem ? sortedElements.indexOf(activeItem) : -1; |
| 2247 |
if (activeIndex !== -1) { |
| 2248 |
onHighlightedIndexChange(activeIndex); |
| 2249 |
} else if (isListIndexDisabled(sortedElements, highlightedIndex, disabledIndices)) { |
| 2250 |
const firstEnabledIndex = findNonDisabledListIndex(sortedElements, { |
| 2251 |
disabledIndices |
| 2252 |
}); |
| 2253 |
if (!isIndexOutOfListBounds(sortedElements, firstEnabledIndex)) { |
| 2254 |
onHighlightedIndexChange(firstEnabledIndex); |
| 2255 |
} |
| 2256 |
} |
| 2257 |
scrollIntoViewIfNeeded(rootRef.current, activeItem, direction, orientation); |
| 2258 |
}); |
| 2259 |
useIsoLayoutEffect(() => { |
| 2260 |
if (disabledIndices == null || externalHighlightedIndex != null || !hasSetDefaultIndexRef.current) { |
| 2261 |
return; |
| 2262 |
} |
| 2263 |
const elements = elementsRef.current; |
| 2264 |
if (isListIndexDisabled(elements, highlightedIndex, disabledIndices)) { |
| 2265 |
const firstEnabledIndex = findNonDisabledListIndex(elements, { |
| 2266 |
disabledIndices |
| 2267 |
}); |
| 2268 |
if (!isIndexOutOfListBounds(elements, firstEnabledIndex)) { |
| 2269 |
onHighlightedIndexChange(firstEnabledIndex); |
| 2270 |
} |
| 2271 |
} |
| 2272 |
}, [disabledIndices, externalHighlightedIndex, highlightedIndex, elementsRef, onHighlightedIndexChange]); |
| 2273 |
const wrappedOnLoop = useStableCallback((event, prevIndex, nextIndex) => { |
| 2274 |
if (!onLoop) { |
| 2275 |
return nextIndex; |
| 2276 |
} |
| 2277 |
return onLoop(event, prevIndex, nextIndex, elementsRef); |
| 2278 |
}); |
| 2279 |
const onKeyDown = useStableCallback((event) => { |
| 2280 |
const RELEVANT_KEYS = enableHomeAndEndKeys ? COMPOSITE_KEYS : ARROW_KEYS; |
| 2281 |
if (!RELEVANT_KEYS.has(event.key)) { |
| 2282 |
return; |
| 2283 |
} |
| 2284 |
if (isModifierKeySet(event, modifierKeys)) { |
| 2285 |
return; |
| 2286 |
} |
| 2287 |
const element = rootRef.current; |
| 2288 |
if (!element) { |
| 2289 |
return; |
| 2290 |
} |
| 2291 |
const isRtl = direction === "rtl"; |
| 2292 |
const horizontalForwardKey = isRtl ? ARROW_LEFT : ARROW_RIGHT; |
| 2293 |
const forwardKey = { |
| 2294 |
horizontal: horizontalForwardKey, |
| 2295 |
vertical: ARROW_DOWN, |
| 2296 |
both: horizontalForwardKey |
| 2297 |
}[orientation]; |
| 2298 |
const horizontalBackwardKey = isRtl ? ARROW_RIGHT : ARROW_LEFT; |
| 2299 |
const backwardKey = { |
| 2300 |
horizontal: horizontalBackwardKey, |
| 2301 |
vertical: ARROW_UP, |
| 2302 |
both: horizontalBackwardKey |
| 2303 |
}[orientation]; |
| 2304 |
const target = getTarget(event.nativeEvent); |
| 2305 |
if (target != null && isNativeInput(target) && !isElementDisabled(target)) { |
| 2306 |
const selectionStart = target.selectionStart; |
| 2307 |
const selectionEnd = target.selectionEnd; |
| 2308 |
const textContent = target.value ?? ""; |
| 2309 |
if (selectionStart == null || event.shiftKey || selectionStart !== selectionEnd) { |
| 2310 |
return; |
| 2311 |
} |
| 2312 |
if (event.key !== backwardKey && selectionStart < textContent.length) { |
| 2313 |
return; |
| 2314 |
} |
| 2315 |
if (event.key !== forwardKey && selectionStart > 0) { |
| 2316 |
return; |
| 2317 |
} |
| 2318 |
} |
| 2319 |
let nextIndex = highlightedIndex; |
| 2320 |
const minIndex = getMinListIndex(elementsRef, disabledIndices); |
| 2321 |
const maxIndex = getMaxListIndex(elementsRef, disabledIndices); |
| 2322 |
if (grid != null) { |
| 2323 |
nextIndex = grid({ |
| 2324 |
disabledIndices, |
| 2325 |
elementsRef, |
| 2326 |
event, |
| 2327 |
highlightedIndex, |
| 2328 |
loopFocus, |
| 2329 |
maxIndex, |
| 2330 |
minIndex, |
| 2331 |
onLoop: wrappedOnLoop, |
| 2332 |
orientation, |
| 2333 |
rtl: isRtl |
| 2334 |
}); |
| 2335 |
} |
| 2336 |
const forwardKeys = { |
| 2337 |
horizontal: [horizontalForwardKey], |
| 2338 |
vertical: [ARROW_DOWN], |
| 2339 |
both: [horizontalForwardKey, ARROW_DOWN] |
| 2340 |
}[orientation]; |
| 2341 |
const backwardKeys = { |
| 2342 |
horizontal: [horizontalBackwardKey], |
| 2343 |
vertical: [ARROW_UP], |
| 2344 |
both: [horizontalBackwardKey, ARROW_UP] |
| 2345 |
}[orientation]; |
| 2346 |
const preventedKeys = isGrid ? RELEVANT_KEYS : { |
| 2347 |
horizontal: enableHomeAndEndKeys ? HORIZONTAL_KEYS_WITH_EXTRA_KEYS : HORIZONTAL_KEYS, |
| 2348 |
vertical: enableHomeAndEndKeys ? VERTICAL_KEYS_WITH_EXTRA_KEYS : VERTICAL_KEYS, |
| 2349 |
both: RELEVANT_KEYS |
| 2350 |
}[orientation]; |
| 2351 |
if (enableHomeAndEndKeys) { |
| 2352 |
if (event.key === HOME) { |
| 2353 |
nextIndex = minIndex; |
| 2354 |
} else if (event.key === END) { |
| 2355 |
nextIndex = maxIndex; |
| 2356 |
} |
| 2357 |
} |
| 2358 |
if (nextIndex === highlightedIndex && (forwardKeys.includes(event.key) || backwardKeys.includes(event.key))) { |
| 2359 |
if (loopFocus && nextIndex === maxIndex && forwardKeys.includes(event.key)) { |
| 2360 |
nextIndex = minIndex; |
| 2361 |
if (onLoop) { |
| 2362 |
nextIndex = onLoop(event, highlightedIndex, nextIndex, elementsRef); |
| 2363 |
} |
| 2364 |
} else if (loopFocus && nextIndex === minIndex && backwardKeys.includes(event.key)) { |
| 2365 |
nextIndex = maxIndex; |
| 2366 |
if (onLoop) { |
| 2367 |
nextIndex = onLoop(event, highlightedIndex, nextIndex, elementsRef); |
| 2368 |
} |
| 2369 |
} else { |
| 2370 |
nextIndex = findNonDisabledListIndex(elementsRef.current, { |
| 2371 |
startingIndex: nextIndex, |
| 2372 |
decrement: backwardKeys.includes(event.key), |
| 2373 |
disabledIndices |
| 2374 |
}); |
| 2375 |
} |
| 2376 |
} |
| 2377 |
if (nextIndex !== highlightedIndex && !isIndexOutOfListBounds(elementsRef.current, nextIndex)) { |
| 2378 |
if (stopEventPropagation) { |
| 2379 |
event.stopPropagation(); |
| 2380 |
} |
| 2381 |
if (preventedKeys.has(event.key)) { |
| 2382 |
event.preventDefault(); |
| 2383 |
} |
| 2384 |
onHighlightedIndexChange(nextIndex, true); |
| 2385 |
queueMicrotask(() => { |
| 2386 |
elementsRef.current[nextIndex]?.focus(); |
| 2387 |
}); |
| 2388 |
} |
| 2389 |
}); |
| 2390 |
const props = { |
| 2391 |
ref: mergedRef, |
| 2392 |
onFocus(event) { |
| 2393 |
const element = rootRef.current; |
| 2394 |
const target = getTarget(event.nativeEvent); |
| 2395 |
if (!element || target == null || !isNativeInput(target)) { |
| 2396 |
return; |
| 2397 |
} |
| 2398 |
target.setSelectionRange(0, target.value.length ?? 0); |
| 2399 |
}, |
| 2400 |
onKeyDown |
| 2401 |
}; |
| 2402 |
return { |
| 2403 |
props, |
| 2404 |
highlightedIndex, |
| 2405 |
onHighlightedIndexChange, |
| 2406 |
elementsRef, |
| 2407 |
disabledIndices, |
| 2408 |
onMapChange, |
| 2409 |
relayKeyboardEvent: onKeyDown |
| 2410 |
}; |
| 2411 |
} |
| 2412 |
function isModifierKeySet(event, ignoredModifierKeys) { |
| 2413 |
for (const key of MODIFIER_KEYS.values()) { |
| 2414 |
if (ignoredModifierKeys.includes(key)) { |
| 2415 |
continue; |
| 2416 |
} |
| 2417 |
if (event.getModifierState(key)) { |
| 2418 |
return true; |
| 2419 |
} |
| 2420 |
} |
| 2421 |
return false; |
| 2422 |
} |
| 2423 |
|
| 2424 |
// node_modules/@base-ui/react/internals/composite/root/CompositeRoot.mjs |
| 2425 |
var import_jsx_runtime18 = __toESM(require_jsx_runtime(), 1); |
| 2426 |
function CompositeRoot(componentProps) { |
| 2427 |
const { |
| 2428 |
render, |
| 2429 |
className, |
| 2430 |
style, |
| 2431 |
refs = EMPTY_ARRAY, |
| 2432 |
props = EMPTY_ARRAY, |
| 2433 |
state = EMPTY_OBJECT, |
| 2434 |
stateAttributesMapping: stateAttributesMapping3, |
| 2435 |
highlightedIndex: highlightedIndexProp, |
| 2436 |
onHighlightedIndexChange: onHighlightedIndexChangeProp, |
| 2437 |
orientation, |
| 2438 |
grid, |
| 2439 |
loopFocus, |
| 2440 |
onLoop, |
| 2441 |
enableHomeAndEndKeys, |
| 2442 |
onMapChange: onMapChangeProp, |
| 2443 |
stopEventPropagation = true, |
| 2444 |
rootRef, |
| 2445 |
disabledIndices, |
| 2446 |
modifierKeys, |
| 2447 |
highlightItemOnHover = false, |
| 2448 |
tag = "div", |
| 2449 |
...elementProps |
| 2450 |
} = componentProps; |
| 2451 |
const direction = useDirection(); |
| 2452 |
const { |
| 2453 |
props: defaultProps, |
| 2454 |
highlightedIndex, |
| 2455 |
onHighlightedIndexChange, |
| 2456 |
elementsRef, |
| 2457 |
onMapChange: onMapChangeUnwrapped, |
| 2458 |
relayKeyboardEvent |
| 2459 |
} = useCompositeRoot({ |
| 2460 |
grid, |
| 2461 |
loopFocus, |
| 2462 |
onLoop, |
| 2463 |
orientation, |
| 2464 |
highlightedIndex: highlightedIndexProp, |
| 2465 |
onHighlightedIndexChange: onHighlightedIndexChangeProp, |
| 2466 |
rootRef, |
| 2467 |
stopEventPropagation, |
| 2468 |
enableHomeAndEndKeys, |
| 2469 |
direction, |
| 2470 |
disabledIndices, |
| 2471 |
modifierKeys |
| 2472 |
}); |
| 2473 |
const element = useRenderElement(tag, componentProps, { |
| 2474 |
state, |
| 2475 |
ref: refs, |
| 2476 |
props: [defaultProps, ...props, elementProps], |
| 2477 |
stateAttributesMapping: stateAttributesMapping3 |
| 2478 |
}); |
| 2479 |
const contextValue = React23.useMemo(() => ({ |
| 2480 |
highlightedIndex, |
| 2481 |
onHighlightedIndexChange, |
| 2482 |
highlightItemOnHover, |
| 2483 |
relayKeyboardEvent |
| 2484 |
}), [highlightedIndex, onHighlightedIndexChange, highlightItemOnHover, relayKeyboardEvent]); |
| 2485 |
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(CompositeRootContext.Provider, { |
| 2486 |
value: contextValue, |
| 2487 |
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(CompositeList, { |
| 2488 |
elementsRef, |
| 2489 |
onMapChange: (newMap) => { |
| 2490 |
onMapChangeProp?.(newMap); |
| 2491 |
onMapChangeUnwrapped(newMap); |
| 2492 |
}, |
| 2493 |
children: element |
| 2494 |
}) |
| 2495 |
}); |
| 2496 |
} |
| 2497 |
|
| 2498 |
// node_modules/@base-ui/react/utils/useIsHydrating.mjs |
| 2499 |
var import_shim = __toESM(require_shim(), 1); |
| 2500 |
function subscribe() { |
| 2501 |
return NOOP; |
| 2502 |
} |
| 2503 |
function getSnapshot() { |
| 2504 |
return false; |
| 2505 |
} |
| 2506 |
function getServerSnapshot() { |
| 2507 |
return true; |
| 2508 |
} |
| 2509 |
function useIsHydrating() { |
| 2510 |
return (0, import_shim.useSyncExternalStore)(subscribe, getSnapshot, getServerSnapshot); |
| 2511 |
} |
| 2512 |
|
| 2513 |
// node_modules/@base-ui/react/tabs/index.parts.mjs |
| 2514 |
var index_parts_exports = {}; |
| 2515 |
__export(index_parts_exports, { |
| 2516 |
Indicator: () => TabsIndicator, |
| 2517 |
List: () => TabsList, |
| 2518 |
Panel: () => TabsPanel, |
| 2519 |
Root: () => TabsRoot, |
| 2520 |
Tab: () => TabsTab |
| 2521 |
}); |
| 2522 |
|
| 2523 |
// node_modules/@base-ui/react/tabs/root/TabsRoot.mjs |
| 2524 |
var React25 = __toESM(require_react(), 1); |
| 2525 |
|
| 2526 |
// node_modules/@base-ui/react/tabs/root/TabsRootContext.mjs |
| 2527 |
var React24 = __toESM(require_react(), 1); |
| 2528 |
var TabsRootContext = /* @__PURE__ */ React24.createContext(void 0); |
| 2529 |
if (true) TabsRootContext.displayName = "TabsRootContext"; |
| 2530 |
function useTabsRootContext() { |
| 2531 |
const context = React24.useContext(TabsRootContext); |
| 2532 |
if (context === void 0) { |
| 2533 |
throw new Error(true ? "Base UI: TabsRootContext is missing. Tabs parts must be placed within <Tabs.Root>." : formatErrorMessage_default(64)); |
| 2534 |
} |
| 2535 |
return context; |
| 2536 |
} |
| 2537 |
|
| 2538 |
// node_modules/@base-ui/react/tabs/root/TabsRootDataAttributes.mjs |
| 2539 |
var TabsRootDataAttributes = /* @__PURE__ */ (function(TabsRootDataAttributes2) { |
| 2540 |
TabsRootDataAttributes2["activationDirection"] = "data-activation-direction"; |
| 2541 |
TabsRootDataAttributes2["orientation"] = "data-orientation"; |
| 2542 |
return TabsRootDataAttributes2; |
| 2543 |
})({}); |
| 2544 |
|
| 2545 |
// node_modules/@base-ui/react/tabs/root/stateAttributesMapping.mjs |
| 2546 |
var tabsStateAttributesMapping = { |
| 2547 |
tabActivationDirection: (dir) => ({ |
| 2548 |
[TabsRootDataAttributes.activationDirection]: dir |
| 2549 |
}) |
| 2550 |
}; |
| 2551 |
|
| 2552 |
// node_modules/@base-ui/react/tabs/root/TabsRoot.mjs |
| 2553 |
var import_jsx_runtime19 = __toESM(require_jsx_runtime(), 1); |
| 2554 |
var TabsRoot = /* @__PURE__ */ React25.forwardRef(function TabsRoot2(componentProps, forwardedRef) { |
| 2555 |
const { |
| 2556 |
className, |
| 2557 |
defaultValue: defaultValueProp = 0, |
| 2558 |
onValueChange: onValueChangeProp, |
| 2559 |
orientation = "horizontal", |
| 2560 |
render, |
| 2561 |
value: valueProp, |
| 2562 |
style, |
| 2563 |
...elementProps |
| 2564 |
} = componentProps; |
| 2565 |
const hasExplicitDefaultValueProp = componentProps.defaultValue !== void 0; |
| 2566 |
const tabPanelRefs = React25.useRef([]); |
| 2567 |
const [mountedTabPanels, setMountedTabPanels] = React25.useState(() => /* @__PURE__ */ new Map()); |
| 2568 |
const [value, setValue] = useControlled({ |
| 2569 |
controlled: valueProp, |
| 2570 |
default: defaultValueProp, |
| 2571 |
name: "Tabs", |
| 2572 |
state: "value" |
| 2573 |
}); |
| 2574 |
const isControlled = valueProp !== void 0; |
| 2575 |
const [tabMap, setTabMap] = React25.useState(() => /* @__PURE__ */ new Map()); |
| 2576 |
const lastKnownTabElementRef = React25.useRef(void 0); |
| 2577 |
const getTabElementBySelectedValue = React25.useCallback((selectedValue) => { |
| 2578 |
if (selectedValue === void 0) { |
| 2579 |
return null; |
| 2580 |
} |
| 2581 |
for (const [tabElement, tabMetadata] of tabMap.entries()) { |
| 2582 |
if (tabMetadata != null && selectedValue === (tabMetadata.value ?? tabMetadata.index)) { |
| 2583 |
return tabElement; |
| 2584 |
} |
| 2585 |
} |
| 2586 |
return null; |
| 2587 |
}, [tabMap]); |
| 2588 |
const [activationDirectionState, setActivationDirectionState] = React25.useState(() => ({ |
| 2589 |
previousValue: value, |
| 2590 |
tabActivationDirection: "none" |
| 2591 |
})); |
| 2592 |
const { |
| 2593 |
previousValue, |
| 2594 |
tabActivationDirection: committedTabActivationDirection |
| 2595 |
} = activationDirectionState; |
| 2596 |
let tabActivationDirection = committedTabActivationDirection; |
| 2597 |
let directionComputationIncomplete = false; |
| 2598 |
if (previousValue !== value) { |
| 2599 |
tabActivationDirection = computeActivationDirection(previousValue, value, orientation, tabMap); |
| 2600 |
directionComputationIncomplete = previousValue != null && value != null && getTabElementBySelectedValue(value) == null; |
| 2601 |
} |
| 2602 |
const nextPreviousValue = directionComputationIncomplete ? previousValue : value; |
| 2603 |
const shouldSyncActivationDirectionState = previousValue !== nextPreviousValue || committedTabActivationDirection !== tabActivationDirection; |
| 2604 |
useIsoLayoutEffect(() => { |
| 2605 |
if (!shouldSyncActivationDirectionState) { |
| 2606 |
return; |
| 2607 |
} |
| 2608 |
setActivationDirectionState({ |
| 2609 |
previousValue: nextPreviousValue, |
| 2610 |
tabActivationDirection |
| 2611 |
}); |
| 2612 |
}, [nextPreviousValue, shouldSyncActivationDirectionState, tabActivationDirection]); |
| 2613 |
const onValueChange = useStableCallback((newValue, eventDetails) => { |
| 2614 |
const activationDirection = computeActivationDirection(value, newValue, orientation, tabMap); |
| 2615 |
eventDetails.activationDirection = activationDirection; |
| 2616 |
onValueChangeProp?.(newValue, eventDetails); |
| 2617 |
if (eventDetails.isCanceled) { |
| 2618 |
return; |
| 2619 |
} |
| 2620 |
setValue(newValue); |
| 2621 |
}); |
| 2622 |
const notifyAutomaticValueChange = useStableCallback((nextValue, reason) => { |
| 2623 |
onValueChangeProp?.(nextValue, createChangeEventDetails(reason, void 0, void 0, { |
| 2624 |
activationDirection: "none" |
| 2625 |
})); |
| 2626 |
}); |
| 2627 |
const registerMountedTabPanel = useStableCallback((panelValue, panelId) => { |
| 2628 |
setMountedTabPanels((prev) => { |
| 2629 |
if (prev.get(panelValue) === panelId) { |
| 2630 |
return prev; |
| 2631 |
} |
| 2632 |
const next = new Map(prev); |
| 2633 |
next.set(panelValue, panelId); |
| 2634 |
return next; |
| 2635 |
}); |
| 2636 |
}); |
| 2637 |
const unregisterMountedTabPanel = useStableCallback((panelValue, panelId) => { |
| 2638 |
setMountedTabPanels((prev) => { |
| 2639 |
if (!prev.has(panelValue) || prev.get(panelValue) !== panelId) { |
| 2640 |
return prev; |
| 2641 |
} |
| 2642 |
const next = new Map(prev); |
| 2643 |
next.delete(panelValue); |
| 2644 |
return next; |
| 2645 |
}); |
| 2646 |
}); |
| 2647 |
const getTabPanelIdByValue = React25.useCallback((tabValue) => { |
| 2648 |
return mountedTabPanels.get(tabValue); |
| 2649 |
}, [mountedTabPanels]); |
| 2650 |
const getTabIdByPanelValue = React25.useCallback((tabPanelValue) => { |
| 2651 |
for (const tabMetadata of tabMap.values()) { |
| 2652 |
if (tabPanelValue === tabMetadata?.value) { |
| 2653 |
return tabMetadata?.id; |
| 2654 |
} |
| 2655 |
} |
| 2656 |
return void 0; |
| 2657 |
}, [tabMap]); |
| 2658 |
const tabsContextValue = React25.useMemo(() => ({ |
| 2659 |
getTabElementBySelectedValue, |
| 2660 |
getTabIdByPanelValue, |
| 2661 |
getTabPanelIdByValue, |
| 2662 |
onValueChange, |
| 2663 |
orientation, |
| 2664 |
registerMountedTabPanel, |
| 2665 |
setTabMap, |
| 2666 |
unregisterMountedTabPanel, |
| 2667 |
tabActivationDirection, |
| 2668 |
value |
| 2669 |
}), [getTabElementBySelectedValue, getTabIdByPanelValue, getTabPanelIdByValue, onValueChange, orientation, registerMountedTabPanel, setTabMap, unregisterMountedTabPanel, tabActivationDirection, value]); |
| 2670 |
const selectedTabMetadata = React25.useMemo(() => { |
| 2671 |
for (const tabMetadata of tabMap.values()) { |
| 2672 |
if (tabMetadata != null && tabMetadata.value === value) { |
| 2673 |
return tabMetadata; |
| 2674 |
} |
| 2675 |
} |
| 2676 |
return void 0; |
| 2677 |
}, [tabMap, value]); |
| 2678 |
const firstEnabledTabValue = React25.useMemo(() => { |
| 2679 |
for (const tabMetadata of tabMap.values()) { |
| 2680 |
if (tabMetadata != null && !tabMetadata.disabled) { |
| 2681 |
return tabMetadata.value; |
| 2682 |
} |
| 2683 |
} |
| 2684 |
return void 0; |
| 2685 |
}, [tabMap]); |
| 2686 |
const shouldNotifyInitialValueChangeRef = React25.useRef(!hasExplicitDefaultValueProp); |
| 2687 |
const initialDefaultValueRef = React25.useRef(defaultValueProp); |
| 2688 |
const shouldHonorDisabledDefaultValueRef = React25.useRef(hasExplicitDefaultValueProp); |
| 2689 |
const didRegisterTabsRef = React25.useRef(false); |
| 2690 |
useIsoLayoutEffect(() => { |
| 2691 |
if (isControlled) { |
| 2692 |
return; |
| 2693 |
} |
| 2694 |
function commitAutomaticValueChange(fallbackValue, fallbackReason) { |
| 2695 |
setValue(fallbackValue); |
| 2696 |
setActivationDirectionState((prev) => { |
| 2697 |
if (prev.previousValue === fallbackValue && prev.tabActivationDirection === "none") { |
| 2698 |
return prev; |
| 2699 |
} |
| 2700 |
return { |
| 2701 |
previousValue: fallbackValue, |
| 2702 |
tabActivationDirection: "none" |
| 2703 |
}; |
| 2704 |
}); |
| 2705 |
notifyAutomaticValueChange(fallbackValue, fallbackReason); |
| 2706 |
shouldNotifyInitialValueChangeRef.current = false; |
| 2707 |
} |
| 2708 |
if (tabMap.size === 0) { |
| 2709 |
if (didRegisterTabsRef.current && value !== null && !lastKnownTabElementRef.current?.isConnected) { |
| 2710 |
commitAutomaticValueChange(null, reason_parts_exports.missing); |
| 2711 |
} |
| 2712 |
return; |
| 2713 |
} |
| 2714 |
didRegisterTabsRef.current = true; |
| 2715 |
lastKnownTabElementRef.current = tabMap.keys().next().value; |
| 2716 |
const selectionIsDisabled = selectedTabMetadata?.disabled; |
| 2717 |
const selectionIsMissing = selectedTabMetadata == null && value !== null; |
| 2718 |
if (!selectionIsDisabled && value === initialDefaultValueRef.current) { |
| 2719 |
shouldHonorDisabledDefaultValueRef.current = false; |
| 2720 |
} |
| 2721 |
if (shouldHonorDisabledDefaultValueRef.current && selectionIsDisabled && value === initialDefaultValueRef.current) { |
| 2722 |
return; |
| 2723 |
} |
| 2724 |
const shouldNotifyInitialValueChange = shouldNotifyInitialValueChangeRef.current; |
| 2725 |
if (selectionIsDisabled || selectionIsMissing) { |
| 2726 |
const fallbackValue = firstEnabledTabValue ?? null; |
| 2727 |
if (value === fallbackValue) { |
| 2728 |
shouldNotifyInitialValueChangeRef.current = false; |
| 2729 |
return; |
| 2730 |
} |
| 2731 |
let fallbackReason = reason_parts_exports.missing; |
| 2732 |
if (shouldNotifyInitialValueChange) { |
| 2733 |
fallbackReason = reason_parts_exports.initial; |
| 2734 |
} else if (selectionIsDisabled) { |
| 2735 |
fallbackReason = reason_parts_exports.disabled; |
| 2736 |
} |
| 2737 |
commitAutomaticValueChange(fallbackValue, fallbackReason); |
| 2738 |
return; |
| 2739 |
} |
| 2740 |
if (shouldNotifyInitialValueChange && selectedTabMetadata != null) { |
| 2741 |
notifyAutomaticValueChange(value, reason_parts_exports.initial); |
| 2742 |
shouldNotifyInitialValueChangeRef.current = false; |
| 2743 |
} |
| 2744 |
}, [firstEnabledTabValue, isControlled, notifyAutomaticValueChange, selectedTabMetadata, setValue, tabMap, value]); |
| 2745 |
const state = { |
| 2746 |
orientation, |
| 2747 |
tabActivationDirection |
| 2748 |
}; |
| 2749 |
const element = useRenderElement("div", componentProps, { |
| 2750 |
state, |
| 2751 |
ref: forwardedRef, |
| 2752 |
props: elementProps, |
| 2753 |
stateAttributesMapping: tabsStateAttributesMapping |
| 2754 |
}); |
| 2755 |
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(TabsRootContext.Provider, { |
| 2756 |
value: tabsContextValue, |
| 2757 |
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(CompositeList, { |
| 2758 |
elementsRef: tabPanelRefs, |
| 2759 |
children: element |
| 2760 |
}) |
| 2761 |
}); |
| 2762 |
}); |
| 2763 |
if (true) TabsRoot.displayName = "TabsRoot"; |
| 2764 |
function computeActivationDirection(oldValue, newValue, orientation, tabMap) { |
| 2765 |
if (oldValue == null || newValue == null) { |
| 2766 |
return "none"; |
| 2767 |
} |
| 2768 |
let oldTab = null; |
| 2769 |
let newTab = null; |
| 2770 |
for (const [tabElement, tabMetadata] of tabMap.entries()) { |
| 2771 |
if (tabMetadata == null) { |
| 2772 |
continue; |
| 2773 |
} |
| 2774 |
const tabValue = tabMetadata.value ?? tabMetadata.index; |
| 2775 |
if (oldValue === tabValue) { |
| 2776 |
oldTab = tabElement; |
| 2777 |
} |
| 2778 |
if (newValue === tabValue) { |
| 2779 |
newTab = tabElement; |
| 2780 |
} |
| 2781 |
if (oldTab != null && newTab != null) { |
| 2782 |
break; |
| 2783 |
} |
| 2784 |
} |
| 2785 |
if (oldTab == null || newTab == null) { |
| 2786 |
if (oldTab !== newTab && (typeof oldValue === "number" || typeof oldValue === "string") && typeof oldValue === typeof newValue) { |
| 2787 |
if (orientation === "horizontal") { |
| 2788 |
return newValue > oldValue ? "right" : "left"; |
| 2789 |
} |
| 2790 |
return newValue > oldValue ? "down" : "up"; |
| 2791 |
} |
| 2792 |
return "none"; |
| 2793 |
} |
| 2794 |
const oldRect = oldTab.getBoundingClientRect(); |
| 2795 |
const newRect = newTab.getBoundingClientRect(); |
| 2796 |
if (orientation === "horizontal") { |
| 2797 |
if (newRect.left < oldRect.left) { |
| 2798 |
return "left"; |
| 2799 |
} |
| 2800 |
if (newRect.left > oldRect.left) { |
| 2801 |
return "right"; |
| 2802 |
} |
| 2803 |
} else { |
| 2804 |
if (newRect.top < oldRect.top) { |
| 2805 |
return "up"; |
| 2806 |
} |
| 2807 |
if (newRect.top > oldRect.top) { |
| 2808 |
return "down"; |
| 2809 |
} |
| 2810 |
} |
| 2811 |
return "none"; |
| 2812 |
} |
| 2813 |
|
| 2814 |
// node_modules/@base-ui/react/tabs/tab/TabsTab.mjs |
| 2815 |
var React27 = __toESM(require_react(), 1); |
| 2816 |
|
| 2817 |
// node_modules/@base-ui/react/tabs/list/TabsListContext.mjs |
| 2818 |
var React26 = __toESM(require_react(), 1); |
| 2819 |
var TabsListContext = /* @__PURE__ */ React26.createContext(void 0); |
| 2820 |
if (true) TabsListContext.displayName = "TabsListContext"; |
| 2821 |
function useTabsListContext() { |
| 2822 |
const context = React26.useContext(TabsListContext); |
| 2823 |
if (context === void 0) { |
| 2824 |
throw new Error(true ? "Base UI: TabsListContext is missing. TabsList parts must be placed within <Tabs.List>." : formatErrorMessage_default(65)); |
| 2825 |
} |
| 2826 |
return context; |
| 2827 |
} |
| 2828 |
|
| 2829 |
// node_modules/@base-ui/react/tabs/tab/TabsTab.mjs |
| 2830 |
var TabsTab = /* @__PURE__ */ React27.forwardRef(function TabsTab2(componentProps, forwardedRef) { |
| 2831 |
const { |
| 2832 |
className, |
| 2833 |
disabled: disabled2 = false, |
| 2834 |
render, |
| 2835 |
value, |
| 2836 |
id: idProp, |
| 2837 |
nativeButton = true, |
| 2838 |
style, |
| 2839 |
...elementProps |
| 2840 |
} = componentProps; |
| 2841 |
const { |
| 2842 |
value: activeTabValue, |
| 2843 |
getTabPanelIdByValue, |
| 2844 |
orientation, |
| 2845 |
tabActivationDirection |
| 2846 |
} = useTabsRootContext(); |
| 2847 |
const { |
| 2848 |
activateOnFocus, |
| 2849 |
highlightedTabIndex, |
| 2850 |
onTabActivation, |
| 2851 |
registerTabResizeObserverElement, |
| 2852 |
setHighlightedTabIndex, |
| 2853 |
tabsListElement |
| 2854 |
} = useTabsListContext(); |
| 2855 |
const id = useBaseUiId(idProp); |
| 2856 |
const tabMetadata = React27.useMemo(() => ({ |
| 2857 |
disabled: disabled2, |
| 2858 |
id, |
| 2859 |
value |
| 2860 |
}), [disabled2, id, value]); |
| 2861 |
const { |
| 2862 |
compositeProps, |
| 2863 |
compositeRef, |
| 2864 |
index |
| 2865 |
// hook is used instead of the CompositeItem component |
| 2866 |
// because the index is needed for Tab internals |
| 2867 |
} = useCompositeItem({ |
| 2868 |
metadata: tabMetadata |
| 2869 |
}); |
| 2870 |
const active = value === activeTabValue; |
| 2871 |
const isNavigatingRef = React27.useRef(false); |
| 2872 |
const tabElementRef = React27.useRef(null); |
| 2873 |
useIsoLayoutEffect(() => { |
| 2874 |
const tabElement = tabElementRef.current; |
| 2875 |
if (!tabElement) { |
| 2876 |
return void 0; |
| 2877 |
} |
| 2878 |
return registerTabResizeObserverElement(tabElement); |
| 2879 |
}, [registerTabResizeObserverElement]); |
| 2880 |
useIsoLayoutEffect(() => { |
| 2881 |
if (isNavigatingRef.current) { |
| 2882 |
isNavigatingRef.current = false; |
| 2883 |
return; |
| 2884 |
} |
| 2885 |
if (!(active && index > -1 && highlightedTabIndex !== index)) { |
| 2886 |
return; |
| 2887 |
} |
| 2888 |
const listElement = tabsListElement; |
| 2889 |
if (listElement != null) { |
| 2890 |
const activeEl = activeElement(ownerDocument(listElement)); |
| 2891 |
if (activeEl && contains(listElement, activeEl)) { |
| 2892 |
return; |
| 2893 |
} |
| 2894 |
} |
| 2895 |
if (!disabled2) { |
| 2896 |
setHighlightedTabIndex(index); |
| 2897 |
} |
| 2898 |
}, [active, index, highlightedTabIndex, setHighlightedTabIndex, disabled2, tabsListElement]); |
| 2899 |
const { |
| 2900 |
getButtonProps, |
| 2901 |
buttonRef |
| 2902 |
} = useButton({ |
| 2903 |
disabled: disabled2, |
| 2904 |
native: nativeButton, |
| 2905 |
focusableWhenDisabled: true |
| 2906 |
}); |
| 2907 |
const tabPanelId = getTabPanelIdByValue(value); |
| 2908 |
const isPressingRef = React27.useRef(false); |
| 2909 |
const isMainButtonRef = React27.useRef(false); |
| 2910 |
function onClick(event) { |
| 2911 |
if (active || disabled2) { |
| 2912 |
return; |
| 2913 |
} |
| 2914 |
onTabActivation(value, createChangeEventDetails(reason_parts_exports.none, event.nativeEvent, void 0, { |
| 2915 |
activationDirection: "none" |
| 2916 |
})); |
| 2917 |
} |
| 2918 |
function onFocus(event) { |
| 2919 |
if (active) { |
| 2920 |
return; |
| 2921 |
} |
| 2922 |
if (index > -1 && !disabled2) { |
| 2923 |
setHighlightedTabIndex(index); |
| 2924 |
} |
| 2925 |
if (disabled2) { |
| 2926 |
return; |
| 2927 |
} |
| 2928 |
if (activateOnFocus && (!isPressingRef.current || // keyboard or touch focus |
| 2929 |
isPressingRef.current && isMainButtonRef.current)) { |
| 2930 |
onTabActivation(value, createChangeEventDetails(reason_parts_exports.none, event.nativeEvent, void 0, { |
| 2931 |
activationDirection: "none" |
| 2932 |
})); |
| 2933 |
} |
| 2934 |
} |
| 2935 |
function onPointerDown(event) { |
| 2936 |
if (active || disabled2) { |
| 2937 |
return; |
| 2938 |
} |
| 2939 |
isPressingRef.current = true; |
| 2940 |
function handlePointerUp() { |
| 2941 |
isPressingRef.current = false; |
| 2942 |
isMainButtonRef.current = false; |
| 2943 |
} |
| 2944 |
if (!event.button || event.button === 0) { |
| 2945 |
isMainButtonRef.current = true; |
| 2946 |
const doc = ownerDocument(event.currentTarget); |
| 2947 |
doc.addEventListener("pointerup", handlePointerUp, { |
| 2948 |
once: true |
| 2949 |
}); |
| 2950 |
} |
| 2951 |
} |
| 2952 |
const state = { |
| 2953 |
disabled: disabled2, |
| 2954 |
active, |
| 2955 |
orientation, |
| 2956 |
tabActivationDirection |
| 2957 |
}; |
| 2958 |
const element = useRenderElement("button", componentProps, { |
| 2959 |
state, |
| 2960 |
ref: [forwardedRef, buttonRef, compositeRef, tabElementRef], |
| 2961 |
props: [compositeProps, { |
| 2962 |
role: "tab", |
| 2963 |
"aria-controls": tabPanelId, |
| 2964 |
"aria-selected": active, |
| 2965 |
id, |
| 2966 |
onClick, |
| 2967 |
onFocus, |
| 2968 |
onPointerDown, |
| 2969 |
[ACTIVE_COMPOSITE_ITEM]: active ? "" : void 0, |
| 2970 |
onKeyDownCapture() { |
| 2971 |
isNavigatingRef.current = true; |
| 2972 |
} |
| 2973 |
}, elementProps, getButtonProps], |
| 2974 |
stateAttributesMapping: tabsStateAttributesMapping |
| 2975 |
}); |
| 2976 |
return element; |
| 2977 |
}); |
| 2978 |
if (true) TabsTab.displayName = "TabsTab"; |
| 2979 |
|
| 2980 |
// node_modules/@base-ui/react/tabs/indicator/TabsIndicator.mjs |
| 2981 |
var React28 = __toESM(require_react(), 1); |
| 2982 |
|
| 2983 |
// node_modules/@base-ui/react/tabs/indicator/prehydrationScript.min.mjs |
| 2984 |
var script = '!function(){const t=document.currentScript.previousElementSibling;if(!t)return;const e=t.closest(\'[role="tablist"]\');if(!e)return;const i=e.querySelector("[data-active]");if(!i)return;if(0===i.offsetWidth||0===e.offsetWidth)return;let o=0,n=0,h=0,l=0,r=0,f=0;function s(t){const e=getComputedStyle(t);let i=parseFloat(e.width)||0,o=parseFloat(e.height)||0;return(Math.round(i)!==t.offsetWidth||Math.round(o)!==t.offsetHeight)&&(i=t.offsetWidth,o=t.offsetHeight),{width:i,height:o}}if(null!=i&&null!=e){const{width:t,height:c}=s(i),{width:u,height:d}=s(e),a=i.getBoundingClientRect(),g=e.getBoundingClientRect(),p=u>0?g.width/u:1,b=d>0?g.height/d:1;if(Math.abs(p)>Number.EPSILON&&Math.abs(b)>Number.EPSILON){const t=a.left-g.left,i=a.top-g.top;o=t/p+e.scrollLeft-e.clientLeft,h=i/b+e.scrollTop-e.clientTop}else o=i.offsetLeft,h=i.offsetTop;r=t,f=c,n=e.scrollWidth-o-r,l=e.scrollHeight-h-f}function c(e,i){t.style.setProperty(`--active-tab-${e}`,`${i}px`)}c("left",o),c("right",n),c("top",h),c("bottom",l),c("width",r),c("height",f),r>0&&f>0&&t.removeAttribute("hidden")}();'; |
| 2985 |
|
| 2986 |
// node_modules/@base-ui/react/tabs/indicator/TabsIndicatorCssVars.mjs |
| 2987 |
var TabsIndicatorCssVars = /* @__PURE__ */ (function(TabsIndicatorCssVars2) { |
| 2988 |
TabsIndicatorCssVars2["activeTabLeft"] = "--active-tab-left"; |
| 2989 |
TabsIndicatorCssVars2["activeTabRight"] = "--active-tab-right"; |
| 2990 |
TabsIndicatorCssVars2["activeTabTop"] = "--active-tab-top"; |
| 2991 |
TabsIndicatorCssVars2["activeTabBottom"] = "--active-tab-bottom"; |
| 2992 |
TabsIndicatorCssVars2["activeTabWidth"] = "--active-tab-width"; |
| 2993 |
TabsIndicatorCssVars2["activeTabHeight"] = "--active-tab-height"; |
| 2994 |
return TabsIndicatorCssVars2; |
| 2995 |
})({}); |
| 2996 |
|
| 2997 |
// node_modules/@base-ui/react/tabs/indicator/TabsIndicator.mjs |
| 2998 |
var import_jsx_runtime20 = __toESM(require_jsx_runtime(), 1); |
| 2999 |
var stateAttributesMapping = { |
| 3000 |
...tabsStateAttributesMapping, |
| 3001 |
activeTabPosition: () => null, |
| 3002 |
activeTabSize: () => null |
| 3003 |
}; |
| 3004 |
var TabsIndicator = /* @__PURE__ */ React28.forwardRef(function TabsIndicator2(componentProps, forwardedRef) { |
| 3005 |
const { |
| 3006 |
className, |
| 3007 |
render, |
| 3008 |
renderBeforeHydration = false, |
| 3009 |
style: styleProp, |
| 3010 |
...elementProps |
| 3011 |
} = componentProps; |
| 3012 |
const { |
| 3013 |
nonce |
| 3014 |
} = useCSPContext(); |
| 3015 |
const { |
| 3016 |
getTabElementBySelectedValue, |
| 3017 |
orientation, |
| 3018 |
tabActivationDirection, |
| 3019 |
value |
| 3020 |
} = useTabsRootContext(); |
| 3021 |
const { |
| 3022 |
tabsListElement, |
| 3023 |
registerIndicatorUpdateListener |
| 3024 |
} = useTabsListContext(); |
| 3025 |
const isHydrating = useIsHydrating(); |
| 3026 |
const rerender = useForcedRerendering(); |
| 3027 |
React28.useEffect(() => { |
| 3028 |
return registerIndicatorUpdateListener(rerender); |
| 3029 |
}, [registerIndicatorUpdateListener, rerender]); |
| 3030 |
let left = 0; |
| 3031 |
let right = 0; |
| 3032 |
let top = 0; |
| 3033 |
let bottom = 0; |
| 3034 |
let width = 0; |
| 3035 |
let height = 0; |
| 3036 |
let isTabSelected = false; |
| 3037 |
if (value != null && tabsListElement != null) { |
| 3038 |
const activeTab = getTabElementBySelectedValue(value); |
| 3039 |
if (activeTab != null) { |
| 3040 |
isTabSelected = true; |
| 3041 |
const { |
| 3042 |
width: computedWidth, |
| 3043 |
height: computedHeight |
| 3044 |
} = getCssDimensions(activeTab); |
| 3045 |
const { |
| 3046 |
width: tabListWidth, |
| 3047 |
height: tabListHeight |
| 3048 |
} = getCssDimensions(tabsListElement); |
| 3049 |
const tabRect = activeTab.getBoundingClientRect(); |
| 3050 |
const tabsListRect = tabsListElement.getBoundingClientRect(); |
| 3051 |
const scaleX = tabListWidth > 0 ? tabsListRect.width / tabListWidth : 1; |
| 3052 |
const scaleY = tabListHeight > 0 ? tabsListRect.height / tabListHeight : 1; |
| 3053 |
const hasNonZeroScale = Math.abs(scaleX) > Number.EPSILON && Math.abs(scaleY) > Number.EPSILON; |
| 3054 |
if (hasNonZeroScale) { |
| 3055 |
const tabLeftDelta = tabRect.left - tabsListRect.left; |
| 3056 |
const tabTopDelta = tabRect.top - tabsListRect.top; |
| 3057 |
left = tabLeftDelta / scaleX + tabsListElement.scrollLeft - tabsListElement.clientLeft; |
| 3058 |
top = tabTopDelta / scaleY + tabsListElement.scrollTop - tabsListElement.clientTop; |
| 3059 |
} else { |
| 3060 |
left = activeTab.offsetLeft; |
| 3061 |
top = activeTab.offsetTop; |
| 3062 |
} |
| 3063 |
width = computedWidth; |
| 3064 |
height = computedHeight; |
| 3065 |
right = tabsListElement.scrollWidth - left - width; |
| 3066 |
bottom = tabsListElement.scrollHeight - top - height; |
| 3067 |
} |
| 3068 |
} |
| 3069 |
const activeTabPosition = isTabSelected ? { |
| 3070 |
left, |
| 3071 |
right, |
| 3072 |
top, |
| 3073 |
bottom |
| 3074 |
} : null; |
| 3075 |
const activeTabSize = isTabSelected ? { |
| 3076 |
width, |
| 3077 |
height |
| 3078 |
} : null; |
| 3079 |
const style = isTabSelected ? { |
| 3080 |
[TabsIndicatorCssVars.activeTabLeft]: `${left}px`, |
| 3081 |
[TabsIndicatorCssVars.activeTabRight]: `${right}px`, |
| 3082 |
[TabsIndicatorCssVars.activeTabTop]: `${top}px`, |
| 3083 |
[TabsIndicatorCssVars.activeTabBottom]: `${bottom}px`, |
| 3084 |
[TabsIndicatorCssVars.activeTabWidth]: `${width}px`, |
| 3085 |
[TabsIndicatorCssVars.activeTabHeight]: `${height}px` |
| 3086 |
} : void 0; |
| 3087 |
const displayIndicator = isTabSelected && width > 0 && height > 0; |
| 3088 |
const state = { |
| 3089 |
orientation, |
| 3090 |
activeTabPosition, |
| 3091 |
activeTabSize, |
| 3092 |
tabActivationDirection |
| 3093 |
}; |
| 3094 |
const element = useRenderElement("span", componentProps, { |
| 3095 |
state, |
| 3096 |
ref: forwardedRef, |
| 3097 |
props: [{ |
| 3098 |
role: "presentation", |
| 3099 |
style, |
| 3100 |
hidden: !displayIndicator |
| 3101 |
// do not display the indicator before the layout is settled |
| 3102 |
}, elementProps, { |
| 3103 |
suppressHydrationWarning: true |
| 3104 |
}], |
| 3105 |
stateAttributesMapping |
| 3106 |
}); |
| 3107 |
if (value == null) { |
| 3108 |
return null; |
| 3109 |
} |
| 3110 |
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(React28.Fragment, { |
| 3111 |
children: [element, isHydrating && renderBeforeHydration && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("script", { |
| 3112 |
nonce, |
| 3113 |
dangerouslySetInnerHTML: { |
| 3114 |
__html: script |
| 3115 |
}, |
| 3116 |
suppressHydrationWarning: true |
| 3117 |
})] |
| 3118 |
}); |
| 3119 |
}); |
| 3120 |
if (true) TabsIndicator.displayName = "TabsIndicator"; |
| 3121 |
|
| 3122 |
// node_modules/@base-ui/react/tabs/panel/TabsPanel.mjs |
| 3123 |
var React29 = __toESM(require_react(), 1); |
| 3124 |
|
| 3125 |
// node_modules/@base-ui/react/tabs/panel/TabsPanelDataAttributes.mjs |
| 3126 |
var TabsPanelDataAttributes = (function(TabsPanelDataAttributes2) { |
| 3127 |
TabsPanelDataAttributes2["index"] = "data-index"; |
| 3128 |
TabsPanelDataAttributes2["activationDirection"] = "data-activation-direction"; |
| 3129 |
TabsPanelDataAttributes2["orientation"] = "data-orientation"; |
| 3130 |
TabsPanelDataAttributes2["hidden"] = "data-hidden"; |
| 3131 |
TabsPanelDataAttributes2[TabsPanelDataAttributes2["startingStyle"] = TransitionStatusDataAttributes.startingStyle] = "startingStyle"; |
| 3132 |
TabsPanelDataAttributes2[TabsPanelDataAttributes2["endingStyle"] = TransitionStatusDataAttributes.endingStyle] = "endingStyle"; |
| 3133 |
return TabsPanelDataAttributes2; |
| 3134 |
})({}); |
| 3135 |
|
| 3136 |
// node_modules/@base-ui/react/tabs/panel/TabsPanel.mjs |
| 3137 |
var stateAttributesMapping2 = { |
| 3138 |
...tabsStateAttributesMapping, |
| 3139 |
...transitionStatusMapping |
| 3140 |
}; |
| 3141 |
var TabsPanel = /* @__PURE__ */ React29.forwardRef(function TabsPanel2(componentProps, forwardedRef) { |
| 3142 |
const { |
| 3143 |
className, |
| 3144 |
value, |
| 3145 |
render, |
| 3146 |
keepMounted = false, |
| 3147 |
style, |
| 3148 |
...elementProps |
| 3149 |
} = componentProps; |
| 3150 |
const { |
| 3151 |
value: selectedValue, |
| 3152 |
getTabIdByPanelValue, |
| 3153 |
orientation, |
| 3154 |
tabActivationDirection, |
| 3155 |
registerMountedTabPanel, |
| 3156 |
unregisterMountedTabPanel |
| 3157 |
} = useTabsRootContext(); |
| 3158 |
const id = useBaseUiId(); |
| 3159 |
const metadata = React29.useMemo(() => ({ |
| 3160 |
id, |
| 3161 |
value |
| 3162 |
}), [id, value]); |
| 3163 |
const { |
| 3164 |
ref: listItemRef, |
| 3165 |
index |
| 3166 |
} = useCompositeListItem({ |
| 3167 |
metadata |
| 3168 |
}); |
| 3169 |
const open = value === selectedValue; |
| 3170 |
const { |
| 3171 |
mounted, |
| 3172 |
transitionStatus, |
| 3173 |
setMounted |
| 3174 |
} = useTransitionStatus(open); |
| 3175 |
const hidden = !mounted; |
| 3176 |
const correspondingTabId = getTabIdByPanelValue(value); |
| 3177 |
const state = { |
| 3178 |
hidden, |
| 3179 |
orientation, |
| 3180 |
tabActivationDirection, |
| 3181 |
transitionStatus |
| 3182 |
}; |
| 3183 |
const panelRef = React29.useRef(null); |
| 3184 |
const element = useRenderElement("div", componentProps, { |
| 3185 |
state, |
| 3186 |
ref: [forwardedRef, listItemRef, panelRef], |
| 3187 |
props: [{ |
| 3188 |
"aria-labelledby": correspondingTabId, |
| 3189 |
hidden, |
| 3190 |
id, |
| 3191 |
role: "tabpanel", |
| 3192 |
tabIndex: open ? 0 : -1, |
| 3193 |
inert: inertValue(!open), |
| 3194 |
[TabsPanelDataAttributes.index]: index |
| 3195 |
}, elementProps], |
| 3196 |
stateAttributesMapping: stateAttributesMapping2 |
| 3197 |
}); |
| 3198 |
useOpenChangeComplete({ |
| 3199 |
open, |
| 3200 |
ref: panelRef, |
| 3201 |
onComplete() { |
| 3202 |
if (!open) { |
| 3203 |
setMounted(false); |
| 3204 |
} |
| 3205 |
} |
| 3206 |
}); |
| 3207 |
useIsoLayoutEffect(() => { |
| 3208 |
if (hidden && !keepMounted) { |
| 3209 |
return void 0; |
| 3210 |
} |
| 3211 |
if (id == null) { |
| 3212 |
return void 0; |
| 3213 |
} |
| 3214 |
registerMountedTabPanel(value, id); |
| 3215 |
return () => { |
| 3216 |
unregisterMountedTabPanel(value, id); |
| 3217 |
}; |
| 3218 |
}, [hidden, keepMounted, value, id, registerMountedTabPanel, unregisterMountedTabPanel]); |
| 3219 |
const shouldRender = keepMounted || mounted; |
| 3220 |
if (!shouldRender) { |
| 3221 |
return null; |
| 3222 |
} |
| 3223 |
return element; |
| 3224 |
}); |
| 3225 |
if (true) TabsPanel.displayName = "TabsPanel"; |
| 3226 |
|
| 3227 |
// node_modules/@base-ui/react/tabs/list/TabsList.mjs |
| 3228 |
var React30 = __toESM(require_react(), 1); |
| 3229 |
var import_jsx_runtime21 = __toESM(require_jsx_runtime(), 1); |
| 3230 |
var TabsList = /* @__PURE__ */ React30.forwardRef(function TabsList2(componentProps, forwardedRef) { |
| 3231 |
const { |
| 3232 |
activateOnFocus = false, |
| 3233 |
className, |
| 3234 |
loopFocus = true, |
| 3235 |
render, |
| 3236 |
style, |
| 3237 |
...elementProps |
| 3238 |
} = componentProps; |
| 3239 |
const { |
| 3240 |
onValueChange, |
| 3241 |
orientation, |
| 3242 |
value, |
| 3243 |
setTabMap, |
| 3244 |
tabActivationDirection |
| 3245 |
} = useTabsRootContext(); |
| 3246 |
const [highlightedTabIndex, setHighlightedTabIndex] = React30.useState(0); |
| 3247 |
const [tabsListElement, setTabsListElement] = React30.useState(null); |
| 3248 |
const indicatorUpdateListenersRef = React30.useRef(/* @__PURE__ */ new Set()); |
| 3249 |
const tabResizeObserverElementsRef = React30.useRef(/* @__PURE__ */ new Set()); |
| 3250 |
const resizeObserverRef = React30.useRef(null); |
| 3251 |
useIsoLayoutEffect(() => { |
| 3252 |
if (typeof ResizeObserver === "undefined") { |
| 3253 |
return void 0; |
| 3254 |
} |
| 3255 |
const resizeObserver = new ResizeObserver(() => { |
| 3256 |
indicatorUpdateListenersRef.current.forEach((listener) => { |
| 3257 |
listener(); |
| 3258 |
}); |
| 3259 |
}); |
| 3260 |
resizeObserverRef.current = resizeObserver; |
| 3261 |
if (tabsListElement) { |
| 3262 |
resizeObserver.observe(tabsListElement); |
| 3263 |
} |
| 3264 |
tabResizeObserverElementsRef.current.forEach((element) => { |
| 3265 |
resizeObserver.observe(element); |
| 3266 |
}); |
| 3267 |
return () => { |
| 3268 |
resizeObserver.disconnect(); |
| 3269 |
resizeObserverRef.current = null; |
| 3270 |
}; |
| 3271 |
}, [tabsListElement]); |
| 3272 |
const registerIndicatorUpdateListener = useStableCallback((listener) => { |
| 3273 |
indicatorUpdateListenersRef.current.add(listener); |
| 3274 |
return () => { |
| 3275 |
indicatorUpdateListenersRef.current.delete(listener); |
| 3276 |
}; |
| 3277 |
}); |
| 3278 |
const registerTabResizeObserverElement = useStableCallback((element) => { |
| 3279 |
tabResizeObserverElementsRef.current.add(element); |
| 3280 |
resizeObserverRef.current?.observe(element); |
| 3281 |
return () => { |
| 3282 |
tabResizeObserverElementsRef.current.delete(element); |
| 3283 |
resizeObserverRef.current?.unobserve(element); |
| 3284 |
}; |
| 3285 |
}); |
| 3286 |
const onTabActivation = useStableCallback((newValue, eventDetails) => { |
| 3287 |
if (newValue !== value) { |
| 3288 |
onValueChange(newValue, eventDetails); |
| 3289 |
} |
| 3290 |
}); |
| 3291 |
const state = { |
| 3292 |
orientation, |
| 3293 |
tabActivationDirection |
| 3294 |
}; |
| 3295 |
const defaultProps = { |
| 3296 |
"aria-orientation": orientation === "vertical" ? "vertical" : void 0, |
| 3297 |
role: "tablist" |
| 3298 |
}; |
| 3299 |
const tabsListContextValue = React30.useMemo(() => ({ |
| 3300 |
activateOnFocus, |
| 3301 |
highlightedTabIndex, |
| 3302 |
registerIndicatorUpdateListener, |
| 3303 |
registerTabResizeObserverElement, |
| 3304 |
onTabActivation, |
| 3305 |
setHighlightedTabIndex, |
| 3306 |
tabsListElement |
| 3307 |
}), [activateOnFocus, highlightedTabIndex, registerIndicatorUpdateListener, registerTabResizeObserverElement, onTabActivation, setHighlightedTabIndex, tabsListElement]); |
| 3308 |
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TabsListContext.Provider, { |
| 3309 |
value: tabsListContextValue, |
| 3310 |
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CompositeRoot, { |
| 3311 |
render, |
| 3312 |
className, |
| 3313 |
style, |
| 3314 |
state, |
| 3315 |
refs: [forwardedRef, setTabsListElement], |
| 3316 |
props: [defaultProps, elementProps], |
| 3317 |
stateAttributesMapping: tabsStateAttributesMapping, |
| 3318 |
highlightedIndex: highlightedTabIndex, |
| 3319 |
enableHomeAndEndKeys: true, |
| 3320 |
loopFocus, |
| 3321 |
orientation, |
| 3322 |
onHighlightedIndexChange: setHighlightedTabIndex, |
| 3323 |
onMapChange: setTabMap, |
| 3324 |
disabledIndices: EMPTY_ARRAY |
| 3325 |
}) |
| 3326 |
}); |
| 3327 |
}); |
| 3328 |
if (true) TabsList.displayName = "TabsList"; |
| 3329 |
|
| 3330 |
// node_modules/@base-ui/react/use-render/useRender.mjs |
| 3331 |
function useRender(params) { |
| 3332 |
return useRenderElement(params.defaultTagName ?? "div", params, params); |
| 3333 |
} |
| 3334 |
|
| 3335 |
// packages/ui/build-module/icon/icon.mjs |
| 3336 |
var import_element2 = __toESM(require_element(), 1); |
| 3337 |
var import_primitives15 = __toESM(require_primitives(), 1); |
| 3338 |
var import_jsx_runtime22 = __toESM(require_jsx_runtime(), 1); |
| 3339 |
var Icon = (0, import_element2.forwardRef)(function Icon2({ icon, size = 24, ...restProps }, ref) { |
| 3340 |
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)( |
| 3341 |
import_primitives15.SVG, |
| 3342 |
{ |
| 3343 |
ref, |
| 3344 |
...icon.props, |
| 3345 |
...restProps, |
| 3346 |
width: size, |
| 3347 |
height: size |
| 3348 |
} |
| 3349 |
); |
| 3350 |
}); |
| 3351 |
|
| 3352 |
// packages/ui/build-module/stack/stack.mjs |
| 3353 |
var import_element3 = __toESM(require_element(), 1); |
| 3354 |
var STYLE_HASH_ATTRIBUTE = "data-wp-hash"; |
| 3355 |
function getRuntime() { |
| 3356 |
const globalScope = globalThis; |
| 3357 |
if (globalScope.__wpStyleRuntime) { |
| 3358 |
return globalScope.__wpStyleRuntime; |
| 3359 |
} |
| 3360 |
globalScope.__wpStyleRuntime = { |
| 3361 |
documents: /* @__PURE__ */ new Map(), |
| 3362 |
styles: /* @__PURE__ */ new Map(), |
| 3363 |
injectedStyles: /* @__PURE__ */ new WeakMap() |
| 3364 |
}; |
| 3365 |
if (typeof document !== "undefined") { |
| 3366 |
registerDocument(document); |
| 3367 |
} |
| 3368 |
return globalScope.__wpStyleRuntime; |
| 3369 |
} |
| 3370 |
function documentContainsStyleHash(targetDocument, hash) { |
| 3371 |
if (!targetDocument.head) { |
| 3372 |
return false; |
| 3373 |
} |
| 3374 |
for (const style of targetDocument.head.querySelectorAll( |
| 3375 |
`style[${STYLE_HASH_ATTRIBUTE}]` |
| 3376 |
)) { |
| 3377 |
if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) { |
| 3378 |
return true; |
| 3379 |
} |
| 3380 |
} |
| 3381 |
return false; |
| 3382 |
} |
| 3383 |
function injectStyle(targetDocument, hash, css) { |
| 3384 |
if (!targetDocument.head) { |
| 3385 |
return; |
| 3386 |
} |
| 3387 |
const runtime = getRuntime(); |
| 3388 |
let injectedStyles = runtime.injectedStyles.get(targetDocument); |
| 3389 |
if (!injectedStyles) { |
| 3390 |
injectedStyles = /* @__PURE__ */ new Set(); |
| 3391 |
runtime.injectedStyles.set(targetDocument, injectedStyles); |
| 3392 |
} |
| 3393 |
if (injectedStyles.has(hash)) { |
| 3394 |
return; |
| 3395 |
} |
| 3396 |
if (documentContainsStyleHash(targetDocument, hash)) { |
| 3397 |
injectedStyles.add(hash); |
| 3398 |
return; |
| 3399 |
} |
| 3400 |
const style = targetDocument.createElement("style"); |
| 3401 |
style.setAttribute(STYLE_HASH_ATTRIBUTE, hash); |
| 3402 |
style.appendChild(targetDocument.createTextNode(css)); |
| 3403 |
targetDocument.head.appendChild(style); |
| 3404 |
injectedStyles.add(hash); |
| 3405 |
} |
| 3406 |
function registerDocument(targetDocument) { |
| 3407 |
const runtime = getRuntime(); |
| 3408 |
runtime.documents.set( |
| 3409 |
targetDocument, |
| 3410 |
(runtime.documents.get(targetDocument) ?? 0) + 1 |
| 3411 |
); |
| 3412 |
for (const [hash, css] of runtime.styles) { |
| 3413 |
injectStyle(targetDocument, hash, css); |
| 3414 |
} |
| 3415 |
return () => { |
| 3416 |
const count = runtime.documents.get(targetDocument); |
| 3417 |
if (count === void 0) { |
| 3418 |
return; |
| 3419 |
} |
| 3420 |
if (count <= 1) { |
| 3421 |
runtime.documents.delete(targetDocument); |
| 3422 |
return; |
| 3423 |
} |
| 3424 |
runtime.documents.set(targetDocument, count - 1); |
| 3425 |
}; |
| 3426 |
} |
| 3427 |
function registerStyle(hash, css) { |
| 3428 |
const runtime = getRuntime(); |
| 3429 |
runtime.styles.set(hash, css); |
| 3430 |
for (const targetDocument of runtime.documents.keys()) { |
| 3431 |
injectStyle(targetDocument, hash, css); |
| 3432 |
} |
| 3433 |
} |
| 3434 |
if (typeof process === "undefined" || true) { |
| 3435 |
registerStyle("32aba35fe1", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._19ce0419607e1896__stack{display:flex}}}"); |
| 3436 |
} |
| 3437 |
var style_default = { "stack": "_19ce0419607e1896__stack" }; |
| 3438 |
var gapTokens = { |
| 3439 |
xs: "var(--wpds-dimension-gap-xs, 4px)", |
| 3440 |
sm: "var(--wpds-dimension-gap-sm, 8px)", |
| 3441 |
md: "var(--wpds-dimension-gap-md, 12px)", |
| 3442 |
lg: "var(--wpds-dimension-gap-lg, 16px)", |
| 3443 |
xl: "var(--wpds-dimension-gap-xl, 24px)", |
| 3444 |
"2xl": "var(--wpds-dimension-gap-2xl, 32px)", |
| 3445 |
"3xl": "var(--wpds-dimension-gap-3xl, 40px)" |
| 3446 |
}; |
| 3447 |
var Stack = (0, import_element3.forwardRef)(function Stack2({ direction, gap, align, justify, wrap, render, ...props }, ref) { |
| 3448 |
const style = { |
| 3449 |
gap: gap && gapTokens[gap], |
| 3450 |
alignItems: align, |
| 3451 |
justifyContent: justify, |
| 3452 |
flexDirection: direction, |
| 3453 |
flexWrap: wrap |
| 3454 |
}; |
| 3455 |
const element = useRender({ |
| 3456 |
render, |
| 3457 |
ref, |
| 3458 |
props: mergeProps(props, { style, className: style_default.stack }) |
| 3459 |
}); |
| 3460 |
return element; |
| 3461 |
}); |
| 3462 |
|
| 3463 |
// packages/ui/build-module/utils/use-schedule-validation.mjs |
| 3464 |
var import_element4 = __toESM(require_element(), 1); |
| 3465 |
function useScheduleValidation(validate) { |
| 3466 |
const validateRef = (0, import_element4.useRef)(validate); |
| 3467 |
validateRef.current = validate; |
| 3468 |
const timerRef = (0, import_element4.useRef)(null); |
| 3469 |
const unmountedRef = (0, import_element4.useRef)(false); |
| 3470 |
const scheduleValidation = (0, import_element4.useCallback)(() => { |
| 3471 |
if (unmountedRef.current) { |
| 3472 |
return; |
| 3473 |
} |
| 3474 |
if (timerRef.current) { |
| 3475 |
clearTimeout(timerRef.current); |
| 3476 |
} |
| 3477 |
timerRef.current = setTimeout(() => { |
| 3478 |
validateRef.current(); |
| 3479 |
timerRef.current = null; |
| 3480 |
}, 0); |
| 3481 |
}, []); |
| 3482 |
(0, import_element4.useEffect)(() => { |
| 3483 |
unmountedRef.current = false; |
| 3484 |
return () => { |
| 3485 |
unmountedRef.current = true; |
| 3486 |
if (timerRef.current) { |
| 3487 |
clearTimeout(timerRef.current); |
| 3488 |
} |
| 3489 |
}; |
| 3490 |
}, []); |
| 3491 |
return scheduleValidation; |
| 3492 |
} |
| 3493 |
|
| 3494 |
// packages/ui/build-module/visually-hidden/visually-hidden.mjs |
| 3495 |
var import_element5 = __toESM(require_element(), 1); |
| 3496 |
var STYLE_HASH_ATTRIBUTE2 = "data-wp-hash"; |
| 3497 |
function getRuntime2() { |
| 3498 |
const globalScope = globalThis; |
| 3499 |
if (globalScope.__wpStyleRuntime) { |
| 3500 |
return globalScope.__wpStyleRuntime; |
| 3501 |
} |
| 3502 |
globalScope.__wpStyleRuntime = { |
| 3503 |
documents: /* @__PURE__ */ new Map(), |
| 3504 |
styles: /* @__PURE__ */ new Map(), |
| 3505 |
injectedStyles: /* @__PURE__ */ new WeakMap() |
| 3506 |
}; |
| 3507 |
if (typeof document !== "undefined") { |
| 3508 |
registerDocument2(document); |
| 3509 |
} |
| 3510 |
return globalScope.__wpStyleRuntime; |
| 3511 |
} |
| 3512 |
function documentContainsStyleHash2(targetDocument, hash) { |
| 3513 |
if (!targetDocument.head) { |
| 3514 |
return false; |
| 3515 |
} |
| 3516 |
for (const style of targetDocument.head.querySelectorAll( |
| 3517 |
`style[${STYLE_HASH_ATTRIBUTE2}]` |
| 3518 |
)) { |
| 3519 |
if (style.getAttribute(STYLE_HASH_ATTRIBUTE2) === hash) { |
| 3520 |
return true; |
| 3521 |
} |
| 3522 |
} |
| 3523 |
return false; |
| 3524 |
} |
| 3525 |
function injectStyle2(targetDocument, hash, css) { |
| 3526 |
if (!targetDocument.head) { |
| 3527 |
return; |
| 3528 |
} |
| 3529 |
const runtime = getRuntime2(); |
| 3530 |
let injectedStyles = runtime.injectedStyles.get(targetDocument); |
| 3531 |
if (!injectedStyles) { |
| 3532 |
injectedStyles = /* @__PURE__ */ new Set(); |
| 3533 |
runtime.injectedStyles.set(targetDocument, injectedStyles); |
| 3534 |
} |
| 3535 |
if (injectedStyles.has(hash)) { |
| 3536 |
return; |
| 3537 |
} |
| 3538 |
if (documentContainsStyleHash2(targetDocument, hash)) { |
| 3539 |
injectedStyles.add(hash); |
| 3540 |
return; |
| 3541 |
} |
| 3542 |
const style = targetDocument.createElement("style"); |
| 3543 |
style.setAttribute(STYLE_HASH_ATTRIBUTE2, hash); |
| 3544 |
style.appendChild(targetDocument.createTextNode(css)); |
| 3545 |
targetDocument.head.appendChild(style); |
| 3546 |
injectedStyles.add(hash); |
| 3547 |
} |
| 3548 |
function registerDocument2(targetDocument) { |
| 3549 |
const runtime = getRuntime2(); |
| 3550 |
runtime.documents.set( |
| 3551 |
targetDocument, |
| 3552 |
(runtime.documents.get(targetDocument) ?? 0) + 1 |
| 3553 |
); |
| 3554 |
for (const [hash, css] of runtime.styles) { |
| 3555 |
injectStyle2(targetDocument, hash, css); |
| 3556 |
} |
| 3557 |
return () => { |
| 3558 |
const count = runtime.documents.get(targetDocument); |
| 3559 |
if (count === void 0) { |
| 3560 |
return; |
| 3561 |
} |
| 3562 |
if (count <= 1) { |
| 3563 |
runtime.documents.delete(targetDocument); |
| 3564 |
return; |
| 3565 |
} |
| 3566 |
runtime.documents.set(targetDocument, count - 1); |
| 3567 |
}; |
| 3568 |
} |
| 3569 |
function registerStyle2(hash, css) { |
| 3570 |
const runtime = getRuntime2(); |
| 3571 |
runtime.styles.set(hash, css); |
| 3572 |
for (const targetDocument of runtime.documents.keys()) { |
| 3573 |
injectStyle2(targetDocument, hash, css); |
| 3574 |
} |
| 3575 |
} |
| 3576 |
if (typeof process === "undefined" || true) { |
| 3577 |
registerStyle2("fa606a57ae", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{.f37b9e2e191ebd66__visually-hidden{word-wrap:normal;border:0;clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;word-break:normal}}}"); |
| 3578 |
} |
| 3579 |
var style_default2 = { "visually-hidden": "f37b9e2e191ebd66__visually-hidden" }; |
| 3580 |
var VisuallyHidden = (0, import_element5.forwardRef)( |
| 3581 |
function VisuallyHidden2({ render, ...restProps }, ref) { |
| 3582 |
const element = useRender({ |
| 3583 |
render, |
| 3584 |
ref, |
| 3585 |
props: mergeProps( |
| 3586 |
{ className: style_default2["visually-hidden"] }, |
| 3587 |
restProps, |
| 3588 |
{ |
| 3589 |
// @ts-expect-error Arbitrary data-* attributes aren't indexable on the typed div props. Kept hardcoded so consumers can't change or remove it. |
| 3590 |
"data-visually-hidden": "" |
| 3591 |
} |
| 3592 |
) |
| 3593 |
}); |
| 3594 |
return element; |
| 3595 |
} |
| 3596 |
); |
| 3597 |
|
| 3598 |
// packages/ui/build-module/link/link.mjs |
| 3599 |
var import_element6 = __toESM(require_element(), 1); |
| 3600 |
var import_i18n3 = __toESM(require_i18n(), 1); |
| 3601 |
var import_jsx_runtime23 = __toESM(require_jsx_runtime(), 1); |
| 3602 |
var STYLE_HASH_ATTRIBUTE3 = "data-wp-hash"; |
| 3603 |
function getRuntime3() { |
| 3604 |
const globalScope = globalThis; |
| 3605 |
if (globalScope.__wpStyleRuntime) { |
| 3606 |
return globalScope.__wpStyleRuntime; |
| 3607 |
} |
| 3608 |
globalScope.__wpStyleRuntime = { |
| 3609 |
documents: /* @__PURE__ */ new Map(), |
| 3610 |
styles: /* @__PURE__ */ new Map(), |
| 3611 |
injectedStyles: /* @__PURE__ */ new WeakMap() |
| 3612 |
}; |
| 3613 |
if (typeof document !== "undefined") { |
| 3614 |
registerDocument3(document); |
| 3615 |
} |
| 3616 |
return globalScope.__wpStyleRuntime; |
| 3617 |
} |
| 3618 |
function documentContainsStyleHash3(targetDocument, hash) { |
| 3619 |
if (!targetDocument.head) { |
| 3620 |
return false; |
| 3621 |
} |
| 3622 |
for (const style of targetDocument.head.querySelectorAll( |
| 3623 |
`style[${STYLE_HASH_ATTRIBUTE3}]` |
| 3624 |
)) { |
| 3625 |
if (style.getAttribute(STYLE_HASH_ATTRIBUTE3) === hash) { |
| 3626 |
return true; |
| 3627 |
} |
| 3628 |
} |
| 3629 |
return false; |
| 3630 |
} |
| 3631 |
function injectStyle3(targetDocument, hash, css) { |
| 3632 |
if (!targetDocument.head) { |
| 3633 |
return; |
| 3634 |
} |
| 3635 |
const runtime = getRuntime3(); |
| 3636 |
let injectedStyles = runtime.injectedStyles.get(targetDocument); |
| 3637 |
if (!injectedStyles) { |
| 3638 |
injectedStyles = /* @__PURE__ */ new Set(); |
| 3639 |
runtime.injectedStyles.set(targetDocument, injectedStyles); |
| 3640 |
} |
| 3641 |
if (injectedStyles.has(hash)) { |
| 3642 |
return; |
| 3643 |
} |
| 3644 |
if (documentContainsStyleHash3(targetDocument, hash)) { |
| 3645 |
injectedStyles.add(hash); |
| 3646 |
return; |
| 3647 |
} |
| 3648 |
const style = targetDocument.createElement("style"); |
| 3649 |
style.setAttribute(STYLE_HASH_ATTRIBUTE3, hash); |
| 3650 |
style.appendChild(targetDocument.createTextNode(css)); |
| 3651 |
targetDocument.head.appendChild(style); |
| 3652 |
injectedStyles.add(hash); |
| 3653 |
} |
| 3654 |
function registerDocument3(targetDocument) { |
| 3655 |
const runtime = getRuntime3(); |
| 3656 |
runtime.documents.set( |
| 3657 |
targetDocument, |
| 3658 |
(runtime.documents.get(targetDocument) ?? 0) + 1 |
| 3659 |
); |
| 3660 |
for (const [hash, css] of runtime.styles) { |
| 3661 |
injectStyle3(targetDocument, hash, css); |
| 3662 |
} |
| 3663 |
return () => { |
| 3664 |
const count = runtime.documents.get(targetDocument); |
| 3665 |
if (count === void 0) { |
| 3666 |
return; |
| 3667 |
} |
| 3668 |
if (count <= 1) { |
| 3669 |
runtime.documents.delete(targetDocument); |
| 3670 |
return; |
| 3671 |
} |
| 3672 |
runtime.documents.set(targetDocument, count - 1); |
| 3673 |
}; |
| 3674 |
} |
| 3675 |
function registerStyle3(hash, css) { |
| 3676 |
const runtime = getRuntime3(); |
| 3677 |
runtime.styles.set(hash, css); |
| 3678 |
for (const targetDocument of runtime.documents.keys()) { |
| 3679 |
injectStyle3(targetDocument, hash, css); |
| 3680 |
} |
| 3681 |
} |
| 3682 |
if (typeof process === "undefined" || true) { |
| 3683 |
registerStyle3("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}"); |
| 3684 |
} |
| 3685 |
var resets_default = { "box-sizing": "_336cd3e4e743482f__box-sizing" }; |
| 3686 |
if (typeof process === "undefined" || true) { |
| 3687 |
registerStyle3("5f8e7aa0bc", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._08e8a2e44959f892__outset-ring--focus:focus,._970d04df7376df67__outset-ring--focus-within-except-active:focus-within:not(:has(:active)),.c5cb3ee4bddaa8e4__outset-ring--focus-within-visible:focus-within:has(:focus-visible),.cd83dfc2126a0846__outset-ring--focus-within:focus-within,.d0541bc9dd9dc7b6__outset-ring--focus-visible:focus-visible,.e25b2bdd7aa21721__outset-ring--focus-except-active:focus:not(:active),:focus-visible .ecadb9e080e2dfa5__outset-ring--focus-parent-visible{--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9));outline-offset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}}}"); |
| 3688 |
} |
| 3689 |
var focus_default = { "outset-ring--focus": "_08e8a2e44959f892__outset-ring--focus", "outset-ring--focus-except-active": "e25b2bdd7aa21721__outset-ring--focus-except-active", "outset-ring--focus-visible": "d0541bc9dd9dc7b6__outset-ring--focus-visible", "outset-ring--focus-within": "cd83dfc2126a0846__outset-ring--focus-within", "outset-ring--focus-within-except-active": "_970d04df7376df67__outset-ring--focus-within-except-active", "outset-ring--focus-within-visible": "c5cb3ee4bddaa8e4__outset-ring--focus-within-visible", "outset-ring--focus-parent-visible": "ecadb9e080e2dfa5__outset-ring--focus-parent-visible" }; |
| 3690 |
if (typeof process === "undefined" || true) { |
| 3691 |
registerStyle3("e8e6a9be37", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{.d4250949359b05ce__link{text-decoration-thickness:from-font;text-underline-offset:.2em}.c6055659b8e2cd2c__is-brand,.c6055659b8e2cd2c__is-brand:visited{--_gcd-a-color:var(--wpds-color-foreground-interactive-brand,var(--wp-admin-theme-color,#3858e9));color:var(--wpds-color-foreground-interactive-brand,var(--wp-admin-theme-color,#3858e9))}.c6055659b8e2cd2c__is-brand:active,.c6055659b8e2cd2c__is-brand:hover{--_gcd-a-color:var(--wpds-color-foreground-interactive-brand-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 52%,#000));color:var(--wpds-color-foreground-interactive-brand-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 52%,#000))}._92e0dfcaeee15b88__is-neutral,._92e0dfcaeee15b88__is-neutral:visited{--_gcd-a-color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);text-decoration-color:var(--wpds-color-stroke-interactive-neutral,#8d8d8d)}._92e0dfcaeee15b88__is-neutral:active,._92e0dfcaeee15b88__is-neutral:hover{--_gcd-a-color:var(--wpds-color-foreground-interactive-neutral-active,#1e1e1e);color:var(--wpds-color-foreground-interactive-neutral-active,#1e1e1e)}.cf122a9bf1035d42__is-unstyled{--_gcd-a-color:inherit;color:inherit;text-decoration:none}._0cb411afac4c86c7__link-icon{display:inline-block;font-weight:var(--wpds-typography-font-weight-default,400);line-height:1;margin-inline-start:var(--wpds-dimension-padding-xs,4px);text-decoration:none}._0cb411afac4c86c7__link-icon:after{content:"\\2197"}._0cb411afac4c86c7__link-icon:dir(rtl):after{content:"\\2196"}}}'); |
| 3692 |
} |
| 3693 |
var style_default3 = { "link": "d4250949359b05ce__link", "is-brand": "c6055659b8e2cd2c__is-brand", "is-neutral": "_92e0dfcaeee15b88__is-neutral", "is-unstyled": "cf122a9bf1035d42__is-unstyled", "link-icon": "_0cb411afac4c86c7__link-icon" }; |
| 3694 |
if (typeof process === "undefined" || true) { |
| 3695 |
registerStyle3("af6d9984a6", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-foreground-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid transparent)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-foreground-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-emphasis,600));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid transparent);transition:var(--_gcd-a-transition,none)}"); |
| 3696 |
} |
| 3697 |
var global_css_defense_default = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a" }; |
| 3698 |
var Link = (0, import_element6.forwardRef)(function Link2({ |
| 3699 |
children, |
| 3700 |
variant = "default", |
| 3701 |
tone = "brand", |
| 3702 |
openInNewTab = false, |
| 3703 |
render, |
| 3704 |
className, |
| 3705 |
...props |
| 3706 |
}, ref) { |
| 3707 |
const element = useRender({ |
| 3708 |
render, |
| 3709 |
defaultTagName: "a", |
| 3710 |
ref, |
| 3711 |
props: mergeProps(props, { |
| 3712 |
className: clsx_default( |
| 3713 |
global_css_defense_default.a, |
| 3714 |
resets_default["box-sizing"], |
| 3715 |
focus_default["outset-ring--focus-except-active"], |
| 3716 |
variant !== "unstyled" && style_default3.link, |
| 3717 |
variant !== "unstyled" && style_default3[`is-${tone}`], |
| 3718 |
variant === "unstyled" && style_default3["is-unstyled"], |
| 3719 |
className |
| 3720 |
), |
| 3721 |
target: openInNewTab ? "_blank" : void 0, |
| 3722 |
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [ |
| 3723 |
children, |
| 3724 |
openInNewTab && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)( |
| 3725 |
"span", |
| 3726 |
{ |
| 3727 |
className: style_default3["link-icon"], |
| 3728 |
role: "img", |
| 3729 |
"aria-label": ( |
| 3730 |
/* translators: accessibility text appended to link text */ |
| 3731 |
(0, import_i18n3.__)("(opens in a new tab)") |
| 3732 |
) |
| 3733 |
} |
| 3734 |
) |
| 3735 |
] }) |
| 3736 |
}) |
| 3737 |
}); |
| 3738 |
return element; |
| 3739 |
}); |
| 3740 |
|
| 3741 |
// packages/ui/build-module/tabs/index.mjs |
| 3742 |
var tabs_exports = {}; |
| 3743 |
__export(tabs_exports, { |
| 3744 |
List: () => List, |
| 3745 |
Panel: () => Panel, |
| 3746 |
Root: () => Root, |
| 3747 |
Tab: () => Tab |
| 3748 |
}); |
| 3749 |
|
| 3750 |
// packages/ui/build-module/tabs/list.mjs |
| 3751 |
var import_element7 = __toESM(require_element(), 1); |
| 3752 |
var import_compose = __toESM(require_compose(), 1); |
| 3753 |
var import_jsx_runtime24 = __toESM(require_jsx_runtime(), 1); |
| 3754 |
var STYLE_HASH_ATTRIBUTE4 = "data-wp-hash"; |
| 3755 |
function getRuntime4() { |
| 3756 |
const globalScope = globalThis; |
| 3757 |
if (globalScope.__wpStyleRuntime) { |
| 3758 |
return globalScope.__wpStyleRuntime; |
| 3759 |
} |
| 3760 |
globalScope.__wpStyleRuntime = { |
| 3761 |
documents: /* @__PURE__ */ new Map(), |
| 3762 |
styles: /* @__PURE__ */ new Map(), |
| 3763 |
injectedStyles: /* @__PURE__ */ new WeakMap() |
| 3764 |
}; |
| 3765 |
if (typeof document !== "undefined") { |
| 3766 |
registerDocument4(document); |
| 3767 |
} |
| 3768 |
return globalScope.__wpStyleRuntime; |
| 3769 |
} |
| 3770 |
function documentContainsStyleHash4(targetDocument, hash) { |
| 3771 |
if (!targetDocument.head) { |
| 3772 |
return false; |
| 3773 |
} |
| 3774 |
for (const style of targetDocument.head.querySelectorAll( |
| 3775 |
`style[${STYLE_HASH_ATTRIBUTE4}]` |
| 3776 |
)) { |
| 3777 |
if (style.getAttribute(STYLE_HASH_ATTRIBUTE4) === hash) { |
| 3778 |
return true; |
| 3779 |
} |
| 3780 |
} |
| 3781 |
return false; |
| 3782 |
} |
| 3783 |
function injectStyle4(targetDocument, hash, css) { |
| 3784 |
if (!targetDocument.head) { |
| 3785 |
return; |
| 3786 |
} |
| 3787 |
const runtime = getRuntime4(); |
| 3788 |
let injectedStyles = runtime.injectedStyles.get(targetDocument); |
| 3789 |
if (!injectedStyles) { |
| 3790 |
injectedStyles = /* @__PURE__ */ new Set(); |
| 3791 |
runtime.injectedStyles.set(targetDocument, injectedStyles); |
| 3792 |
} |
| 3793 |
if (injectedStyles.has(hash)) { |
| 3794 |
return; |
| 3795 |
} |
| 3796 |
if (documentContainsStyleHash4(targetDocument, hash)) { |
| 3797 |
injectedStyles.add(hash); |
| 3798 |
return; |
| 3799 |
} |
| 3800 |
const style = targetDocument.createElement("style"); |
| 3801 |
style.setAttribute(STYLE_HASH_ATTRIBUTE4, hash); |
| 3802 |
style.appendChild(targetDocument.createTextNode(css)); |
| 3803 |
targetDocument.head.appendChild(style); |
| 3804 |
injectedStyles.add(hash); |
| 3805 |
} |
| 3806 |
function registerDocument4(targetDocument) { |
| 3807 |
const runtime = getRuntime4(); |
| 3808 |
runtime.documents.set( |
| 3809 |
targetDocument, |
| 3810 |
(runtime.documents.get(targetDocument) ?? 0) + 1 |
| 3811 |
); |
| 3812 |
for (const [hash, css] of runtime.styles) { |
| 3813 |
injectStyle4(targetDocument, hash, css); |
| 3814 |
} |
| 3815 |
return () => { |
| 3816 |
const count = runtime.documents.get(targetDocument); |
| 3817 |
if (count === void 0) { |
| 3818 |
return; |
| 3819 |
} |
| 3820 |
if (count <= 1) { |
| 3821 |
runtime.documents.delete(targetDocument); |
| 3822 |
return; |
| 3823 |
} |
| 3824 |
runtime.documents.set(targetDocument, count - 1); |
| 3825 |
}; |
| 3826 |
} |
| 3827 |
function registerStyle4(hash, css) { |
| 3828 |
const runtime = getRuntime4(); |
| 3829 |
runtime.styles.set(hash, css); |
| 3830 |
for (const targetDocument of runtime.documents.keys()) { |
| 3831 |
injectStyle4(targetDocument, hash, css); |
| 3832 |
} |
| 3833 |
} |
| 3834 |
if (typeof process === "undefined" || true) { |
| 3835 |
registerStyle4("bb8cbb8f31", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._7313adbc8a112e90__tablist{--direction-factor:1;--direction-start:left;--direction-end:right;align-items:stretch;display:flex;overflow-inline:auto;overscroll-behavior-inline:none;position:relative;&:dir(rtl){--direction-factor:-1;--direction-start:right;--direction-end:left}&[data-orientation=horizontal]{--fade-width:4rem;--fade-gradient-base:transparent 0%,#000 var(--fade-width);--fade-gradient-composed:var(--fade-gradient-base),#000 60%,transparent 50%;width:fit-content;&._9f2ac729c68a735a__is-overflowing-first{mask-image:linear-gradient(to var(--direction-end),var(--fade-gradient-base))}&._81c799c1f3cdd261__is-overflowing-last{mask-image:linear-gradient(to var(--direction-start),var(--fade-gradient-base))}&._9f2ac729c68a735a__is-overflowing-first._81c799c1f3cdd261__is-overflowing-last{mask-image:linear-gradient(to right,var(--fade-gradient-composed)),linear-gradient(to left,var(--fade-gradient-composed))}&._59228b5227f38a99__is-minimal-variant{gap:1rem}}&[data-orientation=vertical]{flex-direction:column}}._1c37dcfaa1ad8cda__indicator{@media not (prefers-reduced-motion){transition-duration:.2s;transition-property:translate,width,height,border-radius,border-block;transition-timing-function:ease-out}outline:2px solid transparent;outline-offset:-1px;pointer-events:none;position:absolute;&[data-orientation=horizontal]{background-color:var(--wpds-color-stroke-interactive-neutral-strong,#6e6e6e);bottom:0;height:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px));left:0;translate:var(--active-tab-left) 0;width:var(--active-tab-width);z-index:1}&[data-orientation=vertical]{background-color:var(--wpds-color-background-interactive-neutral-weak-active,#ededed);border-radius:var(--wpds-border-radius-sm,2px);height:var(--active-tab-height);left:50%;top:0;translate:-50% var(--active-tab-top);width:100%;z-index:0}._7313adbc8a112e90__tablist[data-select-on-move=true]:has(:focus-visible)\n &[data-orientation=vertical]{border:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9));box-sizing:border-box}}.a5fd8814f195aa5e__tab{align-items:center;background:transparent;border:none;border-radius:0;box-shadow:none;color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);cursor:var(--wpds-cursor-control,pointer);display:flex;flex:1 0 auto;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);font-weight:400;line-height:1.2;outline:none;padding:0;position:relative;white-space:nowrap;z-index:1;&[data-disabled]{color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);cursor:default;@media (forced-colors:active){color:GrayText}}&:not([data-disabled]):is(:hover,:focus-visible){color:var(--wpds-color-foreground-interactive-neutral-active,#1e1e1e)}&:after{border-radius:var(--wpds-border-radius-sm,2px);opacity:0;outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9));pointer-events:none;position:absolute;z-index:-1;@media not (prefers-reduced-motion){transition:opacity .1s linear}}&:focus-visible:after{opacity:1}[data-orientation=horizontal] &{height:48px;padding-inline:var(--wpds-dimension-padding-lg,16px);scroll-margin:24px;&:after{content:"";inset:var(--wpds-dimension-padding-md,12px)}}._59228b5227f38a99__is-minimal-variant[data-orientation=horizontal] &{padding-inline:0;&:after{inset-inline:round(up,var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)),1px)}}[data-orientation=vertical] &{min-height:var(--wpds-dimension-size-lg,40px);padding:var(--wpds-dimension-padding-sm,8px) var(--wpds-dimension-padding-md,12px)}[data-orientation=vertical][data-select-on-move=false] &:after{content:"";inset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}}._5dfc77e6edd345d4__tab-children{align-items:center;display:flex;flex-grow:1;[data-orientation=horizontal] &{justify-content:center}[data-orientation=vertical] &{justify-content:start}}._4a20e969d15e5ac1__tab-chevron{flex-shrink:0;margin-inline-end:calc(var(--wpds-dimension-gap-xs, 4px)*-1);opacity:0;[data-orientation=horizontal] &{display:none}[role=tab]:is([aria-selected=true],:focus-visible,:hover) &{opacity:1}@media not (prefers-reduced-motion){[data-select-on-move=true]\n [role=tab]:is([aria-selected=true])\n &{transition:opacity .15s linear .15s}}&:dir(rtl){rotate:180deg}}}}'); |
| 3836 |
} |
| 3837 |
var style_default4 = { "tablist": "_7313adbc8a112e90__tablist", "is-overflowing-first": "_9f2ac729c68a735a__is-overflowing-first", "is-overflowing-last": "_81c799c1f3cdd261__is-overflowing-last", "is-minimal-variant": "_59228b5227f38a99__is-minimal-variant", "indicator": "_1c37dcfaa1ad8cda__indicator", "tab": "a5fd8814f195aa5e__tab", "tab-children": "_5dfc77e6edd345d4__tab-children", "tab-chevron": "_4a20e969d15e5ac1__tab-chevron" }; |
| 3838 |
var SCROLL_EPSILON = 1; |
| 3839 |
var List = (0, import_element7.forwardRef)( |
| 3840 |
function TabList({ |
| 3841 |
children, |
| 3842 |
variant = "default", |
| 3843 |
className, |
| 3844 |
activateOnFocus, |
| 3845 |
...otherProps |
| 3846 |
}, forwardedRef) { |
| 3847 |
const [listEl, setListEl] = (0, import_element7.useState)(null); |
| 3848 |
const [overflow, setOverflow] = (0, import_element7.useState)({ |
| 3849 |
first: false, |
| 3850 |
last: false, |
| 3851 |
isScrolling: false |
| 3852 |
}); |
| 3853 |
(0, import_element7.useEffect)(() => { |
| 3854 |
if (!listEl) { |
| 3855 |
return; |
| 3856 |
} |
| 3857 |
const measureOverflow = () => { |
| 3858 |
const { scrollWidth, clientWidth, scrollLeft } = listEl; |
| 3859 |
const maxScroll = Math.max(scrollWidth - clientWidth, 0); |
| 3860 |
const direction = listEl.dir || (typeof window !== "undefined" ? window.getComputedStyle(listEl).direction : "ltr"); |
| 3861 |
const scrollFromStart = direction === "rtl" && scrollLeft < 0 ? ( |
| 3862 |
// In RTL layouts, scrollLeft is typically 0 at the visual "start" |
| 3863 |
// (right edge) and becomes negative toward the "end" (left edge). |
| 3864 |
// Normalize value for correct first/last detection logic. |
| 3865 |
-scrollLeft |
| 3866 |
) : scrollLeft; |
| 3867 |
const next = { |
| 3868 |
first: scrollFromStart > SCROLL_EPSILON, |
| 3869 |
last: scrollFromStart < maxScroll - SCROLL_EPSILON, |
| 3870 |
isScrolling: scrollWidth > clientWidth |
| 3871 |
}; |
| 3872 |
setOverflow( |
| 3873 |
(prev) => prev.first === next.first && prev.last === next.last && prev.isScrolling === next.isScrolling ? prev : next |
| 3874 |
); |
| 3875 |
}; |
| 3876 |
const resizeObserver = new ResizeObserver(measureOverflow); |
| 3877 |
const observeTabs = () => { |
| 3878 |
resizeObserver.disconnect(); |
| 3879 |
resizeObserver.observe(listEl); |
| 3880 |
listEl.querySelectorAll('[role="tab"]').forEach((tab) => resizeObserver.observe(tab)); |
| 3881 |
}; |
| 3882 |
const mutationObserver = new MutationObserver(observeTabs); |
| 3883 |
mutationObserver.observe(listEl, { |
| 3884 |
childList: true, |
| 3885 |
subtree: true |
| 3886 |
}); |
| 3887 |
let scrollTick = false; |
| 3888 |
const throttleMeasureOverflowOnScroll = () => { |
| 3889 |
if (!scrollTick) { |
| 3890 |
requestAnimationFrame(() => { |
| 3891 |
measureOverflow(); |
| 3892 |
scrollTick = false; |
| 3893 |
}); |
| 3894 |
scrollTick = true; |
| 3895 |
} |
| 3896 |
}; |
| 3897 |
listEl.addEventListener( |
| 3898 |
"scroll", |
| 3899 |
throttleMeasureOverflowOnScroll, |
| 3900 |
{ passive: true } |
| 3901 |
); |
| 3902 |
observeTabs(); |
| 3903 |
measureOverflow(); |
| 3904 |
return () => { |
| 3905 |
listEl.removeEventListener( |
| 3906 |
"scroll", |
| 3907 |
throttleMeasureOverflowOnScroll |
| 3908 |
); |
| 3909 |
resizeObserver.disconnect(); |
| 3910 |
mutationObserver.disconnect(); |
| 3911 |
}; |
| 3912 |
}, [listEl]); |
| 3913 |
const mergedListRef = (0, import_compose.useMergeRefs)([ |
| 3914 |
forwardedRef, |
| 3915 |
(el) => setListEl(el) |
| 3916 |
]); |
| 3917 |
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)( |
| 3918 |
index_parts_exports.List, |
| 3919 |
{ |
| 3920 |
ref: mergedListRef, |
| 3921 |
activateOnFocus, |
| 3922 |
"data-select-on-move": activateOnFocus ? "true" : "false", |
| 3923 |
className: clsx_default( |
| 3924 |
style_default4.tablist, |
| 3925 |
overflow.first && style_default4["is-overflowing-first"], |
| 3926 |
overflow.last && style_default4["is-overflowing-last"], |
| 3927 |
style_default4[`is-${variant}-variant`], |
| 3928 |
className |
| 3929 |
), |
| 3930 |
...otherProps, |
| 3931 |
tabIndex: otherProps.tabIndex ?? (overflow.isScrolling ? -1 : void 0), |
| 3932 |
children: [ |
| 3933 |
children, |
| 3934 |
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(index_parts_exports.Indicator, { className: style_default4.indicator }) |
| 3935 |
] |
| 3936 |
} |
| 3937 |
); |
| 3938 |
} |
| 3939 |
); |
| 3940 |
|
| 3941 |
// packages/ui/build-module/tabs/panel.mjs |
| 3942 |
var import_element9 = __toESM(require_element(), 1); |
| 3943 |
|
| 3944 |
// packages/ui/build-module/tabs/context.mjs |
| 3945 |
var import_element8 = __toESM(require_element(), 1); |
| 3946 |
var import_jsx_runtime25 = __toESM(require_jsx_runtime(), 1); |
| 3947 |
var VALIDATION_ENABLED = true; |
| 3948 |
var TabsValidationContext = VALIDATION_ENABLED ? (0, import_element8.createContext)(null) : null; |
| 3949 |
function useRegisterTabDev() { |
| 3950 |
const context = (0, import_element8.useContext)(TabsValidationContext); |
| 3951 |
(0, import_element8.useEffect)(() => { |
| 3952 |
if (context) { |
| 3953 |
return context.registerTab(); |
| 3954 |
} |
| 3955 |
return void 0; |
| 3956 |
}, [context]); |
| 3957 |
} |
| 3958 |
function useRegisterTabProd() { |
| 3959 |
} |
| 3960 |
var useRegisterTab = VALIDATION_ENABLED ? useRegisterTabDev : useRegisterTabProd; |
| 3961 |
function useRegisterPanelDev() { |
| 3962 |
const context = (0, import_element8.useContext)(TabsValidationContext); |
| 3963 |
(0, import_element8.useEffect)(() => { |
| 3964 |
if (context) { |
| 3965 |
return context.registerPanel(); |
| 3966 |
} |
| 3967 |
return void 0; |
| 3968 |
}, [context]); |
| 3969 |
} |
| 3970 |
function useRegisterPanelProd() { |
| 3971 |
} |
| 3972 |
var useRegisterPanel = VALIDATION_ENABLED ? useRegisterPanelDev : useRegisterPanelProd; |
| 3973 |
function TabsValidationProviderDev({ |
| 3974 |
children |
| 3975 |
}) { |
| 3976 |
const tabCountRef = (0, import_element8.useRef)(0); |
| 3977 |
const panelCountRef = (0, import_element8.useRef)(0); |
| 3978 |
const scheduleValidation = useScheduleValidation(() => { |
| 3979 |
const tabCount = tabCountRef.current; |
| 3980 |
const panelCount = panelCountRef.current; |
| 3981 |
if (tabCount !== panelCount) { |
| 3982 |
throw new Error( |
| 3983 |
`Tabs: Tab/Panel count mismatch (${tabCount} Tabs, ${panelCount} Panels). Each Tab must be associated with exactly one Panel. Mismatched or missing associations can break screen reader navigation and violate WAI-ARIA Tabs pattern requirements.` |
| 3984 |
); |
| 3985 |
} |
| 3986 |
}); |
| 3987 |
const registerTab = (0, import_element8.useCallback)(() => { |
| 3988 |
tabCountRef.current += 1; |
| 3989 |
scheduleValidation(); |
| 3990 |
return () => { |
| 3991 |
tabCountRef.current -= 1; |
| 3992 |
scheduleValidation(); |
| 3993 |
}; |
| 3994 |
}, [scheduleValidation]); |
| 3995 |
const registerPanel = (0, import_element8.useCallback)(() => { |
| 3996 |
panelCountRef.current += 1; |
| 3997 |
scheduleValidation(); |
| 3998 |
return () => { |
| 3999 |
panelCountRef.current -= 1; |
| 4000 |
scheduleValidation(); |
| 4001 |
}; |
| 4002 |
}, [scheduleValidation]); |
| 4003 |
const contextValue = (0, import_element8.useMemo)( |
| 4004 |
() => ({ |
| 4005 |
registerTab, |
| 4006 |
registerPanel |
| 4007 |
}), |
| 4008 |
[registerTab, registerPanel] |
| 4009 |
); |
| 4010 |
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TabsValidationContext.Provider, { value: contextValue, children }); |
| 4011 |
} |
| 4012 |
function TabsValidationProviderProd({ |
| 4013 |
children |
| 4014 |
}) { |
| 4015 |
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children }); |
| 4016 |
} |
| 4017 |
var TabsValidationProvider = VALIDATION_ENABLED ? TabsValidationProviderDev : TabsValidationProviderProd; |
| 4018 |
|
| 4019 |
// packages/ui/build-module/tabs/panel.mjs |
| 4020 |
var import_jsx_runtime26 = __toESM(require_jsx_runtime(), 1); |
| 4021 |
var STYLE_HASH_ATTRIBUTE5 = "data-wp-hash"; |
| 4022 |
function getRuntime5() { |
| 4023 |
const globalScope = globalThis; |
| 4024 |
if (globalScope.__wpStyleRuntime) { |
| 4025 |
return globalScope.__wpStyleRuntime; |
| 4026 |
} |
| 4027 |
globalScope.__wpStyleRuntime = { |
| 4028 |
documents: /* @__PURE__ */ new Map(), |
| 4029 |
styles: /* @__PURE__ */ new Map(), |
| 4030 |
injectedStyles: /* @__PURE__ */ new WeakMap() |
| 4031 |
}; |
| 4032 |
if (typeof document !== "undefined") { |
| 4033 |
registerDocument5(document); |
| 4034 |
} |
| 4035 |
return globalScope.__wpStyleRuntime; |
| 4036 |
} |
| 4037 |
function documentContainsStyleHash5(targetDocument, hash) { |
| 4038 |
if (!targetDocument.head) { |
| 4039 |
return false; |
| 4040 |
} |
| 4041 |
for (const style of targetDocument.head.querySelectorAll( |
| 4042 |
`style[${STYLE_HASH_ATTRIBUTE5}]` |
| 4043 |
)) { |
| 4044 |
if (style.getAttribute(STYLE_HASH_ATTRIBUTE5) === hash) { |
| 4045 |
return true; |
| 4046 |
} |
| 4047 |
} |
| 4048 |
return false; |
| 4049 |
} |
| 4050 |
function injectStyle5(targetDocument, hash, css) { |
| 4051 |
if (!targetDocument.head) { |
| 4052 |
return; |
| 4053 |
} |
| 4054 |
const runtime = getRuntime5(); |
| 4055 |
let injectedStyles = runtime.injectedStyles.get(targetDocument); |
| 4056 |
if (!injectedStyles) { |
| 4057 |
injectedStyles = /* @__PURE__ */ new Set(); |
| 4058 |
runtime.injectedStyles.set(targetDocument, injectedStyles); |
| 4059 |
} |
| 4060 |
if (injectedStyles.has(hash)) { |
| 4061 |
return; |
| 4062 |
} |
| 4063 |
if (documentContainsStyleHash5(targetDocument, hash)) { |
| 4064 |
injectedStyles.add(hash); |
| 4065 |
return; |
| 4066 |
} |
| 4067 |
const style = targetDocument.createElement("style"); |
| 4068 |
style.setAttribute(STYLE_HASH_ATTRIBUTE5, hash); |
| 4069 |
style.appendChild(targetDocument.createTextNode(css)); |
| 4070 |
targetDocument.head.appendChild(style); |
| 4071 |
injectedStyles.add(hash); |
| 4072 |
} |
| 4073 |
function registerDocument5(targetDocument) { |
| 4074 |
const runtime = getRuntime5(); |
| 4075 |
runtime.documents.set( |
| 4076 |
targetDocument, |
| 4077 |
(runtime.documents.get(targetDocument) ?? 0) + 1 |
| 4078 |
); |
| 4079 |
for (const [hash, css] of runtime.styles) { |
| 4080 |
injectStyle5(targetDocument, hash, css); |
| 4081 |
} |
| 4082 |
return () => { |
| 4083 |
const count = runtime.documents.get(targetDocument); |
| 4084 |
if (count === void 0) { |
| 4085 |
return; |
| 4086 |
} |
| 4087 |
if (count <= 1) { |
| 4088 |
runtime.documents.delete(targetDocument); |
| 4089 |
return; |
| 4090 |
} |
| 4091 |
runtime.documents.set(targetDocument, count - 1); |
| 4092 |
}; |
| 4093 |
} |
| 4094 |
function registerStyle5(hash, css) { |
| 4095 |
const runtime = getRuntime5(); |
| 4096 |
runtime.styles.set(hash, css); |
| 4097 |
for (const targetDocument of runtime.documents.keys()) { |
| 4098 |
injectStyle5(targetDocument, hash, css); |
| 4099 |
} |
| 4100 |
} |
| 4101 |
if (typeof process === "undefined" || true) { |
| 4102 |
registerStyle5("af6d9984a6", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-foreground-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid transparent)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-foreground-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-emphasis,600));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid transparent);transition:var(--_gcd-a-transition,none)}"); |
| 4103 |
} |
| 4104 |
var global_css_defense_default2 = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a" }; |
| 4105 |
if (typeof process === "undefined" || true) { |
| 4106 |
registerStyle5("5f8e7aa0bc", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._08e8a2e44959f892__outset-ring--focus:focus,._970d04df7376df67__outset-ring--focus-within-except-active:focus-within:not(:has(:active)),.c5cb3ee4bddaa8e4__outset-ring--focus-within-visible:focus-within:has(:focus-visible),.cd83dfc2126a0846__outset-ring--focus-within:focus-within,.d0541bc9dd9dc7b6__outset-ring--focus-visible:focus-visible,.e25b2bdd7aa21721__outset-ring--focus-except-active:focus:not(:active),:focus-visible .ecadb9e080e2dfa5__outset-ring--focus-parent-visible{--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9));outline-offset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}}}"); |
| 4107 |
} |
| 4108 |
var focus_default2 = { "outset-ring--focus": "_08e8a2e44959f892__outset-ring--focus", "outset-ring--focus-except-active": "e25b2bdd7aa21721__outset-ring--focus-except-active", "outset-ring--focus-visible": "d0541bc9dd9dc7b6__outset-ring--focus-visible", "outset-ring--focus-within": "cd83dfc2126a0846__outset-ring--focus-within", "outset-ring--focus-within-except-active": "_970d04df7376df67__outset-ring--focus-within-except-active", "outset-ring--focus-within-visible": "c5cb3ee4bddaa8e4__outset-ring--focus-within-visible", "outset-ring--focus-parent-visible": "ecadb9e080e2dfa5__outset-ring--focus-parent-visible" }; |
| 4109 |
var Panel = (0, import_element9.forwardRef)( |
| 4110 |
function TabPanel({ className, ...otherProps }, forwardedRef) { |
| 4111 |
useRegisterPanel(); |
| 4112 |
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)( |
| 4113 |
index_parts_exports.Panel, |
| 4114 |
{ |
| 4115 |
ref: forwardedRef, |
| 4116 |
className: clsx_default( |
| 4117 |
global_css_defense_default2.div, |
| 4118 |
focus_default2["outset-ring--focus-visible"], |
| 4119 |
className |
| 4120 |
), |
| 4121 |
...otherProps |
| 4122 |
} |
| 4123 |
); |
| 4124 |
} |
| 4125 |
); |
| 4126 |
|
| 4127 |
// packages/ui/build-module/tabs/root.mjs |
| 4128 |
var import_element10 = __toESM(require_element(), 1); |
| 4129 |
var import_jsx_runtime27 = __toESM(require_jsx_runtime(), 1); |
| 4130 |
var Root = (0, import_element10.forwardRef)( |
| 4131 |
function TabsRoot3({ ...otherProps }, forwardedRef) { |
| 4132 |
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(TabsValidationProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(index_parts_exports.Root, { ref: forwardedRef, ...otherProps }) }); |
| 4133 |
} |
| 4134 |
); |
| 4135 |
|
| 4136 |
// packages/ui/build-module/tabs/tab.mjs |
| 4137 |
var import_element11 = __toESM(require_element(), 1); |
| 4138 |
var import_jsx_runtime28 = __toESM(require_jsx_runtime(), 1); |
| 4139 |
var STYLE_HASH_ATTRIBUTE6 = "data-wp-hash"; |
| 4140 |
function getRuntime6() { |
| 4141 |
const globalScope = globalThis; |
| 4142 |
if (globalScope.__wpStyleRuntime) { |
| 4143 |
return globalScope.__wpStyleRuntime; |
| 4144 |
} |
| 4145 |
globalScope.__wpStyleRuntime = { |
| 4146 |
documents: /* @__PURE__ */ new Map(), |
| 4147 |
styles: /* @__PURE__ */ new Map(), |
| 4148 |
injectedStyles: /* @__PURE__ */ new WeakMap() |
| 4149 |
}; |
| 4150 |
if (typeof document !== "undefined") { |
| 4151 |
registerDocument6(document); |
| 4152 |
} |
| 4153 |
return globalScope.__wpStyleRuntime; |
| 4154 |
} |
| 4155 |
function documentContainsStyleHash6(targetDocument, hash) { |
| 4156 |
if (!targetDocument.head) { |
| 4157 |
return false; |
| 4158 |
} |
| 4159 |
for (const style of targetDocument.head.querySelectorAll( |
| 4160 |
`style[${STYLE_HASH_ATTRIBUTE6}]` |
| 4161 |
)) { |
| 4162 |
if (style.getAttribute(STYLE_HASH_ATTRIBUTE6) === hash) { |
| 4163 |
return true; |
| 4164 |
} |
| 4165 |
} |
| 4166 |
return false; |
| 4167 |
} |
| 4168 |
function injectStyle6(targetDocument, hash, css) { |
| 4169 |
if (!targetDocument.head) { |
| 4170 |
return; |
| 4171 |
} |
| 4172 |
const runtime = getRuntime6(); |
| 4173 |
let injectedStyles = runtime.injectedStyles.get(targetDocument); |
| 4174 |
if (!injectedStyles) { |
| 4175 |
injectedStyles = /* @__PURE__ */ new Set(); |
| 4176 |
runtime.injectedStyles.set(targetDocument, injectedStyles); |
| 4177 |
} |
| 4178 |
if (injectedStyles.has(hash)) { |
| 4179 |
return; |
| 4180 |
} |
| 4181 |
if (documentContainsStyleHash6(targetDocument, hash)) { |
| 4182 |
injectedStyles.add(hash); |
| 4183 |
return; |
| 4184 |
} |
| 4185 |
const style = targetDocument.createElement("style"); |
| 4186 |
style.setAttribute(STYLE_HASH_ATTRIBUTE6, hash); |
| 4187 |
style.appendChild(targetDocument.createTextNode(css)); |
| 4188 |
targetDocument.head.appendChild(style); |
| 4189 |
injectedStyles.add(hash); |
| 4190 |
} |
| 4191 |
function registerDocument6(targetDocument) { |
| 4192 |
const runtime = getRuntime6(); |
| 4193 |
runtime.documents.set( |
| 4194 |
targetDocument, |
| 4195 |
(runtime.documents.get(targetDocument) ?? 0) + 1 |
| 4196 |
); |
| 4197 |
for (const [hash, css] of runtime.styles) { |
| 4198 |
injectStyle6(targetDocument, hash, css); |
| 4199 |
} |
| 4200 |
return () => { |
| 4201 |
const count = runtime.documents.get(targetDocument); |
| 4202 |
if (count === void 0) { |
| 4203 |
return; |
| 4204 |
} |
| 4205 |
if (count <= 1) { |
| 4206 |
runtime.documents.delete(targetDocument); |
| 4207 |
return; |
| 4208 |
} |
| 4209 |
runtime.documents.set(targetDocument, count - 1); |
| 4210 |
}; |
| 4211 |
} |
| 4212 |
function registerStyle6(hash, css) { |
| 4213 |
const runtime = getRuntime6(); |
| 4214 |
runtime.styles.set(hash, css); |
| 4215 |
for (const targetDocument of runtime.documents.keys()) { |
| 4216 |
injectStyle6(targetDocument, hash, css); |
| 4217 |
} |
| 4218 |
} |
| 4219 |
if (typeof process === "undefined" || true) { |
| 4220 |
registerStyle6("bb8cbb8f31", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._7313adbc8a112e90__tablist{--direction-factor:1;--direction-start:left;--direction-end:right;align-items:stretch;display:flex;overflow-inline:auto;overscroll-behavior-inline:none;position:relative;&:dir(rtl){--direction-factor:-1;--direction-start:right;--direction-end:left}&[data-orientation=horizontal]{--fade-width:4rem;--fade-gradient-base:transparent 0%,#000 var(--fade-width);--fade-gradient-composed:var(--fade-gradient-base),#000 60%,transparent 50%;width:fit-content;&._9f2ac729c68a735a__is-overflowing-first{mask-image:linear-gradient(to var(--direction-end),var(--fade-gradient-base))}&._81c799c1f3cdd261__is-overflowing-last{mask-image:linear-gradient(to var(--direction-start),var(--fade-gradient-base))}&._9f2ac729c68a735a__is-overflowing-first._81c799c1f3cdd261__is-overflowing-last{mask-image:linear-gradient(to right,var(--fade-gradient-composed)),linear-gradient(to left,var(--fade-gradient-composed))}&._59228b5227f38a99__is-minimal-variant{gap:1rem}}&[data-orientation=vertical]{flex-direction:column}}._1c37dcfaa1ad8cda__indicator{@media not (prefers-reduced-motion){transition-duration:.2s;transition-property:translate,width,height,border-radius,border-block;transition-timing-function:ease-out}outline:2px solid transparent;outline-offset:-1px;pointer-events:none;position:absolute;&[data-orientation=horizontal]{background-color:var(--wpds-color-stroke-interactive-neutral-strong,#6e6e6e);bottom:0;height:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px));left:0;translate:var(--active-tab-left) 0;width:var(--active-tab-width);z-index:1}&[data-orientation=vertical]{background-color:var(--wpds-color-background-interactive-neutral-weak-active,#ededed);border-radius:var(--wpds-border-radius-sm,2px);height:var(--active-tab-height);left:50%;top:0;translate:-50% var(--active-tab-top);width:100%;z-index:0}._7313adbc8a112e90__tablist[data-select-on-move=true]:has(:focus-visible)\n &[data-orientation=vertical]{border:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9));box-sizing:border-box}}.a5fd8814f195aa5e__tab{align-items:center;background:transparent;border:none;border-radius:0;box-shadow:none;color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);cursor:var(--wpds-cursor-control,pointer);display:flex;flex:1 0 auto;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);font-weight:400;line-height:1.2;outline:none;padding:0;position:relative;white-space:nowrap;z-index:1;&[data-disabled]{color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);cursor:default;@media (forced-colors:active){color:GrayText}}&:not([data-disabled]):is(:hover,:focus-visible){color:var(--wpds-color-foreground-interactive-neutral-active,#1e1e1e)}&:after{border-radius:var(--wpds-border-radius-sm,2px);opacity:0;outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9));pointer-events:none;position:absolute;z-index:-1;@media not (prefers-reduced-motion){transition:opacity .1s linear}}&:focus-visible:after{opacity:1}[data-orientation=horizontal] &{height:48px;padding-inline:var(--wpds-dimension-padding-lg,16px);scroll-margin:24px;&:after{content:"";inset:var(--wpds-dimension-padding-md,12px)}}._59228b5227f38a99__is-minimal-variant[data-orientation=horizontal] &{padding-inline:0;&:after{inset-inline:round(up,var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)),1px)}}[data-orientation=vertical] &{min-height:var(--wpds-dimension-size-lg,40px);padding:var(--wpds-dimension-padding-sm,8px) var(--wpds-dimension-padding-md,12px)}[data-orientation=vertical][data-select-on-move=false] &:after{content:"";inset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}}._5dfc77e6edd345d4__tab-children{align-items:center;display:flex;flex-grow:1;[data-orientation=horizontal] &{justify-content:center}[data-orientation=vertical] &{justify-content:start}}._4a20e969d15e5ac1__tab-chevron{flex-shrink:0;margin-inline-end:calc(var(--wpds-dimension-gap-xs, 4px)*-1);opacity:0;[data-orientation=horizontal] &{display:none}[role=tab]:is([aria-selected=true],:focus-visible,:hover) &{opacity:1}@media not (prefers-reduced-motion){[data-select-on-move=true]\n [role=tab]:is([aria-selected=true])\n &{transition:opacity .15s linear .15s}}&:dir(rtl){rotate:180deg}}}}'); |
| 4221 |
} |
| 4222 |
var style_default5 = { "tablist": "_7313adbc8a112e90__tablist", "is-overflowing-first": "_9f2ac729c68a735a__is-overflowing-first", "is-overflowing-last": "_81c799c1f3cdd261__is-overflowing-last", "is-minimal-variant": "_59228b5227f38a99__is-minimal-variant", "indicator": "_1c37dcfaa1ad8cda__indicator", "tab": "a5fd8814f195aa5e__tab", "tab-children": "_5dfc77e6edd345d4__tab-children", "tab-chevron": "_4a20e969d15e5ac1__tab-chevron" }; |
| 4223 |
var Tab = (0, import_element11.forwardRef)(function Tab2({ className, children, ...otherProps }, forwardedRef) { |
| 4224 |
useRegisterTab(); |
| 4225 |
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)( |
| 4226 |
index_parts_exports.Tab, |
| 4227 |
{ |
| 4228 |
ref: forwardedRef, |
| 4229 |
className: clsx_default(style_default5.tab, className), |
| 4230 |
...otherProps, |
| 4231 |
children: [ |
| 4232 |
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: style_default5["tab-children"], children }), |
| 4233 |
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Icon, { icon: chevron_right_default, className: style_default5["tab-chevron"] }) |
| 4234 |
] |
| 4235 |
} |
| 4236 |
); |
| 4237 |
}); |
| 4238 |
|
| 4239 |
// packages/format-library/build-module/image/index.mjs |
| 4240 |
var import_i18n4 = __toESM(require_i18n(), 1); |
| 4241 |
var import_element12 = __toESM(require_element(), 1); |
| 4242 |
var import_rich_text3 = __toESM(require_rich_text(), 1); |
| 4243 |
var import_block_editor3 = __toESM(require_block_editor(), 1); |
| 4244 |
var import_jsx_runtime29 = __toESM(require_jsx_runtime(), 1); |
| 4245 |
var ALLOWED_MEDIA_TYPES = ["image"]; |
| 4246 |
var name3 = "core/image"; |
| 4247 |
var title3 = (0, import_i18n4.__)("Inline image"); |
| 4248 |
function getCurrentImageId(activeObjectAttributes) { |
| 4249 |
if (!activeObjectAttributes?.className) { |
| 4250 |
return void 0; |
| 4251 |
} |
| 4252 |
const [, id] = activeObjectAttributes.className.match(/wp-image-(\d+)/) ?? []; |
| 4253 |
return id ? parseInt(id, 10) : void 0; |
| 4254 |
} |
| 4255 |
var image = { |
| 4256 |
name: name3, |
| 4257 |
title: title3, |
| 4258 |
keywords: [(0, import_i18n4.__)("photo"), (0, import_i18n4.__)("media")], |
| 4259 |
object: true, |
| 4260 |
tagName: "img", |
| 4261 |
className: null, |
| 4262 |
attributes: { |
| 4263 |
className: "class", |
| 4264 |
style: "style", |
| 4265 |
url: "src", |
| 4266 |
alt: "alt" |
| 4267 |
}, |
| 4268 |
edit: Edit |
| 4269 |
}; |
| 4270 |
function InlineUI({ value, onChange, activeObjectAttributes, contentRef }) { |
| 4271 |
const { style, alt } = activeObjectAttributes; |
| 4272 |
const width = style?.replace(/\D/g, ""); |
| 4273 |
const [editedWidth, setEditedWidth] = (0, import_element12.useState)(width); |
| 4274 |
const [editedAlt, setEditedAlt] = (0, import_element12.useState)(alt); |
| 4275 |
const hasChanged = editedWidth !== width || editedAlt !== alt; |
| 4276 |
const popoverAnchor = (0, import_rich_text3.useAnchor)({ |
| 4277 |
editableContentElement: contentRef.current, |
| 4278 |
settings: image |
| 4279 |
}); |
| 4280 |
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)( |
| 4281 |
import_components.Popover, |
| 4282 |
{ |
| 4283 |
focusOnMount: false, |
| 4284 |
anchor: popoverAnchor, |
| 4285 |
className: "block-editor-format-toolbar__image-popover", |
| 4286 |
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)( |
| 4287 |
"form", |
| 4288 |
{ |
| 4289 |
className: "block-editor-format-toolbar__image-container-content", |
| 4290 |
onSubmit: (event) => { |
| 4291 |
const newReplacements = value.replacements.slice(); |
| 4292 |
newReplacements[value.start] = { |
| 4293 |
type: name3, |
| 4294 |
attributes: { |
| 4295 |
...activeObjectAttributes, |
| 4296 |
style: editedWidth ? `width: ${editedWidth}px;` : "", |
| 4297 |
alt: editedAlt |
| 4298 |
} |
| 4299 |
}; |
| 4300 |
onChange({ |
| 4301 |
...value, |
| 4302 |
replacements: newReplacements |
| 4303 |
}); |
| 4304 |
event.preventDefault(); |
| 4305 |
}, |
| 4306 |
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(Stack, { direction: "column", gap: "lg", children: [ |
| 4307 |
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)( |
| 4308 |
import_components.__experimentalNumberControl, |
| 4309 |
{ |
| 4310 |
label: (0, import_i18n4.__)("Width"), |
| 4311 |
value: editedWidth, |
| 4312 |
min: 1, |
| 4313 |
onChange: (newWidth) => { |
| 4314 |
setEditedWidth(newWidth); |
| 4315 |
} |
| 4316 |
} |
| 4317 |
), |
| 4318 |
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)( |
| 4319 |
import_components.TextareaControl, |
| 4320 |
{ |
| 4321 |
label: (0, import_i18n4.__)("Alternative text"), |
| 4322 |
value: editedAlt, |
| 4323 |
onChange: (newAlt) => { |
| 4324 |
setEditedAlt(newAlt); |
| 4325 |
}, |
| 4326 |
help: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [ |
| 4327 |
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)( |
| 4328 |
Link, |
| 4329 |
{ |
| 4330 |
openInNewTab: true, |
| 4331 |
href: ( |
| 4332 |
// translators: Localized tutorial, if one exists. W3C Web Accessibility Initiative link has list of existing translations. |
| 4333 |
(0, import_i18n4.__)( |
| 4334 |
"https://www.w3.org/WAI/tutorials/images/decision-tree/" |
| 4335 |
) |
| 4336 |
), |
| 4337 |
children: (0, import_i18n4.__)( |
| 4338 |
"Describe the purpose of the image." |
| 4339 |
) |
| 4340 |
} |
| 4341 |
), |
| 4342 |
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("br", {}), |
| 4343 |
(0, import_i18n4.__)("Leave empty if decorative.") |
| 4344 |
] }) |
| 4345 |
} |
| 4346 |
), |
| 4347 |
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Stack, { justify: "right", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)( |
| 4348 |
import_components.Button, |
| 4349 |
{ |
| 4350 |
disabled: !hasChanged, |
| 4351 |
accessibleWhenDisabled: true, |
| 4352 |
variant: "primary", |
| 4353 |
type: "submit", |
| 4354 |
size: "compact", |
| 4355 |
children: (0, import_i18n4.__)("Apply") |
| 4356 |
} |
| 4357 |
) }) |
| 4358 |
] }) |
| 4359 |
} |
| 4360 |
) |
| 4361 |
} |
| 4362 |
); |
| 4363 |
} |
| 4364 |
function Edit({ |
| 4365 |
value, |
| 4366 |
onChange, |
| 4367 |
onFocus, |
| 4368 |
isObjectActive, |
| 4369 |
activeObjectAttributes, |
| 4370 |
contentRef |
| 4371 |
}) { |
| 4372 |
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_block_editor3.MediaUploadCheck, { children: [ |
| 4373 |
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)( |
| 4374 |
import_block_editor3.MediaUpload, |
| 4375 |
{ |
| 4376 |
allowedTypes: ALLOWED_MEDIA_TYPES, |
| 4377 |
value: getCurrentImageId(activeObjectAttributes), |
| 4378 |
onSelect: ({ id, url, alt, width: imgWidth }) => { |
| 4379 |
onChange( |
| 4380 |
(0, import_rich_text3.insertObject)(value, { |
| 4381 |
type: name3, |
| 4382 |
attributes: { |
| 4383 |
className: `wp-image-${id}`, |
| 4384 |
style: `width: ${Math.min( |
| 4385 |
imgWidth, |
| 4386 |
150 |
| 4387 |
)}px;`, |
| 4388 |
url, |
| 4389 |
alt |
| 4390 |
} |
| 4391 |
}) |
| 4392 |
); |
| 4393 |
onFocus(); |
| 4394 |
}, |
| 4395 |
render: ({ open }) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)( |
| 4396 |
import_block_editor3.RichTextToolbarButton, |
| 4397 |
{ |
| 4398 |
icon: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)( |
| 4399 |
import_components.SVG, |
| 4400 |
{ |
| 4401 |
xmlns: "http://www.w3.org/2000/svg", |
| 4402 |
viewBox: "0 0 24 24", |
| 4403 |
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_components.Path, { d: "M4 18.5h16V17H4v1.5zM16 13v1.5h4V13h-4zM5.1 15h7.8c.6 0 1.1-.5 1.1-1.1V6.1c0-.6-.5-1.1-1.1-1.1H5.1C4.5 5 4 5.5 4 6.1v7.8c0 .6.5 1.1 1.1 1.1zm.4-8.5h7V10l-1-1c-.3-.3-.8-.3-1 0l-1.6 1.5-1.2-.7c-.3-.2-.6-.2-.9 0l-1.3 1V6.5zm0 6.1l1.8-1.3 1.3.8c.3.2.7.2.9-.1l1.5-1.4 1.5 1.4v1.5h-7v-.9z" }) |
| 4404 |
} |
| 4405 |
), |
| 4406 |
title: isObjectActive ? (0, import_i18n4.__)("Replace image") : title3, |
| 4407 |
onClick: open, |
| 4408 |
isActive: isObjectActive |
| 4409 |
} |
| 4410 |
) |
| 4411 |
} |
| 4412 |
), |
| 4413 |
isObjectActive && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)( |
| 4414 |
InlineUI, |
| 4415 |
{ |
| 4416 |
value, |
| 4417 |
onChange, |
| 4418 |
activeObjectAttributes, |
| 4419 |
contentRef |
| 4420 |
} |
| 4421 |
) |
| 4422 |
] }); |
| 4423 |
} |
| 4424 |
|
| 4425 |
// packages/format-library/build-module/italic/index.mjs |
| 4426 |
var import_i18n5 = __toESM(require_i18n(), 1); |
| 4427 |
var import_rich_text4 = __toESM(require_rich_text(), 1); |
| 4428 |
var import_block_editor4 = __toESM(require_block_editor(), 1); |
| 4429 |
var import_jsx_runtime30 = __toESM(require_jsx_runtime(), 1); |
| 4430 |
var name4 = "core/italic"; |
| 4431 |
var title4 = (0, import_i18n5.__)("Italic"); |
| 4432 |
var italic = { |
| 4433 |
name: name4, |
| 4434 |
title: title4, |
| 4435 |
tagName: "em", |
| 4436 |
className: null, |
| 4437 |
edit({ isActive, value, onChange, onFocus, isVisible = true }) { |
| 4438 |
function onToggle() { |
| 4439 |
onChange((0, import_rich_text4.toggleFormat)(value, { type: name4, title: title4 })); |
| 4440 |
} |
| 4441 |
function onClick() { |
| 4442 |
onChange((0, import_rich_text4.toggleFormat)(value, { type: name4 })); |
| 4443 |
onFocus(); |
| 4444 |
} |
| 4445 |
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [ |
| 4446 |
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)( |
| 4447 |
import_block_editor4.RichTextShortcut, |
| 4448 |
{ |
| 4449 |
type: "primary", |
| 4450 |
character: "i", |
| 4451 |
onUse: onToggle |
| 4452 |
} |
| 4453 |
), |
| 4454 |
isVisible && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)( |
| 4455 |
import_block_editor4.RichTextToolbarButton, |
| 4456 |
{ |
| 4457 |
name: "italic", |
| 4458 |
icon: format_italic_default, |
| 4459 |
title: title4, |
| 4460 |
onClick, |
| 4461 |
isActive, |
| 4462 |
shortcutType: "primary", |
| 4463 |
shortcutCharacter: "i" |
| 4464 |
} |
| 4465 |
), |
| 4466 |
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)( |
| 4467 |
import_block_editor4.__unstableRichTextInputEvent, |
| 4468 |
{ |
| 4469 |
inputType: "formatItalic", |
| 4470 |
onInput: onToggle |
| 4471 |
} |
| 4472 |
) |
| 4473 |
] }); |
| 4474 |
} |
| 4475 |
}; |
| 4476 |
|
| 4477 |
// packages/format-library/build-module/link/index.mjs |
| 4478 |
var import_i18n8 = __toESM(require_i18n(), 1); |
| 4479 |
var import_element15 = __toESM(require_element(), 1); |
| 4480 |
var import_rich_text6 = __toESM(require_rich_text(), 1); |
| 4481 |
var import_url3 = __toESM(require_url(), 1); |
| 4482 |
var import_block_editor6 = __toESM(require_block_editor(), 1); |
| 4483 |
var import_html_entities = __toESM(require_html_entities(), 1); |
| 4484 |
var import_a11y2 = __toESM(require_a11y(), 1); |
| 4485 |
|
| 4486 |
// packages/format-library/build-module/link/inline.mjs |
| 4487 |
var import_element14 = __toESM(require_element(), 1); |
| 4488 |
var import_i18n7 = __toESM(require_i18n(), 1); |
| 4489 |
var import_a11y = __toESM(require_a11y(), 1); |
| 4490 |
var import_components3 = __toESM(require_components(), 1); |
| 4491 |
var import_url2 = __toESM(require_url(), 1); |
| 4492 |
var import_rich_text5 = __toESM(require_rich_text(), 1); |
| 4493 |
var import_block_editor5 = __toESM(require_block_editor(), 1); |
| 4494 |
var import_data = __toESM(require_data(), 1); |
| 4495 |
|
| 4496 |
// packages/format-library/build-module/link/utils.mjs |
| 4497 |
var import_url = __toESM(require_url(), 1); |
| 4498 |
function isValidHref(href) { |
| 4499 |
if (!href) { |
| 4500 |
return false; |
| 4501 |
} |
| 4502 |
const trimmedHref = href.trim(); |
| 4503 |
if (!trimmedHref) { |
| 4504 |
return false; |
| 4505 |
} |
| 4506 |
if (/^\S+:/.test(trimmedHref)) { |
| 4507 |
const protocol = (0, import_url.getProtocol)(trimmedHref); |
| 4508 |
if (!(0, import_url.isValidProtocol)(protocol)) { |
| 4509 |
return false; |
| 4510 |
} |
| 4511 |
if (protocol.startsWith("http") && !/^https?:\/\/[^\/\s]/i.test(trimmedHref)) { |
| 4512 |
return false; |
| 4513 |
} |
| 4514 |
const authority = (0, import_url.getAuthority)(trimmedHref); |
| 4515 |
if (!(0, import_url.isValidAuthority)(authority)) { |
| 4516 |
return false; |
| 4517 |
} |
| 4518 |
const path = (0, import_url.getPath)(trimmedHref); |
| 4519 |
if (path && !(0, import_url.isValidPath)(path)) { |
| 4520 |
return false; |
| 4521 |
} |
| 4522 |
const queryString = (0, import_url.getQueryString)(trimmedHref); |
| 4523 |
if (queryString && !(0, import_url.isValidQueryString)(queryString)) { |
| 4524 |
return false; |
| 4525 |
} |
| 4526 |
const fragment = (0, import_url.getFragment)(trimmedHref); |
| 4527 |
if (fragment && !(0, import_url.isValidFragment)(fragment)) { |
| 4528 |
return false; |
| 4529 |
} |
| 4530 |
} |
| 4531 |
if (trimmedHref.startsWith("#") && !(0, import_url.isValidFragment)(trimmedHref)) { |
| 4532 |
return false; |
| 4533 |
} |
| 4534 |
return true; |
| 4535 |
} |
| 4536 |
function createLinkFormat({ |
| 4537 |
url, |
| 4538 |
type, |
| 4539 |
id, |
| 4540 |
opensInNewWindow, |
| 4541 |
nofollow, |
| 4542 |
cssClasses |
| 4543 |
}) { |
| 4544 |
const format = { |
| 4545 |
type: "core/link", |
| 4546 |
attributes: { |
| 4547 |
url |
| 4548 |
} |
| 4549 |
}; |
| 4550 |
if (type) { |
| 4551 |
format.attributes.type = type; |
| 4552 |
} |
| 4553 |
if (id) { |
| 4554 |
format.attributes.id = id; |
| 4555 |
} |
| 4556 |
if (opensInNewWindow) { |
| 4557 |
format.attributes.target = "_blank"; |
| 4558 |
format.attributes.rel = format.attributes.rel ? format.attributes.rel + " noopener" : "noopener"; |
| 4559 |
} |
| 4560 |
if (nofollow) { |
| 4561 |
format.attributes.rel = format.attributes.rel ? format.attributes.rel + " nofollow" : "nofollow"; |
| 4562 |
} |
| 4563 |
const trimmedCssClasses = cssClasses?.trim(); |
| 4564 |
if (trimmedCssClasses?.length) { |
| 4565 |
format.attributes.class = trimmedCssClasses; |
| 4566 |
} |
| 4567 |
return format; |
| 4568 |
} |
| 4569 |
function getFormatBoundary(value, format, startIndex = value.start, endIndex = value.end) { |
| 4570 |
const EMPTY_BOUNDARIES = { |
| 4571 |
start: void 0, |
| 4572 |
end: void 0 |
| 4573 |
}; |
| 4574 |
const { formats } = value; |
| 4575 |
let targetFormat; |
| 4576 |
let initialIndex; |
| 4577 |
if (!formats?.length) { |
| 4578 |
return EMPTY_BOUNDARIES; |
| 4579 |
} |
| 4580 |
const newFormats = formats.slice(); |
| 4581 |
const formatAtStart = newFormats[startIndex]?.find( |
| 4582 |
({ type }) => type === format.type |
| 4583 |
); |
| 4584 |
const formatAtEnd = newFormats[endIndex]?.find( |
| 4585 |
({ type }) => type === format.type |
| 4586 |
); |
| 4587 |
const formatAtEndMinusOne = newFormats[endIndex - 1]?.find( |
| 4588 |
({ type }) => type === format.type |
| 4589 |
); |
| 4590 |
if (!!formatAtStart) { |
| 4591 |
targetFormat = formatAtStart; |
| 4592 |
initialIndex = startIndex; |
| 4593 |
} else if (!!formatAtEnd) { |
| 4594 |
targetFormat = formatAtEnd; |
| 4595 |
initialIndex = endIndex; |
| 4596 |
} else if (!!formatAtEndMinusOne) { |
| 4597 |
targetFormat = formatAtEndMinusOne; |
| 4598 |
initialIndex = endIndex - 1; |
| 4599 |
} else { |
| 4600 |
return EMPTY_BOUNDARIES; |
| 4601 |
} |
| 4602 |
const index = newFormats[initialIndex].indexOf(targetFormat); |
| 4603 |
const walkingArgs = [newFormats, initialIndex, targetFormat, index]; |
| 4604 |
startIndex = walkToStart(...walkingArgs); |
| 4605 |
endIndex = walkToEnd(...walkingArgs); |
| 4606 |
startIndex = startIndex < 0 ? 0 : startIndex; |
| 4607 |
return { |
| 4608 |
start: startIndex, |
| 4609 |
end: endIndex + 1 |
| 4610 |
}; |
| 4611 |
} |
| 4612 |
function walkToBoundary(formats, initialIndex, targetFormatRef, formatIndex, direction) { |
| 4613 |
let index = initialIndex; |
| 4614 |
const directions = { |
| 4615 |
forwards: 1, |
| 4616 |
backwards: -1 |
| 4617 |
}; |
| 4618 |
const directionIncrement = directions[direction] || 1; |
| 4619 |
const inverseDirectionIncrement = directionIncrement * -1; |
| 4620 |
while (formats[index] && formats[index][formatIndex] === targetFormatRef) { |
| 4621 |
index = index + directionIncrement; |
| 4622 |
} |
| 4623 |
index = index + inverseDirectionIncrement; |
| 4624 |
return index; |
| 4625 |
} |
| 4626 |
var partialRight = (fn, ...partialArgs) => (...args) => fn(...args, ...partialArgs); |
| 4627 |
var walkToStart = partialRight(walkToBoundary, "backwards"); |
| 4628 |
var walkToEnd = partialRight(walkToBoundary, "forwards"); |
| 4629 |
|
| 4630 |
// packages/format-library/build-module/link/css-classes-setting.mjs |
| 4631 |
var import_element13 = __toESM(require_element(), 1); |
| 4632 |
var import_compose2 = __toESM(require_compose(), 1); |
| 4633 |
var import_i18n6 = __toESM(require_i18n(), 1); |
| 4634 |
var import_components2 = __toESM(require_components(), 1); |
| 4635 |
var import_jsx_runtime31 = __toESM(require_jsx_runtime(), 1); |
| 4636 |
var CSSClassesSettingComponent = ({ setting, value, onChange }) => { |
| 4637 |
const hasValue = value ? value?.cssClasses?.length > 0 : false; |
| 4638 |
const [isSettingActive, setIsSettingActive] = (0, import_element13.useState)(hasValue); |
| 4639 |
const instanceId = (0, import_compose2.useInstanceId)(CSSClassesSettingComponent); |
| 4640 |
const controlledRegionId = `css-classes-setting-${instanceId}`; |
| 4641 |
const handleSettingChange = (newValue) => { |
| 4642 |
const sanitizedValue = typeof newValue === "string" ? newValue.replace(/,/g, " ").replace(/\s+/g, " ").trim() : newValue; |
| 4643 |
onChange({ |
| 4644 |
...value, |
| 4645 |
[setting.id]: sanitizedValue |
| 4646 |
}); |
| 4647 |
}; |
| 4648 |
const handleCheckboxChange = () => { |
| 4649 |
if (isSettingActive) { |
| 4650 |
if (hasValue) { |
| 4651 |
handleSettingChange(""); |
| 4652 |
} |
| 4653 |
setIsSettingActive(false); |
| 4654 |
} else { |
| 4655 |
setIsSettingActive(true); |
| 4656 |
} |
| 4657 |
}; |
| 4658 |
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("fieldset", { children: [ |
| 4659 |
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(VisuallyHidden, { render: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("legend", {}), children: setting.title }), |
| 4660 |
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(Stack, { direction: "column", gap: "md", children: [ |
| 4661 |
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)( |
| 4662 |
import_components2.CheckboxControl, |
| 4663 |
{ |
| 4664 |
label: setting.title, |
| 4665 |
onChange: handleCheckboxChange, |
| 4666 |
checked: isSettingActive || hasValue, |
| 4667 |
"aria-expanded": isSettingActive, |
| 4668 |
"aria-controls": isSettingActive ? controlledRegionId : void 0 |
| 4669 |
} |
| 4670 |
), |
| 4671 |
isSettingActive && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { id: controlledRegionId, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)( |
| 4672 |
import_components2.__experimentalInputControl, |
| 4673 |
{ |
| 4674 |
label: (0, import_i18n6.__)("CSS classes"), |
| 4675 |
value: value?.cssClasses, |
| 4676 |
onChange: handleSettingChange, |
| 4677 |
help: (0, import_i18n6.__)( |
| 4678 |
"Separate multiple classes with spaces." |
| 4679 |
), |
| 4680 |
__unstableInputWidth: "100%" |
| 4681 |
} |
| 4682 |
) }) |
| 4683 |
] }) |
| 4684 |
] }); |
| 4685 |
}; |
| 4686 |
var css_classes_setting_default = CSSClassesSettingComponent; |
| 4687 |
|
| 4688 |
// packages/format-library/build-module/link/inline.mjs |
| 4689 |
var import_jsx_runtime32 = __toESM(require_jsx_runtime(), 1); |
| 4690 |
var LINK_SETTINGS = [ |
| 4691 |
...import_block_editor5.LinkControl.DEFAULT_LINK_SETTINGS, |
| 4692 |
{ |
| 4693 |
id: "nofollow", |
| 4694 |
title: (0, import_i18n7.__)("Mark as nofollow") |
| 4695 |
}, |
| 4696 |
{ |
| 4697 |
id: "cssClasses", |
| 4698 |
title: (0, import_i18n7.__)("Additional CSS class(es)"), |
| 4699 |
render: (setting, value, onChange) => { |
| 4700 |
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)( |
| 4701 |
css_classes_setting_default, |
| 4702 |
{ |
| 4703 |
setting, |
| 4704 |
value, |
| 4705 |
onChange |
| 4706 |
} |
| 4707 |
); |
| 4708 |
} |
| 4709 |
} |
| 4710 |
]; |
| 4711 |
function InlineLinkUI({ |
| 4712 |
isActive, |
| 4713 |
activeAttributes, |
| 4714 |
value, |
| 4715 |
onChange, |
| 4716 |
onFocusOutside, |
| 4717 |
stopAddingLink, |
| 4718 |
contentRef, |
| 4719 |
focusOnMount |
| 4720 |
}) { |
| 4721 |
const richLinkTextValue = getRichTextValueFromSelection(value, isActive); |
| 4722 |
const richTextText = richLinkTextValue.text; |
| 4723 |
const { selectionChange } = (0, import_data.useDispatch)(import_block_editor5.store); |
| 4724 |
const { createPageEntity, userCanCreatePages, selectionStart } = (0, import_data.useSelect)( |
| 4725 |
(select) => { |
| 4726 |
const { getSettings, getSelectionStart } = select(import_block_editor5.store); |
| 4727 |
const _settings = getSettings(); |
| 4728 |
return { |
| 4729 |
createPageEntity: _settings.__experimentalCreatePageEntity, |
| 4730 |
userCanCreatePages: _settings.__experimentalUserCanCreatePages, |
| 4731 |
selectionStart: getSelectionStart() |
| 4732 |
}; |
| 4733 |
}, |
| 4734 |
[] |
| 4735 |
); |
| 4736 |
const linkValue = (0, import_element14.useMemo)( |
| 4737 |
() => ({ |
| 4738 |
url: activeAttributes.url, |
| 4739 |
type: activeAttributes.type, |
| 4740 |
id: activeAttributes.id, |
| 4741 |
opensInNewTab: activeAttributes.target === "_blank", |
| 4742 |
nofollow: activeAttributes.rel?.includes("nofollow"), |
| 4743 |
title: richTextText, |
| 4744 |
cssClasses: activeAttributes.class |
| 4745 |
}), |
| 4746 |
[ |
| 4747 |
activeAttributes.class, |
| 4748 |
activeAttributes.id, |
| 4749 |
activeAttributes.rel, |
| 4750 |
activeAttributes.target, |
| 4751 |
activeAttributes.type, |
| 4752 |
activeAttributes.url, |
| 4753 |
richTextText |
| 4754 |
] |
| 4755 |
); |
| 4756 |
function removeLink() { |
| 4757 |
const newValue = (0, import_rich_text5.removeFormat)(value, "core/link"); |
| 4758 |
onChange(newValue); |
| 4759 |
stopAddingLink(); |
| 4760 |
(0, import_a11y.speak)((0, import_i18n7.__)("Link removed."), "assertive"); |
| 4761 |
} |
| 4762 |
function onChangeLink(nextValue) { |
| 4763 |
const hasLink = linkValue?.url; |
| 4764 |
const isNewLink = !hasLink; |
| 4765 |
nextValue = { |
| 4766 |
...linkValue, |
| 4767 |
...nextValue |
| 4768 |
}; |
| 4769 |
const newUrl = (0, import_url2.prependHTTPS)(nextValue.url); |
| 4770 |
const linkFormat = createLinkFormat({ |
| 4771 |
url: newUrl, |
| 4772 |
type: nextValue.type, |
| 4773 |
id: nextValue.id !== void 0 && nextValue.id !== null ? String(nextValue.id) : void 0, |
| 4774 |
opensInNewWindow: nextValue.opensInNewTab, |
| 4775 |
nofollow: nextValue.nofollow, |
| 4776 |
cssClasses: nextValue.cssClasses |
| 4777 |
}); |
| 4778 |
const newText = nextValue.title || newUrl; |
| 4779 |
let newValue; |
| 4780 |
if ((0, import_rich_text5.isCollapsed)(value) && !isActive) { |
| 4781 |
const inserted = (0, import_rich_text5.insert)(value, newText); |
| 4782 |
newValue = (0, import_rich_text5.applyFormat)( |
| 4783 |
inserted, |
| 4784 |
linkFormat, |
| 4785 |
value.start, |
| 4786 |
value.start + newText.length |
| 4787 |
); |
| 4788 |
onChange(newValue); |
| 4789 |
stopAddingLink(); |
| 4790 |
selectionChange({ |
| 4791 |
clientId: selectionStart.clientId, |
| 4792 |
identifier: selectionStart.attributeKey, |
| 4793 |
start: value.start + newText.length + 1 |
| 4794 |
}); |
| 4795 |
return; |
| 4796 |
} else if (newText === richTextText) { |
| 4797 |
const boundary = getFormatBoundary(value, { |
| 4798 |
type: "core/link" |
| 4799 |
}); |
| 4800 |
newValue = (0, import_rich_text5.applyFormat)( |
| 4801 |
value, |
| 4802 |
linkFormat, |
| 4803 |
boundary.start, |
| 4804 |
boundary.end |
| 4805 |
); |
| 4806 |
} else { |
| 4807 |
newValue = (0, import_rich_text5.create)({ text: newText }); |
| 4808 |
newValue = (0, import_rich_text5.applyFormat)(newValue, linkFormat, 0, newText.length); |
| 4809 |
const boundary = getFormatBoundary(value, { |
| 4810 |
type: "core/link" |
| 4811 |
}); |
| 4812 |
const [valBefore, valAfter] = (0, import_rich_text5.split)( |
| 4813 |
value, |
| 4814 |
boundary.start, |
| 4815 |
boundary.start |
| 4816 |
); |
| 4817 |
const newValAfter = (0, import_rich_text5.replace)(valAfter, richTextText, newValue); |
| 4818 |
newValue = (0, import_rich_text5.concat)(valBefore, newValAfter); |
| 4819 |
} |
| 4820 |
onChange(newValue); |
| 4821 |
if (!isNewLink) { |
| 4822 |
stopAddingLink(); |
| 4823 |
} |
| 4824 |
if (!isValidHref(newUrl)) { |
| 4825 |
(0, import_a11y.speak)( |
| 4826 |
(0, import_i18n7.__)( |
| 4827 |
"Warning: the link has been inserted but may have errors. Please test it." |
| 4828 |
), |
| 4829 |
"assertive" |
| 4830 |
); |
| 4831 |
} else if (isActive) { |
| 4832 |
(0, import_a11y.speak)((0, import_i18n7.__)("Link edited."), "assertive"); |
| 4833 |
} else { |
| 4834 |
(0, import_a11y.speak)((0, import_i18n7.__)("Link inserted."), "assertive"); |
| 4835 |
} |
| 4836 |
} |
| 4837 |
const popoverAnchor = (0, import_rich_text5.useAnchor)({ |
| 4838 |
editableContentElement: contentRef.current, |
| 4839 |
settings: { |
| 4840 |
...link, |
| 4841 |
isActive |
| 4842 |
} |
| 4843 |
}); |
| 4844 |
async function handleCreate(pageTitle) { |
| 4845 |
const page = await createPageEntity({ |
| 4846 |
title: pageTitle, |
| 4847 |
status: "draft" |
| 4848 |
}); |
| 4849 |
return { |
| 4850 |
id: page.id, |
| 4851 |
type: page.type, |
| 4852 |
title: page.title.rendered, |
| 4853 |
url: page.link, |
| 4854 |
kind: "post-type" |
| 4855 |
}; |
| 4856 |
} |
| 4857 |
function createButtonText(searchTerm) { |
| 4858 |
return (0, import_element14.createInterpolateElement)( |
| 4859 |
(0, import_i18n7.sprintf)( |
| 4860 |
/* translators: %s: search term. */ |
| 4861 |
(0, import_i18n7.__)("Create page: <mark>%s</mark>"), |
| 4862 |
searchTerm |
| 4863 |
), |
| 4864 |
{ mark: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("mark", {}) } |
| 4865 |
); |
| 4866 |
} |
| 4867 |
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)( |
| 4868 |
import_components3.Popover, |
| 4869 |
{ |
| 4870 |
anchor: popoverAnchor, |
| 4871 |
animate: false, |
| 4872 |
onClose: stopAddingLink, |
| 4873 |
onFocusOutside, |
| 4874 |
placement: "bottom", |
| 4875 |
offset: 8, |
| 4876 |
shift: true, |
| 4877 |
focusOnMount, |
| 4878 |
constrainTabbing: true, |
| 4879 |
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)( |
| 4880 |
import_block_editor5.LinkControl, |
| 4881 |
{ |
| 4882 |
value: linkValue, |
| 4883 |
onChange: onChangeLink, |
| 4884 |
onRemove: removeLink, |
| 4885 |
hasRichPreviews: true, |
| 4886 |
createSuggestion: createPageEntity && handleCreate, |
| 4887 |
withCreateSuggestion: userCanCreatePages, |
| 4888 |
createSuggestionButtonText: createButtonText, |
| 4889 |
hasTextControl: true, |
| 4890 |
settings: LINK_SETTINGS, |
| 4891 |
showInitialSuggestions: true, |
| 4892 |
suggestionsQuery: { |
| 4893 |
// always show Pages as initial suggestions |
| 4894 |
initialSuggestionsSearchOptions: { |
| 4895 |
type: "post", |
| 4896 |
subtype: "page", |
| 4897 |
perPage: 20 |
| 4898 |
} |
| 4899 |
} |
| 4900 |
} |
| 4901 |
) |
| 4902 |
} |
| 4903 |
); |
| 4904 |
} |
| 4905 |
function getRichTextValueFromSelection(value, isActive) { |
| 4906 |
let textStart = value.start; |
| 4907 |
let textEnd = value.end; |
| 4908 |
if (isActive) { |
| 4909 |
const boundary = getFormatBoundary(value, { |
| 4910 |
type: "core/link" |
| 4911 |
}); |
| 4912 |
textStart = boundary.start; |
| 4913 |
textEnd = boundary.end; |
| 4914 |
} |
| 4915 |
return (0, import_rich_text5.slice)(value, textStart, textEnd); |
| 4916 |
} |
| 4917 |
var inline_default = InlineLinkUI; |
| 4918 |
|
| 4919 |
// packages/format-library/build-module/link/index.mjs |
| 4920 |
var import_jsx_runtime33 = __toESM(require_jsx_runtime(), 1); |
| 4921 |
var name5 = "core/link"; |
| 4922 |
var title5 = (0, import_i18n8.__)("Link"); |
| 4923 |
function Edit2({ |
| 4924 |
isActive, |
| 4925 |
activeAttributes, |
| 4926 |
value, |
| 4927 |
onChange, |
| 4928 |
onFocus, |
| 4929 |
contentRef, |
| 4930 |
isVisible = true |
| 4931 |
}) { |
| 4932 |
const [addingLink, setAddingLink] = (0, import_element15.useState)(false); |
| 4933 |
const [openedBy, setOpenedBy] = (0, import_element15.useState)(null); |
| 4934 |
(0, import_element15.useEffect)(() => { |
| 4935 |
if (!isActive) { |
| 4936 |
setAddingLink(false); |
| 4937 |
} |
| 4938 |
}, [isActive]); |
| 4939 |
(0, import_element15.useLayoutEffect)(() => { |
| 4940 |
const editableContentElement = contentRef.current; |
| 4941 |
if (!editableContentElement) { |
| 4942 |
return; |
| 4943 |
} |
| 4944 |
function handleClick(event) { |
| 4945 |
const link2 = event.target.closest("[contenteditable] a"); |
| 4946 |
if (!link2 || // other formats (e.g. bold) may be nested within the link. |
| 4947 |
!isActive) { |
| 4948 |
return; |
| 4949 |
} |
| 4950 |
setAddingLink(true); |
| 4951 |
setOpenedBy({ |
| 4952 |
el: link2, |
| 4953 |
action: "click" |
| 4954 |
}); |
| 4955 |
} |
| 4956 |
editableContentElement.addEventListener("click", handleClick); |
| 4957 |
return () => { |
| 4958 |
editableContentElement.removeEventListener("click", handleClick); |
| 4959 |
}; |
| 4960 |
}, [contentRef, isActive]); |
| 4961 |
function addLink(target) { |
| 4962 |
const text = (0, import_rich_text6.getTextContent)((0, import_rich_text6.slice)(value)); |
| 4963 |
if (!isActive && text && (0, import_url3.isURL)(text) && isValidHref(text)) { |
| 4964 |
onChange( |
| 4965 |
(0, import_rich_text6.applyFormat)(value, { |
| 4966 |
type: name5, |
| 4967 |
attributes: { url: text } |
| 4968 |
}) |
| 4969 |
); |
| 4970 |
} else if (!isActive && text && (0, import_url3.isEmail)(text)) { |
| 4971 |
onChange( |
| 4972 |
(0, import_rich_text6.applyFormat)(value, { |
| 4973 |
type: name5, |
| 4974 |
attributes: { url: `mailto:${text}` } |
| 4975 |
}) |
| 4976 |
); |
| 4977 |
} else if (!isActive && text && (0, import_url3.isPhoneNumber)(text)) { |
| 4978 |
onChange( |
| 4979 |
(0, import_rich_text6.applyFormat)(value, { |
| 4980 |
type: name5, |
| 4981 |
attributes: { url: `tel:${text.replace(/\D/g, "")}` } |
| 4982 |
}) |
| 4983 |
); |
| 4984 |
} else { |
| 4985 |
if (target) { |
| 4986 |
setOpenedBy({ |
| 4987 |
el: target, |
| 4988 |
action: null |
| 4989 |
// We don't need to distinguish between click or keyboard here |
| 4990 |
}); |
| 4991 |
} |
| 4992 |
setAddingLink(true); |
| 4993 |
} |
| 4994 |
} |
| 4995 |
function stopAddingLink() { |
| 4996 |
setAddingLink(false); |
| 4997 |
if (openedBy?.el?.tagName === "BUTTON") { |
| 4998 |
openedBy.el.focus(); |
| 4999 |
} else { |
| 5000 |
onFocus(); |
| 5001 |
} |
| 5002 |
setOpenedBy(null); |
| 5003 |
} |
| 5004 |
function onFocusOutside() { |
| 5005 |
setAddingLink(false); |
| 5006 |
setOpenedBy(null); |
| 5007 |
} |
| 5008 |
function onRemoveFormat() { |
| 5009 |
onChange((0, import_rich_text6.removeFormat)(value, name5)); |
| 5010 |
(0, import_a11y2.speak)((0, import_i18n8.__)("Link removed."), "assertive"); |
| 5011 |
} |
| 5012 |
const shouldAutoFocus = !(openedBy?.el?.tagName === "A" && openedBy?.action === "click"); |
| 5013 |
const hasSelection = !(0, import_rich_text6.isCollapsed)(value); |
| 5014 |
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [ |
| 5015 |
hasSelection && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)( |
| 5016 |
import_block_editor6.RichTextShortcut, |
| 5017 |
{ |
| 5018 |
type: "primary", |
| 5019 |
character: "k", |
| 5020 |
onUse: addLink |
| 5021 |
} |
| 5022 |
), |
| 5023 |
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)( |
| 5024 |
import_block_editor6.RichTextShortcut, |
| 5025 |
{ |
| 5026 |
type: "primaryShift", |
| 5027 |
character: "k", |
| 5028 |
onUse: onRemoveFormat |
| 5029 |
} |
| 5030 |
), |
| 5031 |
isVisible && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)( |
| 5032 |
import_block_editor6.RichTextToolbarButton, |
| 5033 |
{ |
| 5034 |
name: "link", |
| 5035 |
icon: link_default, |
| 5036 |
title: isActive ? (0, import_i18n8.__)("Link") : title5, |
| 5037 |
onClick: (event) => { |
| 5038 |
addLink(event.currentTarget); |
| 5039 |
}, |
| 5040 |
isActive: isActive || addingLink, |
| 5041 |
shortcutType: "primary", |
| 5042 |
shortcutCharacter: "k", |
| 5043 |
"aria-haspopup": "true", |
| 5044 |
"aria-expanded": addingLink |
| 5045 |
} |
| 5046 |
), |
| 5047 |
isVisible && addingLink && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)( |
| 5048 |
inline_default, |
| 5049 |
{ |
| 5050 |
stopAddingLink, |
| 5051 |
onFocusOutside, |
| 5052 |
isActive, |
| 5053 |
activeAttributes, |
| 5054 |
value, |
| 5055 |
onChange, |
| 5056 |
contentRef, |
| 5057 |
focusOnMount: shouldAutoFocus ? "firstElement" : false |
| 5058 |
} |
| 5059 |
) |
| 5060 |
] }); |
| 5061 |
} |
| 5062 |
var link = { |
| 5063 |
name: name5, |
| 5064 |
title: title5, |
| 5065 |
tagName: "a", |
| 5066 |
className: null, |
| 5067 |
attributes: { |
| 5068 |
url: "href", |
| 5069 |
type: "data-type", |
| 5070 |
id: "data-id", |
| 5071 |
_id: "id", |
| 5072 |
target: "target", |
| 5073 |
rel: "rel", |
| 5074 |
class: "class" |
| 5075 |
}, |
| 5076 |
__unstablePasteRule(value, { html, plainText }) { |
| 5077 |
const pastedText = (html || plainText).replace(/<[^>]+>/g, "").trim(); |
| 5078 |
if (!(0, import_url3.isURL)(pastedText) || !/^https?:/.test(pastedText)) { |
| 5079 |
return value; |
| 5080 |
} |
| 5081 |
window.console.log("Created link:\n\n", pastedText); |
| 5082 |
const format = { |
| 5083 |
type: name5, |
| 5084 |
attributes: { |
| 5085 |
url: (0, import_html_entities.decodeEntities)(pastedText) |
| 5086 |
} |
| 5087 |
}; |
| 5088 |
if ((0, import_rich_text6.isCollapsed)(value)) { |
| 5089 |
return (0, import_rich_text6.insert)( |
| 5090 |
value, |
| 5091 |
(0, import_rich_text6.applyFormat)( |
| 5092 |
(0, import_rich_text6.create)({ text: plainText }), |
| 5093 |
format, |
| 5094 |
0, |
| 5095 |
plainText.length |
| 5096 |
) |
| 5097 |
); |
| 5098 |
} |
| 5099 |
return (0, import_rich_text6.applyFormat)(value, format); |
| 5100 |
}, |
| 5101 |
edit: Edit2 |
| 5102 |
}; |
| 5103 |
|
| 5104 |
// packages/format-library/build-module/strikethrough/index.mjs |
| 5105 |
var import_i18n9 = __toESM(require_i18n(), 1); |
| 5106 |
var import_rich_text7 = __toESM(require_rich_text(), 1); |
| 5107 |
var import_block_editor7 = __toESM(require_block_editor(), 1); |
| 5108 |
var import_jsx_runtime34 = __toESM(require_jsx_runtime(), 1); |
| 5109 |
var name6 = "core/strikethrough"; |
| 5110 |
var title6 = (0, import_i18n9.__)("Strikethrough"); |
| 5111 |
var strikethrough = { |
| 5112 |
name: name6, |
| 5113 |
title: title6, |
| 5114 |
tagName: "s", |
| 5115 |
className: null, |
| 5116 |
edit({ isActive, value, onChange, onFocus }) { |
| 5117 |
function onClick() { |
| 5118 |
onChange((0, import_rich_text7.toggleFormat)(value, { type: name6, title: title6 })); |
| 5119 |
onFocus(); |
| 5120 |
} |
| 5121 |
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [ |
| 5122 |
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)( |
| 5123 |
import_block_editor7.RichTextShortcut, |
| 5124 |
{ |
| 5125 |
type: "access", |
| 5126 |
character: "d", |
| 5127 |
onUse: onClick |
| 5128 |
} |
| 5129 |
), |
| 5130 |
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)( |
| 5131 |
import_block_editor7.RichTextToolbarButton, |
| 5132 |
{ |
| 5133 |
icon: format_strikethrough_default, |
| 5134 |
title: title6, |
| 5135 |
onClick, |
| 5136 |
isActive, |
| 5137 |
role: "menuitemcheckbox" |
| 5138 |
} |
| 5139 |
) |
| 5140 |
] }); |
| 5141 |
} |
| 5142 |
}; |
| 5143 |
|
| 5144 |
// packages/format-library/build-module/underline/index.mjs |
| 5145 |
var import_i18n10 = __toESM(require_i18n(), 1); |
| 5146 |
var import_rich_text8 = __toESM(require_rich_text(), 1); |
| 5147 |
var import_block_editor8 = __toESM(require_block_editor(), 1); |
| 5148 |
var import_jsx_runtime35 = __toESM(require_jsx_runtime(), 1); |
| 5149 |
var name7 = "core/underline"; |
| 5150 |
var title7 = (0, import_i18n10.__)("Underline"); |
| 5151 |
var underline = { |
| 5152 |
name: name7, |
| 5153 |
title: title7, |
| 5154 |
tagName: "span", |
| 5155 |
className: null, |
| 5156 |
attributes: { |
| 5157 |
style: "style" |
| 5158 |
}, |
| 5159 |
edit({ value, onChange }) { |
| 5160 |
const onToggle = () => { |
| 5161 |
onChange( |
| 5162 |
(0, import_rich_text8.toggleFormat)(value, { |
| 5163 |
type: name7, |
| 5164 |
attributes: { |
| 5165 |
style: "text-decoration: underline;" |
| 5166 |
}, |
| 5167 |
title: title7 |
| 5168 |
}) |
| 5169 |
); |
| 5170 |
}; |
| 5171 |
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [ |
| 5172 |
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)( |
| 5173 |
import_block_editor8.RichTextShortcut, |
| 5174 |
{ |
| 5175 |
type: "primary", |
| 5176 |
character: "u", |
| 5177 |
onUse: onToggle |
| 5178 |
} |
| 5179 |
), |
| 5180 |
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)( |
| 5181 |
import_block_editor8.__unstableRichTextInputEvent, |
| 5182 |
{ |
| 5183 |
inputType: "formatUnderline", |
| 5184 |
onInput: onToggle |
| 5185 |
} |
| 5186 |
) |
| 5187 |
] }); |
| 5188 |
} |
| 5189 |
}; |
| 5190 |
|
| 5191 |
// packages/format-library/build-module/text-color/index.mjs |
| 5192 |
var import_i18n12 = __toESM(require_i18n(), 1); |
| 5193 |
var import_element17 = __toESM(require_element(), 1); |
| 5194 |
var import_block_editor10 = __toESM(require_block_editor(), 1); |
| 5195 |
var import_rich_text10 = __toESM(require_rich_text(), 1); |
| 5196 |
|
| 5197 |
// packages/format-library/build-module/text-color/inline.mjs |
| 5198 |
var import_element16 = __toESM(require_element(), 1); |
| 5199 |
var import_data2 = __toESM(require_data(), 1); |
| 5200 |
var import_rich_text9 = __toESM(require_rich_text(), 1); |
| 5201 |
var import_block_editor9 = __toESM(require_block_editor(), 1); |
| 5202 |
var import_components4 = __toESM(require_components(), 1); |
| 5203 |
var import_i18n11 = __toESM(require_i18n(), 1); |
| 5204 |
var import_jsx_runtime36 = __toESM(require_jsx_runtime(), 1); |
| 5205 |
var TABS = [ |
| 5206 |
{ name: "color", title: (0, import_i18n11.__)("Text") }, |
| 5207 |
{ name: "backgroundColor", title: (0, import_i18n11.__)("Background") } |
| 5208 |
]; |
| 5209 |
function parseCSS(css = "") { |
| 5210 |
return css.split(";").reduce((accumulator, rule) => { |
| 5211 |
if (rule) { |
| 5212 |
const [property, value] = rule.split(":"); |
| 5213 |
if (property === "color") { |
| 5214 |
accumulator.color = value; |
| 5215 |
} |
| 5216 |
if (property === "background-color" && value !== transparentValue) { |
| 5217 |
accumulator.backgroundColor = value; |
| 5218 |
} |
| 5219 |
} |
| 5220 |
return accumulator; |
| 5221 |
}, {}); |
| 5222 |
} |
| 5223 |
function parseClassName(className = "", colorSettings) { |
| 5224 |
return className.split(" ").reduce((accumulator, name16) => { |
| 5225 |
if (name16.startsWith("has-") && name16.endsWith("-color")) { |
| 5226 |
const colorSlug = name16.replace(/^has-/, "").replace(/-color$/, ""); |
| 5227 |
const colorObject = (0, import_block_editor9.getColorObjectByAttributeValues)( |
| 5228 |
colorSettings, |
| 5229 |
colorSlug |
| 5230 |
); |
| 5231 |
accumulator.color = colorObject.color; |
| 5232 |
} |
| 5233 |
return accumulator; |
| 5234 |
}, {}); |
| 5235 |
} |
| 5236 |
function getActiveColors(value, name16, colorSettings) { |
| 5237 |
const activeColorFormat = (0, import_rich_text9.getActiveFormat)(value, name16); |
| 5238 |
if (!activeColorFormat) { |
| 5239 |
return {}; |
| 5240 |
} |
| 5241 |
return { |
| 5242 |
...parseCSS(activeColorFormat.attributes.style), |
| 5243 |
...parseClassName(activeColorFormat.attributes.class, colorSettings) |
| 5244 |
}; |
| 5245 |
} |
| 5246 |
function setColors(value, name16, colorSettings, colors) { |
| 5247 |
const { color, backgroundColor } = { |
| 5248 |
...getActiveColors(value, name16, colorSettings), |
| 5249 |
...colors |
| 5250 |
}; |
| 5251 |
if (!color && !backgroundColor) { |
| 5252 |
return (0, import_rich_text9.removeFormat)(value, name16); |
| 5253 |
} |
| 5254 |
const styles = []; |
| 5255 |
const classNames = []; |
| 5256 |
const attributes = {}; |
| 5257 |
if (backgroundColor) { |
| 5258 |
styles.push(["background-color", backgroundColor].join(":")); |
| 5259 |
} else { |
| 5260 |
styles.push(["background-color", transparentValue].join(":")); |
| 5261 |
} |
| 5262 |
if (color) { |
| 5263 |
const colorObject = (0, import_block_editor9.getColorObjectByColorValue)(colorSettings, color); |
| 5264 |
if (colorObject) { |
| 5265 |
classNames.push((0, import_block_editor9.getColorClassName)("color", colorObject.slug)); |
| 5266 |
} else { |
| 5267 |
styles.push(["color", color].join(":")); |
| 5268 |
} |
| 5269 |
} |
| 5270 |
if (styles.length) { |
| 5271 |
attributes.style = styles.join(";"); |
| 5272 |
} |
| 5273 |
if (classNames.length) { |
| 5274 |
attributes.class = classNames.join(" "); |
| 5275 |
} |
| 5276 |
return (0, import_rich_text9.applyFormat)(value, { type: name16, attributes }); |
| 5277 |
} |
| 5278 |
function ColorPicker({ name: name16, property, value, onChange }) { |
| 5279 |
const colors = (0, import_data2.useSelect)((select) => { |
| 5280 |
const { getSettings } = select(import_block_editor9.store); |
| 5281 |
return getSettings().colors ?? []; |
| 5282 |
}, []); |
| 5283 |
const activeColors = (0, import_element16.useMemo)( |
| 5284 |
() => getActiveColors(value, name16, colors), |
| 5285 |
[name16, value, colors] |
| 5286 |
); |
| 5287 |
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)( |
| 5288 |
import_block_editor9.ColorPalette, |
| 5289 |
{ |
| 5290 |
value: activeColors[property], |
| 5291 |
onChange: (color) => { |
| 5292 |
onChange( |
| 5293 |
setColors(value, name16, colors, { [property]: color }) |
| 5294 |
); |
| 5295 |
}, |
| 5296 |
enableAlpha: true, |
| 5297 |
__experimentalIsRenderedInSidebar: true |
| 5298 |
} |
| 5299 |
); |
| 5300 |
} |
| 5301 |
function InlineColorUI({ |
| 5302 |
name: name16, |
| 5303 |
value, |
| 5304 |
onChange, |
| 5305 |
onClose, |
| 5306 |
contentRef, |
| 5307 |
isActive |
| 5308 |
}) { |
| 5309 |
const popoverAnchor = (0, import_rich_text9.useAnchor)({ |
| 5310 |
editableContentElement: contentRef.current, |
| 5311 |
settings: { ...textColor, isActive } |
| 5312 |
}); |
| 5313 |
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)( |
| 5314 |
import_components4.Popover, |
| 5315 |
{ |
| 5316 |
onClose, |
| 5317 |
className: "format-library__inline-color-popover", |
| 5318 |
anchor: popoverAnchor, |
| 5319 |
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(tabs_exports.Root, { defaultValue: TABS[0].name, children: [ |
| 5320 |
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(tabs_exports.List, { children: TABS.map((tab) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(tabs_exports.Tab, { value: tab.name, children: tab.title }, tab.name)) }), |
| 5321 |
TABS.map((tab) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)( |
| 5322 |
tabs_exports.Panel, |
| 5323 |
{ |
| 5324 |
value: tab.name, |
| 5325 |
tabIndex: -1, |
| 5326 |
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)( |
| 5327 |
ColorPicker, |
| 5328 |
{ |
| 5329 |
name: name16, |
| 5330 |
property: tab.name, |
| 5331 |
value, |
| 5332 |
onChange |
| 5333 |
} |
| 5334 |
) |
| 5335 |
}, |
| 5336 |
tab.name |
| 5337 |
)) |
| 5338 |
] }) |
| 5339 |
} |
| 5340 |
); |
| 5341 |
} |
| 5342 |
|
| 5343 |
// packages/format-library/build-module/text-color/index.mjs |
| 5344 |
var import_jsx_runtime37 = __toESM(require_jsx_runtime(), 1); |
| 5345 |
var transparentValue = "rgba(0, 0, 0, 0)"; |
| 5346 |
var name8 = "core/text-color"; |
| 5347 |
var title8 = (0, import_i18n12.__)("Highlight"); |
| 5348 |
var EMPTY_ARRAY3 = []; |
| 5349 |
function getComputedStyleProperty(element, property) { |
| 5350 |
const { ownerDocument: ownerDocument2 } = element; |
| 5351 |
const { defaultView } = ownerDocument2; |
| 5352 |
const style = defaultView.getComputedStyle(element); |
| 5353 |
const value = style.getPropertyValue(property); |
| 5354 |
if (property === "background-color" && value === transparentValue && element.parentElement) { |
| 5355 |
return getComputedStyleProperty(element.parentElement, property); |
| 5356 |
} |
| 5357 |
return value; |
| 5358 |
} |
| 5359 |
function fillComputedColors(element, { color, backgroundColor }) { |
| 5360 |
if (!color && !backgroundColor) { |
| 5361 |
return; |
| 5362 |
} |
| 5363 |
return { |
| 5364 |
color: color || getComputedStyleProperty(element, "color"), |
| 5365 |
backgroundColor: backgroundColor === transparentValue ? getComputedStyleProperty(element, "background-color") : backgroundColor |
| 5366 |
}; |
| 5367 |
} |
| 5368 |
function TextColorEdit({ |
| 5369 |
value, |
| 5370 |
onChange, |
| 5371 |
isActive, |
| 5372 |
activeAttributes, |
| 5373 |
contentRef |
| 5374 |
}) { |
| 5375 |
const [allowCustomControl, colors = EMPTY_ARRAY3] = (0, import_block_editor10.useSettings)( |
| 5376 |
"color.custom", |
| 5377 |
"color.palette" |
| 5378 |
); |
| 5379 |
const [isAddingColor, setIsAddingColor] = (0, import_element17.useState)(false); |
| 5380 |
const colorIndicatorStyle = (0, import_element17.useMemo)( |
| 5381 |
() => fillComputedColors( |
| 5382 |
contentRef.current, |
| 5383 |
getActiveColors(value, name8, colors) |
| 5384 |
), |
| 5385 |
[contentRef, value, colors] |
| 5386 |
); |
| 5387 |
const hasColorsToChoose = !!colors.length || allowCustomControl; |
| 5388 |
if (!hasColorsToChoose && !isActive) { |
| 5389 |
return null; |
| 5390 |
} |
| 5391 |
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [ |
| 5392 |
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)( |
| 5393 |
import_block_editor10.RichTextToolbarButton, |
| 5394 |
{ |
| 5395 |
className: "format-library-text-color-button", |
| 5396 |
isActive, |
| 5397 |
icon: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)( |
| 5398 |
icon_default, |
| 5399 |
{ |
| 5400 |
icon: Object.keys(activeAttributes).length ? text_color_default : color_default, |
| 5401 |
style: colorIndicatorStyle |
| 5402 |
} |
| 5403 |
), |
| 5404 |
title: title8, |
| 5405 |
onClick: hasColorsToChoose ? () => setIsAddingColor(true) : () => onChange((0, import_rich_text10.removeFormat)(value, name8)), |
| 5406 |
role: "menuitemcheckbox" |
| 5407 |
} |
| 5408 |
), |
| 5409 |
isAddingColor && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)( |
| 5410 |
InlineColorUI, |
| 5411 |
{ |
| 5412 |
name: name8, |
| 5413 |
onClose: () => setIsAddingColor(false), |
| 5414 |
activeAttributes, |
| 5415 |
value, |
| 5416 |
onChange, |
| 5417 |
contentRef, |
| 5418 |
isActive |
| 5419 |
} |
| 5420 |
) |
| 5421 |
] }); |
| 5422 |
} |
| 5423 |
var textColor = { |
| 5424 |
name: name8, |
| 5425 |
title: title8, |
| 5426 |
tagName: "mark", |
| 5427 |
className: "has-inline-color", |
| 5428 |
attributes: { |
| 5429 |
style: "style", |
| 5430 |
class: "class" |
| 5431 |
}, |
| 5432 |
edit: TextColorEdit |
| 5433 |
}; |
| 5434 |
|
| 5435 |
// packages/format-library/build-module/subscript/index.mjs |
| 5436 |
var import_i18n13 = __toESM(require_i18n(), 1); |
| 5437 |
var import_rich_text11 = __toESM(require_rich_text(), 1); |
| 5438 |
var import_block_editor11 = __toESM(require_block_editor(), 1); |
| 5439 |
var import_jsx_runtime38 = __toESM(require_jsx_runtime(), 1); |
| 5440 |
var name9 = "core/subscript"; |
| 5441 |
var title9 = (0, import_i18n13.__)("Subscript"); |
| 5442 |
var subscript = { |
| 5443 |
name: name9, |
| 5444 |
title: title9, |
| 5445 |
tagName: "sub", |
| 5446 |
className: null, |
| 5447 |
edit({ isActive, value, onChange, onFocus }) { |
| 5448 |
function onToggle() { |
| 5449 |
onChange((0, import_rich_text11.toggleFormat)(value, { type: name9, title: title9 })); |
| 5450 |
} |
| 5451 |
function onClick() { |
| 5452 |
onToggle(); |
| 5453 |
onFocus(); |
| 5454 |
} |
| 5455 |
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)( |
| 5456 |
import_block_editor11.RichTextToolbarButton, |
| 5457 |
{ |
| 5458 |
icon: subscript_default, |
| 5459 |
title: title9, |
| 5460 |
onClick, |
| 5461 |
isActive, |
| 5462 |
role: "menuitemcheckbox" |
| 5463 |
} |
| 5464 |
); |
| 5465 |
} |
| 5466 |
}; |
| 5467 |
|
| 5468 |
// packages/format-library/build-module/superscript/index.mjs |
| 5469 |
var import_i18n14 = __toESM(require_i18n(), 1); |
| 5470 |
var import_rich_text12 = __toESM(require_rich_text(), 1); |
| 5471 |
var import_block_editor12 = __toESM(require_block_editor(), 1); |
| 5472 |
var import_jsx_runtime39 = __toESM(require_jsx_runtime(), 1); |
| 5473 |
var name10 = "core/superscript"; |
| 5474 |
var title10 = (0, import_i18n14.__)("Superscript"); |
| 5475 |
var superscript = { |
| 5476 |
name: name10, |
| 5477 |
title: title10, |
| 5478 |
tagName: "sup", |
| 5479 |
className: null, |
| 5480 |
edit({ isActive, value, onChange, onFocus }) { |
| 5481 |
function onToggle() { |
| 5482 |
onChange((0, import_rich_text12.toggleFormat)(value, { type: name10, title: title10 })); |
| 5483 |
} |
| 5484 |
function onClick() { |
| 5485 |
onToggle(); |
| 5486 |
onFocus(); |
| 5487 |
} |
| 5488 |
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)( |
| 5489 |
import_block_editor12.RichTextToolbarButton, |
| 5490 |
{ |
| 5491 |
icon: superscript_default, |
| 5492 |
title: title10, |
| 5493 |
onClick, |
| 5494 |
isActive, |
| 5495 |
role: "menuitemcheckbox" |
| 5496 |
} |
| 5497 |
); |
| 5498 |
} |
| 5499 |
}; |
| 5500 |
|
| 5501 |
// packages/format-library/build-module/keyboard/index.mjs |
| 5502 |
var import_i18n15 = __toESM(require_i18n(), 1); |
| 5503 |
var import_rich_text13 = __toESM(require_rich_text(), 1); |
| 5504 |
var import_block_editor13 = __toESM(require_block_editor(), 1); |
| 5505 |
var import_jsx_runtime40 = __toESM(require_jsx_runtime(), 1); |
| 5506 |
var name11 = "core/keyboard"; |
| 5507 |
var title11 = (0, import_i18n15.__)("Keyboard input"); |
| 5508 |
var keyboard2 = { |
| 5509 |
name: name11, |
| 5510 |
title: title11, |
| 5511 |
tagName: "kbd", |
| 5512 |
className: null, |
| 5513 |
edit({ isActive, value, onChange, onFocus }) { |
| 5514 |
function onToggle() { |
| 5515 |
onChange((0, import_rich_text13.toggleFormat)(value, { type: name11, title: title11 })); |
| 5516 |
} |
| 5517 |
function onClick() { |
| 5518 |
onToggle(); |
| 5519 |
onFocus(); |
| 5520 |
} |
| 5521 |
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)( |
| 5522 |
import_block_editor13.RichTextToolbarButton, |
| 5523 |
{ |
| 5524 |
icon: button_default, |
| 5525 |
title: title11, |
| 5526 |
onClick, |
| 5527 |
isActive, |
| 5528 |
role: "menuitemcheckbox" |
| 5529 |
} |
| 5530 |
); |
| 5531 |
} |
| 5532 |
}; |
| 5533 |
|
| 5534 |
// packages/format-library/build-module/unknown/index.mjs |
| 5535 |
var import_i18n16 = __toESM(require_i18n(), 1); |
| 5536 |
var import_rich_text14 = __toESM(require_rich_text(), 1); |
| 5537 |
var import_block_editor14 = __toESM(require_block_editor(), 1); |
| 5538 |
var import_jsx_runtime41 = __toESM(require_jsx_runtime(), 1); |
| 5539 |
var name12 = "core/unknown"; |
| 5540 |
var title12 = (0, import_i18n16.__)("Clear Unknown Formatting"); |
| 5541 |
function selectionContainsUnknownFormats(value) { |
| 5542 |
if ((0, import_rich_text14.isCollapsed)(value)) { |
| 5543 |
return false; |
| 5544 |
} |
| 5545 |
const selectedValue = (0, import_rich_text14.slice)(value); |
| 5546 |
return selectedValue.formats.some((formats) => { |
| 5547 |
return formats.some((format) => format.type === name12); |
| 5548 |
}); |
| 5549 |
} |
| 5550 |
var unknown = { |
| 5551 |
name: name12, |
| 5552 |
title: title12, |
| 5553 |
tagName: "*", |
| 5554 |
className: null, |
| 5555 |
edit({ isActive, value, onChange, onFocus }) { |
| 5556 |
if (!isActive && !selectionContainsUnknownFormats(value)) { |
| 5557 |
return null; |
| 5558 |
} |
| 5559 |
function onClick() { |
| 5560 |
onChange((0, import_rich_text14.removeFormat)(value, name12)); |
| 5561 |
onFocus(); |
| 5562 |
} |
| 5563 |
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)( |
| 5564 |
import_block_editor14.RichTextToolbarButton, |
| 5565 |
{ |
| 5566 |
name: "unknown", |
| 5567 |
icon: help_default, |
| 5568 |
title: title12, |
| 5569 |
onClick, |
| 5570 |
isActive: true |
| 5571 |
} |
| 5572 |
); |
| 5573 |
} |
| 5574 |
}; |
| 5575 |
|
| 5576 |
// packages/format-library/build-module/language/index.mjs |
| 5577 |
var import_i18n17 = __toESM(require_i18n(), 1); |
| 5578 |
var import_block_editor15 = __toESM(require_block_editor(), 1); |
| 5579 |
var import_components5 = __toESM(require_components(), 1); |
| 5580 |
var import_element18 = __toESM(require_element(), 1); |
| 5581 |
var import_rich_text15 = __toESM(require_rich_text(), 1); |
| 5582 |
var import_jsx_runtime42 = __toESM(require_jsx_runtime(), 1); |
| 5583 |
var name13 = "core/language"; |
| 5584 |
var title13 = (0, import_i18n17.__)("Language"); |
| 5585 |
var language = { |
| 5586 |
name: name13, |
| 5587 |
title: title13, |
| 5588 |
tagName: "bdo", |
| 5589 |
className: null, |
| 5590 |
attributes: { |
| 5591 |
lang: "lang", |
| 5592 |
dir: "dir" |
| 5593 |
}, |
| 5594 |
edit: Edit3 |
| 5595 |
}; |
| 5596 |
function Edit3({ isActive, value, onChange, contentRef }) { |
| 5597 |
const [isPopoverVisible, setIsPopoverVisible] = (0, import_element18.useState)(false); |
| 5598 |
const togglePopover = () => { |
| 5599 |
setIsPopoverVisible((state) => !state); |
| 5600 |
}; |
| 5601 |
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_jsx_runtime42.Fragment, { children: [ |
| 5602 |
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)( |
| 5603 |
import_block_editor15.RichTextToolbarButton, |
| 5604 |
{ |
| 5605 |
icon: language_default, |
| 5606 |
label: title13, |
| 5607 |
title: title13, |
| 5608 |
onClick: () => { |
| 5609 |
if (isActive) { |
| 5610 |
onChange((0, import_rich_text15.removeFormat)(value, name13)); |
| 5611 |
} else { |
| 5612 |
togglePopover(); |
| 5613 |
} |
| 5614 |
}, |
| 5615 |
isActive, |
| 5616 |
role: "menuitemcheckbox" |
| 5617 |
} |
| 5618 |
), |
| 5619 |
isPopoverVisible && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)( |
| 5620 |
InlineLanguageUI, |
| 5621 |
{ |
| 5622 |
value, |
| 5623 |
onChange, |
| 5624 |
onClose: togglePopover, |
| 5625 |
contentRef |
| 5626 |
} |
| 5627 |
) |
| 5628 |
] }); |
| 5629 |
} |
| 5630 |
function InlineLanguageUI({ value, contentRef, onChange, onClose }) { |
| 5631 |
const popoverAnchor = (0, import_rich_text15.useAnchor)({ |
| 5632 |
editableContentElement: contentRef.current, |
| 5633 |
settings: language |
| 5634 |
}); |
| 5635 |
const [lang, setLang] = (0, import_element18.useState)(""); |
| 5636 |
const [dir, setDir] = (0, import_element18.useState)("ltr"); |
| 5637 |
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)( |
| 5638 |
import_components5.Popover, |
| 5639 |
{ |
| 5640 |
className: "block-editor-format-toolbar__language-popover", |
| 5641 |
anchor: popoverAnchor, |
| 5642 |
onClose, |
| 5643 |
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)( |
| 5644 |
Stack, |
| 5645 |
{ |
| 5646 |
render: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("form", {}), |
| 5647 |
direction: "column", |
| 5648 |
gap: "lg", |
| 5649 |
className: "block-editor-format-toolbar__language-container-content", |
| 5650 |
onSubmit: (event) => { |
| 5651 |
event.preventDefault(); |
| 5652 |
onChange( |
| 5653 |
(0, import_rich_text15.applyFormat)(value, { |
| 5654 |
type: name13, |
| 5655 |
attributes: { |
| 5656 |
lang, |
| 5657 |
dir |
| 5658 |
} |
| 5659 |
}) |
| 5660 |
); |
| 5661 |
onClose(); |
| 5662 |
}, |
| 5663 |
children: [ |
| 5664 |
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)( |
| 5665 |
import_components5.TextControl, |
| 5666 |
{ |
| 5667 |
label: title13, |
| 5668 |
value: lang, |
| 5669 |
onChange: (val) => setLang(val), |
| 5670 |
help: (0, import_i18n17.__)( |
| 5671 |
'A valid language attribute, like "en" or "fr".' |
| 5672 |
) |
| 5673 |
} |
| 5674 |
), |
| 5675 |
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)( |
| 5676 |
import_components5.SelectControl, |
| 5677 |
{ |
| 5678 |
label: (0, import_i18n17.__)("Text direction"), |
| 5679 |
value: dir, |
| 5680 |
options: [ |
| 5681 |
{ |
| 5682 |
label: (0, import_i18n17.__)("Left to right"), |
| 5683 |
value: "ltr" |
| 5684 |
}, |
| 5685 |
{ |
| 5686 |
label: (0, import_i18n17.__)("Right to left"), |
| 5687 |
value: "rtl" |
| 5688 |
} |
| 5689 |
], |
| 5690 |
onChange: (val) => setDir(val) |
| 5691 |
} |
| 5692 |
), |
| 5693 |
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Stack, { justify: "right", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)( |
| 5694 |
import_components5.Button, |
| 5695 |
{ |
| 5696 |
__next40pxDefaultSize: true, |
| 5697 |
variant: "primary", |
| 5698 |
type: "submit", |
| 5699 |
text: (0, import_i18n17.__)("Apply") |
| 5700 |
} |
| 5701 |
) }) |
| 5702 |
] |
| 5703 |
} |
| 5704 |
) |
| 5705 |
} |
| 5706 |
); |
| 5707 |
} |
| 5708 |
|
| 5709 |
// packages/format-library/build-module/math/index.mjs |
| 5710 |
var import_i18n18 = __toESM(require_i18n(), 1); |
| 5711 |
var import_element19 = __toESM(require_element(), 1); |
| 5712 |
var import_rich_text16 = __toESM(require_rich_text(), 1); |
| 5713 |
var import_block_editor16 = __toESM(require_block_editor(), 1); |
| 5714 |
var import_components6 = __toESM(require_components(), 1); |
| 5715 |
var import_a11y3 = __toESM(require_a11y(), 1); |
| 5716 |
|
| 5717 |
// packages/format-library/build-module/lock-unlock.mjs |
| 5718 |
var import_private_apis = __toESM(require_private_apis(), 1); |
| 5719 |
var { lock, unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( |
| 5720 |
"I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", |
| 5721 |
"@wordpress/format-library" |
| 5722 |
); |
| 5723 |
|
| 5724 |
// packages/format-library/build-module/math/index.mjs |
| 5725 |
var import_jsx_runtime43 = __toESM(require_jsx_runtime(), 1); |
| 5726 |
var { Badge: WCBadge } = unlock(import_components6.privateApis); |
| 5727 |
var name14 = "core/math"; |
| 5728 |
var title14 = (0, import_i18n18.__)("Math"); |
| 5729 |
function InlineUI2({ |
| 5730 |
value, |
| 5731 |
onChange, |
| 5732 |
activeAttributes, |
| 5733 |
contentRef, |
| 5734 |
latexToMathML |
| 5735 |
}) { |
| 5736 |
const [latex, setLatex] = (0, import_element19.useState)( |
| 5737 |
activeAttributes?.["data-latex"] || "" |
| 5738 |
); |
| 5739 |
const [error2, setError] = (0, import_element19.useState)(null); |
| 5740 |
const popoverAnchor = (0, import_rich_text16.useAnchor)({ |
| 5741 |
editableContentElement: contentRef.current, |
| 5742 |
settings: math |
| 5743 |
}); |
| 5744 |
const handleLatexChange = (newLatex) => { |
| 5745 |
let mathML = ""; |
| 5746 |
setLatex(newLatex); |
| 5747 |
if (newLatex) { |
| 5748 |
try { |
| 5749 |
mathML = latexToMathML(newLatex, { displayMode: false }); |
| 5750 |
setError(null); |
| 5751 |
} catch (err) { |
| 5752 |
setError(err.message); |
| 5753 |
(0, import_a11y3.speak)( |
| 5754 |
(0, import_i18n18.sprintf)( |
| 5755 |
/* translators: %s: error message returned when parsing LaTeX. */ |
| 5756 |
(0, import_i18n18.__)("Error parsing mathematical expression: %s"), |
| 5757 |
err.message |
| 5758 |
) |
| 5759 |
); |
| 5760 |
return; |
| 5761 |
} |
| 5762 |
} |
| 5763 |
const newReplacements = value.replacements.slice(); |
| 5764 |
newReplacements[value.start] = { |
| 5765 |
type: name14, |
| 5766 |
attributes: { |
| 5767 |
"data-latex": newLatex |
| 5768 |
}, |
| 5769 |
innerHTML: mathML |
| 5770 |
}; |
| 5771 |
onChange({ |
| 5772 |
...value, |
| 5773 |
replacements: newReplacements |
| 5774 |
}); |
| 5775 |
}; |
| 5776 |
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)( |
| 5777 |
import_components6.Popover, |
| 5778 |
{ |
| 5779 |
placement: "bottom-start", |
| 5780 |
offset: 8, |
| 5781 |
focusOnMount: false, |
| 5782 |
anchor: popoverAnchor, |
| 5783 |
className: "block-editor-format-toolbar__math-popover", |
| 5784 |
children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { style: { minWidth: "300px", padding: "4px" }, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(Stack, { direction: "column", gap: "xs", children: [ |
| 5785 |
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)( |
| 5786 |
import_components6.TextControl, |
| 5787 |
{ |
| 5788 |
hideLabelFromVision: true, |
| 5789 |
label: (0, import_i18n18.__)("LaTeX math syntax"), |
| 5790 |
value: latex, |
| 5791 |
onChange: handleLatexChange, |
| 5792 |
placeholder: (0, import_i18n18.__)("e.g., x^2, \\frac{a}{b}"), |
| 5793 |
autoComplete: "off", |
| 5794 |
className: "block-editor-format-toolbar__math-input" |
| 5795 |
} |
| 5796 |
), |
| 5797 |
error2 && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_jsx_runtime43.Fragment, { children: [ |
| 5798 |
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)( |
| 5799 |
WCBadge, |
| 5800 |
{ |
| 5801 |
intent: "error", |
| 5802 |
className: "wp-block-math__error", |
| 5803 |
children: (0, import_i18n18.sprintf)( |
| 5804 |
/* translators: %s: error message returned when parsing LaTeX. */ |
| 5805 |
(0, import_i18n18.__)("Error: %s"), |
| 5806 |
error2 |
| 5807 |
) |
| 5808 |
} |
| 5809 |
), |
| 5810 |
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("style", { children: ".wp-block-math__error .components-badge__content{white-space:normal}" }) |
| 5811 |
] }) |
| 5812 |
] }) }) |
| 5813 |
} |
| 5814 |
); |
| 5815 |
} |
| 5816 |
function Edit4({ |
| 5817 |
value, |
| 5818 |
onChange, |
| 5819 |
onFocus, |
| 5820 |
isObjectActive, |
| 5821 |
activeObjectAttributes, |
| 5822 |
contentRef |
| 5823 |
}) { |
| 5824 |
const [latexToMathML, setLatexToMathML] = (0, import_element19.useState)(); |
| 5825 |
(0, import_element19.useEffect)(() => { |
| 5826 |
import("@wordpress/latex-to-mathml").then((module) => { |
| 5827 |
setLatexToMathML(() => module.default); |
| 5828 |
}); |
| 5829 |
}, []); |
| 5830 |
function onClick() { |
| 5831 |
let newValue; |
| 5832 |
if (isObjectActive) { |
| 5833 |
const latex = activeObjectAttributes?.["data-latex"] || ""; |
| 5834 |
newValue = (0, import_rich_text16.insert)(value, latex); |
| 5835 |
newValue.start = newValue.end - latex.length; |
| 5836 |
} else { |
| 5837 |
const selectedText = (0, import_rich_text16.getTextContent)((0, import_rich_text16.slice)(value)); |
| 5838 |
let innerHTML = ""; |
| 5839 |
if (selectedText && latexToMathML) { |
| 5840 |
try { |
| 5841 |
innerHTML = latexToMathML(selectedText, { |
| 5842 |
displayMode: false |
| 5843 |
}); |
| 5844 |
} catch { |
| 5845 |
} |
| 5846 |
} |
| 5847 |
newValue = (0, import_rich_text16.insertObject)(value, { |
| 5848 |
type: name14, |
| 5849 |
attributes: { "data-latex": selectedText }, |
| 5850 |
innerHTML |
| 5851 |
}); |
| 5852 |
newValue.start = newValue.end - 1; |
| 5853 |
} |
| 5854 |
onChange(newValue); |
| 5855 |
onFocus(); |
| 5856 |
} |
| 5857 |
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_jsx_runtime43.Fragment, { children: [ |
| 5858 |
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)( |
| 5859 |
import_block_editor16.RichTextToolbarButton, |
| 5860 |
{ |
| 5861 |
icon: math_default, |
| 5862 |
title: title14, |
| 5863 |
onClick, |
| 5864 |
isActive: isObjectActive |
| 5865 |
} |
| 5866 |
), |
| 5867 |
isObjectActive && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)( |
| 5868 |
InlineUI2, |
| 5869 |
{ |
| 5870 |
value, |
| 5871 |
onChange, |
| 5872 |
activeAttributes: activeObjectAttributes, |
| 5873 |
contentRef, |
| 5874 |
latexToMathML |
| 5875 |
} |
| 5876 |
) |
| 5877 |
] }); |
| 5878 |
} |
| 5879 |
var math = { |
| 5880 |
name: name14, |
| 5881 |
title: title14, |
| 5882 |
tagName: "math", |
| 5883 |
className: null, |
| 5884 |
attributes: { |
| 5885 |
"data-latex": "data-latex" |
| 5886 |
}, |
| 5887 |
contentEditable: false, |
| 5888 |
edit: Edit4 |
| 5889 |
}; |
| 5890 |
|
| 5891 |
// packages/format-library/build-module/non-breaking-space/index.mjs |
| 5892 |
var import_i18n19 = __toESM(require_i18n(), 1); |
| 5893 |
var import_rich_text17 = __toESM(require_rich_text(), 1); |
| 5894 |
var import_block_editor17 = __toESM(require_block_editor(), 1); |
| 5895 |
var import_jsx_runtime44 = __toESM(require_jsx_runtime(), 1); |
| 5896 |
var name15 = "core/non-breaking-space"; |
| 5897 |
var title15 = (0, import_i18n19.__)("Non breaking space"); |
| 5898 |
var nonBreakingSpace = { |
| 5899 |
name: name15, |
| 5900 |
title: title15, |
| 5901 |
tagName: "nbsp", |
| 5902 |
className: null, |
| 5903 |
edit({ value, onChange }) { |
| 5904 |
function addNonBreakingSpace() { |
| 5905 |
onChange((0, import_rich_text17.insert)(value, "\xA0")); |
| 5906 |
} |
| 5907 |
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)( |
| 5908 |
import_block_editor17.RichTextShortcut, |
| 5909 |
{ |
| 5910 |
type: "primaryShift", |
| 5911 |
character: " ", |
| 5912 |
onUse: addNonBreakingSpace |
| 5913 |
} |
| 5914 |
); |
| 5915 |
} |
| 5916 |
}; |
| 5917 |
|
| 5918 |
// packages/format-library/build-module/default-formats.mjs |
| 5919 |
var default_formats_default = [ |
| 5920 |
bold, |
| 5921 |
code, |
| 5922 |
image, |
| 5923 |
italic, |
| 5924 |
link, |
| 5925 |
strikethrough, |
| 5926 |
underline, |
| 5927 |
textColor, |
| 5928 |
subscript, |
| 5929 |
superscript, |
| 5930 |
keyboard2, |
| 5931 |
unknown, |
| 5932 |
language, |
| 5933 |
math, |
| 5934 |
nonBreakingSpace |
| 5935 |
]; |
| 5936 |
|
| 5937 |
// packages/format-library/build-module/index.mjs |
| 5938 |
default_formats_default.forEach( |
| 5939 |
({ name: name16, ...settings }) => (0, import_rich_text18.registerFormatType)(name16, settings) |
| 5940 |
); |
| 5941 |
})(); |
| 5942 |
/*! Bundled license information: |
| 5943 |
|
| 5944 |
use-sync-external-store/cjs/use-sync-external-store-shim.development.js: |
| 5945 |
(** |
| 5946 |
* @license React |
| 5947 |
* use-sync-external-store-shim.development.js |
| 5948 |
* |
| 5949 |
* Copyright (c) Meta Platforms, Inc. and affiliates. |
| 5950 |
* |
| 5951 |
* This source code is licensed under the MIT license found in the |
| 5952 |
* LICENSE file in the root directory of this source tree. |
| 5953 |
*) |
| 5954 |
*/ |
| 5955 |
//# sourceMappingURL=index.js.map |
| 5956 |
|