@json-to-office/jto 6.4.0 → 6.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/dist/cli.js +1 -1
  2. package/dist/client/assets/{HomePage-DgyrBIGY.js → HomePage-DdKO7Rz8.js} +4 -4
  3. package/dist/client/assets/{HomePage-DgyrBIGY.js.map → HomePage-DdKO7Rz8.js.map} +1 -1
  4. package/dist/client/assets/{JsonEditorPage-BGctWRXE.js → JsonEditorPage-CIB7kfUW.js} +3 -3
  5. package/dist/client/assets/{JsonEditorPage-BGctWRXE.js.map → JsonEditorPage-CIB7kfUW.js.map} +1 -1
  6. package/dist/client/assets/{MonacoPluginProvider-DbBCCotq.js → MonacoPluginProvider-Cql9aylS.js} +5 -5
  7. package/dist/client/assets/{MonacoPluginProvider-DbBCCotq.js.map → MonacoPluginProvider-Cql9aylS.js.map} +1 -1
  8. package/dist/client/assets/{_virtual_jto-plugin-type-libs-BpQu9aDr.js → _virtual_jto-plugin-type-libs-BJgH7I8Z.js} +32 -9
  9. package/dist/client/assets/{_virtual_jto-plugin-type-libs-BpQu9aDr.js.map → _virtual_jto-plugin-type-libs-BJgH7I8Z.js.map} +1 -1
  10. package/dist/client/assets/_virtual_jto-sandbox-runtime-BFXK15tx.js +2 -0
  11. package/dist/client/assets/_virtual_jto-sandbox-runtime-BFXK15tx.js.map +1 -0
  12. package/dist/client/assets/{editor-DnPnx_0M.js → editor-Dl0mPZWB.js} +2 -2
  13. package/dist/client/assets/{editor-DnPnx_0M.js.map → editor-Dl0mPZWB.js.map} +1 -1
  14. package/dist/client/assets/{editor-monaco-json-B_U6hHbA.js → editor-monaco-json-BWLlWM6o.js} +2 -2
  15. package/dist/client/assets/{editor-monaco-json-B_U6hHbA.js.map → editor-monaco-json-BWLlWM6o.js.map} +1 -1
  16. package/dist/client/assets/{index-2S58SOrb.js → index-1Vg-Jg2R.js} +4 -4
  17. package/dist/client/assets/index-1Vg-Jg2R.js.map +1 -0
  18. package/dist/client/assets/{index-CWzQeme_.js → index-Db2WFiF0.js} +2 -2
  19. package/dist/client/assets/{index-CWzQeme_.js.map → index-Db2WFiF0.js.map} +1 -1
  20. package/dist/client/assets/{preview-Bdmil0FT.js → preview-BXysnPth.js} +2 -2
  21. package/dist/client/assets/{preview-Bdmil0FT.js.map → preview-BXysnPth.js.map} +1 -1
  22. package/dist/client/assets/{useQualityAnalysis-B0tasjoU.js → useQualityAnalysis-Dr3UHxyN.js} +2 -2
  23. package/dist/client/assets/{useQualityAnalysis-B0tasjoU.js.map → useQualityAnalysis-Dr3UHxyN.js.map} +1 -1
  24. package/dist/client/index.html +1 -1
  25. package/package.json +10 -10
  26. package/dist/client/assets/_virtual_jto-sandbox-runtime-CySzPJ5n.js +0 -2
  27. package/dist/client/assets/_virtual_jto-sandbox-runtime-CySzPJ5n.js.map +0 -1
  28. package/dist/client/assets/index-2S58SOrb.js.map +0 -1
@@ -1,2 +1,2 @@
1
- import{r as K,j as Q,e as p,g as Y}from"./react-vendor-BmQ2Ko_D.js";import{r as Z}from"./radix-ui-BzbaiLpZ.js";import{d as ee}from"./ui-vendor-BsAtAN16.js";import{c as re}from"./index-2S58SOrb.js";const te=ee("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-sm text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 cursor-pointer",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 px-3",lg:"h-10 px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),ne=K.forwardRef(({className:v,variant:m,size:y,asChild:h=!1,...x},j)=>{const T=h?Z:"button";return Q.jsx(T,{className:re(te({variant:m,size:y,className:v})),ref:j,...x})});ne.displayName="Button";var _,F;function ie(){if(F)return _;F=1;var v="Expected a function",m=NaN,y="[object Symbol]",h=/^\s+|\s+$/g,x=/^[-+]0x[0-9a-f]+$/i,j=/^0b[01]+$/i,T=/^0o[0-7]+$/i,M=parseInt,W=typeof p=="object"&&p&&p.Object===Object&&p,$=typeof self=="object"&&self&&self.Object===Object&&self,z=W||$||Function("return this")(),A=Object.prototype,q=A.toString,D=Math.max,G=Math.min,k=function(){return z.Date.now()};function P(e,t,i){var a,c,b,f,n,s,u=0,B=!1,d=!1,I=!0;if(typeof e!="function")throw new TypeError(v);t=L(t)||0,E(i)&&(B=!!i.leading,d="maxWait"in i,b=d?D(L(i.maxWait)||0,t):b,I="trailing"in i?!!i.trailing:I);function O(r){var o=a,l=c;return a=c=void 0,u=r,f=e.apply(l,o),f}function H(r){return u=r,n=setTimeout(g,t),B?O(r):f}function U(r){var o=r-s,l=r-u,R=t-o;return d?G(R,b-l):R}function C(r){var o=r-s,l=r-u;return s===void 0||o>=t||o<0||d&&l>=b}function g(){var r=k();if(C(r))return N(r);n=setTimeout(g,U(r))}function N(r){return n=void 0,I&&a?O(r):(a=c=void 0,f)}function X(){n!==void 0&&clearTimeout(n),u=0,a=s=c=n=void 0}function J(){return n===void 0?f:N(k())}function S(){var r=k(),o=C(r);if(a=arguments,c=this,s=r,o){if(n===void 0)return H(s);if(d)return n=setTimeout(g,t),O(s)}return n===void 0&&(n=setTimeout(g,t)),f}return S.cancel=X,S.flush=J,S}function E(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function V(e){return!!e&&typeof e=="object"}function w(e){return typeof e=="symbol"||V(e)&&q.call(e)==y}function L(e){if(typeof e=="number")return e;if(w(e))return m;if(E(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=E(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=e.replace(h,"");var i=j.test(e);return i||T.test(e)?M(e.slice(2),i?2:8):x.test(e)?m:+e}return _=P,_}var oe=ie();const ue=Y(oe);export{ne as B,ue as d};
2
- //# sourceMappingURL=index-CWzQeme_.js.map
1
+ import{r as K,j as Q,e as p,g as Y}from"./react-vendor-BmQ2Ko_D.js";import{r as Z}from"./radix-ui-BzbaiLpZ.js";import{d as ee}from"./ui-vendor-BsAtAN16.js";import{c as re}from"./index-1Vg-Jg2R.js";const te=ee("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-sm text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 cursor-pointer",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 px-3",lg:"h-10 px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),ne=K.forwardRef(({className:v,variant:m,size:y,asChild:h=!1,...x},j)=>{const T=h?Z:"button";return Q.jsx(T,{className:re(te({variant:m,size:y,className:v})),ref:j,...x})});ne.displayName="Button";var _,F;function ie(){if(F)return _;F=1;var v="Expected a function",m=NaN,y="[object Symbol]",h=/^\s+|\s+$/g,x=/^[-+]0x[0-9a-f]+$/i,j=/^0b[01]+$/i,T=/^0o[0-7]+$/i,M=parseInt,W=typeof p=="object"&&p&&p.Object===Object&&p,$=typeof self=="object"&&self&&self.Object===Object&&self,z=W||$||Function("return this")(),A=Object.prototype,q=A.toString,D=Math.max,G=Math.min,k=function(){return z.Date.now()};function P(e,t,i){var a,c,b,f,n,s,u=0,B=!1,d=!1,I=!0;if(typeof e!="function")throw new TypeError(v);t=L(t)||0,E(i)&&(B=!!i.leading,d="maxWait"in i,b=d?D(L(i.maxWait)||0,t):b,I="trailing"in i?!!i.trailing:I);function O(r){var o=a,l=c;return a=c=void 0,u=r,f=e.apply(l,o),f}function H(r){return u=r,n=setTimeout(g,t),B?O(r):f}function U(r){var o=r-s,l=r-u,R=t-o;return d?G(R,b-l):R}function C(r){var o=r-s,l=r-u;return s===void 0||o>=t||o<0||d&&l>=b}function g(){var r=k();if(C(r))return N(r);n=setTimeout(g,U(r))}function N(r){return n=void 0,I&&a?O(r):(a=c=void 0,f)}function X(){n!==void 0&&clearTimeout(n),u=0,a=s=c=n=void 0}function J(){return n===void 0?f:N(k())}function S(){var r=k(),o=C(r);if(a=arguments,c=this,s=r,o){if(n===void 0)return H(s);if(d)return n=setTimeout(g,t),O(s)}return n===void 0&&(n=setTimeout(g,t)),f}return S.cancel=X,S.flush=J,S}function E(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function V(e){return!!e&&typeof e=="object"}function w(e){return typeof e=="symbol"||V(e)&&q.call(e)==y}function L(e){if(typeof e=="number")return e;if(w(e))return m;if(E(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=E(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=e.replace(h,"");var i=j.test(e);return i||T.test(e)?M(e.slice(2),i?2:8):x.test(e)?m:+e}return _=P,_}var oe=ie();const ue=Y(oe);export{ne as B,ue as d};
2
+ //# sourceMappingURL=index-Db2WFiF0.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-CWzQeme_.js","sources":["../../../src/client/components/ui/button.tsx","../../../../../node_modules/.pnpm/lodash.debounce@4.0.8/node_modules/lodash.debounce/index.js"],"sourcesContent":["import * as React from 'react';\nimport { Slot } from '@radix-ui/react-slot';\nimport { type VariantProps, cva } from 'class-variance-authority';\nimport { cn } from '@/lib/utils';\n\n/**\n * Wiseair button. Flat 2px-cornered controls — the system separates planes\n * with hairlines and the cool page grey, not with elevation, so no variant\n * carries a shadow. `outline` is a bordered field (`border-input\n * bg-background`), not an accent-filled pill.\n */\nconst buttonVariants = cva(\n 'inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-sm text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 cursor-pointer',\n {\n variants: {\n variant: {\n default: 'bg-primary text-primary-foreground hover:bg-primary/90',\n destructive:\n 'bg-destructive text-destructive-foreground hover:bg-destructive/90',\n outline:\n 'border border-input bg-background hover:bg-accent hover:text-accent-foreground',\n secondary:\n 'bg-secondary text-secondary-foreground hover:bg-secondary/80',\n ghost: 'hover:bg-accent hover:text-accent-foreground',\n link: 'text-primary underline-offset-4 hover:underline',\n },\n /* Heights follow the Wiseair Dashboard control rhythm (36 / 32 / 40),\n one step tighter than the shadcn defaults. */\n size: {\n default: 'h-9 px-4 py-2',\n sm: 'h-8 px-3',\n lg: 'h-10 px-8',\n icon: 'h-9 w-9',\n },\n },\n defaultVariants: {\n variant: 'default',\n size: 'default',\n },\n }\n);\n\nexport interface ButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement>,\n VariantProps<typeof buttonVariants> {\n asChild?: boolean;\n}\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n ({ className, variant, size, asChild = false, ...props }, ref) => {\n const Comp = asChild ? Slot : 'button';\n return (\n <Comp\n className={cn(buttonVariants({ variant, size, className }))}\n ref={ref}\n {...props}\n />\n );\n }\n);\nButton.displayName = 'Button';\n\nexport { Button, buttonVariants };\n","/**\n * lodash (Custom Build) <https://lodash.com/>\n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright jQuery Foundation and other contributors <https://jquery.org/>\n * Released under MIT license <https://lodash.com/license>\n * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>\n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n */\n\n/** Used as the `TypeError` message for \"Functions\" methods. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/** Used as references for various `Number` constants. */\nvar NAN = 0 / 0;\n\n/** `Object#toString` result references. */\nvar symbolTag = '[object Symbol]';\n\n/** Used to match leading and trailing whitespace. */\nvar reTrim = /^\\s+|\\s+$/g;\n\n/** Used to detect bad signed hexadecimal string values. */\nvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n/** Used to detect binary string values. */\nvar reIsBinary = /^0b[01]+$/i;\n\n/** Used to detect octal string values. */\nvar reIsOctal = /^0o[0-7]+$/i;\n\n/** Built-in method references without a dependency on `root`. */\nvar freeParseInt = parseInt;\n\n/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objectToString = objectProto.toString;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max,\n nativeMin = Math.min;\n\n/**\n * Gets the timestamp of the number of milliseconds that have elapsed since\n * the Unix epoch (1 January 1970 00:00:00 UTC).\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Date\n * @returns {number} Returns the timestamp.\n * @example\n *\n * _.defer(function(stamp) {\n * console.log(_.now() - stamp);\n * }, _.now());\n * // => Logs the number of milliseconds it took for the deferred invocation.\n */\nvar now = function() {\n return root.Date.now();\n};\n\n/**\n * Creates a debounced function that delays invoking `func` until after `wait`\n * milliseconds have elapsed since the last time the debounced function was\n * invoked. The debounced function comes with a `cancel` method to cancel\n * delayed `func` invocations and a `flush` method to immediately invoke them.\n * Provide `options` to indicate whether `func` should be invoked on the\n * leading and/or trailing edge of the `wait` timeout. The `func` is invoked\n * with the last arguments provided to the debounced function. Subsequent\n * calls to the debounced function return the result of the last `func`\n * invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the debounced function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.debounce` and `_.throttle`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to debounce.\n * @param {number} [wait=0] The number of milliseconds to delay.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=false]\n * Specify invoking on the leading edge of the timeout.\n * @param {number} [options.maxWait]\n * The maximum time `func` is allowed to be delayed before it's invoked.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new debounced function.\n * @example\n *\n * // Avoid costly calculations while the window size is in flux.\n * jQuery(window).on('resize', _.debounce(calculateLayout, 150));\n *\n * // Invoke `sendMail` when clicked, debouncing subsequent calls.\n * jQuery(element).on('click', _.debounce(sendMail, 300, {\n * 'leading': true,\n * 'trailing': false\n * }));\n *\n * // Ensure `batchLog` is invoked once after 1 second of debounced calls.\n * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });\n * var source = new EventSource('/stream');\n * jQuery(source).on('message', debounced);\n *\n * // Cancel the trailing debounced invocation.\n * jQuery(window).on('popstate', debounced.cancel);\n */\nfunction debounce(func, wait, options) {\n var lastArgs,\n lastThis,\n maxWait,\n result,\n timerId,\n lastCallTime,\n lastInvokeTime = 0,\n leading = false,\n maxing = false,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n wait = toNumber(wait) || 0;\n if (isObject(options)) {\n leading = !!options.leading;\n maxing = 'maxWait' in options;\n maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n\n function invokeFunc(time) {\n var args = lastArgs,\n thisArg = lastThis;\n\n lastArgs = lastThis = undefined;\n lastInvokeTime = time;\n result = func.apply(thisArg, args);\n return result;\n }\n\n function leadingEdge(time) {\n // Reset any `maxWait` timer.\n lastInvokeTime = time;\n // Start the timer for the trailing edge.\n timerId = setTimeout(timerExpired, wait);\n // Invoke the leading edge.\n return leading ? invokeFunc(time) : result;\n }\n\n function remainingWait(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime,\n result = wait - timeSinceLastCall;\n\n return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result;\n }\n\n function shouldInvoke(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime;\n\n // Either this is the first call, activity has stopped and we're at the\n // trailing edge, the system time has gone backwards and we're treating\n // it as the trailing edge, or we've hit the `maxWait` limit.\n return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||\n (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));\n }\n\n function timerExpired() {\n var time = now();\n if (shouldInvoke(time)) {\n return trailingEdge(time);\n }\n // Restart the timer.\n timerId = setTimeout(timerExpired, remainingWait(time));\n }\n\n function trailingEdge(time) {\n timerId = undefined;\n\n // Only invoke if we have `lastArgs` which means `func` has been\n // debounced at least once.\n if (trailing && lastArgs) {\n return invokeFunc(time);\n }\n lastArgs = lastThis = undefined;\n return result;\n }\n\n function cancel() {\n if (timerId !== undefined) {\n clearTimeout(timerId);\n }\n lastInvokeTime = 0;\n lastArgs = lastCallTime = lastThis = timerId = undefined;\n }\n\n function flush() {\n return timerId === undefined ? result : trailingEdge(now());\n }\n\n function debounced() {\n var time = now(),\n isInvoking = shouldInvoke(time);\n\n lastArgs = arguments;\n lastThis = this;\n lastCallTime = time;\n\n if (isInvoking) {\n if (timerId === undefined) {\n return leadingEdge(lastCallTime);\n }\n if (maxing) {\n // Handle invocations in a tight loop.\n timerId = setTimeout(timerExpired, wait);\n return invokeFunc(lastCallTime);\n }\n }\n if (timerId === undefined) {\n timerId = setTimeout(timerExpired, wait);\n }\n return result;\n }\n debounced.cancel = cancel;\n debounced.flush = flush;\n return debounced;\n}\n\n/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return !!value && typeof value == 'object';\n}\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && objectToString.call(value) == symbolTag);\n}\n\n/**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3.2);\n * // => 3.2\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3.2');\n * // => 3.2\n */\nfunction toNumber(value) {\n if (typeof value == 'number') {\n return value;\n }\n if (isSymbol(value)) {\n return NAN;\n }\n if (isObject(value)) {\n var other = typeof value.valueOf == 'function' ? value.valueOf() : value;\n value = isObject(other) ? (other + '') : other;\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value;\n }\n value = value.replace(reTrim, '');\n var isBinary = reIsBinary.test(value);\n return (isBinary || reIsOctal.test(value))\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : (reIsBadHex.test(value) ? NAN : +value);\n}\n\nmodule.exports = debounce;\n"],"names":["buttonVariants","cva","Button","React.forwardRef","className","variant","size","asChild","props","ref","Comp","Slot","jsx","cn","FUNC_ERROR_TEXT","NAN","symbolTag","reTrim","reIsBadHex","reIsBinary","reIsOctal","freeParseInt","freeGlobal","global","freeSelf","root","objectProto","objectToString","nativeMax","nativeMin","now","debounce","func","wait","options","lastArgs","lastThis","maxWait","result","timerId","lastCallTime","lastInvokeTime","leading","maxing","trailing","toNumber","isObject","invokeFunc","time","args","thisArg","leadingEdge","timerExpired","remainingWait","timeSinceLastCall","timeSinceLastInvoke","shouldInvoke","trailingEdge","cancel","flush","debounced","isInvoking","value","type","isObjectLike","isSymbol","other","isBinary","lodash_debounce"],"mappings":"qMAWA,MAAMA,GAAiBC,GACrB,0WACA,CACE,SAAU,CACR,QAAS,CACP,QAAS,yDACT,YACE,qEACF,QACE,iFACF,UACE,+DACF,MAAO,+CACP,KAAM,iDAAA,EAIR,KAAM,CACJ,QAAS,gBACT,GAAI,WACJ,GAAI,YACJ,KAAM,SAAA,CACR,EAEF,gBAAiB,CACf,QAAS,UACT,KAAM,SAAA,CACR,CAEJ,EAQMC,GAASC,EAAAA,WACb,CAAC,CAAE,UAAAC,EAAW,QAAAC,EAAS,KAAAC,EAAM,QAAAC,EAAU,GAAO,GAAGC,CAAA,EAASC,IAAQ,CAChE,MAAMC,EAAOH,EAAUI,EAAO,SAC9B,OACEC,EAAAA,IAACF,EAAA,CACC,UAAWG,GAAGb,GAAe,CAAE,QAAAK,EAAS,KAAAC,EAAM,UAAAF,CAAA,CAAW,CAAC,EAC1D,IAAAK,EACC,GAAGD,CAAA,CAAA,CAGV,CACF,EACAN,GAAO,YAAc,iDClDrB,IAAIY,EAAkB,sBAGlBC,EAAM,IAGNC,EAAY,kBAGZC,EAAS,aAGTC,EAAa,qBAGbC,EAAa,aAGbC,EAAY,cAGZC,EAAe,SAGfC,EAAa,OAAOC,GAAU,UAAYA,GAAUA,EAAO,SAAW,QAAUA,EAGhFC,EAAW,OAAO,MAAQ,UAAY,MAAQ,KAAK,SAAW,QAAU,KAGxEC,EAAOH,GAAcE,GAAY,SAAS,aAAa,EAAC,EAGxDE,EAAc,OAAO,UAOrBC,EAAiBD,EAAY,SAG7BE,EAAY,KAAK,IACjBC,EAAY,KAAK,IAkBjBC,EAAM,UAAW,CACnB,OAAOL,EAAK,KAAK,IAAG,CACtB,EAwDA,SAASM,EAASC,EAAMC,EAAMC,EAAS,CACrC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAAiB,EACjBC,EAAU,GACVC,EAAS,GACTC,EAAW,GAEf,GAAI,OAAOZ,GAAQ,WACjB,MAAM,IAAI,UAAUlB,CAAe,EAErCmB,EAAOY,EAASZ,CAAI,GAAK,EACrBa,EAASZ,CAAO,IAClBQ,EAAU,CAAC,CAACR,EAAQ,QACpBS,EAAS,YAAaT,EACtBG,EAAUM,EAASf,EAAUiB,EAASX,EAAQ,OAAO,GAAK,EAAGD,CAAI,EAAII,EACrEO,EAAW,aAAcV,EAAU,CAAC,CAACA,EAAQ,SAAWU,GAG1D,SAASG,EAAWC,EAAM,CACxB,IAAIC,EAAOd,EACPe,EAAUd,EAEd,OAAAD,EAAWC,EAAW,OACtBK,EAAiBO,EACjBV,EAASN,EAAK,MAAMkB,EAASD,CAAI,EAC1BX,CACX,CAEE,SAASa,EAAYH,EAAM,CAEzB,OAAAP,EAAiBO,EAEjBT,EAAU,WAAWa,EAAcnB,CAAI,EAEhCS,EAAUK,EAAWC,CAAI,EAAIV,CACxC,CAEE,SAASe,EAAcL,EAAM,CAC3B,IAAIM,EAAoBN,EAAOR,EAC3Be,EAAsBP,EAAOP,EAC7BH,EAASL,EAAOqB,EAEpB,OAAOX,EAASd,EAAUS,EAAQD,EAAUkB,CAAmB,EAAIjB,CACvE,CAEE,SAASkB,EAAaR,EAAM,CAC1B,IAAIM,EAAoBN,EAAOR,EAC3Be,EAAsBP,EAAOP,EAKjC,OAAQD,IAAiB,QAAcc,GAAqBrB,GACzDqB,EAAoB,GAAOX,GAAUY,GAAuBlB,CACnE,CAEE,SAASe,GAAe,CACtB,IAAIJ,EAAOlB,EAAG,EACd,GAAI0B,EAAaR,CAAI,EACnB,OAAOS,EAAaT,CAAI,EAG1BT,EAAU,WAAWa,EAAcC,EAAcL,CAAI,CAAC,CAC1D,CAEE,SAASS,EAAaT,EAAM,CAK1B,OAJAT,EAAU,OAINK,GAAYT,EACPY,EAAWC,CAAI,GAExBb,EAAWC,EAAW,OACfE,EACX,CAEE,SAASoB,GAAS,CACZnB,IAAY,QACd,aAAaA,CAAO,EAEtBE,EAAiB,EACjBN,EAAWK,EAAeJ,EAAWG,EAAU,MACnD,CAEE,SAASoB,GAAQ,CACf,OAAOpB,IAAY,OAAYD,EAASmB,EAAa3B,EAAG,CAAE,CAC9D,CAEE,SAAS8B,GAAY,CACnB,IAAIZ,EAAOlB,EAAG,EACV+B,EAAaL,EAAaR,CAAI,EAMlC,GAJAb,EAAW,UACXC,EAAW,KACXI,EAAeQ,EAEXa,EAAY,CACd,GAAItB,IAAY,OACd,OAAOY,EAAYX,CAAY,EAEjC,GAAIG,EAEF,OAAAJ,EAAU,WAAWa,EAAcnB,CAAI,EAChCc,EAAWP,CAAY,CAEtC,CACI,OAAID,IAAY,SACdA,EAAU,WAAWa,EAAcnB,CAAI,GAElCK,CACX,CACE,OAAAsB,EAAU,OAASF,EACnBE,EAAU,MAAQD,EACXC,CACT,CA2BA,SAASd,EAASgB,EAAO,CACvB,IAAIC,EAAO,OAAOD,EAClB,MAAO,CAAC,CAACA,IAAUC,GAAQ,UAAYA,GAAQ,WACjD,CA0BA,SAASC,EAAaF,EAAO,CAC3B,MAAO,CAAC,CAACA,GAAS,OAAOA,GAAS,QACpC,CAmBA,SAASG,EAASH,EAAO,CACvB,OAAO,OAAOA,GAAS,UACpBE,EAAaF,CAAK,GAAKnC,EAAe,KAAKmC,CAAK,GAAK9C,CAC1D,CAyBA,SAAS6B,EAASiB,EAAO,CACvB,GAAI,OAAOA,GAAS,SAClB,OAAOA,EAET,GAAIG,EAASH,CAAK,EAChB,OAAO/C,EAET,GAAI+B,EAASgB,CAAK,EAAG,CACnB,IAAII,EAAQ,OAAOJ,EAAM,SAAW,WAAaA,EAAM,QAAO,EAAKA,EACnEA,EAAQhB,EAASoB,CAAK,EAAKA,EAAQ,GAAMA,CAC7C,CACE,GAAI,OAAOJ,GAAS,SAClB,OAAOA,IAAU,EAAIA,EAAQ,CAACA,EAEhCA,EAAQA,EAAM,QAAQ7C,EAAQ,EAAE,EAChC,IAAIkD,EAAWhD,EAAW,KAAK2C,CAAK,EACpC,OAAQK,GAAY/C,EAAU,KAAK0C,CAAK,EACpCzC,EAAayC,EAAM,MAAM,CAAC,EAAGK,EAAW,EAAI,CAAC,EAC5CjD,EAAW,KAAK4C,CAAK,EAAI/C,EAAM,CAAC+C,CACvC,CAEA,OAAAM,EAAiBrC","x_google_ignoreList":[1]}
1
+ {"version":3,"file":"index-Db2WFiF0.js","sources":["../../../src/client/components/ui/button.tsx","../../../../../node_modules/.pnpm/lodash.debounce@4.0.8/node_modules/lodash.debounce/index.js"],"sourcesContent":["import * as React from 'react';\nimport { Slot } from '@radix-ui/react-slot';\nimport { type VariantProps, cva } from 'class-variance-authority';\nimport { cn } from '@/lib/utils';\n\n/**\n * Wiseair button. Flat 2px-cornered controls — the system separates planes\n * with hairlines and the cool page grey, not with elevation, so no variant\n * carries a shadow. `outline` is a bordered field (`border-input\n * bg-background`), not an accent-filled pill.\n */\nconst buttonVariants = cva(\n 'inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-sm text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 cursor-pointer',\n {\n variants: {\n variant: {\n default: 'bg-primary text-primary-foreground hover:bg-primary/90',\n destructive:\n 'bg-destructive text-destructive-foreground hover:bg-destructive/90',\n outline:\n 'border border-input bg-background hover:bg-accent hover:text-accent-foreground',\n secondary:\n 'bg-secondary text-secondary-foreground hover:bg-secondary/80',\n ghost: 'hover:bg-accent hover:text-accent-foreground',\n link: 'text-primary underline-offset-4 hover:underline',\n },\n /* Heights follow the Wiseair Dashboard control rhythm (36 / 32 / 40),\n one step tighter than the shadcn defaults. */\n size: {\n default: 'h-9 px-4 py-2',\n sm: 'h-8 px-3',\n lg: 'h-10 px-8',\n icon: 'h-9 w-9',\n },\n },\n defaultVariants: {\n variant: 'default',\n size: 'default',\n },\n }\n);\n\nexport interface ButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement>,\n VariantProps<typeof buttonVariants> {\n asChild?: boolean;\n}\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n ({ className, variant, size, asChild = false, ...props }, ref) => {\n const Comp = asChild ? Slot : 'button';\n return (\n <Comp\n className={cn(buttonVariants({ variant, size, className }))}\n ref={ref}\n {...props}\n />\n );\n }\n);\nButton.displayName = 'Button';\n\nexport { Button, buttonVariants };\n","/**\n * lodash (Custom Build) <https://lodash.com/>\n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright jQuery Foundation and other contributors <https://jquery.org/>\n * Released under MIT license <https://lodash.com/license>\n * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>\n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n */\n\n/** Used as the `TypeError` message for \"Functions\" methods. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/** Used as references for various `Number` constants. */\nvar NAN = 0 / 0;\n\n/** `Object#toString` result references. */\nvar symbolTag = '[object Symbol]';\n\n/** Used to match leading and trailing whitespace. */\nvar reTrim = /^\\s+|\\s+$/g;\n\n/** Used to detect bad signed hexadecimal string values. */\nvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n/** Used to detect binary string values. */\nvar reIsBinary = /^0b[01]+$/i;\n\n/** Used to detect octal string values. */\nvar reIsOctal = /^0o[0-7]+$/i;\n\n/** Built-in method references without a dependency on `root`. */\nvar freeParseInt = parseInt;\n\n/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objectToString = objectProto.toString;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max,\n nativeMin = Math.min;\n\n/**\n * Gets the timestamp of the number of milliseconds that have elapsed since\n * the Unix epoch (1 January 1970 00:00:00 UTC).\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Date\n * @returns {number} Returns the timestamp.\n * @example\n *\n * _.defer(function(stamp) {\n * console.log(_.now() - stamp);\n * }, _.now());\n * // => Logs the number of milliseconds it took for the deferred invocation.\n */\nvar now = function() {\n return root.Date.now();\n};\n\n/**\n * Creates a debounced function that delays invoking `func` until after `wait`\n * milliseconds have elapsed since the last time the debounced function was\n * invoked. The debounced function comes with a `cancel` method to cancel\n * delayed `func` invocations and a `flush` method to immediately invoke them.\n * Provide `options` to indicate whether `func` should be invoked on the\n * leading and/or trailing edge of the `wait` timeout. The `func` is invoked\n * with the last arguments provided to the debounced function. Subsequent\n * calls to the debounced function return the result of the last `func`\n * invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the debounced function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.debounce` and `_.throttle`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to debounce.\n * @param {number} [wait=0] The number of milliseconds to delay.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=false]\n * Specify invoking on the leading edge of the timeout.\n * @param {number} [options.maxWait]\n * The maximum time `func` is allowed to be delayed before it's invoked.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new debounced function.\n * @example\n *\n * // Avoid costly calculations while the window size is in flux.\n * jQuery(window).on('resize', _.debounce(calculateLayout, 150));\n *\n * // Invoke `sendMail` when clicked, debouncing subsequent calls.\n * jQuery(element).on('click', _.debounce(sendMail, 300, {\n * 'leading': true,\n * 'trailing': false\n * }));\n *\n * // Ensure `batchLog` is invoked once after 1 second of debounced calls.\n * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });\n * var source = new EventSource('/stream');\n * jQuery(source).on('message', debounced);\n *\n * // Cancel the trailing debounced invocation.\n * jQuery(window).on('popstate', debounced.cancel);\n */\nfunction debounce(func, wait, options) {\n var lastArgs,\n lastThis,\n maxWait,\n result,\n timerId,\n lastCallTime,\n lastInvokeTime = 0,\n leading = false,\n maxing = false,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n wait = toNumber(wait) || 0;\n if (isObject(options)) {\n leading = !!options.leading;\n maxing = 'maxWait' in options;\n maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n\n function invokeFunc(time) {\n var args = lastArgs,\n thisArg = lastThis;\n\n lastArgs = lastThis = undefined;\n lastInvokeTime = time;\n result = func.apply(thisArg, args);\n return result;\n }\n\n function leadingEdge(time) {\n // Reset any `maxWait` timer.\n lastInvokeTime = time;\n // Start the timer for the trailing edge.\n timerId = setTimeout(timerExpired, wait);\n // Invoke the leading edge.\n return leading ? invokeFunc(time) : result;\n }\n\n function remainingWait(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime,\n result = wait - timeSinceLastCall;\n\n return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result;\n }\n\n function shouldInvoke(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime;\n\n // Either this is the first call, activity has stopped and we're at the\n // trailing edge, the system time has gone backwards and we're treating\n // it as the trailing edge, or we've hit the `maxWait` limit.\n return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||\n (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));\n }\n\n function timerExpired() {\n var time = now();\n if (shouldInvoke(time)) {\n return trailingEdge(time);\n }\n // Restart the timer.\n timerId = setTimeout(timerExpired, remainingWait(time));\n }\n\n function trailingEdge(time) {\n timerId = undefined;\n\n // Only invoke if we have `lastArgs` which means `func` has been\n // debounced at least once.\n if (trailing && lastArgs) {\n return invokeFunc(time);\n }\n lastArgs = lastThis = undefined;\n return result;\n }\n\n function cancel() {\n if (timerId !== undefined) {\n clearTimeout(timerId);\n }\n lastInvokeTime = 0;\n lastArgs = lastCallTime = lastThis = timerId = undefined;\n }\n\n function flush() {\n return timerId === undefined ? result : trailingEdge(now());\n }\n\n function debounced() {\n var time = now(),\n isInvoking = shouldInvoke(time);\n\n lastArgs = arguments;\n lastThis = this;\n lastCallTime = time;\n\n if (isInvoking) {\n if (timerId === undefined) {\n return leadingEdge(lastCallTime);\n }\n if (maxing) {\n // Handle invocations in a tight loop.\n timerId = setTimeout(timerExpired, wait);\n return invokeFunc(lastCallTime);\n }\n }\n if (timerId === undefined) {\n timerId = setTimeout(timerExpired, wait);\n }\n return result;\n }\n debounced.cancel = cancel;\n debounced.flush = flush;\n return debounced;\n}\n\n/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return !!value && typeof value == 'object';\n}\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && objectToString.call(value) == symbolTag);\n}\n\n/**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3.2);\n * // => 3.2\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3.2');\n * // => 3.2\n */\nfunction toNumber(value) {\n if (typeof value == 'number') {\n return value;\n }\n if (isSymbol(value)) {\n return NAN;\n }\n if (isObject(value)) {\n var other = typeof value.valueOf == 'function' ? value.valueOf() : value;\n value = isObject(other) ? (other + '') : other;\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value;\n }\n value = value.replace(reTrim, '');\n var isBinary = reIsBinary.test(value);\n return (isBinary || reIsOctal.test(value))\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : (reIsBadHex.test(value) ? NAN : +value);\n}\n\nmodule.exports = debounce;\n"],"names":["buttonVariants","cva","Button","React.forwardRef","className","variant","size","asChild","props","ref","Comp","Slot","jsx","cn","FUNC_ERROR_TEXT","NAN","symbolTag","reTrim","reIsBadHex","reIsBinary","reIsOctal","freeParseInt","freeGlobal","global","freeSelf","root","objectProto","objectToString","nativeMax","nativeMin","now","debounce","func","wait","options","lastArgs","lastThis","maxWait","result","timerId","lastCallTime","lastInvokeTime","leading","maxing","trailing","toNumber","isObject","invokeFunc","time","args","thisArg","leadingEdge","timerExpired","remainingWait","timeSinceLastCall","timeSinceLastInvoke","shouldInvoke","trailingEdge","cancel","flush","debounced","isInvoking","value","type","isObjectLike","isSymbol","other","isBinary","lodash_debounce"],"mappings":"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","x_google_ignoreList":[1]}
@@ -1,4 +1,4 @@
1
- import{r as x,j as t,c as w}from"./react-vendor-BmQ2Ko_D.js";import{S as oe,c as v,j as bt,i as Jt,F,w as Yt,Q as Kt,p as Xt,x as dt,u as jt,a as _e,h as yt}from"./index-2S58SOrb.js";import{p as ne,L as $e,S as Re,a as Ae,b as Le,c as Fe,d as be,q as Zt,r as qt,B as es,P as ts,s as ss,v as ns,w as rs,x as as,y as is}from"./HomePage-DgyrBIGY.js";import{B as We}from"./index-CWzQeme_.js";import{e as wt,W as Y,y as K,ad as os,R as Nt,ae as Je,$ as ls,af as St,z as cs,ag as ds,ah as us,U as ms,g as fs}from"./ui-vendor-BsAtAN16.js";import xs from"./monaco-editor-DJsdM0WK.js";import{X as re,Y as hs,R as Ge,Z as ps,_ as gs,$ as vs,e as bs,r as le,g as W,v as js,N as ys,O as ws}from"./useQualityAnalysis-B0tasjoU.js";import{f as _,a as L,b as Ye,T as Ns,g as ut,d as Ss,y as ks,h as Es}from"./MonacoPluginProvider-DbBCCotq.js";import{ah as kt,ai as Ts}from"./radix-ui-BzbaiLpZ.js";import"./query-vendor--rhYD8mC.js";import"./state-vendor-Cq67_JbF.js";function Et(e){const[s]=x.useState(()=>Date.now()),n=e??s,[r,o]=x.useState(()=>Date.now());return x.useEffect(()=>{const a=setInterval(()=>o(Date.now()),100);return()=>clearInterval(a)},[]),Math.max(0,(r-n)/1e3)}function Cs(e){var s,n;if(!e)return null;try{const r=JSON.parse(e);if(!r||typeof r!="object")return null;const o=new Map,a=[r];for(;a.length>0;){const m=a.pop();if(!m||typeof m!="object")continue;const{name:u,children:f}=m;typeof u=="string"&&o.set(u,(o.get(u)??0)+1),Array.isArray(f)&&a.push(...f)}const i=[["slide","slide","slides"],["section","section","sections"],["visual","visual","visuals"],["chart","chart","charts"],["image","image","images"],["table","table","tables"],["shape","shape","shapes"],["paragraph","paragraph","paragraphs"]].map(([m,u,f])=>{const c=o.get(m)??0;return{label:c===1?u:f,count:c}}).filter(m=>m.count>0).slice(0,5),d=(n=(s=r.props)==null?void 0:s.metadata)==null?void 0:n.title;return{title:typeof d=="string"?d:void 0,counts:i,visualCount:(o.get("visual")??0)+(o.get("chart")??0),imageCount:o.get("image")??0}}catch{return null}}function $s(e){const s=[];return e&&e.visualCount>0&&s.push(`${e.visualCount} visual${e.visualCount===1?"":"s"} in this document ${e.visualCount===1?"is":"are"} rasterized on first build — later builds reuse the cached renders.`),e&&e.imageCount>3&&s.push("Large embedded images dominate build time — downscaling them speeds up iteration."),s.push("Re-running an unchanged document is served from the cache almost instantly.","Generation warnings, if any, will appear above the preview when the build completes."),s}const Rs=()=>t.jsx("svg",{className:"h-3.5 w-3.5 text-success",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:t.jsx("path",{d:"M3 8.5L6.5 12L13 4.5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})});function As({className:e,currentStage:s="parsing",message:n,documentText:r,startedAt:o,onCancel:a}){const l=["parsing","building","rendering","finalizing"],i={parsing:"Validating JSON",building:"Building structure",rendering:"Rendering content",finalizing:"Finalizing document"},d=l.indexOf(s),m=Et(o),u=x.useMemo(()=>Cs(r),[r]),f=x.useMemo(()=>$s(u),[u]),c=m>3,p=Math.floor(Math.max(0,m-3)/5)%f.length;return t.jsxs("div",{className:v("p-6 max-w-lg mx-auto space-y-5",e),children:[t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[t.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[t.jsx(oe,{size:"md"}),t.jsxs("div",{className:"space-y-0.5 min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:u!=null&&u.title?`Generating “${u.title}”`:"Generating document"}),t.jsx("p",{className:"text-xs text-muted-foreground truncate",role:"status","aria-live":"polite",children:n||`${i[s]}...`})]})]}),t.jsxs("span",{className:"shrink-0 rounded-full bg-secondary px-2 py-0.5 text-xs text-muted-foreground tabular-nums","aria-hidden":"true",children:[m.toFixed(1),"s"]})]}),u&&u.counts.length>0&&t.jsx("div",{className:"flex flex-wrap gap-1.5","aria-label":"Document contents",children:u.counts.map(({label:b,count:$})=>t.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-xs text-muted-foreground",children:[t.jsx("span",{className:"font-medium text-foreground tabular-nums",children:$}),b]},b))}),t.jsx("div",{className:"space-y-3",children:l.map((b,$)=>{const M=$===d,N=$<d;return t.jsxs("div",{className:"space-y-1.5",children:[t.jsxs("div",{className:"flex items-center justify-between text-xs",children:[t.jsx("span",{className:v(M?"text-primary font-medium":N?"text-muted-foreground":"text-muted-foreground/60"),children:i[b]}),N?t.jsx(Rs,{}):M?t.jsx(oe,{size:"sm",className:"h-3.5 w-3.5"}):t.jsx("span",{className:"h-3.5 w-3.5 rounded-full border border-muted-foreground/40"})]}),t.jsx("div",{className:"w-full bg-secondary rounded-full h-1.5 overflow-hidden",children:N?t.jsx("div",{className:"h-full w-full rounded-full bg-success"}):M?t.jsx("div",{className:"h-full w-2/5 rounded-full bg-primary animate-progress-indeterminate"}):null})]},b)})}),t.jsxs("div",{className:"flex items-center justify-between gap-3 min-h-8",children:[t.jsx("p",{className:v("text-xs text-muted-foreground/80 italic transition-opacity duration-500",c?"opacity-100":"opacity-0"),children:f[p]}),a&&t.jsx(We,{variant:"outline",size:"sm",onClick:a,className:"shrink-0",children:"Cancel"})]})]})}function Ls({mode:e,message:s,startedAt:n,onCancel:r,className:o}){const a=Et(n);return t.jsxs("div",{className:v("flex flex-col items-center gap-2 rounded-md border bg-background/95 px-6 py-4 shadow-sm",o),children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(oe,{size:"md"}),t.jsx("p",{className:"text-sm font-medium",role:"status","aria-live":"polite",children:e==="generating"?"Generating":"Rendering"}),t.jsxs("span",{className:"rounded-full bg-secondary px-2 py-0.5 text-xs text-muted-foreground tabular-nums","aria-hidden":"true",children:[a.toFixed(1),"s"]})]}),s&&t.jsx("p",{className:"max-w-xs text-center text-xs text-muted-foreground truncate",children:s}),e==="generating"&&r&&t.jsx(We,{variant:"outline",size:"sm",onClick:r,children:"Cancel"})]})}function Fs({renderingLibrary:e,className:s}){const n=a=>{switch(a){case"LibreOffice":return{name:"LibreOffice",description:"Converting document to PDF locally..."};case"Office":return{name:"Microsoft Office",description:"Uploading file and loading Office viewer..."};case"Docs":return{name:"Google Docs",description:"Uploading file and loading Docs viewer..."};default:return{name:"Default",description:"Processing document..."}}},{name:r,description:o}=n(e);return t.jsxs("div",{className:v("flex flex-col items-center justify-center h-full p-8 space-y-4",s),children:[t.jsx(oe,{size:"lg"}),t.jsxs("div",{className:"text-center space-y-2",children:[t.jsx("p",{className:"text-sm font-medium",children:"Rendering Preview"}),t.jsxs("p",{className:"text-xs text-muted-foreground",children:["Using ",r," renderer"]}),t.jsx("p",{className:"text-xs text-muted-foreground/80",children:o})]}),t.jsxs("div",{className:"w-full max-w-md space-y-3",children:[t.jsx(ne,{className:"h-16 w-full"}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"h-4 w-full"}),t.jsx(ne,{className:"h-4 w-3/4"}),t.jsx(ne,{className:"h-4 w-1/2"})]}),t.jsx(ne,{className:"h-12 w-full"})]})]})}const Tt=w.forwardRef(({isLoading:e,iframeSrc:s,iframeSrcDoc:n,isGenerating:r,generationProgress:o,generationDocumentText:a,generationStartedAt:l,onCancelGeneration:i},d)=>{const[m,u]=x.useState(!1);x.useEffect(()=>{u(!1)},[s,n]);const f=()=>{u(!0)},c=()=>{console.warn("Iframe failed to load content"),u(!1)},p=n?"allow-scripts allow-popups allow-forms":void 0,b=!!(s||n);return r&&!b?t.jsx("div",{className:"grow",children:t.jsx(As,{currentStage:o==null?void 0:o.stage,message:o==null?void 0:o.message,documentText:a,startedAt:l,onCancel:i})}):e&&!b?t.jsx("div",{className:"grow",children:t.jsx(Fs,{renderingLibrary:"LibreOffice"})}):b?t.jsxs("div",{className:"h-full w-full relative bg-white",children:[!m&&t.jsx("div",{className:"absolute inset-0 bg-muted/80 flex items-center justify-center z-10",children:t.jsxs("div",{className:"text-center",children:[t.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-foreground mx-auto mb-2"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading preview..."})]})}),(r||e)&&t.jsx("div",{className:"absolute inset-0 bg-background/60 backdrop-blur-[2px] flex items-center justify-center z-20 transition-opacity duration-200",children:t.jsx(Ls,{mode:r?"generating":"rendering",message:r?o==null?void 0:o.message:void 0,startedAt:r?l:void 0,onCancel:r?i:void 0})}),t.jsx("iframe",{ref:d,className:"w-full h-full border-0",style:{backgroundColor:"white",opacity:m?1:0,transition:"opacity 0.2s ease-in-out"},src:s,srcDoc:n,onLoad:f,onError:c,sandbox:p,title:"Document preview","aria-label":`Preview of rendered ${bt.toLowerCase()}`},n?"srcdoc":"src")]}):null});Tt.displayName="PreviewFrame";const Ms=w.memo(Tt);function Ps({warnings:e,className:s}){const[n,r]=w.useState(!1),o=w.useMemo(()=>(e??[]).filter(a=>a.component!=="quality"),[e]);return o.length===0?null:t.jsxs("div",{className:s,children:[t.jsxs("button",{type:"button",onClick:()=>r(!n),className:"flex w-full items-center gap-2 rounded-sm border border-transparent bg-warning/10 px-3 py-1.5 text-left transition-colors hover:bg-warning/20",children:[t.jsx(wt,{className:`h-3.5 w-3.5 text-warning transition-transform flex-shrink-0 ${n?"rotate-90":""}`}),t.jsx(Y,{className:"h-3.5 w-3.5 text-warning flex-shrink-0"}),t.jsxs("span",{className:"text-xs font-medium text-warning",children:[o.length," warning",o.length!==1?"s":""]})]}),n&&t.jsx("div",{className:"mt-1.5 space-y-1.5",children:o.map((a,l)=>t.jsxs("div",{className:"flex items-start gap-2 rounded-sm border bg-card px-3 py-2",children:[a.severity==="info"?t.jsx(K,{className:"h-3.5 w-3.5 mt-0.5 text-data-blue flex-shrink-0"}):t.jsx(Y,{className:"h-3.5 w-3.5 mt-0.5 text-warning flex-shrink-0"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("code",{className:"text-[11px] font-medium text-warning bg-warning/15 px-1 py-0.5 rounded-sm",children:a.component}),a.severity==="info"&&t.jsx("span",{className:"text-[10px] uppercase tracking-wide text-data-blue font-medium",children:"info"})]}),t.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground leading-relaxed",children:a.message}),a.context&&Object.keys(a.context).length>0&&t.jsxs("details",{className:"mt-1.5",children:[t.jsx("summary",{className:"text-[11px] text-muted-foreground/70 cursor-pointer hover:text-foreground",children:"Context"}),t.jsx("pre",{className:"mt-1 text-[11px] bg-header-bg p-1.5 rounded-sm overflow-x-auto text-muted-foreground",children:JSON.stringify(a.context,null,2)})]})]})]},l))})]})}function Is({className:e}){const{resolvedTheme:s}=Jt(),n=_(c=>c.qualityPolicies),r=_(c=>c.setSettings),o=n==null?void 0:n[F],[a,l]=x.useState(o??re),i=x.useMemo(()=>hs(a),[a]),d=x.useMemo(()=>Yt().map(c=>c.id),[]),m=x.useCallback(c=>{l(c),r({qualityPolicies:{...n,[F]:c}})},[n,r]),u=x.useRef(null),f=x.useCallback(()=>{const c=u.current;c?c.setValue(re):m(re)},[m]);return t.jsxs("div",{className:v("flex min-w-0 flex-col gap-2",e),children:[t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsx("span",{className:"text-[11px] leading-snug text-muted-foreground",children:"Rule severity, parameters and suppressions. The gate and profile stay with their controls above."}),t.jsxs("button",{type:"button",onClick:f,disabled:a===re,title:a===re?"The policy is already empty":"Clear the policy back to an empty one",className:v("flex flex-shrink-0 items-center gap-1 rounded-sm px-1.5 py-0.5","text-[11px] font-medium text-muted-foreground transition-colors","hover:bg-accent hover:text-foreground","focus-visible:ring-1 focus-visible:ring-ring focus-visible:outline-none","disabled:pointer-events-none disabled:opacity-40"),children:[t.jsx(os,{className:"h-3 w-3","aria-hidden":"true"}),"Reset"]})]}),t.jsx("div",{className:"overflow-hidden rounded-sm border",children:t.jsx(xs,{height:"180px",language:"json",path:Kt,theme:s==="dark"?"vs-dark":"vs",defaultValue:a,onMount:c=>{u.current=c},onChange:c=>m(c??""),options:{minimap:{enabled:!1},lineNumbers:"off",folding:!1,scrollBeyondLastLine:!1,fontSize:11,lineHeight:17,tabSize:2,renderLineHighlight:"none",overviewRulerLanes:0,scrollbar:{verticalScrollbarSize:8,horizontalScrollbarSize:8},padding:{top:8,bottom:8},automaticLayout:!0}})}),i.ok?t.jsx("p",{className:"text-[11px] leading-snug text-muted-foreground",children:i.policy?"Applied to every analysis and build.":"Empty — the profile decides on its own."}):t.jsxs("p",{className:"flex items-start gap-1.5 text-[11px] leading-snug text-destructive",children:[t.jsx(Y,{className:"mt-0.5 h-3 w-3 flex-shrink-0","aria-hidden":"true"}),t.jsxs("span",{children:[i.error," Until this parses, the run ignores it."]})]}),t.jsxs("details",{className:"text-[11px] text-muted-foreground",children:[t.jsx("summary",{className:"cursor-pointer hover:text-foreground",children:"Rules in this format"}),t.jsx("ul",{className:"mt-1 space-y-0.5 pl-3",children:d.map(c=>t.jsx("li",{className:"font-mono text-[10px]",children:c},c))})]})]})}const Qe="__default__",Os={docx:[{value:"executive-report",label:"Executive report",description:"Short decision document with strict outline continuity"},{value:"technical-report",label:"Technical report",description:"Numbered sections under a running head, a source under every figure, every size on the theme scale, at least one chart or table"},{value:"legal-appendix",label:"Legal appendix",description:"Dense appendix: preserve integrity without editorial taste"},{value:"general",label:"General",description:"The format default: integrity and information design, nothing required by structure"}],pptx:[{value:"executive-presentation",label:"Executive presentation",description:"Decision deck optimized for scan speed and projection"},{value:"technical-presentation",label:"Technical presentation",description:"Portable professional presentation defaults"}]},zs={docx:"general",pptx:"technical-presentation"},Me=[{value:"none",label:"Never blocks",description:"Findings are reported and the run always finishes"},{value:"error",label:"Blocks on errors",description:"Generation fails when a finding is an error"},{value:"warning",label:"Blocks on warnings",description:"Generation fails on any warning or error"},{value:"info",label:"Blocks on anything",description:"Generation fails on any finding, info included"}],Pe=[{value:"error",label:"Errors only",description:"Warnings and info stay hidden"},{value:"warning",label:"Warnings and errors",description:"Info stays hidden"},{value:"info",label:"Everything",description:"Every finding the analysis produced"}],Ie="h-8 min-h-0 w-full gap-1.5 px-2 text-xs [&>span]:truncate [&>span]:whitespace-nowrap",Oe="max-w-[min(20rem,var(--radix-select-content-available-width))]",ze="flex items-center gap-1.5 text-xs",Se="text-[11px] leading-snug text-muted-foreground",mt={value:Qe,label:"Default",description:`The format's own profile (${zs[F]})`};function De({children:e}){return t.jsx("span",{className:"text-[10px] font-semibold tracking-wide text-muted-foreground uppercase",children:e})}function je({choice:e}){return t.jsxs("span",{className:"flex min-w-0 flex-col gap-0.5",children:[t.jsx("span",{className:"font-medium",children:e.label}),t.jsx("span",{className:Se,children:e.description})]})}function Ds({className:e}){const s=x.useId(),n=_(c=>c.qualityProfileIds),r=n==null?void 0:n[F],o=_(c=>c.qualityGate)??"none",a=_(c=>c.qualityMinSeverity)??"warning",l=_(c=>c.setSettings),i=Os[F],m=i.find(c=>c.value===r)??mt,u=Me.find(c=>c.value===o)??Me[0],f=Pe.find(c=>c.value===a)??Pe[1];return t.jsxs("div",{className:v("flex w-full min-w-0 flex-col gap-5",e),children:[t.jsxs("div",{className:"flex min-w-0 flex-col gap-3",children:[t.jsx(De,{children:"Run policy"}),t.jsxs("div",{className:"grid min-w-0 gap-1.5",children:[t.jsxs($e,{htmlFor:`${s}-profile`,className:ze,children:[t.jsx(Nt,{className:"h-3.5 w-3.5 shrink-0 opacity-60"}),"Profile"]}),t.jsxs(Re,{value:m.value,onValueChange:c=>l({qualityProfileIds:{...n,[F]:c===Qe?void 0:c}}),children:[t.jsx(Ae,{id:`${s}-profile`,"aria-describedby":`${s}-profile-help`,className:Ie,children:t.jsx(Le,{children:t.jsx("span",{className:"font-medium",children:m.label})})}),t.jsxs(Fe,{className:Oe,children:[t.jsx(be,{value:Qe,className:"text-xs",children:t.jsx(je,{choice:mt})}),i.map(c=>t.jsx(be,{value:c.value,className:"text-xs",children:t.jsx(je,{choice:c})},c.value))]})]}),t.jsx("p",{id:`${s}-profile-help`,className:Se,children:m.description})]}),t.jsxs("div",{className:"grid min-w-0 gap-1.5",children:[t.jsxs($e,{htmlFor:`${s}-gate`,className:ze,children:[t.jsx(Je,{className:"h-3.5 w-3.5 shrink-0 opacity-60"}),"Gate"]}),t.jsxs(Re,{value:u.value,onValueChange:c=>l({qualityGate:c}),children:[t.jsx(Ae,{id:`${s}-gate`,"aria-describedby":`${s}-gate-help`,className:Ie,children:t.jsx(Le,{children:t.jsx("span",{className:"font-medium",children:u.label})})}),t.jsx(Fe,{className:Oe,children:Me.map(c=>t.jsx(be,{value:c.value,className:"text-xs",children:t.jsx(je,{choice:c})},c.value))})]}),t.jsxs("p",{id:`${s}-gate-help`,className:Se,children:[u.description,"."]})]})]}),t.jsx("div",{className:"h-px shrink-0 bg-border/60"}),t.jsxs("div",{className:"flex min-w-0 flex-col gap-3",children:[t.jsx(De,{children:"Rule policy"}),t.jsx(Is,{})]}),t.jsx("div",{className:"h-px shrink-0 bg-border/60"}),t.jsxs("div",{className:"flex min-w-0 flex-col gap-3",children:[t.jsx(De,{children:"Panel display"}),t.jsxs("div",{className:"grid min-w-0 gap-1.5",children:[t.jsxs($e,{htmlFor:`${s}-severity`,className:ze,children:[t.jsx(ls,{className:"h-3.5 w-3.5 shrink-0 opacity-60"}),"Show"]}),t.jsxs(Re,{value:f.value,onValueChange:c=>l({qualityMinSeverity:c}),children:[t.jsx(Ae,{id:`${s}-severity`,"aria-describedby":`${s}-severity-help`,className:Ie,children:t.jsx(Le,{children:t.jsx("span",{className:"font-medium",children:f.label})})}),t.jsx(Fe,{className:Oe,children:Pe.map(c=>t.jsx(be,{value:c.value,className:"text-xs",children:t.jsx(je,{choice:c})},c.value))})]}),t.jsx("p",{id:`${s}-severity-help`,className:Se,children:"Filters this panel only. It never changes what the run does."})]})]})]})}const Bs=/^(?:0|[1-9][0-9]*)$/;function _s(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function Gs(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Ke(e){return e===""?[]:(e.startsWith("/")?e.slice(1):e).split("/").map(n=>{const r=_s(n);return Bs.test(r)?Number(r):r})}function Qs(e){return e.map(s=>`/${Gs(String(s))}`).join("")}function Hs(e,s){const n=dt(e,[s]);return n||typeof s!="number"?n:dt(e,[String(s)])}function Us(e,s){if(!e.trim())return null;let n;try{if(n=Xt(e,[],{allowTrailingComma:!0}),!n)return null;for(const r of Ke(s))if(n=Hs(n,r),!n)return null}catch{return null}return{start:n.offset,end:n.offset+n.length}}const Vs=["add","remove","replace","move","copy","test"];function Ws(e,s){try{let n=e;for(let r=0;r<s.length;r++){const o=Js(n,s[r],r);if(!o.ok)return{ok:!1,error:o.error};n=o.value}return{ok:!0,doc:n,applied:s.length}}catch(n){return{ok:!1,error:`quality fix failed: ${Zs(n)}`}}}function Ct(e){return!e||e.length===0?!1:e.every(s=>$t(s.op)?s.op==="move"||s.op==="copy"?typeof s.from=="string":!0:!1)}function Js(e,s,n){const r=`fix #${n+1} (${String(s.op)} "${String(s.path)}")`,o=s.op;if(!$t(o))return j(`${r}: unsupported operation "${String(o)}"`);const a=Ke(s.path);switch(o){case"add":return Be(e,a,s.value,r);case"replace":return Ys(e,a,s.value,r);case"remove":{const l=ft(e,a,r);return l.ok?T(l.value.doc):l}case"copy":{const l=ht(s,r);if(!l.ok)return l;const i=xt(e,l.value.path);return i.ok?Be(e,a,i.value,r):j(`${r}: ${i.error}`)}case"move":{const l=ht(s,r);if(!l.ok)return l;if(Ks(l.value.path,a))return T(e);if(Xs(l.value.path,a))return j(`${r}: ${O(l.value.path)} cannot be moved into its own child`);const i=ft(e,l.value.path,r);return i.ok?Be(i.value.doc,a,i.value.removed,r):i}case"test":{const l=xt(e,a);return l.ok?Ue(l.value,s.value)?T(e):j(`${r}: test failed, the value at the path differs`):j(`${r}: ${l.error}`)}}}function Be(e,s,n,r){if(s.length===0)return T(n);const o=s[s.length-1];return Xe(e,s,r,a=>{if(Array.isArray(a)){const l=o==="-"?a.length:de(o);if(l===null)return j(`${r}: "${String(o)}" is not an array index`);if(l>a.length)return j(`${r}: index ${l} is past the end of the array`);const i=G(a);return i.splice(l,0,n),T(i)}if(H(a)){const l=G(a);return l[String(o)]=n,T(l)}return j(`${r}: ${O(s.slice(0,-1))} is not an object or array`)})}function Ys(e,s,n,r){if(s.length===0)return T(n);const o=s[s.length-1];return Xe(e,s,r,a=>{if(Array.isArray(a)){const l=de(o);if(l===null||l>=a.length)return j(`${r}: "${String(o)}" is not an existing array index`);const i=G(a);return i[l]=n,T(i)}if(H(a)){const l=String(o);if(!ue(a,l))return j(`${r}: "${l}" does not exist`);const i=G(a);return i[l]=n,T(i)}return j(`${r}: ${O(s.slice(0,-1))} is not an object or array`)})}function ft(e,s,n){if(s.length===0)return j(`${n}: the whole document cannot be removed`);const r=s[s.length-1];let o;const a=Xe(e,s,n,l=>{if(Array.isArray(l)){const i=de(r);if(i===null||i>=l.length)return j(`${n}: "${String(r)}" is not an existing array index`);const d=G(l);return o=d.splice(i,1)[0],T(d)}if(H(l)){const i=String(r);if(!ue(l,i))return j(`${n}: "${i}" does not exist`);const d=G(l);return o=d[i],delete d[i],T(d)}return j(`${n}: ${O(s.slice(0,-1))} is not an object or array`)});return a.ok?T({doc:a.value,removed:o}):a}function Xe(e,s,n,r){return He(e,s.slice(0,-1),0,n,r)}function He(e,s,n,r,o){if(n===s.length)return o(e);const a=()=>O(s.slice(0,n+1)),l=s[n];if(Array.isArray(e)){const i=de(l);if(i===null||i>=e.length)return j(`${r}: ${a()} does not exist`);const d=He(e[i],s,n+1,r,o);if(!d.ok)return d;const m=G(e);return m[i]=d.value,T(m)}if(H(e)){const i=String(l);if(!ue(e,i))return j(`${r}: ${a()} does not exist`);const d=He(e[i],s,n+1,r,o);if(!d.ok)return d;const m=G(e);return m[i]=d.value,T(m)}return j(`${r}: ${O(s.slice(0,n))} is not an object or array`)}function xt(e,s){let n=e;for(let r=0;r<s.length;r++){const o=s[r];if(Array.isArray(n)){const a=de(o);if(a===null||a>=n.length)return j(`${O(s.slice(0,r+1))} does not exist`);n=n[a];continue}if(H(n)){const a=String(o);if(!ue(n,a))return j(`${O(s.slice(0,r+1))} does not exist`);n=n[a];continue}return j(`${O(s.slice(0,r))} is not an object or array`)}return T(n)}function ht(e,s){const n=e.from;return typeof n!="string"?j(`${s}: a "from" pointer is required`):T({pointer:n,path:Ke(n)})}function G(e){return Array.isArray(e)?[...e]:{...e}}function de(e){return typeof e=="number"?Number.isInteger(e)&&e>=0?e:null:/^(?:0|[1-9][0-9]*)$/.test(e)?Number(e):null}function O(e){return e.length===0?"the document root":`"${Qs(e)}"`}function $t(e){return Vs.includes(e)}function H(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ue(e,s){return Object.prototype.hasOwnProperty.call(e,s)}function Ks(e,s){return e.length===s.length&&e.every((n,r)=>String(n)===String(s[r]))}function Xs(e,s){return e.length>=s.length?!1:e.every((n,r)=>String(n)===String(s[r]))}function Ue(e,s){if(e===s)return!0;if(Array.isArray(e)||Array.isArray(s))return!Array.isArray(e)||!Array.isArray(s)||e.length!==s.length?!1:e.every((n,r)=>Ue(n,s[r]));if(H(e)&&H(s)){const n=Object.keys(e);return n.length!==Object.keys(s).length?!1:n.every(r=>ue(s,r)&&Ue(e[r],s[r]))}return!1}function Zs(e){return e instanceof Error?e.message:String(e)}function T(e){return{ok:!0,value:e}}function j(e){return{ok:!1,error:e}}const ye=50,Rt=[],At=["error","warning","info"],qs={error:St,warning:Y,info:K},Lt={error:"text-destructive",warning:"text-warning",info:"text-data-blue"},en=new Set(["actual","expected","unit"]);function Ft(e,s){return e==="info"?`${s} info`:`${s} ${e}${s===1?"":"s"}`}function pt(e,s){const n=typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"?String(e):JSON.stringify(e);return s?`${n} ${s}`:n}function tn(e){if(!e)return null;const s={};let n=!1;for(const[r,o]of Object.entries(e))en.has(r)||(s[r]=o,n=!0);return n?s:null}function gt({path:e,onRevealPath:s,muted:n}){const r=v("inline-flex max-w-full items-center gap-1 rounded-sm font-mono text-[10px]",n?"text-muted-foreground/60":"text-muted-foreground/80");return s?t.jsxs("button",{type:"button",onClick:()=>s(e),title:`Reveal ${e} in the editor`,className:v(r,"-mx-1 px-1 py-0.5 transition-colors","hover:bg-accent hover:text-foreground hover:underline","focus-visible:ring-1 focus-visible:ring-ring focus-visible:outline-none"),children:[t.jsx(us,{className:"h-2.5 w-2.5 flex-shrink-0","aria-hidden":"true"}),t.jsx("span",{className:"truncate",children:e})]}):t.jsx("span",{className:r,children:t.jsx("span",{className:"truncate",children:e})})}function sn({finding:e,onRevealPath:s,onApplyFixes:n,isApplying:r}){const o=qs[e.severity]??K,a=Lt[e.severity]??"text-muted-foreground",l=vs(e.certainty),i=e.evidence,d=i!==void 0&&(i.actual!==void 0||i.expected!==void 0),m=tn(i),u=!!n&&Ct(e.fixes),f=e.relatedPaths??[];return t.jsxs("div",{className:"rounded-sm border bg-card px-3 py-2.5",children:[t.jsxs("div",{className:"flex items-start gap-2",children:[t.jsx(o,{className:v("mt-0.5 h-3.5 w-3.5 flex-shrink-0",a)}),t.jsxs("div",{className:"min-w-0 flex-1",children:[e.blocking&&t.jsx("span",{className:"mr-1.5 rounded-sm bg-destructive/15 px-1 py-0.5 align-[1px] text-[10px] font-medium tracking-wide text-destructive uppercase",children:"blocking"}),t.jsx("span",{className:"text-xs leading-relaxed text-foreground",children:e.message})]})]}),t.jsxs("div",{className:"mt-1.5 pl-[1.375rem]",children:[d&&i&&t.jsxs("p",{className:"text-[11px] text-muted-foreground",children:[i.expected!==void 0&&t.jsxs(t.Fragment,{children:["Expected"," ",t.jsx("span",{className:"font-mono font-medium text-foreground/90",children:pt(i.expected,i.unit)})]}),i.expected!==void 0&&i.actual!==void 0&&t.jsx("span",{className:"text-muted-foreground/50",children:" · "}),i.actual!==void 0&&t.jsxs(t.Fragment,{children:[i.expected===void 0?"Found":"found"," ",t.jsx("span",{className:"font-mono font-medium text-foreground/90",children:pt(i.actual,i.unit)})]})]}),(e.suggestion||u)&&t.jsxs("div",{className:v("mt-1.5 flex items-center gap-2 rounded-sm bg-header-bg/70 px-2 py-1.5",!e.suggestion&&"justify-end"),children:[e.suggestion&&t.jsx("p",{className:"min-w-0 flex-1 text-[11px] leading-relaxed text-muted-foreground",children:e.suggestion}),u&&t.jsxs("button",{type:"button",onClick:()=>n==null?void 0:n(e),disabled:r,className:v("flex flex-shrink-0 items-center gap-1 rounded-sm border bg-card px-1.5 py-1","text-[11px] font-medium text-foreground transition-colors","hover:bg-accent focus-visible:ring-1 focus-visible:ring-ring","focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-60"),children:[r?t.jsx(oe,{size:"sm",variant:"muted",className:"h-3 w-3"}):t.jsx(ds,{className:"h-3 w-3","aria-hidden":"true"}),"Apply fix"]})]}),t.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-x-2.5 gap-y-1",children:[e.path&&t.jsx(gt,{path:e.path,onRevealPath:s}),f.map(c=>t.jsx(gt,{path:c,onRevealPath:s,muted:!0},c)),l&&t.jsx("span",{className:"text-[10px] text-muted-foreground/70",title:"How the analysis reached this finding",children:l}),e.code&&t.jsx("code",{className:"text-[10px] text-muted-foreground/60",children:e.code})]}),m&&t.jsxs("details",{className:"mt-1.5",children:[t.jsx("summary",{className:"cursor-pointer text-[11px] text-muted-foreground/70 hover:text-foreground",children:"More evidence"}),t.jsx("pre",{className:"mt-1 overflow-x-auto rounded-sm bg-header-bg p-1.5 text-[11px] text-muted-foreground",children:JSON.stringify(m,null,2)})]})]})]})}function nn({quality:e,id:s,className:n,onRevealPath:r,onApplyFixes:o,applyingFindingId:a}){const l=_(k=>k.qualityMinSeverity),[i,d]=w.useState(!1),[m,u]=w.useState(!1),f=(e==null?void 0:e.findings)??Rt,c=l??"warning",p=w.useMemo(()=>ps(f,c),[f,c]),b=i?f:p,$=w.useMemo(()=>gs(b),[b]),M=w.useMemo(()=>{if(m||b.length<=ye)return $;let k=ye;const C=[];for(const I of $){if(k<=0)break;const B=I.findings.slice(0,k);k-=B.length,C.push({category:I.category,findings:B})}return C},[$,m,b.length]),N=w.useMemo(()=>Ge(f),[f]),z=w.useMemo(()=>Ge(p),[p]),S=f.length-p.length,D=w.useMemo(()=>{const k=[];let C=0;for(const I of At){const B=N[I]-z[I];B>0&&(k.push(Ft(I,B)),C+=B)}return C<S&&k.push(`${S-C} other`),k.join(", ")},[N,z,S]);return!e||f.length===0&&!e.gateError&&!e.analysisError&&!e.truncated?null:t.jsxs("div",{id:s,className:v("space-y-1.5",n),children:[e.gateError&&t.jsxs("div",{className:"flex items-start gap-2 rounded-sm border border-destructive/40 bg-destructive/10 px-3 py-2",children:[t.jsx(Je,{className:"mt-0.5 h-3.5 w-3.5 flex-shrink-0 text-destructive"}),t.jsx("p",{className:"text-xs leading-relaxed text-destructive",children:e.gateError})]}),e.analysisError&&t.jsxs("div",{className:"flex items-start gap-2 rounded-sm border bg-muted/60 px-3 py-2",children:[t.jsx(K,{className:"mt-0.5 h-3.5 w-3.5 flex-shrink-0 text-muted-foreground"}),t.jsxs("p",{className:"text-xs leading-relaxed text-muted-foreground",children:[e.analysisError,f.length>0&&" Showing the last completed analysis."]})]}),t.jsxs("div",{className:"space-y-1.5",children:[e.truncated&&t.jsx("p",{className:"px-0.5 text-[11px] text-muted-foreground/80",children:"The analysis stopped early — not every finding is listed."}),S>0&&t.jsxs("div",{className:"flex items-center gap-2 rounded-sm border border-dashed px-3 py-1.5",children:[t.jsx("span",{className:"min-w-0 flex-1 truncate text-[11px] text-muted-foreground",children:i?`${D} below the ${c} filter, now shown`:`${D} hidden by the ${c}-and-above filter`}),t.jsx("button",{type:"button",onClick:()=>d(!i),className:v("flex-shrink-0 rounded-sm px-1.5 py-0.5 text-[11px] font-medium","text-foreground transition-colors hover:bg-accent","focus-visible:ring-1 focus-visible:ring-ring focus-visible:outline-none"),children:i?"Hide again":"Show all"})]}),M.map(k=>t.jsxs("div",{className:"space-y-1.5",children:[t.jsx("div",{className:"px-0.5 text-[10px] font-medium tracking-wide text-muted-foreground/70 uppercase",children:k.category}),k.findings.map(C=>t.jsx(sn,{finding:C,onRevealPath:r,onApplyFixes:o,isApplying:a===C.id},C.id))]},k.category)),b.length>ye&&t.jsx("button",{type:"button",onClick:()=>u(!m),className:v("w-full rounded-sm border border-dashed px-3 py-1.5 text-[11px]","font-medium text-muted-foreground transition-colors","hover:bg-accent hover:text-foreground","focus-visible:ring-1 focus-visible:ring-ring focus-visible:outline-none"),children:m?`Show first ${ye}`:`Show all ${b.length}`})]})]})}function Mt(e){return e?e.findings.length>0||!!e.gateError||!!e.analysisError||!!e.truncated:!1}function rn({quality:e,open:s=!1,onToggle:n,controlsId:r,className:o}){const a=w.useMemo(()=>Ge((e==null?void 0:e.findings)??Rt),[e==null?void 0:e.findings]);if(!e)return null;const l=!!(e.blocked||e.gateError),i=At.filter(p=>a[p]>0),d=Mt(e)&&!!n,m=l||a.error>0?"text-destructive":a.warning>0?"text-warning":e.analysisError?"text-muted-foreground":i.length===0?"text-success":"text-data-blue",u=l?Je:a.error>0?St:a.warning>0?Y:e.analysisError?K:i.length===0?cs:K,f=t.jsxs(t.Fragment,{children:[d&&t.jsx(wt,{className:v("h-3.5 w-3.5 flex-shrink-0 text-muted-foreground transition-transform",s&&"rotate-90"),"aria-hidden":"true"}),t.jsx(u,{className:v("h-3.5 w-3.5 flex-shrink-0",m)}),t.jsx("span",{className:"text-xs font-medium text-foreground",children:"Quality"}),i.length===0?t.jsx("span",{className:"truncate text-xs text-muted-foreground",children:e.analysisError?"Not available":"No findings"}):i.map((p,b)=>t.jsxs(w.Fragment,{children:[b>0&&t.jsx("span",{"aria-hidden":"true",className:"text-muted-foreground/40",children:"·"}),t.jsx("span",{className:v("text-xs font-medium",Lt[p]),children:Ft(p,a[p])})]},p)),l&&t.jsx("span",{className:"flex-shrink-0 rounded-sm bg-destructive/15 px-1.5 py-0.5 text-[10px] font-medium tracking-wide text-destructive uppercase",children:"blocked"}),e.profileId&&t.jsx("span",{className:"ml-auto truncate pl-2 font-mono text-[10px] text-muted-foreground",title:`Quality profile: ${e.profileId}`,children:e.profileId})]}),c="flex min-w-0 items-center gap-2 rounded-sm px-1.5 py-0.5";return d?t.jsx("button",{type:"button",onClick:n,"aria-expanded":s,"aria-controls":s?r:void 0,className:v(c,"text-left transition-colors hover:bg-accent","focus-visible:ring-1 focus-visible:ring-ring focus-visible:outline-none",o),children:f}):t.jsx("div",{className:v(c,o),children:f})}const vt={pptx:["default","dark","minimal","consulting","vermilion","devportal"],docx:["minimal","devportal","vermilion","consulting"]};function an({className:e}){var l;const s=L(i=>i.activeTab),n=L(i=>i.documentTypes),r=L(i=>i.documents),o=Ye(i=>i.customThemes),a=x.useMemo(()=>{var m,u,f;if(!s||n[s]==="application/json+theme")return null;const i=r.find(c=>c.name===s);if(!(i!=null&&i.text))return null;let d;try{d=(u=(m=JSON.parse(i.text))==null?void 0:m.props)==null?void 0:u.theme}catch{return null}if(typeof d!="string"||!d||(f=vt[F])!=null&&f.includes(d))return null;for(const c of Object.values(o))if(c.valid&&c.name===d)return null;return d},[s,n,r,o]);return a?t.jsxs("div",{className:`flex items-start gap-2 rounded-sm border border-transparent bg-warning/10 px-3 py-2 ${e??""}`,children:[t.jsx(Y,{className:"h-3.5 w-3.5 mt-0.5 text-warning flex-shrink-0"}),t.jsxs("div",{className:"flex-1 min-w-0 text-xs leading-relaxed",children:[t.jsxs("span",{className:"font-medium text-warning",children:["Theme"," ",t.jsx("code",{className:"bg-warning/20 px-1 py-0.5 rounded-sm text-warning",children:a})," ","is not available."]})," ",t.jsxs("span",{className:"text-warning/80",children:["Add it as a custom theme or use a built-in theme (",(l=vt[F])==null?void 0:l.join(", "),"). The renderer will fall back to a default."]})]})]}):null}const we={background:"#FFFFFF",text:"#1F2937",border:"#D1D5DB",primary:"#1F2937"};function Pt(e){return Math.min(34,Math.max(11,Math.round(e*.75)))}function J(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:void 0}function ce(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}function X(e){return typeof e=="string"&&e.trim()?e:void 0}function Ve(e){if(!e)return!1;const s=ce(e.fontWeight);return s!==void 0?s>=600:e.bold===!0}function Ne(e,s,n,r,o){const a=J(W(e,["styles",s])),l=X(a==null?void 0:a.font)??n,i=J(W(e,["fonts",l])),d=X(i==null?void 0:i.family)??"sans-serif",m=ce(a==null?void 0:a.size)??ce(i==null?void 0:i.size)??r,u=le(e,a==null?void 0:a.color)??le(e,i==null?void 0:i.color)??o;return{family:d,sizePx:Pt(m),color:u,bold:Ve(a)||a===void 0&&Ve(i),italic:(a==null?void 0:a.italic)===!0,mono:l==="mono"}}function ae(e,s,n,r,o){const a=J(W(e,["styles",s])),l=X(a==null?void 0:a.fontFace)??X(W(e,["fonts",n]))??"sans-serif",i=ce(a==null?void 0:a.fontSize)??ce(W(e,["defaults","fontSize"]))??r,d=le(e,a==null?void 0:a.fontColor)??le(e,W(e,["defaults","fontColor"]))??o;return{family:l,sizePx:Pt(i),color:d,bold:Ve(a),italic:(a==null?void 0:a.italic)===!0,mono:!1}}const on=["primary","secondary","accent","accent4","accent5","accent6"];function ln(e){var z;const s=J(e.colors)??{},n=S=>le(e,s[S]),r=n("background")??we.background,o=n("text")??we.text,a=n("border")??n("background2")??n("borderPrimary")??we.border,l=n("backgroundSecondary")??n("background2")??r,i=n("primary")??we.primary,d=n("textMuted")??n("text2")??n("textSecondary")??o,m=on.map(S=>({key:S,hex:n(S)})).filter(S=>!!S.hex),u=F==="docx",f=u?Ne(e,"title","heading",28,i):ae(e,"title","heading",40,i),c=u?Ne(e,"heading1","heading",20,i):ae(e,"heading1","heading",32,i),p=u?Ne(e,"heading2","heading",16,i):ae(e,"heading2","heading",24,i),b=u?Ne(e,"normal","body",11,o):ae(e,"body","body",16,o),$=u?{...b,sizePx:11,color:d,bold:!1}:ae(e,"caption","body",11,d),M=[],N=J(e.fonts)??{};for(const S of Object.keys(N)){const D=X(u?(z=J(N[S]))==null?void 0:z.family:N[S]);D&&M.push({role:S,family:D})}return{background:r,text:o,border:a,stripe:l,primary:i,headerText:r,palette:m,title:f,heading1:c,heading2:p,body:b,caption:$,families:M}}function It(e,s){const n=`"${e.replace(/"/g,"")}"`;return s?`${n}, ui-monospace, "SF Mono", Menlo, monospace`:`${n}, "Inter Variable", system-ui, sans-serif`}function ie({text:e,children:s,block:n}){return t.jsx("div",{className:n?"leading-snug":"truncate leading-tight",style:{fontFamily:It(e.family,e.mono),fontSize:e.sizePx,color:e.color,fontWeight:e.bold?700:400,fontStyle:e.italic?"italic":"normal"},children:s})}const cn=[["Region","Q1","Q2"],["North","1,240","1,385"],["South","980","1,102"]];function dn({theme:e}){const s=x.useMemo(()=>ln(e),[e]),n=bs(),r=s.families.map(o=>o.family).join(`
1
+ import{r as x,j as t,c as w}from"./react-vendor-BmQ2Ko_D.js";import{S as oe,c as v,j as bt,i as Jt,F,w as Yt,Q as Kt,p as Xt,x as dt,u as jt,a as _e,h as yt}from"./index-1Vg-Jg2R.js";import{p as ne,L as $e,S as Re,a as Ae,b as Le,c as Fe,d as be,q as Zt,r as qt,B as es,P as ts,s as ss,v as ns,w as rs,x as as,y as is}from"./HomePage-DdKO7Rz8.js";import{B as We}from"./index-Db2WFiF0.js";import{e as wt,W as Y,y as K,ad as os,R as Nt,ae as Je,$ as ls,af as St,z as cs,ag as ds,ah as us,U as ms,g as fs}from"./ui-vendor-BsAtAN16.js";import xs from"./monaco-editor-DJsdM0WK.js";import{X as re,Y as hs,R as Ge,Z as ps,_ as gs,$ as vs,e as bs,r as le,g as W,v as js,N as ys,O as ws}from"./useQualityAnalysis-Dr3UHxyN.js";import{f as _,a as L,b as Ye,T as Ns,g as ut,d as Ss,y as ks,h as Es}from"./MonacoPluginProvider-Cql9aylS.js";import{ah as kt,ai as Ts}from"./radix-ui-BzbaiLpZ.js";import"./query-vendor--rhYD8mC.js";import"./state-vendor-Cq67_JbF.js";function Et(e){const[s]=x.useState(()=>Date.now()),n=e??s,[r,o]=x.useState(()=>Date.now());return x.useEffect(()=>{const a=setInterval(()=>o(Date.now()),100);return()=>clearInterval(a)},[]),Math.max(0,(r-n)/1e3)}function Cs(e){var s,n;if(!e)return null;try{const r=JSON.parse(e);if(!r||typeof r!="object")return null;const o=new Map,a=[r];for(;a.length>0;){const m=a.pop();if(!m||typeof m!="object")continue;const{name:u,children:f}=m;typeof u=="string"&&o.set(u,(o.get(u)??0)+1),Array.isArray(f)&&a.push(...f)}const i=[["slide","slide","slides"],["section","section","sections"],["visual","visual","visuals"],["chart","chart","charts"],["image","image","images"],["table","table","tables"],["shape","shape","shapes"],["paragraph","paragraph","paragraphs"]].map(([m,u,f])=>{const c=o.get(m)??0;return{label:c===1?u:f,count:c}}).filter(m=>m.count>0).slice(0,5),d=(n=(s=r.props)==null?void 0:s.metadata)==null?void 0:n.title;return{title:typeof d=="string"?d:void 0,counts:i,visualCount:(o.get("visual")??0)+(o.get("chart")??0),imageCount:o.get("image")??0}}catch{return null}}function $s(e){const s=[];return e&&e.visualCount>0&&s.push(`${e.visualCount} visual${e.visualCount===1?"":"s"} in this document ${e.visualCount===1?"is":"are"} rasterized on first build — later builds reuse the cached renders.`),e&&e.imageCount>3&&s.push("Large embedded images dominate build time — downscaling them speeds up iteration."),s.push("Re-running an unchanged document is served from the cache almost instantly.","Generation warnings, if any, will appear above the preview when the build completes."),s}const Rs=()=>t.jsx("svg",{className:"h-3.5 w-3.5 text-success",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:t.jsx("path",{d:"M3 8.5L6.5 12L13 4.5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})});function As({className:e,currentStage:s="parsing",message:n,documentText:r,startedAt:o,onCancel:a}){const l=["parsing","building","rendering","finalizing"],i={parsing:"Validating JSON",building:"Building structure",rendering:"Rendering content",finalizing:"Finalizing document"},d=l.indexOf(s),m=Et(o),u=x.useMemo(()=>Cs(r),[r]),f=x.useMemo(()=>$s(u),[u]),c=m>3,p=Math.floor(Math.max(0,m-3)/5)%f.length;return t.jsxs("div",{className:v("p-6 max-w-lg mx-auto space-y-5",e),children:[t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[t.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[t.jsx(oe,{size:"md"}),t.jsxs("div",{className:"space-y-0.5 min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:u!=null&&u.title?`Generating “${u.title}”`:"Generating document"}),t.jsx("p",{className:"text-xs text-muted-foreground truncate",role:"status","aria-live":"polite",children:n||`${i[s]}...`})]})]}),t.jsxs("span",{className:"shrink-0 rounded-full bg-secondary px-2 py-0.5 text-xs text-muted-foreground tabular-nums","aria-hidden":"true",children:[m.toFixed(1),"s"]})]}),u&&u.counts.length>0&&t.jsx("div",{className:"flex flex-wrap gap-1.5","aria-label":"Document contents",children:u.counts.map(({label:b,count:$})=>t.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-xs text-muted-foreground",children:[t.jsx("span",{className:"font-medium text-foreground tabular-nums",children:$}),b]},b))}),t.jsx("div",{className:"space-y-3",children:l.map((b,$)=>{const M=$===d,N=$<d;return t.jsxs("div",{className:"space-y-1.5",children:[t.jsxs("div",{className:"flex items-center justify-between text-xs",children:[t.jsx("span",{className:v(M?"text-primary font-medium":N?"text-muted-foreground":"text-muted-foreground/60"),children:i[b]}),N?t.jsx(Rs,{}):M?t.jsx(oe,{size:"sm",className:"h-3.5 w-3.5"}):t.jsx("span",{className:"h-3.5 w-3.5 rounded-full border border-muted-foreground/40"})]}),t.jsx("div",{className:"w-full bg-secondary rounded-full h-1.5 overflow-hidden",children:N?t.jsx("div",{className:"h-full w-full rounded-full bg-success"}):M?t.jsx("div",{className:"h-full w-2/5 rounded-full bg-primary animate-progress-indeterminate"}):null})]},b)})}),t.jsxs("div",{className:"flex items-center justify-between gap-3 min-h-8",children:[t.jsx("p",{className:v("text-xs text-muted-foreground/80 italic transition-opacity duration-500",c?"opacity-100":"opacity-0"),children:f[p]}),a&&t.jsx(We,{variant:"outline",size:"sm",onClick:a,className:"shrink-0",children:"Cancel"})]})]})}function Ls({mode:e,message:s,startedAt:n,onCancel:r,className:o}){const a=Et(n);return t.jsxs("div",{className:v("flex flex-col items-center gap-2 rounded-md border bg-background/95 px-6 py-4 shadow-sm",o),children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(oe,{size:"md"}),t.jsx("p",{className:"text-sm font-medium",role:"status","aria-live":"polite",children:e==="generating"?"Generating":"Rendering"}),t.jsxs("span",{className:"rounded-full bg-secondary px-2 py-0.5 text-xs text-muted-foreground tabular-nums","aria-hidden":"true",children:[a.toFixed(1),"s"]})]}),s&&t.jsx("p",{className:"max-w-xs text-center text-xs text-muted-foreground truncate",children:s}),e==="generating"&&r&&t.jsx(We,{variant:"outline",size:"sm",onClick:r,children:"Cancel"})]})}function Fs({renderingLibrary:e,className:s}){const n=a=>{switch(a){case"LibreOffice":return{name:"LibreOffice",description:"Converting document to PDF locally..."};case"Office":return{name:"Microsoft Office",description:"Uploading file and loading Office viewer..."};case"Docs":return{name:"Google Docs",description:"Uploading file and loading Docs viewer..."};default:return{name:"Default",description:"Processing document..."}}},{name:r,description:o}=n(e);return t.jsxs("div",{className:v("flex flex-col items-center justify-center h-full p-8 space-y-4",s),children:[t.jsx(oe,{size:"lg"}),t.jsxs("div",{className:"text-center space-y-2",children:[t.jsx("p",{className:"text-sm font-medium",children:"Rendering Preview"}),t.jsxs("p",{className:"text-xs text-muted-foreground",children:["Using ",r," renderer"]}),t.jsx("p",{className:"text-xs text-muted-foreground/80",children:o})]}),t.jsxs("div",{className:"w-full max-w-md space-y-3",children:[t.jsx(ne,{className:"h-16 w-full"}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"h-4 w-full"}),t.jsx(ne,{className:"h-4 w-3/4"}),t.jsx(ne,{className:"h-4 w-1/2"})]}),t.jsx(ne,{className:"h-12 w-full"})]})]})}const Tt=w.forwardRef(({isLoading:e,iframeSrc:s,iframeSrcDoc:n,isGenerating:r,generationProgress:o,generationDocumentText:a,generationStartedAt:l,onCancelGeneration:i},d)=>{const[m,u]=x.useState(!1);x.useEffect(()=>{u(!1)},[s,n]);const f=()=>{u(!0)},c=()=>{console.warn("Iframe failed to load content"),u(!1)},p=n?"allow-scripts allow-popups allow-forms":void 0,b=!!(s||n);return r&&!b?t.jsx("div",{className:"grow",children:t.jsx(As,{currentStage:o==null?void 0:o.stage,message:o==null?void 0:o.message,documentText:a,startedAt:l,onCancel:i})}):e&&!b?t.jsx("div",{className:"grow",children:t.jsx(Fs,{renderingLibrary:"LibreOffice"})}):b?t.jsxs("div",{className:"h-full w-full relative bg-white",children:[!m&&t.jsx("div",{className:"absolute inset-0 bg-muted/80 flex items-center justify-center z-10",children:t.jsxs("div",{className:"text-center",children:[t.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-foreground mx-auto mb-2"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading preview..."})]})}),(r||e)&&t.jsx("div",{className:"absolute inset-0 bg-background/60 backdrop-blur-[2px] flex items-center justify-center z-20 transition-opacity duration-200",children:t.jsx(Ls,{mode:r?"generating":"rendering",message:r?o==null?void 0:o.message:void 0,startedAt:r?l:void 0,onCancel:r?i:void 0})}),t.jsx("iframe",{ref:d,className:"w-full h-full border-0",style:{backgroundColor:"white",opacity:m?1:0,transition:"opacity 0.2s ease-in-out"},src:s,srcDoc:n,onLoad:f,onError:c,sandbox:p,title:"Document preview","aria-label":`Preview of rendered ${bt.toLowerCase()}`},n?"srcdoc":"src")]}):null});Tt.displayName="PreviewFrame";const Ms=w.memo(Tt);function Ps({warnings:e,className:s}){const[n,r]=w.useState(!1),o=w.useMemo(()=>(e??[]).filter(a=>a.component!=="quality"),[e]);return o.length===0?null:t.jsxs("div",{className:s,children:[t.jsxs("button",{type:"button",onClick:()=>r(!n),className:"flex w-full items-center gap-2 rounded-sm border border-transparent bg-warning/10 px-3 py-1.5 text-left transition-colors hover:bg-warning/20",children:[t.jsx(wt,{className:`h-3.5 w-3.5 text-warning transition-transform flex-shrink-0 ${n?"rotate-90":""}`}),t.jsx(Y,{className:"h-3.5 w-3.5 text-warning flex-shrink-0"}),t.jsxs("span",{className:"text-xs font-medium text-warning",children:[o.length," warning",o.length!==1?"s":""]})]}),n&&t.jsx("div",{className:"mt-1.5 space-y-1.5",children:o.map((a,l)=>t.jsxs("div",{className:"flex items-start gap-2 rounded-sm border bg-card px-3 py-2",children:[a.severity==="info"?t.jsx(K,{className:"h-3.5 w-3.5 mt-0.5 text-data-blue flex-shrink-0"}):t.jsx(Y,{className:"h-3.5 w-3.5 mt-0.5 text-warning flex-shrink-0"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("code",{className:"text-[11px] font-medium text-warning bg-warning/15 px-1 py-0.5 rounded-sm",children:a.component}),a.severity==="info"&&t.jsx("span",{className:"text-[10px] uppercase tracking-wide text-data-blue font-medium",children:"info"})]}),t.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground leading-relaxed",children:a.message}),a.context&&Object.keys(a.context).length>0&&t.jsxs("details",{className:"mt-1.5",children:[t.jsx("summary",{className:"text-[11px] text-muted-foreground/70 cursor-pointer hover:text-foreground",children:"Context"}),t.jsx("pre",{className:"mt-1 text-[11px] bg-header-bg p-1.5 rounded-sm overflow-x-auto text-muted-foreground",children:JSON.stringify(a.context,null,2)})]})]})]},l))})]})}function Is({className:e}){const{resolvedTheme:s}=Jt(),n=_(c=>c.qualityPolicies),r=_(c=>c.setSettings),o=n==null?void 0:n[F],[a,l]=x.useState(o??re),i=x.useMemo(()=>hs(a),[a]),d=x.useMemo(()=>Yt().map(c=>c.id),[]),m=x.useCallback(c=>{l(c),r({qualityPolicies:{...n,[F]:c}})},[n,r]),u=x.useRef(null),f=x.useCallback(()=>{const c=u.current;c?c.setValue(re):m(re)},[m]);return t.jsxs("div",{className:v("flex min-w-0 flex-col gap-2",e),children:[t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsx("span",{className:"text-[11px] leading-snug text-muted-foreground",children:"Rule severity, parameters and suppressions. The gate and profile stay with their controls above."}),t.jsxs("button",{type:"button",onClick:f,disabled:a===re,title:a===re?"The policy is already empty":"Clear the policy back to an empty one",className:v("flex flex-shrink-0 items-center gap-1 rounded-sm px-1.5 py-0.5","text-[11px] font-medium text-muted-foreground transition-colors","hover:bg-accent hover:text-foreground","focus-visible:ring-1 focus-visible:ring-ring focus-visible:outline-none","disabled:pointer-events-none disabled:opacity-40"),children:[t.jsx(os,{className:"h-3 w-3","aria-hidden":"true"}),"Reset"]})]}),t.jsx("div",{className:"overflow-hidden rounded-sm border",children:t.jsx(xs,{height:"180px",language:"json",path:Kt,theme:s==="dark"?"vs-dark":"vs",defaultValue:a,onMount:c=>{u.current=c},onChange:c=>m(c??""),options:{minimap:{enabled:!1},lineNumbers:"off",folding:!1,scrollBeyondLastLine:!1,fontSize:11,lineHeight:17,tabSize:2,renderLineHighlight:"none",overviewRulerLanes:0,scrollbar:{verticalScrollbarSize:8,horizontalScrollbarSize:8},padding:{top:8,bottom:8},automaticLayout:!0}})}),i.ok?t.jsx("p",{className:"text-[11px] leading-snug text-muted-foreground",children:i.policy?"Applied to every analysis and build.":"Empty — the profile decides on its own."}):t.jsxs("p",{className:"flex items-start gap-1.5 text-[11px] leading-snug text-destructive",children:[t.jsx(Y,{className:"mt-0.5 h-3 w-3 flex-shrink-0","aria-hidden":"true"}),t.jsxs("span",{children:[i.error," Until this parses, the run ignores it."]})]}),t.jsxs("details",{className:"text-[11px] text-muted-foreground",children:[t.jsx("summary",{className:"cursor-pointer hover:text-foreground",children:"Rules in this format"}),t.jsx("ul",{className:"mt-1 space-y-0.5 pl-3",children:d.map(c=>t.jsx("li",{className:"font-mono text-[10px]",children:c},c))})]})]})}const Qe="__default__",Os={docx:[{value:"executive-report",label:"Executive report",description:"Short decision document with strict outline continuity"},{value:"technical-report",label:"Technical report",description:"Numbered sections under a running head, a source under every figure, every size on the theme scale, at least one chart or table"},{value:"legal-appendix",label:"Legal appendix",description:"Dense appendix: preserve integrity without editorial taste"},{value:"general",label:"General",description:"The format default: integrity and information design, nothing required by structure"}],pptx:[{value:"executive-presentation",label:"Executive presentation",description:"Decision deck optimized for scan speed and projection"},{value:"technical-presentation",label:"Technical presentation",description:"Portable professional presentation defaults"}]},zs={docx:"general",pptx:"technical-presentation"},Me=[{value:"none",label:"Never blocks",description:"Findings are reported and the run always finishes"},{value:"error",label:"Blocks on errors",description:"Generation fails when a finding is an error"},{value:"warning",label:"Blocks on warnings",description:"Generation fails on any warning or error"},{value:"info",label:"Blocks on anything",description:"Generation fails on any finding, info included"}],Pe=[{value:"error",label:"Errors only",description:"Warnings and info stay hidden"},{value:"warning",label:"Warnings and errors",description:"Info stays hidden"},{value:"info",label:"Everything",description:"Every finding the analysis produced"}],Ie="h-8 min-h-0 w-full gap-1.5 px-2 text-xs [&>span]:truncate [&>span]:whitespace-nowrap",Oe="max-w-[min(20rem,var(--radix-select-content-available-width))]",ze="flex items-center gap-1.5 text-xs",Se="text-[11px] leading-snug text-muted-foreground",mt={value:Qe,label:"Default",description:`The format's own profile (${zs[F]})`};function De({children:e}){return t.jsx("span",{className:"text-[10px] font-semibold tracking-wide text-muted-foreground uppercase",children:e})}function je({choice:e}){return t.jsxs("span",{className:"flex min-w-0 flex-col gap-0.5",children:[t.jsx("span",{className:"font-medium",children:e.label}),t.jsx("span",{className:Se,children:e.description})]})}function Ds({className:e}){const s=x.useId(),n=_(c=>c.qualityProfileIds),r=n==null?void 0:n[F],o=_(c=>c.qualityGate)??"none",a=_(c=>c.qualityMinSeverity)??"warning",l=_(c=>c.setSettings),i=Os[F],m=i.find(c=>c.value===r)??mt,u=Me.find(c=>c.value===o)??Me[0],f=Pe.find(c=>c.value===a)??Pe[1];return t.jsxs("div",{className:v("flex w-full min-w-0 flex-col gap-5",e),children:[t.jsxs("div",{className:"flex min-w-0 flex-col gap-3",children:[t.jsx(De,{children:"Run policy"}),t.jsxs("div",{className:"grid min-w-0 gap-1.5",children:[t.jsxs($e,{htmlFor:`${s}-profile`,className:ze,children:[t.jsx(Nt,{className:"h-3.5 w-3.5 shrink-0 opacity-60"}),"Profile"]}),t.jsxs(Re,{value:m.value,onValueChange:c=>l({qualityProfileIds:{...n,[F]:c===Qe?void 0:c}}),children:[t.jsx(Ae,{id:`${s}-profile`,"aria-describedby":`${s}-profile-help`,className:Ie,children:t.jsx(Le,{children:t.jsx("span",{className:"font-medium",children:m.label})})}),t.jsxs(Fe,{className:Oe,children:[t.jsx(be,{value:Qe,className:"text-xs",children:t.jsx(je,{choice:mt})}),i.map(c=>t.jsx(be,{value:c.value,className:"text-xs",children:t.jsx(je,{choice:c})},c.value))]})]}),t.jsx("p",{id:`${s}-profile-help`,className:Se,children:m.description})]}),t.jsxs("div",{className:"grid min-w-0 gap-1.5",children:[t.jsxs($e,{htmlFor:`${s}-gate`,className:ze,children:[t.jsx(Je,{className:"h-3.5 w-3.5 shrink-0 opacity-60"}),"Gate"]}),t.jsxs(Re,{value:u.value,onValueChange:c=>l({qualityGate:c}),children:[t.jsx(Ae,{id:`${s}-gate`,"aria-describedby":`${s}-gate-help`,className:Ie,children:t.jsx(Le,{children:t.jsx("span",{className:"font-medium",children:u.label})})}),t.jsx(Fe,{className:Oe,children:Me.map(c=>t.jsx(be,{value:c.value,className:"text-xs",children:t.jsx(je,{choice:c})},c.value))})]}),t.jsxs("p",{id:`${s}-gate-help`,className:Se,children:[u.description,"."]})]})]}),t.jsx("div",{className:"h-px shrink-0 bg-border/60"}),t.jsxs("div",{className:"flex min-w-0 flex-col gap-3",children:[t.jsx(De,{children:"Rule policy"}),t.jsx(Is,{})]}),t.jsx("div",{className:"h-px shrink-0 bg-border/60"}),t.jsxs("div",{className:"flex min-w-0 flex-col gap-3",children:[t.jsx(De,{children:"Panel display"}),t.jsxs("div",{className:"grid min-w-0 gap-1.5",children:[t.jsxs($e,{htmlFor:`${s}-severity`,className:ze,children:[t.jsx(ls,{className:"h-3.5 w-3.5 shrink-0 opacity-60"}),"Show"]}),t.jsxs(Re,{value:f.value,onValueChange:c=>l({qualityMinSeverity:c}),children:[t.jsx(Ae,{id:`${s}-severity`,"aria-describedby":`${s}-severity-help`,className:Ie,children:t.jsx(Le,{children:t.jsx("span",{className:"font-medium",children:f.label})})}),t.jsx(Fe,{className:Oe,children:Pe.map(c=>t.jsx(be,{value:c.value,className:"text-xs",children:t.jsx(je,{choice:c})},c.value))})]}),t.jsx("p",{id:`${s}-severity-help`,className:Se,children:"Filters this panel only. It never changes what the run does."})]})]})]})}const Bs=/^(?:0|[1-9][0-9]*)$/;function _s(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function Gs(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Ke(e){return e===""?[]:(e.startsWith("/")?e.slice(1):e).split("/").map(n=>{const r=_s(n);return Bs.test(r)?Number(r):r})}function Qs(e){return e.map(s=>`/${Gs(String(s))}`).join("")}function Hs(e,s){const n=dt(e,[s]);return n||typeof s!="number"?n:dt(e,[String(s)])}function Us(e,s){if(!e.trim())return null;let n;try{if(n=Xt(e,[],{allowTrailingComma:!0}),!n)return null;for(const r of Ke(s))if(n=Hs(n,r),!n)return null}catch{return null}return{start:n.offset,end:n.offset+n.length}}const Vs=["add","remove","replace","move","copy","test"];function Ws(e,s){try{let n=e;for(let r=0;r<s.length;r++){const o=Js(n,s[r],r);if(!o.ok)return{ok:!1,error:o.error};n=o.value}return{ok:!0,doc:n,applied:s.length}}catch(n){return{ok:!1,error:`quality fix failed: ${Zs(n)}`}}}function Ct(e){return!e||e.length===0?!1:e.every(s=>$t(s.op)?s.op==="move"||s.op==="copy"?typeof s.from=="string":!0:!1)}function Js(e,s,n){const r=`fix #${n+1} (${String(s.op)} "${String(s.path)}")`,o=s.op;if(!$t(o))return j(`${r}: unsupported operation "${String(o)}"`);const a=Ke(s.path);switch(o){case"add":return Be(e,a,s.value,r);case"replace":return Ys(e,a,s.value,r);case"remove":{const l=ft(e,a,r);return l.ok?T(l.value.doc):l}case"copy":{const l=ht(s,r);if(!l.ok)return l;const i=xt(e,l.value.path);return i.ok?Be(e,a,i.value,r):j(`${r}: ${i.error}`)}case"move":{const l=ht(s,r);if(!l.ok)return l;if(Ks(l.value.path,a))return T(e);if(Xs(l.value.path,a))return j(`${r}: ${O(l.value.path)} cannot be moved into its own child`);const i=ft(e,l.value.path,r);return i.ok?Be(i.value.doc,a,i.value.removed,r):i}case"test":{const l=xt(e,a);return l.ok?Ue(l.value,s.value)?T(e):j(`${r}: test failed, the value at the path differs`):j(`${r}: ${l.error}`)}}}function Be(e,s,n,r){if(s.length===0)return T(n);const o=s[s.length-1];return Xe(e,s,r,a=>{if(Array.isArray(a)){const l=o==="-"?a.length:de(o);if(l===null)return j(`${r}: "${String(o)}" is not an array index`);if(l>a.length)return j(`${r}: index ${l} is past the end of the array`);const i=G(a);return i.splice(l,0,n),T(i)}if(H(a)){const l=G(a);return l[String(o)]=n,T(l)}return j(`${r}: ${O(s.slice(0,-1))} is not an object or array`)})}function Ys(e,s,n,r){if(s.length===0)return T(n);const o=s[s.length-1];return Xe(e,s,r,a=>{if(Array.isArray(a)){const l=de(o);if(l===null||l>=a.length)return j(`${r}: "${String(o)}" is not an existing array index`);const i=G(a);return i[l]=n,T(i)}if(H(a)){const l=String(o);if(!ue(a,l))return j(`${r}: "${l}" does not exist`);const i=G(a);return i[l]=n,T(i)}return j(`${r}: ${O(s.slice(0,-1))} is not an object or array`)})}function ft(e,s,n){if(s.length===0)return j(`${n}: the whole document cannot be removed`);const r=s[s.length-1];let o;const a=Xe(e,s,n,l=>{if(Array.isArray(l)){const i=de(r);if(i===null||i>=l.length)return j(`${n}: "${String(r)}" is not an existing array index`);const d=G(l);return o=d.splice(i,1)[0],T(d)}if(H(l)){const i=String(r);if(!ue(l,i))return j(`${n}: "${i}" does not exist`);const d=G(l);return o=d[i],delete d[i],T(d)}return j(`${n}: ${O(s.slice(0,-1))} is not an object or array`)});return a.ok?T({doc:a.value,removed:o}):a}function Xe(e,s,n,r){return He(e,s.slice(0,-1),0,n,r)}function He(e,s,n,r,o){if(n===s.length)return o(e);const a=()=>O(s.slice(0,n+1)),l=s[n];if(Array.isArray(e)){const i=de(l);if(i===null||i>=e.length)return j(`${r}: ${a()} does not exist`);const d=He(e[i],s,n+1,r,o);if(!d.ok)return d;const m=G(e);return m[i]=d.value,T(m)}if(H(e)){const i=String(l);if(!ue(e,i))return j(`${r}: ${a()} does not exist`);const d=He(e[i],s,n+1,r,o);if(!d.ok)return d;const m=G(e);return m[i]=d.value,T(m)}return j(`${r}: ${O(s.slice(0,n))} is not an object or array`)}function xt(e,s){let n=e;for(let r=0;r<s.length;r++){const o=s[r];if(Array.isArray(n)){const a=de(o);if(a===null||a>=n.length)return j(`${O(s.slice(0,r+1))} does not exist`);n=n[a];continue}if(H(n)){const a=String(o);if(!ue(n,a))return j(`${O(s.slice(0,r+1))} does not exist`);n=n[a];continue}return j(`${O(s.slice(0,r))} is not an object or array`)}return T(n)}function ht(e,s){const n=e.from;return typeof n!="string"?j(`${s}: a "from" pointer is required`):T({pointer:n,path:Ke(n)})}function G(e){return Array.isArray(e)?[...e]:{...e}}function de(e){return typeof e=="number"?Number.isInteger(e)&&e>=0?e:null:/^(?:0|[1-9][0-9]*)$/.test(e)?Number(e):null}function O(e){return e.length===0?"the document root":`"${Qs(e)}"`}function $t(e){return Vs.includes(e)}function H(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ue(e,s){return Object.prototype.hasOwnProperty.call(e,s)}function Ks(e,s){return e.length===s.length&&e.every((n,r)=>String(n)===String(s[r]))}function Xs(e,s){return e.length>=s.length?!1:e.every((n,r)=>String(n)===String(s[r]))}function Ue(e,s){if(e===s)return!0;if(Array.isArray(e)||Array.isArray(s))return!Array.isArray(e)||!Array.isArray(s)||e.length!==s.length?!1:e.every((n,r)=>Ue(n,s[r]));if(H(e)&&H(s)){const n=Object.keys(e);return n.length!==Object.keys(s).length?!1:n.every(r=>ue(s,r)&&Ue(e[r],s[r]))}return!1}function Zs(e){return e instanceof Error?e.message:String(e)}function T(e){return{ok:!0,value:e}}function j(e){return{ok:!1,error:e}}const ye=50,Rt=[],At=["error","warning","info"],qs={error:St,warning:Y,info:K},Lt={error:"text-destructive",warning:"text-warning",info:"text-data-blue"},en=new Set(["actual","expected","unit"]);function Ft(e,s){return e==="info"?`${s} info`:`${s} ${e}${s===1?"":"s"}`}function pt(e,s){const n=typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"?String(e):JSON.stringify(e);return s?`${n} ${s}`:n}function tn(e){if(!e)return null;const s={};let n=!1;for(const[r,o]of Object.entries(e))en.has(r)||(s[r]=o,n=!0);return n?s:null}function gt({path:e,onRevealPath:s,muted:n}){const r=v("inline-flex max-w-full items-center gap-1 rounded-sm font-mono text-[10px]",n?"text-muted-foreground/60":"text-muted-foreground/80");return s?t.jsxs("button",{type:"button",onClick:()=>s(e),title:`Reveal ${e} in the editor`,className:v(r,"-mx-1 px-1 py-0.5 transition-colors","hover:bg-accent hover:text-foreground hover:underline","focus-visible:ring-1 focus-visible:ring-ring focus-visible:outline-none"),children:[t.jsx(us,{className:"h-2.5 w-2.5 flex-shrink-0","aria-hidden":"true"}),t.jsx("span",{className:"truncate",children:e})]}):t.jsx("span",{className:r,children:t.jsx("span",{className:"truncate",children:e})})}function sn({finding:e,onRevealPath:s,onApplyFixes:n,isApplying:r}){const o=qs[e.severity]??K,a=Lt[e.severity]??"text-muted-foreground",l=vs(e.certainty),i=e.evidence,d=i!==void 0&&(i.actual!==void 0||i.expected!==void 0),m=tn(i),u=!!n&&Ct(e.fixes),f=e.relatedPaths??[];return t.jsxs("div",{className:"rounded-sm border bg-card px-3 py-2.5",children:[t.jsxs("div",{className:"flex items-start gap-2",children:[t.jsx(o,{className:v("mt-0.5 h-3.5 w-3.5 flex-shrink-0",a)}),t.jsxs("div",{className:"min-w-0 flex-1",children:[e.blocking&&t.jsx("span",{className:"mr-1.5 rounded-sm bg-destructive/15 px-1 py-0.5 align-[1px] text-[10px] font-medium tracking-wide text-destructive uppercase",children:"blocking"}),t.jsx("span",{className:"text-xs leading-relaxed text-foreground",children:e.message})]})]}),t.jsxs("div",{className:"mt-1.5 pl-[1.375rem]",children:[d&&i&&t.jsxs("p",{className:"text-[11px] text-muted-foreground",children:[i.expected!==void 0&&t.jsxs(t.Fragment,{children:["Expected"," ",t.jsx("span",{className:"font-mono font-medium text-foreground/90",children:pt(i.expected,i.unit)})]}),i.expected!==void 0&&i.actual!==void 0&&t.jsx("span",{className:"text-muted-foreground/50",children:" · "}),i.actual!==void 0&&t.jsxs(t.Fragment,{children:[i.expected===void 0?"Found":"found"," ",t.jsx("span",{className:"font-mono font-medium text-foreground/90",children:pt(i.actual,i.unit)})]})]}),(e.suggestion||u)&&t.jsxs("div",{className:v("mt-1.5 flex items-center gap-2 rounded-sm bg-header-bg/70 px-2 py-1.5",!e.suggestion&&"justify-end"),children:[e.suggestion&&t.jsx("p",{className:"min-w-0 flex-1 text-[11px] leading-relaxed text-muted-foreground",children:e.suggestion}),u&&t.jsxs("button",{type:"button",onClick:()=>n==null?void 0:n(e),disabled:r,className:v("flex flex-shrink-0 items-center gap-1 rounded-sm border bg-card px-1.5 py-1","text-[11px] font-medium text-foreground transition-colors","hover:bg-accent focus-visible:ring-1 focus-visible:ring-ring","focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-60"),children:[r?t.jsx(oe,{size:"sm",variant:"muted",className:"h-3 w-3"}):t.jsx(ds,{className:"h-3 w-3","aria-hidden":"true"}),"Apply fix"]})]}),t.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-x-2.5 gap-y-1",children:[e.path&&t.jsx(gt,{path:e.path,onRevealPath:s}),f.map(c=>t.jsx(gt,{path:c,onRevealPath:s,muted:!0},c)),l&&t.jsx("span",{className:"text-[10px] text-muted-foreground/70",title:"How the analysis reached this finding",children:l}),e.code&&t.jsx("code",{className:"text-[10px] text-muted-foreground/60",children:e.code})]}),m&&t.jsxs("details",{className:"mt-1.5",children:[t.jsx("summary",{className:"cursor-pointer text-[11px] text-muted-foreground/70 hover:text-foreground",children:"More evidence"}),t.jsx("pre",{className:"mt-1 overflow-x-auto rounded-sm bg-header-bg p-1.5 text-[11px] text-muted-foreground",children:JSON.stringify(m,null,2)})]})]})]})}function nn({quality:e,id:s,className:n,onRevealPath:r,onApplyFixes:o,applyingFindingId:a}){const l=_(k=>k.qualityMinSeverity),[i,d]=w.useState(!1),[m,u]=w.useState(!1),f=(e==null?void 0:e.findings)??Rt,c=l??"warning",p=w.useMemo(()=>ps(f,c),[f,c]),b=i?f:p,$=w.useMemo(()=>gs(b),[b]),M=w.useMemo(()=>{if(m||b.length<=ye)return $;let k=ye;const C=[];for(const I of $){if(k<=0)break;const B=I.findings.slice(0,k);k-=B.length,C.push({category:I.category,findings:B})}return C},[$,m,b.length]),N=w.useMemo(()=>Ge(f),[f]),z=w.useMemo(()=>Ge(p),[p]),S=f.length-p.length,D=w.useMemo(()=>{const k=[];let C=0;for(const I of At){const B=N[I]-z[I];B>0&&(k.push(Ft(I,B)),C+=B)}return C<S&&k.push(`${S-C} other`),k.join(", ")},[N,z,S]);return!e||f.length===0&&!e.gateError&&!e.analysisError&&!e.truncated?null:t.jsxs("div",{id:s,className:v("space-y-1.5",n),children:[e.gateError&&t.jsxs("div",{className:"flex items-start gap-2 rounded-sm border border-destructive/40 bg-destructive/10 px-3 py-2",children:[t.jsx(Je,{className:"mt-0.5 h-3.5 w-3.5 flex-shrink-0 text-destructive"}),t.jsx("p",{className:"text-xs leading-relaxed text-destructive",children:e.gateError})]}),e.analysisError&&t.jsxs("div",{className:"flex items-start gap-2 rounded-sm border bg-muted/60 px-3 py-2",children:[t.jsx(K,{className:"mt-0.5 h-3.5 w-3.5 flex-shrink-0 text-muted-foreground"}),t.jsxs("p",{className:"text-xs leading-relaxed text-muted-foreground",children:[e.analysisError,f.length>0&&" Showing the last completed analysis."]})]}),t.jsxs("div",{className:"space-y-1.5",children:[e.truncated&&t.jsx("p",{className:"px-0.5 text-[11px] text-muted-foreground/80",children:"The analysis stopped early — not every finding is listed."}),S>0&&t.jsxs("div",{className:"flex items-center gap-2 rounded-sm border border-dashed px-3 py-1.5",children:[t.jsx("span",{className:"min-w-0 flex-1 truncate text-[11px] text-muted-foreground",children:i?`${D} below the ${c} filter, now shown`:`${D} hidden by the ${c}-and-above filter`}),t.jsx("button",{type:"button",onClick:()=>d(!i),className:v("flex-shrink-0 rounded-sm px-1.5 py-0.5 text-[11px] font-medium","text-foreground transition-colors hover:bg-accent","focus-visible:ring-1 focus-visible:ring-ring focus-visible:outline-none"),children:i?"Hide again":"Show all"})]}),M.map(k=>t.jsxs("div",{className:"space-y-1.5",children:[t.jsx("div",{className:"px-0.5 text-[10px] font-medium tracking-wide text-muted-foreground/70 uppercase",children:k.category}),k.findings.map(C=>t.jsx(sn,{finding:C,onRevealPath:r,onApplyFixes:o,isApplying:a===C.id},C.id))]},k.category)),b.length>ye&&t.jsx("button",{type:"button",onClick:()=>u(!m),className:v("w-full rounded-sm border border-dashed px-3 py-1.5 text-[11px]","font-medium text-muted-foreground transition-colors","hover:bg-accent hover:text-foreground","focus-visible:ring-1 focus-visible:ring-ring focus-visible:outline-none"),children:m?`Show first ${ye}`:`Show all ${b.length}`})]})]})}function Mt(e){return e?e.findings.length>0||!!e.gateError||!!e.analysisError||!!e.truncated:!1}function rn({quality:e,open:s=!1,onToggle:n,controlsId:r,className:o}){const a=w.useMemo(()=>Ge((e==null?void 0:e.findings)??Rt),[e==null?void 0:e.findings]);if(!e)return null;const l=!!(e.blocked||e.gateError),i=At.filter(p=>a[p]>0),d=Mt(e)&&!!n,m=l||a.error>0?"text-destructive":a.warning>0?"text-warning":e.analysisError?"text-muted-foreground":i.length===0?"text-success":"text-data-blue",u=l?Je:a.error>0?St:a.warning>0?Y:e.analysisError?K:i.length===0?cs:K,f=t.jsxs(t.Fragment,{children:[d&&t.jsx(wt,{className:v("h-3.5 w-3.5 flex-shrink-0 text-muted-foreground transition-transform",s&&"rotate-90"),"aria-hidden":"true"}),t.jsx(u,{className:v("h-3.5 w-3.5 flex-shrink-0",m)}),t.jsx("span",{className:"text-xs font-medium text-foreground",children:"Quality"}),i.length===0?t.jsx("span",{className:"truncate text-xs text-muted-foreground",children:e.analysisError?"Not available":"No findings"}):i.map((p,b)=>t.jsxs(w.Fragment,{children:[b>0&&t.jsx("span",{"aria-hidden":"true",className:"text-muted-foreground/40",children:"·"}),t.jsx("span",{className:v("text-xs font-medium",Lt[p]),children:Ft(p,a[p])})]},p)),l&&t.jsx("span",{className:"flex-shrink-0 rounded-sm bg-destructive/15 px-1.5 py-0.5 text-[10px] font-medium tracking-wide text-destructive uppercase",children:"blocked"}),e.profileId&&t.jsx("span",{className:"ml-auto truncate pl-2 font-mono text-[10px] text-muted-foreground",title:`Quality profile: ${e.profileId}`,children:e.profileId})]}),c="flex min-w-0 items-center gap-2 rounded-sm px-1.5 py-0.5";return d?t.jsx("button",{type:"button",onClick:n,"aria-expanded":s,"aria-controls":s?r:void 0,className:v(c,"text-left transition-colors hover:bg-accent","focus-visible:ring-1 focus-visible:ring-ring focus-visible:outline-none",o),children:f}):t.jsx("div",{className:v(c,o),children:f})}const vt={pptx:["default","dark","minimal","consulting","vermilion","devportal"],docx:["minimal","devportal","vermilion","consulting"]};function an({className:e}){var l;const s=L(i=>i.activeTab),n=L(i=>i.documentTypes),r=L(i=>i.documents),o=Ye(i=>i.customThemes),a=x.useMemo(()=>{var m,u,f;if(!s||n[s]==="application/json+theme")return null;const i=r.find(c=>c.name===s);if(!(i!=null&&i.text))return null;let d;try{d=(u=(m=JSON.parse(i.text))==null?void 0:m.props)==null?void 0:u.theme}catch{return null}if(typeof d!="string"||!d||(f=vt[F])!=null&&f.includes(d))return null;for(const c of Object.values(o))if(c.valid&&c.name===d)return null;return d},[s,n,r,o]);return a?t.jsxs("div",{className:`flex items-start gap-2 rounded-sm border border-transparent bg-warning/10 px-3 py-2 ${e??""}`,children:[t.jsx(Y,{className:"h-3.5 w-3.5 mt-0.5 text-warning flex-shrink-0"}),t.jsxs("div",{className:"flex-1 min-w-0 text-xs leading-relaxed",children:[t.jsxs("span",{className:"font-medium text-warning",children:["Theme"," ",t.jsx("code",{className:"bg-warning/20 px-1 py-0.5 rounded-sm text-warning",children:a})," ","is not available."]})," ",t.jsxs("span",{className:"text-warning/80",children:["Add it as a custom theme or use a built-in theme (",(l=vt[F])==null?void 0:l.join(", "),"). The renderer will fall back to a default."]})]})]}):null}const we={background:"#FFFFFF",text:"#1F2937",border:"#D1D5DB",primary:"#1F2937"};function Pt(e){return Math.min(34,Math.max(11,Math.round(e*.75)))}function J(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:void 0}function ce(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}function X(e){return typeof e=="string"&&e.trim()?e:void 0}function Ve(e){if(!e)return!1;const s=ce(e.fontWeight);return s!==void 0?s>=600:e.bold===!0}function Ne(e,s,n,r,o){const a=J(W(e,["styles",s])),l=X(a==null?void 0:a.font)??n,i=J(W(e,["fonts",l])),d=X(i==null?void 0:i.family)??"sans-serif",m=ce(a==null?void 0:a.size)??ce(i==null?void 0:i.size)??r,u=le(e,a==null?void 0:a.color)??le(e,i==null?void 0:i.color)??o;return{family:d,sizePx:Pt(m),color:u,bold:Ve(a)||a===void 0&&Ve(i),italic:(a==null?void 0:a.italic)===!0,mono:l==="mono"}}function ae(e,s,n,r,o){const a=J(W(e,["styles",s])),l=X(a==null?void 0:a.fontFace)??X(W(e,["fonts",n]))??"sans-serif",i=ce(a==null?void 0:a.fontSize)??ce(W(e,["defaults","fontSize"]))??r,d=le(e,a==null?void 0:a.fontColor)??le(e,W(e,["defaults","fontColor"]))??o;return{family:l,sizePx:Pt(i),color:d,bold:Ve(a),italic:(a==null?void 0:a.italic)===!0,mono:!1}}const on=["primary","secondary","accent","accent4","accent5","accent6"];function ln(e){var z;const s=J(e.colors)??{},n=S=>le(e,s[S]),r=n("background")??we.background,o=n("text")??we.text,a=n("border")??n("background2")??n("borderPrimary")??we.border,l=n("backgroundSecondary")??n("background2")??r,i=n("primary")??we.primary,d=n("textMuted")??n("text2")??n("textSecondary")??o,m=on.map(S=>({key:S,hex:n(S)})).filter(S=>!!S.hex),u=F==="docx",f=u?Ne(e,"title","heading",28,i):ae(e,"title","heading",40,i),c=u?Ne(e,"heading1","heading",20,i):ae(e,"heading1","heading",32,i),p=u?Ne(e,"heading2","heading",16,i):ae(e,"heading2","heading",24,i),b=u?Ne(e,"normal","body",11,o):ae(e,"body","body",16,o),$=u?{...b,sizePx:11,color:d,bold:!1}:ae(e,"caption","body",11,d),M=[],N=J(e.fonts)??{};for(const S of Object.keys(N)){const D=X(u?(z=J(N[S]))==null?void 0:z.family:N[S]);D&&M.push({role:S,family:D})}return{background:r,text:o,border:a,stripe:l,primary:i,headerText:r,palette:m,title:f,heading1:c,heading2:p,body:b,caption:$,families:M}}function It(e,s){const n=`"${e.replace(/"/g,"")}"`;return s?`${n}, ui-monospace, "SF Mono", Menlo, monospace`:`${n}, "Inter Variable", system-ui, sans-serif`}function ie({text:e,children:s,block:n}){return t.jsx("div",{className:n?"leading-snug":"truncate leading-tight",style:{fontFamily:It(e.family,e.mono),fontSize:e.sizePx,color:e.color,fontWeight:e.bold?700:400,fontStyle:e.italic?"italic":"normal"},children:s})}const cn=[["Region","Q1","Q2"],["North","1,240","1,385"],["South","980","1,102"]];function dn({theme:e}){const s=x.useMemo(()=>ln(e),[e]),n=bs(),r=s.families.map(o=>o.family).join(`
2
2
  `);return x.useEffect(()=>{const o=new Set(n.safe.map(a=>a.toLowerCase()));for(const a of new Set(r.split(`
3
3
  `)))a&&!o.has(a.toLowerCase())&&Zt(a)},[r,n.safe]),t.jsx("div",{"aria-label":"Theme sample",title:"Approximate: the browser's rendering of the theme. Run sample to see the real output.",className:"@container overflow-hidden rounded-md border",style:{background:s.background,color:s.text},children:t.jsxs("div",{className:"grid max-h-[260px] grid-cols-1 gap-x-5 gap-y-3 p-4 @[30rem]:grid-cols-[1.3fr_1fr]",children:[t.jsxs("div",{className:"flex min-w-0 flex-col gap-1.5",children:[t.jsx(ie,{text:s.title,children:"Annual report"}),t.jsx(ie,{text:s.heading1,children:"1. Executive summary"}),t.jsx(ie,{text:s.heading2,children:"1.1 Where the year landed"}),t.jsx(ie,{text:s.body,block:!0,children:"Body text in the theme's body face, sized as the document sets it. A second sentence lets the line spacing and colour read."}),t.jsx(ie,{text:s.caption,children:"Figure 1 - a caption in the muted colour"})]}),t.jsxs("div",{className:"flex min-w-0 flex-col justify-between gap-3",children:[t.jsx("table",{className:"w-full border-collapse",style:{fontFamily:It(s.body.family,!1),fontSize:Math.max(10,s.body.sizePx-1)},children:t.jsx("tbody",{children:cn.map((o,a)=>t.jsx("tr",{style:{background:a===0?s.primary:a%2===0?s.stripe:"transparent",color:a===0?s.headerText:s.text,fontWeight:a===0?600:400},children:o.map((l,i)=>t.jsx("td",{className:"px-2 py-1 leading-tight",style:{borderBottom:`1px solid ${s.border}`,textAlign:i===0?"left":"right",fontVariantNumeric:"tabular-nums"},children:l},l))},o[0]))})}),t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsxs("div",{className:"flex gap-1.5","aria-label":"Chart palette",children:[s.palette.map(o=>t.jsx("span",{title:`${o.key} ${o.hex}`,className:"h-5 flex-1 rounded-sm",style:{background:o.hex,boxShadow:`inset 0 0 0 1px ${s.border}`}},o.key)),s.palette.length===0&&t.jsx("span",{className:"text-[11px] opacity-60",children:"No palette yet"})]}),s.families.length>0&&t.jsx("p",{className:"truncate text-[10px] opacity-60",children:s.families.map(o=>`${o.role}: ${o.family}`).join(" / ")})]})]})]})})}const un=w.memo(dn);function mn({themeDocName:e,onRan:s}){const n=L(m=>{var u;return((u=m.documents.find(f=>f.name===e))==null?void 0:u.text)??""}),r=Ye(m=>m.updateTheme),o=x.useContext(Ns),{toast:a}=jt(),l=x.useMemo(()=>js(n),[n]),i=l.ok?ut(l.theme):null,d=x.useCallback(()=>{const m=qt(e,n);let u=null;try{u=ut(JSON.parse(m))}catch{}if(!u){a({title:"Theme has no name",description:'Give the theme a "name" so a document can refer to it.',variant:"destructive"});return}const f=o==null?void 0:o.getState().customThemes[e];(!f||f.content!==m)&&r(e,m),window.dispatchEvent(new CustomEvent("preview:buildSpecimen",{detail:{themeDocName:e}})),s()},[s,n,e,o,a,r]);return t.jsxs("div",{className:"flex flex-col gap-3",children:[t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[t.jsxs("div",{className:"flex min-w-0 flex-col",children:[t.jsx("h3",{className:"text-sm font-medium",children:"Theme sample"}),t.jsx("p",{className:"text-[11px] leading-snug text-muted-foreground",children:"Approximate — drawn by the browser, not the renderer."})]}),t.jsxs(We,{variant:"outline",size:"sm",className:"h-7 shrink-0 gap-1.5 px-2.5 text-xs",onClick:d,disabled:!i,title:i?`Render a sample ${F==="docx"?"document":"deck"} in "${i}" through the same pipeline as Run`:"Give the theme a name first",children:[t.jsx(ms,{className:"size-3.5"}),"Run sample"]})]}),l.ok?t.jsx(un,{theme:l.theme}):t.jsxs("p",{className:"text-xs text-muted-foreground",children:["The theme JSON has an error:"," ",t.jsx("span",{className:"text-destructive",children:l.error})]})]})}const fn=w.memo(mn);async function xn(e,s,n,r,o,a){const l=typeof n=="string"&&n.length>0;let i;if(l){let u;try{u=JSON.parse(n)}catch(c){throw new Error(`Invalid JSON document: ${c.message}`)}const f={jsonDefinition:u,customThemes:r??{},options:{sourceName:a??e,...o?{renderer:o}:{}}};i=await fetch(_e.preview.libreofficeFromJson,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(f)})}else{const u=new FormData,f=F==="pptx"?".pptx":".docx";u.append("file",s,`${e}${f}`),i=await fetch(_e.preview.libreoffice,{method:"POST",body:u})}if(!i.ok){let u=`LibreOffice preview failed (${i.status})`;try{const f=await i.json();f&&typeof f=="object"&&typeof f.error=="string"&&(u=f.error)}catch{}throw new Error(u)}const d=await i.blob();if(!d.size)throw new Error("LibreOffice preview returned an empty PDF");const m=URL.createObjectURL(d);return{iframeSrc:m,cleanup:()=>URL.revokeObjectURL(m)}}async function hn(e,s,n,r,o,a){try{if(!s||s.size===0)throw new Error("Invalid or empty document blob");const l=await xn(e,s,n,r,o,a);return{status:"success",name:e,payload:l}}catch(l){const i=l instanceof Error?l.message:String(l);return{status:"error",name:e,payload:new Error(i)}}}function pn(){const e=L(o=>o.activeTab),s=L(o=>o.documents),n=L(o=>o.documentTypes),r=L(o=>o.saveDocument);return x.useCallback((o,a)=>{var c;const l=o.fixes;if(!l||!Ct(l))return{ok:!1,error:"This finding carries no applicable fix."};if(!e)return{ok:!1,error:"No active file"};if(a&&a!==e)return{ok:!1,error:`This finding belongs to ${a}, which is no longer the active file.`};if(n[e]!=="application/json+report")return{ok:!1,error:"Quality fixes apply to a document, not to a theme or a plugin."};const i=s.find(p=>p.name===e);if(!i)return{ok:!1,error:"Active document not found"};const d=yt.getState().getEditor(e);(c=d==null?void 0:d.flushPendingSave)==null||c.call(d);const m=d?d.toStorageValue(d.editor.getValue()):i.text;let u;try{u=JSON.parse(m)}catch(p){return{ok:!1,error:`Active document is not valid JSON: ${p.message}`}}const f=Ws(u,l);return f.ok?(r(e,JSON.stringify(f.doc,null,2)),{ok:!0}):{ok:!1,error:f.error}},[e,n,s,r])}const Ze=x.forwardRef(({className:e,value:s,...n},r)=>t.jsx(kt,{ref:r,className:v("relative h-4 w-full overflow-hidden rounded-full bg-secondary",e),...n,children:t.jsx(Ts,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(s||0)}%)`}})}));Ze.displayName=kt.displayName;function Ot(e){if(e===0)return"0 B";const s=1024,n=["B","KB","MB","GB"],r=Math.floor(Math.log(e)/Math.log(s));return parseFloat((e/Math.pow(s,r)).toFixed(2))+" "+n[r]}function gn(){const[e,s]=x.useState(null),[n,r]=x.useState(!0),[o,a]=x.useState(null);if(x.useEffect(()=>{const d=new AbortController,m=async()=>{try{const c=await fetch(_e.cacheStats,{signal:d.signal});if(!c.ok)throw new Error("Failed to fetch cache stats");const p=await c.json();d.signal.aborted||(s(p.data),a(null))}catch(c){d.signal.aborted||(c instanceof Error&&c.name!=="AbortError"?a(c.message):(!(c instanceof Error)||c.name!=="AbortError")&&a("Failed to load cache stats"))}finally{d.signal.aborted||r(!1)}};m();const u=setInterval(m,5e3),f=()=>m();return window.addEventListener("cache:cleared",f),()=>{d.abort(),clearInterval(u),window.removeEventListener("cache:cleared",f)}},[]),n)return t.jsx("div",{className:"flex items-center justify-center p-8",children:t.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})});if(o)return t.jsxs("div",{className:"text-destructive p-4",children:["Error loading cache metrics: ",o]});if(!e)return null;const{document:l}=e,i=l.hitRate*100;return t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"flex items-center gap-6 text-sm",children:[t.jsxs("div",{children:[t.jsx("span",{className:"text-muted-foreground",children:"Hit Rate"})," ",t.jsxs("span",{className:"font-semibold text-base",children:[i.toFixed(1),"%"]}),t.jsxs("span",{className:"text-muted-foreground ml-1",children:["(",l.hits," hits / ",l.misses," misses)"]})]}),t.jsxs("div",{children:[t.jsx("span",{className:"text-muted-foreground",children:"Size"})," ",t.jsx("span",{className:"font-semibold",children:Ot(l.size)}),t.jsxs("span",{className:"text-muted-foreground ml-1",children:["(",l.itemCount," items)"]})]}),t.jsx(es,{variant:l.enabled?"default":"secondary",children:l.enabled?"Enabled":"Disabled"})]}),t.jsx(Ze,{value:i,className:"h-2","aria-label":"Cache hit rate"}),e.rasterizer&&t.jsx(vn,{data:e.rasterizer})]})}function vn({data:e}){const s=e.diskHits+e.diskMisses;if(s+e.dedupedRequests+e.rendered+e.entries===0)return null;const r=e.hitRate*100,o=e.prepass?e.prepass.collected-e.prepass.unique:e.dedupedRequests;return t.jsxs("div",{className:"space-y-2",children:[t.jsx("h4",{className:"text-sm font-medium",children:"Visual Rasterizer"}),t.jsxs("div",{className:"px-3 py-1.5 text-sm space-y-1.5",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("span",{className:"text-muted-foreground",children:"Disk cache"}),t.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[t.jsx("span",{children:s>0?`${r.toFixed(0)}% hit`:"no lookups"}),t.jsxs("span",{children:["(",e.diskHits," hits / ",e.diskMisses," misses)"]}),t.jsxs("span",{children:[e.entries," PNGs, ",Ot(e.bytes)]})]})]}),t.jsx(Ze,{value:r,className:"h-1.5","aria-label":"Rasterizer disk cache hit rate"}),t.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[t.jsxs("span",{children:[e.rendered," rendered",e.failed>0?`, ${e.failed} failed`:""]}),t.jsxs("span",{children:[o," duplicate visual",o===1?"":"s"," deduped",e.prepass?` (${e.prepass.collected} collected → ${e.prepass.unique} unique)`:""]})]})]})]})}function Rn(){var ve,lt;const{name:e,text:s,blob:n,renderer:r,isGenerating:o,generationProgress:a,generationStartedAt:l,cancelGeneration:i,globalError:d,cacheStatus:m,cacheHitRate:u,warnings:f,quality:c,isRendering:p,isPreviewStale:b,editSequence:$,lastBuiltSequence:M,setOutput:N}=Ss(h=>h),z=L(h=>{var g;return h.activeTab&&(h.documentTypes[h.activeTab]??"application/json+report")==="application/json+report"?(g=h.documents.find(y=>y.name===h.activeTab))==null?void 0:g.text:void 0}),S=L(h=>h.activeTab&&(h.documentTypes[h.activeTab]??"application/json+report")==="application/json+report"?h.activeTab:void 0),D=x.useContext(ks),{toast:k}=jt(),C=pn(),{analyze:I}=ys(),[B,qe]=x.useState(null),[U,ke]=x.useState(!1),[Z,q]=x.useState(!1),[ee,te]=x.useState(!1),et=w.useId(),tt=L(h=>h.activeTab),se=L(h=>h.activeTab&&h.documentTypes[h.activeTab]==="application/json+theme"?h.activeTab:""),Q=x.useMemo(()=>c&&c.documentName===tt?c:null,[c,tt]),Ee=U||Z||ee,me=x.useCallback(()=>{ke(!1),q(!1),te(!1)},[]);x.useEffect(()=>{se||te(!1)},[se]),x.useEffect(()=>{if(!Ee)return;const h=g=>{g.key==="Escape"&&me()};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[Ee,me]);const st=Q==null?void 0:Q.gateError;x.useEffect(()=>{st&&q(!0)},[st]);const nt=Mt(Q);x.useEffect(()=>{nt||q(!1)},[nt]);const zt=x.useMemo(()=>ws(f).others,[f]),Dt=x.useCallback(h=>{if(!h)return;const g=yt.getState().getActiveEditor();if(!g)return;const{editor:y,monaco:P}=g,R=y.getModel();if(!R)return;const A=Us(R.getValue(),h);if(!A)return;const E=R.getPositionAt(A.start),V=R.getPositionAt(A.end),ct=new P.Range(E.lineNumber,E.column,V.lineNumber,V.column);y.revealRangeNearTopIfOutsideViewport(ct,P.editor.ScrollType.Smooth),y.setPosition(E),y.setSelection(ct),y.focus()},[]),fe=x.useRef(new Set);x.useEffect(()=>{fe.current=new Set},[c==null?void 0:c.seq]);const Bt=x.useCallback(h=>{var g;if(!fe.current.has(h.id)){fe.current.add(h.id),qe(h.id);try{const y=C(h,c==null?void 0:c.documentName);if(!y.ok){fe.current.delete(h.id),k({variant:"destructive",title:"Could not apply fix",description:y.error});return}const{activeTab:P,documents:R}=D.getState(),A=(g=R.find(E=>E.name===P))==null?void 0:g.text;A&&I(P,A,{immediate:!0})}finally{qe(null)}}},[I,C,D,c==null?void 0:c.documentName,k]),rt=Ye(h=>h.customThemes),at=x.useMemo(()=>{const h={};for(const g of Object.values(rt))g.valid&&g.name&&g.parsed&&(h[g.name]=g.parsed);return h},[rt]),[_t,Gt]=x.useState(void 0),[Qt,Ht]=x.useState(void 0),[Ut,Te]=x.useState(!1),Vt=w.useRef(null),xe=x.useRef(null),he=x.useRef(!1),it=Es(),pe=x.useCallback(()=>{xe.current&&(xe.current(),xe.current=null)},[]),ge=x.useCallback(async(h,g,y,P,R)=>{N({isRendering:!0,isPreviewStale:!1,globalError:void 0});try{const{status:A,payload:E}=await hn(h,g,y,P,R,it(h));if(A!=="success")throw E instanceof Error?E:new Error(String(E));pe(),Gt(E.iframeSrc||void 0),Ht(E.iframeSrcDoc||void 0),xe.current=E.cleanup||null}catch(A){const E=A instanceof Error?A.message:String(A);let V=E;E.includes("Failed to fetch")?V="Network error: Unable to load required resources. Check if the server is running properly.":E.includes("timeout")&&(V="Render timeout: The rendering process took too long."),N({globalError:V})}finally{N({isRendering:!1})}},[N,pe,it]),Wt=x.useRef({name:e,blob:n,text:s,doRender:ge});x.useEffect(()=>{Wt.current={name:e,blob:n,text:s,doRender:ge}});const Ce=x.useCallback(async()=>{he.current=!0,window.dispatchEvent(new CustomEvent("preview:flushAndBuild"))},[]);x.useEffect(()=>{if(!(!n||!e)){if(he.current){he.current=!1,ge(e,n,s,at,r);return}N({isPreviewStale:!0})}},[n,e,s,at,r,ge,N]),x.useEffect(()=>()=>{pe()},[pe]),x.useEffect(()=>{const h=()=>Ce(),g=()=>Te(!0),y=()=>{he.current=!0};return window.addEventListener("preview:manualRender",h),window.addEventListener("preview:showCacheMetrics",g),window.addEventListener("preview:buildSpecimen",y),()=>{window.removeEventListener("preview:manualRender",h),window.removeEventListener("preview:showCacheMetrics",g),window.removeEventListener("preview:buildSpecimen",y)}},[Ce]);const ot=((lt=(ve=_)==null?void 0:ve.getState)==null?void 0:lt.call(ve).useGlobalPreviewHeader)===!1;return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex h-full flex-col",children:[ot&&t.jsx(ts,{name:(e==null?void 0:e.trim())||"Preview",blob:n,onManualRender:Ce,isGenerating:o,isRendering:p,onShowCacheMetrics:()=>Te(!0),documentText:s,editorDocumentText:z,editorDocumentName:S,warnings:f}),!ot&&t.jsx(ss,{}),(()=>{const h=($??0)>(M??0),g=(b||h)&&!o&&!p,y=g?t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"h-1.5 w-1.5 flex-shrink-0 rounded-full bg-warning"}),t.jsx("span",{className:"truncate text-xs text-warning",children:"Outdated — click Run"})]}):m==="HIT"?t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"h-1.5 w-1.5 flex-shrink-0 rounded-full bg-success"}),t.jsx("span",{className:"truncate text-xs text-muted-foreground",children:"Cached"})]}):m==="MISS"?t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"h-1.5 w-1.5 flex-shrink-0 rounded-full bg-accent2"}),t.jsxs("span",{className:"truncate text-xs text-muted-foreground",children:["Fresh ",bt.toLowerCase()]})]}):null,P=!!y&&(m&&m!=="UNKNOWN"||g);return t.jsxs("div",{className:"flex items-center gap-2 overflow-hidden border-b bg-header-bg px-3 py-1.5",children:[P&&t.jsx("div",{className:"flex min-w-0 flex-shrink items-center gap-2",children:y}),P&&Q&&t.jsx("div",{"aria-hidden":"true",className:"h-3 w-px flex-shrink-0 bg-border"}),t.jsx(rn,{quality:Q,open:Z,onToggle:()=>{q(R=>!R),te(!1)},controlsId:et,className:"min-w-0 flex-1"}),!g&&u&&u!=="0.0%"&&t.jsxs("span",{className:"hidden flex-shrink-0 text-xs text-muted-foreground lg:inline",children:[u," hit rate"]}),se&&t.jsxs("button",{type:"button",onClick:()=>{te(R=>!R),ke(!1),q(!1)},"aria-expanded":ee,"aria-label":"Theme sample",className:v("flex flex-shrink-0 items-center gap-1.5 rounded-sm px-1.5 py-0.5","text-[11px] font-medium transition-colors","focus-visible:ring-1 focus-visible:ring-ring focus-visible:outline-none",ee?"bg-accent text-foreground":"text-muted-foreground hover:bg-accent hover:text-foreground"),children:[t.jsx(fs,{className:"h-3 w-3","aria-hidden":"true"}),t.jsx("span",{className:"hidden sm:inline",children:"Theme sample"})]}),t.jsxs("button",{type:"button",onClick:()=>{ke(!U),te(!1)},"aria-expanded":U,"aria-label":"Quality settings",className:v("flex flex-shrink-0 items-center gap-1.5 rounded-sm px-1.5 py-0.5","text-[11px] font-medium text-muted-foreground","transition-colors hover:bg-accent hover:text-foreground","focus-visible:ring-1 focus-visible:ring-ring focus-visible:outline-none"),children:[t.jsx(Nt,{className:"h-3 w-3","aria-hidden":"true"}),t.jsx("span",{className:"hidden sm:inline",children:"Quality settings"})]})]})})(),t.jsx(Ps,{warnings:zt,className:"mx-3 my-2"}),t.jsx(an,{className:"mx-3 my-2"}),t.jsxs("div",{className:"relative min-h-0 flex-1",children:[d&&!o?t.jsx("div",{className:"flex h-full items-center justify-center p-6",children:t.jsxs("div",{className:"max-w-md rounded-sm border-l-4 border-l-destructive bg-destructive/10 px-4 py-3 text-sm text-destructive",children:[t.jsx("p",{className:"font-medium mb-1",children:"Generation failed"}),t.jsx("p",{className:"text-xs text-destructive/80 break-words",children:d})]})}):t.jsx(Ms,{ref:Vt,isLoading:!!p,iframeSrc:_t,iframeSrcDoc:Qt,isGenerating:!!o,generationProgress:a,generationDocumentText:z??s,generationStartedAt:l,onCancelGeneration:i}),Ee&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"absolute inset-0 z-30",onClick:me,"aria-hidden":"true"}),t.jsxs("div",{className:v("absolute inset-x-3 top-2 z-40 overflow-y-auto","rounded-sm border bg-card p-4 shadow-lg",ee&&!U&&!Z?"max-h-[calc(100%-1rem)]":"bottom-2"),children:[ee&&se&&t.jsx(fn,{themeDocName:se,onRan:me}),U&&t.jsx(Ds,{}),U&&Z&&t.jsx("div",{className:"my-4 border-t"}),Z&&t.jsx(nn,{id:et,quality:Q,onRevealPath:Dt,onApplyFixes:Bt,applyingFindingId:B})]})]})]})]}),t.jsx(ns,{open:Ut,onOpenChange:Te,children:t.jsxs(rs,{className:"max-w-2xl",children:[t.jsx(as,{children:t.jsx(is,{children:"Cache Performance"})}),t.jsx(gn,{})]})})]})}export{Rn as Preview};
4
- //# sourceMappingURL=preview-Bdmil0FT.js.map
4
+ //# sourceMappingURL=preview-BXysnPth.js.map