react-semaphor 0.1.507 → 0.1.509
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.
- package/DATA_APP_SDK.md +56 -0
- package/dist/analytics-protocol/index.cjs +1 -1
- package/dist/analytics-protocol/index.js +194 -172
- package/dist/appearance/index.cjs +1 -1
- package/dist/appearance/index.js +1 -1
- package/dist/appearance-runtime/index.cjs +1 -1
- package/dist/appearance-runtime/index.js +1 -1
- package/dist/brand-studio/index.cjs +2 -2
- package/dist/brand-studio/index.js +279 -250
- package/dist/briefings/index.cjs +1 -1
- package/dist/briefings/index.js +3 -3
- package/dist/chunks/appearance-context-DzqCdhB4.cjs +1 -0
- package/dist/chunks/{appearance-context-XviHOhWJ.js → appearance-context-VJdrKi7r.js} +2 -1
- package/dist/chunks/{appearance-runtime-provider-D0xVQWnH.js → appearance-runtime-provider-CC4HT2Gi.js} +2 -2
- package/dist/chunks/{appearance-runtime-provider-Ca8rxO86.cjs → appearance-runtime-provider-D5pkvgE4.cjs} +1 -1
- package/dist/chunks/calculated-field-identity-BiTGmnST.cjs +1 -0
- package/dist/chunks/calculated-field-identity-CJL54uFx.js +1373 -0
- package/dist/chunks/{constants-NUleP4DY.js → card-config-utils-Bq1enstT.js} +260 -260
- package/dist/chunks/card-config-utils-CMO4_zVs.cjs +1 -0
- package/dist/chunks/{dashboard-briefing-launcher-DXTpU85p.js → dashboard-briefing-launcher-B5AQu-Vb.js} +12 -12
- package/dist/chunks/{dashboard-briefing-launcher-C8nDSDnV.cjs → dashboard-briefing-launcher-BoXFrqq0.cjs} +1 -1
- package/dist/chunks/{dashboard-controls-CyL0yimg.js → dashboard-controls-CKKkSXEX.js} +16 -14
- package/dist/chunks/dashboard-controls-gUVkQm8o.cjs +52 -0
- package/dist/chunks/dashboard-json-B7fSi6_b.cjs +1 -0
- package/dist/chunks/{dashboard-json-5Jr3RudV.js → dashboard-json-CAJJquVx.js} +9 -9
- package/dist/chunks/edit-dashboard-visual-AZetLUv1.cjs +172 -0
- package/dist/chunks/{edit-dashboard-visual-C7X-um9g.js → edit-dashboard-visual-DCnbqRRn.js} +1986 -1990
- package/dist/chunks/{editor-action-buttons-CcDm8nA5.cjs → editor-action-buttons-CBQsVYdt.cjs} +2 -2
- package/dist/chunks/{editor-action-buttons-C5Wja_J4.js → editor-action-buttons-DDA5JGwO.js} +6 -6
- package/dist/chunks/field-aggregations-DUb0NU6c.js +1229 -0
- package/dist/chunks/field-aggregations-jSi77h9Z.cjs +1 -0
- package/dist/chunks/{field-dependencies-DVl2p1Nm.js → field-dependencies-Cl97kkHy.js} +30 -34
- package/dist/chunks/{field-dependencies-r_U0CGQ-.cjs → field-dependencies-DIab72rQ.cjs} +1 -1
- package/dist/chunks/{index-BVr4fcCB.js → index-0pdaQ9e1.js} +5 -5
- package/dist/chunks/{index-De2QNsqV.js → index-CL2lvhwk.js} +47783 -46019
- package/dist/chunks/{index-C9KXfCkC.js → index-CLIro-EG.js} +3 -0
- package/dist/chunks/index-Cx3qmRUB.cjs +1 -0
- package/dist/chunks/{index-BlYf8gNa.cjs → index-DhlVxvyI.cjs} +1 -1
- package/dist/chunks/index-DkEAikW8.cjs +1420 -0
- package/dist/chunks/{matrix-card-DACDwdTq.js → matrix-card-CnKQpnsj.js} +1 -1
- package/dist/chunks/{matrix-card-CRXcmAjp.cjs → matrix-card-U4c72doZ.cjs} +1 -1
- package/dist/chunks/{matrix-control-sources-ClQzIk7E.js → matrix-control-sources-CRRdP03Q.js} +165 -134
- package/dist/chunks/matrix-control-sources-FjxGIbqk.cjs +1 -0
- package/dist/chunks/{matrix-formatter-7GLTcBuy.cjs → matrix-formatter-CveLJo6S.cjs} +1 -1
- package/dist/chunks/{matrix-formatter-xsq7n_e6.js → matrix-formatter-ZVS5QOuq.js} +2 -2
- package/dist/chunks/matrix-member-presentation-CFHjdrxT.cjs +1 -0
- package/dist/chunks/matrix-member-presentation-CzGZJd3a.js +182 -0
- package/dist/chunks/matrix-operation-contract-DoiWTUbT.cjs +1 -0
- package/dist/chunks/matrix-operation-contract-xL8IhFzp.js +1802 -0
- package/dist/chunks/{pivot-header-presentation-3wqWChFd.cjs → pivot-header-presentation-Cxz8-06f.cjs} +1 -1
- package/dist/chunks/{pivot-header-presentation-D44ODZGn.js → pivot-header-presentation-DVylCBHB.js} +2 -2
- package/dist/chunks/{pivot-result-lifecycle-DZ0ZSMoM.cjs → pivot-result-lifecycle-BiERyXnS.cjs} +1 -1
- package/dist/chunks/{pivot-result-lifecycle-BSmqVkVG.js → pivot-result-lifecycle-CmjpW7qG.js} +1 -1
- package/dist/chunks/{report-preferences-dialog-xADifRXs.js → report-preferences-dialog-Bv2VIOKc.js} +4 -4
- package/dist/chunks/report-preferences-dialog-Wg9g9fIj.cjs +1 -0
- package/dist/chunks/{search-BHsQIWBV.js → selection-reducer-B94WgZ9V.js} +55 -11
- package/dist/chunks/selection-reducer-CGKKsaPa.cjs +26 -0
- package/dist/chunks/{semantic-format-BhIL1PXP.cjs → semantic-format-BzH69TRq.cjs} +1 -1
- package/dist/chunks/{semantic-format-C3amkGmY.js → semantic-format-CBlRO8Aw.js} +1 -1
- package/dist/chunks/{switch-DHGiC0aU.js → switch-CD4uGTZI.js} +7450 -7694
- package/dist/chunks/switch-iC1x2dcE.cjs +134 -0
- package/dist/chunks/token-types-Ahh5u4iT.cjs +1 -0
- package/dist/chunks/token-types-CPde8_LG.js +8 -0
- package/dist/chunks/{update-policy-Cc9h57pA.cjs → update-policy-COjFudhl.cjs} +1 -1
- package/dist/chunks/{update-policy-eTcz52jO.js → update-policy-D9q1Tz8k.js} +1 -1
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/dashboard-authoring/index.cjs +3 -3
- package/dist/dashboard-authoring/index.js +734 -622
- package/dist/data-app-builder/index.cjs +1 -1
- package/dist/data-app-builder/index.js +3 -3
- package/dist/data-app-codegen/index.cjs +1 -1
- package/dist/data-app-codegen/index.js +2 -2
- package/dist/data-app-codegen-node/index.cjs +94 -92
- package/dist/data-app-codegen-node/index.js +337 -333
- package/dist/data-app-sdk/index.cjs +9 -9
- package/dist/data-app-sdk/index.js +1091 -969
- package/dist/data-app-sdk-adapters/index.cjs +1 -1
- package/dist/data-app-sdk-adapters/index.js +104 -96
- package/dist/data-app-sdk-validation/index.cjs +1 -1
- package/dist/data-app-sdk-validation/index.js +2 -2
- package/dist/format-utils/index.cjs +1 -1
- package/dist/format-utils/index.js +8 -8
- package/dist/index.cjs +1 -1
- package/dist/index.js +15 -15
- package/dist/style.css +1 -1
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/brand-studio/brand-studio-draft.d.ts +3 -1
- package/dist/types/components/dashboard/card-selection-pill.d.ts +5 -0
- package/dist/types/components/dashboard/dashboard-container.d.ts +1 -1
- package/dist/types/components/dashboard/drill-breadcrumb.d.ts +1 -0
- package/dist/types/components/dashboard/drill-navigation-controls.d.ts +3 -3
- package/dist/types/components/interactions/applied-filters-display.d.ts +6 -1
- package/dist/types/components/interactions/click-to-filter-review-dialog.d.ts +21 -0
- package/dist/types/components/interactions/dashboard-drill-host.d.ts +13 -0
- package/dist/types/components/interactions/filter-badge-tooltip.d.ts +4 -4
- package/dist/types/components/interactions/insight-modal.d.ts +4 -14
- package/dist/types/components/interactions/insight-viewer.d.ts +7 -19
- package/dist/types/components/interactions/interactions-sheet.d.ts +6 -0
- package/dist/types/components/interactions/panels/click-to-filter-panel.d.ts +20 -0
- package/dist/types/components/interactions/reusable/interaction-selection-popover.d.ts +2 -2
- package/dist/types/components/interactions/sheet/action-editor.d.ts +17 -0
- package/dist/types/components/interactions/sheet/action-meta.d.ts +45 -0
- package/dist/types/components/interactions/sheet/action-picker.d.ts +7 -0
- package/dist/types/components/interactions/sheet/click-outcome-preview.d.ts +10 -0
- package/dist/types/components/interactions/sheet/interactions-home.d.ts +28 -0
- package/dist/types/components/interactions/sheet/sheet-parts.d.ts +37 -0
- package/dist/types/components/surfboard/filter/dashboard-filter-mapping-panel.d.ts +28 -1
- package/dist/types/components/surfboard/filter/selection-chip.d.ts +11 -0
- package/dist/types/components/surfboard/filter/selection-filter-section.d.ts +4 -0
- package/dist/types/components/surfboard/filter/use-dashboard-filter-mapping-popover.d.ts +3 -0
- package/dist/types/components/ui/resizable.d.ts +1 -1
- package/dist/types/components/visual/matrix-table/matrix-interaction-actions.d.ts +24 -3
- package/dist/types/components/visual/matrix-table/matrix-selection-click.d.ts +6 -0
- package/dist/types/components/visual/matrix-table/matrix-window-viewer.d.ts +1 -1
- package/dist/types/data-app-sdk/adapters.d.ts +3 -2
- package/dist/types/data-app-sdk/builders.d.ts +2 -1
- package/dist/types/data-app-sdk/contracts.d.ts +44 -2
- package/dist/types/data-app-sdk/index.d.ts +1 -0
- package/dist/types/data-app-sdk/query-request.d.ts +7 -2
- package/dist/types/data-app-sdk/selection.d.ts +2 -0
- package/dist/types/index.cjs +1 -1
- package/dist/types/index.js +24 -23
- package/dist/types/lib/appearance/types.d.ts +3 -1
- package/dist/types/lib/briefings/briefing-attachment-model.d.ts +0 -2
- package/dist/types/lib/contexts/interactions-popover-context.d.ts +1 -8
- package/dist/types/lib/dashboard/click-to-filter-card-references.d.ts +23 -0
- package/dist/types/lib/dashboard-inputs/build-normalized-dashboard-inputs.d.ts +16 -2
- package/dist/types/lib/dashboard-inputs/build-selection-dashboard-inputs.d.ts +31 -0
- package/dist/types/lib/dashboard-inputs/click-to-filter-emitted-fields.d.ts +17 -0
- package/dist/types/lib/dashboard-inputs/click-to-filter-mapping-draft.d.ts +99 -0
- package/dist/types/lib/dashboard-inputs/click-to-filter-sheet-reach.d.ts +12 -0
- package/dist/types/lib/dashboard-inputs/dashboard-filter-mapping-authoring.d.ts +18 -1
- package/dist/types/lib/dashboard-inputs/dashboard-filter-mapping-candidate-metadata.d.ts +4 -1
- package/dist/types/lib/dashboard-inputs/dashboard-input-scope.d.ts +10 -0
- package/dist/types/lib/dashboard-inputs/dashboard-input-snapshot.d.ts +8 -1
- package/dist/types/lib/dashboard-inputs/index.d.ts +1 -0
- package/dist/types/lib/dashboard-inputs/resolve-dashboard-input-context.d.ts +18 -7
- package/dist/types/lib/dashboard-inputs/resolve-field-date-comparison-coverage.d.ts +5 -2
- package/dist/types/lib/dashboard-inputs/resolve-selection-input.d.ts +77 -0
- package/dist/types/lib/dashboard-inputs/selection-targets.d.ts +26 -0
- package/dist/types/lib/dashboard-inputs/transient-input-context.d.ts +102 -0
- package/dist/types/lib/dashboard-navigation/build-carried-click-context.d.ts +50 -0
- package/dist/types/lib/dashboard-navigation/describe-carried-context.d.ts +11 -0
- package/dist/types/lib/dashboard-navigation/index.d.ts +1 -0
- package/dist/types/lib/dashboard-navigation/navigation-state.d.ts +120 -0
- package/dist/types/lib/dashboard-navigation/run-one-off-drill.d.ts +11 -0
- package/dist/types/lib/dashboard-navigation/use-transient-contexts.d.ts +17 -0
- package/dist/types/lib/dashboard-view-state/card-view-state.d.ts +48 -0
- package/dist/types/lib/dashboard-view-state/drill-path.d.ts +20 -0
- package/dist/types/lib/dashboard-view-state/index.d.ts +2 -0
- package/dist/types/lib/download-pdf.d.ts +0 -3
- package/dist/types/lib/formatters/metric-formatting.d.ts +1 -1
- package/dist/types/lib/hooks/ai/dashboard-context.d.ts +15 -8
- package/dist/types/lib/hooks/chartjs/use-chart-blur.d.ts +10 -2
- package/dist/types/lib/hooks/interactions/{use-event-engine.d.ts → use-drill-actions.d.ts} +28 -7
- package/dist/types/lib/hooks/selection/use-active-selections.d.ts +15 -0
- package/dist/types/lib/hooks/selection/use-click-to-filter-mapping-draft.d.ts +20 -0
- package/dist/types/lib/hooks/selection/use-selection-click.d.ts +34 -0
- package/dist/types/lib/hooks/selection/use-selection-gestures.d.ts +38 -0
- package/dist/types/lib/hooks/selection/use-table-row-selection.d.ts +46 -0
- package/dist/types/lib/hooks/use-dashboard-card.d.ts +0 -2
- package/dist/types/lib/hooks/use-dashboard-filter-mapping-candidates.d.ts +18 -0
- package/dist/types/lib/hooks/use-dashboard-frame-query.d.ts +0 -1
- package/dist/types/lib/hooks/use-dashboard.d.ts +1 -3
- package/dist/types/lib/hooks/use-interactions-popover.d.ts +1 -8
- package/dist/types/lib/hooks/use-resolved-card-config.d.ts +6 -0
- package/dist/types/lib/interactions/click-outcome.d.ts +25 -0
- package/dist/types/lib/interactions/get-click-context-from-chartjs.d.ts +3 -1
- package/dist/types/lib/interactions/get-click-context-from-matrix.d.ts +1 -1
- package/dist/types/lib/interactions/get-click-context-from-table.d.ts +7 -0
- package/dist/types/lib/interactions/interaction-utils.d.ts +17 -1
- package/dist/types/lib/matrix-table/build-matrix-drill-to-detail.d.ts +15 -0
- package/dist/types/lib/matrix-table/matrix-card-interactions.d.ts +14 -3
- package/dist/types/lib/matrix-table/matrix-runtime-types.d.ts +0 -3
- package/dist/types/lib/matrix-table/matrix-runtime.d.ts +0 -4
- package/dist/types/lib/matrix-table/{use-matrix-selection.d.ts → use-matrix-cell-focus.d.ts} +13 -17
- package/dist/types/lib/matrix-table/use-matrix.d.ts +0 -1
- package/dist/types/lib/query-context/build-card-query-context.d.ts +19 -8
- package/dist/types/lib/query-context/build-dashboard-execution-snapshot.d.ts +5 -3
- package/dist/types/lib/query-context/build-dashboard-frame-base-query-contexts.d.ts +12 -4
- package/dist/types/lib/query-context/compile-selection-filters.d.ts +5 -0
- package/dist/types/lib/query-context/dashboard-filter-mapping-resolution.d.ts +46 -0
- package/dist/types/lib/query-context/filter-group-utils.d.ts +3 -0
- package/dist/types/lib/query-context/resolve-runtime-card-filters.d.ts +29 -0
- package/dist/types/lib/selection/click-to-filter-authoring-support.d.ts +9 -0
- package/dist/types/lib/selection/selection-from-click-context.d.ts +41 -0
- package/dist/types/lib/selection/selection-labels.d.ts +3 -0
- package/dist/types/lib/selection/selection-notices.d.ts +9 -0
- package/dist/types/lib/selection/selection-reducer.d.ts +46 -0
- package/dist/types/lib/stores/dashboard-store.d.ts +62 -17
- package/dist/types/lib/stores/editor-store.d.ts +1 -2
- package/dist/types/lib/stores/index.d.ts +0 -2
- package/dist/types/lib/types/common-types.d.ts +60 -6
- package/dist/types/lib/types/explorer-types.d.ts +1 -22
- package/dist/types/lib/types/interaction-types.d.ts +6 -198
- package/dist/types/lib/utils/calculate-context-aware-filters.d.ts +21 -12
- package/dist/types/lib/utils/card-utils.d.ts +11 -0
- package/dist/types/lib/utils/date-hierarchy-utils.d.ts +3 -1
- package/dist/types/lib/utils/drag-and-drop-utils.d.ts +1 -1
- package/dist/types/lib/utils/interaction-icons.d.ts +1 -1
- package/dist/types/shared/analytics-protocol/execution-input-schemas.d.ts +32 -32
- package/dist/types/shared/analytics-protocol/index.d.ts +2 -0
- package/dist/types/shared/analytics-protocol/selection-contract.d.ts +100 -0
- package/dist/types/shared/analytics-protocol/selection-filter-compiler.d.ts +12 -0
- package/dist/types/shared/dashboard-authoring/apply-group-by-override.d.ts +19 -0
- package/dist/types/shared/dashboard-authoring/click-to-filter-settings.d.ts +88 -0
- package/dist/types/shared/dashboard-authoring/contracts.d.ts +8 -0
- package/dist/types/shared/dashboard-authoring/index.d.ts +3 -0
- package/dist/types/shared/dashboard-authoring/linked-click-to-filter-overrides.d.ts +32 -0
- package/dist/types/shared/format-utils/matrix-continuation.d.ts +3 -3
- package/package.json +1 -1
- package/src/data-app-sdk/README.md +58 -1
- package/dist/chunks/appearance-context-tNjvTJj3.cjs +0 -1
- package/dist/chunks/calculated-field-identity-BTpUqfEu.js +0 -1276
- package/dist/chunks/calculated-field-identity-rMuXuzEY.cjs +0 -1
- package/dist/chunks/constants-vtu7_IUo.cjs +0 -1
- package/dist/chunks/dashboard-controls-DlxeddZN.cjs +0 -52
- package/dist/chunks/dashboard-json-DhS4yJfc.cjs +0 -1
- package/dist/chunks/edit-dashboard-visual-X3OCnivL.cjs +0 -172
- package/dist/chunks/field-aggregations-BU_3gHKR.js +0 -957
- package/dist/chunks/field-aggregations-CDCamEsQ.cjs +0 -1
- package/dist/chunks/index-C8XCKzB6.cjs +0 -1
- package/dist/chunks/index-DSa6RSdg.cjs +0 -1417
- package/dist/chunks/matrix-control-sources-CeC5EMyq.cjs +0 -1
- package/dist/chunks/matrix-member-presentation-E2B4k3ws.cjs +0 -1
- package/dist/chunks/matrix-member-presentation-qiHxv67e.js +0 -105
- package/dist/chunks/matrix-operation-contract-Cqy4EW2H.js +0 -1638
- package/dist/chunks/matrix-operation-contract-D9dLX-Wr.cjs +0 -1
- package/dist/chunks/report-preferences-dialog-7Vsc_fsG.cjs +0 -1
- package/dist/chunks/search-BqqhaMx9.cjs +0 -26
- package/dist/chunks/switch-BytP6QY8.cjs +0 -139
- package/dist/types/components/interactions/configuration-popover.d.ts +0 -1
- package/dist/types/components/interactions/interaction-card.d.ts +0 -59
- package/dist/types/components/interactions/interaction-event-handler.d.ts +0 -11
- package/dist/types/components/interactions/interactions-list.d.ts +0 -50
- package/dist/types/components/interactions/panels/cross-filter-panel.d.ts +0 -24
- package/dist/types/components/interactions/panels/inline-drill-panel.d.ts +0 -24
- package/dist/types/components/interactions/selectors/action-selector.d.ts +0 -31
- package/dist/types/components/interactions/selectors/trigger-selector.d.ts +0 -38
- package/dist/types/components/surfboard/filter/click-filter-section.d.ts +0 -5
- package/dist/types/lib/interactions/build-interaction-event.d.ts +0 -25
- package/dist/types/lib/interactions/convert-click-filters-to-filter-group.d.ts +0 -10
- package/dist/types/lib/interactions/execute-interaction-event.d.ts +0 -80
- package/dist/types/lib/interactions/field-utils.d.ts +0 -11
- package/dist/types/lib/interactions/handle-chart-click.d.ts +0 -75
- package/dist/types/lib/interactions/linked-interaction-utils.d.ts +0 -14
- package/dist/types/lib/interactions/source-card-filter-utils.d.ts +0 -9
- package/dist/types/lib/matrix-table/matrix-clipboard.d.ts +0 -45
- package/dist/types/lib/matrix-table/matrix-selection.d.ts +0 -20
- package/dist/types/lib/stores/drill-actions.d.ts +0 -139
- package/dist/types/lib/stores/interaction-store.d.ts +0 -113
- package/dist/types/lib/stores/pointer-interaction-store.d.ts +0 -18
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var me=Object.defineProperty;var he=(e,t,n)=>t in e?me(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var L=(e,t,n)=>he(e,typeof t!="symbol"?t+"":t,n);const p=require("./validators-DVYAnnX0.cjs");require("./matrix-operation-contract-D9dLX-Wr.cjs");const R=require("./field-aggregations-CDCamEsQ.cjs"),j=require("./matrix-analytical-definition-Ct5Tu8np.cjs"),k=require("./stable-serialize-jqCpyZvd.cjs"),J=(e,t)=>{const n={};if(e===null||t===null)return t;const i=new Set([...Object.keys(e),...Object.keys(t)]);for(const r of i){if(!(r in e)&&r in t){n[r]=t[r];continue}if(r in e&&!(r in t)){n[r]=void 0;continue}const o=e[r],d=t[r];if(!O(o,d))if(Array.isArray(o)&&Array.isArray(d))n[r]=d;else if(q(o)&&q(d)){const a=J(o,d);Object.keys(a).length>0&&(n[r]=a)}else n[r]=d}return n},O=(e,t)=>{if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(Array.isArray(e)&&Array.isArray(t))return e.length!==t.length?!1:e.every((r,o)=>O(r,t[o]));const n=Object.keys(e),i=Object.keys(t);return n.length!==i.length?!1:n.every(r=>O(e[r],t[r]))}return!1},q=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),N=e=>{if(e===null||typeof e!="object")return e;if(e instanceof Date)return new Date(e);if(e instanceof RegExp)return new RegExp(e);if(Array.isArray(e))return e.map(n=>N(n));const t={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=N(e[n]));return t},H=/\[\[\s*param\.([A-Za-z0-9_.-]+)\s*\]\]/g,U=/\bparam\s*\(\s*(['"])([^'"]+)\1/g;function ge(e){const t=[];let n=0;for(;n<e.length;){const i=e.indexOf("{{",n),r=e.indexOf("{%",n);let o=-1,d="";if(i===-1?(o=r,d="%}"):r===-1||i<r?(o=i,d="}}"):(o=r,d="%}"),o===-1)break;const a=e.indexOf(d,o+2);if(a===-1){n=o+2;continue}t.push(e.slice(o+2,a)),n=a+2}return t}function M(e){var i,r;if(!e)return[];const t=new Set;let n;for(H.lastIndex=0;(n=H.exec(e))!==null;){const o=(i=n[1])==null?void 0:i.trim();o&&t.add(o)}for(const o of ge(e))for(U.lastIndex=0;(n=U.exec(o))!==null;){const d=(r=n[2])==null?void 0:r.trim();d&&t.add(d)}return Array.from(t)}function be(e){const t=new Set,n=new Map;for(const i of e.controlBindings||[])t.add(i.controlId),i.target==="sql_param"&&n.set(i.paramId,i.controlId);for(const i of M(e.sql))t.add(n.get(i)??i);return Array.from(t)}function X(e){const t=new Map,n=new Map;for(const i of e.controlBindings||[])i.target==="sql_param"&&n.set(i.paramId,i.controlId);for(const i of M(e.sql))t.set(i,{paramId:i,controlId:n.get(i)??i});return Array.from(t.values())}function ye(e,t){var r;const n=(r=e.controlBindings)==null?void 0:r.map(o=>({...o,controlId:t.get(o.controlId)??o.controlId})),i=X(e).flatMap(({paramId:o,controlId:d})=>{var l;const a=t.get(d);return!a||a===d||(l=e.controlBindings)!=null&&l.some(s=>s.target==="sql_param"&&s.paramId===o)?[]:[{target:"sql_param",paramId:o,controlId:a}]});return i.length?[...n??[],...i]:n}function Q(e,t){var r,o;const n=e.source==="dashboardInputAlias"?((r=t.inputAliases)==null?void 0:r[e.variableName])??e:e,i=e.source==="dashboardInputAlias"&&n!==e?{...n,export:e.export??"label"}:n;return i.source==="dashboardInput"?{...i,inputId:((o=t.inputIds)==null?void 0:o[i.inputId])??i.inputId}:i}function Ie(e,t){var r;const n={};for(const o of["cardIds","sheetIds","inputIds","controlIds","filterIds"]){const d={...t[o]};for(const[a,l]of Object.entries((e==null?void 0:e[o])??{}))d[a]=((r=t[o])==null?void 0:r[l])??l;Object.keys(d).length&&(n[o]=d)}const i={...t.inputAliases};for(const[o,d]of Object.entries((e==null?void 0:e.inputAliases)??{}))i[o]=Q(d,t);return Object.keys(i).length&&(n.inputAliases=i),n}function ve(e,t){var r,o,d,a;const n=N(e);n.controlBindings=ye(e,new Map(Object.entries(t.controlIds??{})));for(const l of n.controls??[])l.id=((r=t.controlIds)==null?void 0:r[l.id])??l.id;for(const l of n.inlineFilters??[])l.id=((o=t.filterIds)==null?void 0:o[l.id])??l.id;const i=l=>{var m,f,u;if(!l||typeof l!="object")return;if(Array.isArray(l)){l.forEach(i);return}const s=l;if(s.type==="variable"&&s.ref&&typeof s.ref=="object"){const h=s.ref;s.ref=h.source==="input"?{...h,inputId:((m=t.inputIds)==null?void 0:m[h.inputId])??h.inputId}:Q(h,t)}if(typeof s.entityId=="string"){const h=s.entityId;s.fieldScope==="card"&&(s.entityId=((f=t.cardIds)==null?void 0:f[h])??h),s.fieldScope==="sheet"&&(s.entityId=((u=t.sheetIds)==null?void 0:u[h])??h)}for(const[h,F]of Object.entries(s))h!=="linkedReferenceOverrides"&&i(F)};i(n);for(const l of Object.values(((d=n.customCardPreferences)==null?void 0:d.dataInputCardIds)??{}))l.cardId=((a=t.cardIds)==null?void 0:a[l.cardId])??l.cardId;return n}function $(e){return(e==null?void 0:e.trim())||void 0}function W(e){return e.split(".").at(-1)||e}function V(e,t){var l,s;const n=$(t);if(!n)return;const i=W(n),r=$((l=e.fieldMeta)==null?void 0:l.name);if(r&&r!==n&&r!==i)return;const o=$((s=e.fieldMeta)==null?void 0:s.qualifiedFieldName);if(o&&W(o)!==i)return;const d=n.includes(".")?n:void 0,a=o!=null&&o.includes(".")?o:void 0;if(!(d&&a&&d!==a))return{leafName:i,...d||a?{qualifiedFieldName:d||a}:{}}}function K(e,t){return V(e,t)||V({},t)}function Y({source:e,sourceFieldName:t,target:n,targetFieldName:i}){const r=K(e,t),o=K(n,i);return!r||!o||r.leafName!==o.leafName?!1:o.qualifiedFieldName?r.qualifiedFieldName===o.qualifiedFieldName:!0}function x(e,t){var r,o;const n=De(e);if(n)return n;const i=(o=(r=e==null?void 0:e.fieldMeta)==null?void 0:r.nativeDataType)==null?void 0:o.trim();if(P(e==null?void 0:e.fieldMeta,t)&&i&&i!=="date"&&i!=="datetime")return i}function De(e){var n;const t=(n=e==null?void 0:e.nativeDataType)==null?void 0:n.trim();return t&&t!=="date"&&t!=="datetime"?t:void 0}function P(e,t){var d,a;const n=t.trim();if(!n)return!1;const i=n.split(".").at(-1),r=(d=e==null?void 0:e.qualifiedFieldName)==null?void 0:d.trim();if(r&&!(r===n||!r.includes(".")&&r===i))return!1;const o=(a=e==null?void 0:e.name)==null?void 0:a.trim();return o&&o!==n&&o!==i?!1:!!(r||o)}function Fe({fieldName:e,definition:t,value:n}){if((t==null?void 0:t.column)===e){const i=x(t,e);if(i)return i}return(n==null?void 0:n.name)===e?x(n,e):void 0}function Z({definition:e,value:t,sourceValue:n=t}){const i=e&&Y({source:e,sourceFieldName:e.column,target:t,targetFieldName:t.name})?e:void 0,r=n&&Y({source:n,sourceFieldName:n.name,target:t,targetFieldName:t.name})?n:void 0,o=(i?x(i,i.column):void 0)||(r?x(r,r.name):void 0);return ee({carrier:t,nativeDataType:o,projectNestedNativeDataType:P(t.fieldMeta,t.name)})}function _e({filterDefinitions:e,filterValues:t}){if(!(e!=null&&e.length)||!t.length)return t;const n=new Map(e.map(o=>[o.id,o]));let i=!1;const r=t.map(o=>{if(typeof o.name!="string"||!o.name.trim())return o;const d=n.get(o.filterId);if(!d)return o;const a=Z({definition:d,value:o});return i||(i=a!==o),a});return i?r:t}function Se(e){const t=Fe({fieldName:e.column,definition:e});return ee({carrier:e,nativeDataType:t,projectNestedNativeDataType:P(e.fieldMeta,e.column)})}function ee({carrier:e,nativeDataType:t,projectNestedNativeDataType:n}){var s;const i=(s=e.fieldMeta)==null?void 0:s.nativeDataType;if(t){if(e.nativeDataType===t&&(!e.fieldMeta||(n?i===t:!i)))return e;const{nativeDataType:m,...f}=e.fieldMeta||{};return{...e,nativeDataType:t,...e.fieldMeta?{fieldMeta:n?{...e.fieldMeta,nativeDataType:t}:f}:{}}}if(e.nativeDataType===void 0&&i===void 0)return e;const{nativeDataType:r,fieldMeta:o,...d}=e,{nativeDataType:a,...l}=o||{};return{...d,...o?{fieldMeta:l}:{}}}function G(e){const t=new Set;for(const n of[e.name,e.sourceField]){if(!n)continue;const i=p.normalizeAnalyticsCatalogName(n);if(!i)continue;t.add(i);const r=i.split("."),o=r[r.length-1];o&&t.add(o)}return t}function te(e,t){const n=p.normalizeAnalyticsCatalogDataType(e),i=p.normalizeAnalyticsCatalogDataType(t);return n==="unknown"||i==="unknown"?!1:(n==="date"||n==="datetime")&&(i==="date"||i==="datetime")?!0:n===i}function Te(e,t){return p.semaphorSourcesReferToSameDataset(e.field.source,t.field.source)&&p.normalizeAnalyticsCatalogName(e.field.name)===p.normalizeAnalyticsCatalogName(t.field.name)&&p.normalizeAnalyticsCatalogName(e.field.sourceField||e.field.name)===p.normalizeAnalyticsCatalogName(t.field.sourceField||t.field.name)}function ne(e,t){if(e.kind!=="field")return!1;const n=G(t),i=G(e.field);return te(t.dataType,e.field.dataType)&&[...i].some(r=>n.has(r))}function ke(e){const t=e.candidates.filter(n=>ne(n,e.logicalValueField));return t.length===1?{status:"matched",target:t[0]}:t.length>1?{status:"ambiguous"}:{status:"notApplicable"}}function Ae(e){const t=[];for(const n of e.acceptedTargets)!te(e.logicalValueField.dataType,n.field.dataType)||t.some(i=>Te(i,n))||t.push(n);return t.length===1?{status:"matched",target:t[0]}:t.length>1?{status:"ambiguous"}:{status:"notApplicable"}}const Ne=/\{\{-?\s*filters\s*\|\s*where\s*-?\}\}/i,xe=/\{\{-?\s*filters\s*\|\s*and\s*-?\}\}/i,we=/\bwhere\b/i;function ie(e){return e!=null&&e.trim()?Ne.test(e)||xe.test(e):!1}function $e(e){return!(e!=null&&e.trim())||ie(e)?null:we.test(e)?{helper:"{{ filters | and }}",description:"For queries with an existing WHERE clause."}:{helper:"{{ filters | where }}",description:"For queries without a WHERE clause."}}function Re(e){return(e.field.sourceField||e.field.name).trim()||void 0}function Oe(e){if(e.inventory.kind!=="sql"||e.target.kind!=="field")return{status:"ineligible"};const t=R.findDashboardSqlPinnedCatalogSource(e.inventory,e.target.field.source),n=Re(e.target);if(!t||!n)return{status:"ineligible"};if(t.executionTable){const d=[t.executionTable.databaseName,t.executionTable.schemaName,t.executionTable.tableName,n].filter(Boolean).join(".");return{status:"eligible",source:t.source,executionIdentifier:d}}if(e.inventory.pinnedCatalogSources.length!==1)return{status:"ineligible"};const i=p.normalizeAnalyticsCatalogName(n),r=(e.candidateTargets||[]).filter(d=>p.normalizeAnalyticsCatalogName(d.field.sourceField||d.field.name)===i),o=[];for(const d of r)o.some(a=>p.semaphorSourcesReferToSameDataset(a,d.field.source))||o.push(d.field.source);return o.length>1?{status:"ineligible"}:{status:"eligible",source:t.source,executionIdentifier:n}}const re=Object.freeze({mode:"all_applicable"});function oe(e){if(e===void 0)return{ok:!0,dependencies:{...re}};const t=p.validateSemaphorOptionDependencies(e,"dashboard");if(!t.ok)return{ok:!1,error:"Invalid dashboard option dependency policy.",issues:t.errors.map(i=>i.message)};const n=e;switch(n.mode){case"independent":return{ok:!0,dependencies:{mode:"independent"}};case"explicit":return{ok:!0,dependencies:{mode:"explicit",includeInputIds:[...n.includeInputIds||[]]}};case"all_applicable":return{ok:!0,dependencies:{mode:"all_applicable",...n.excludeInputIds?{excludeInputIds:[...n.excludeInputIds]}:{}}};default:return{ok:!1,error:"Invalid dashboard option dependency policy.",issues:["Dashboard option dependencies must declare a mode."]}}}function ae(e){if(e===void 0)return{ok:!0,population:void 0};const t={ok:!1,error:"Invalid option population."};if(!e||typeof e!="object"||Array.isArray(e))return t;const n=e;if(n.kind==="option_source")return{ok:!0,population:{kind:"option_source"}};if(n.kind!=="related_population")return t;const i=n.baseSource;if(!i||i.kind!=="semantic"||!p.hasCompleteSemaphorSourceIdentity(i))return t;const r=n.relationshipHint;return r!==void 0&&(!r||typeof r!="object"||r.relationshipIds!==void 0&&(!Array.isArray(r.relationshipIds)||r.relationshipIds.some(o=>typeof o!="string"||!o.trim())))?t:{ok:!0,population:{kind:"related_population",baseSource:i,...r?{relationshipHint:r}:{}}}}function Ce(e){const{dependencies:t}=e,n=new Set([e.targetInputId,...t.excludeInputIds||[]]);return t.mode==="independent"?[]:t.mode==="explicit"?(t.includeInputIds||[]).filter(i=>!n.has(i)):e.peerInputIds.filter(i=>!n.has(i))}function Ee(e,t,n){if(t===n)return e;let i=!1;const r=d=>d!=null&&d.includes(t)?(i=!0,Array.from(new Set(d.map(a=>a===t?n:a)))):d,o=e.map(d=>{const a=d.optionDependencies;if(!a)return d;const l=r(a.includeInputIds),s=r(a.excludeInputIds);return l===a.includeInputIds&&s===a.excludeInputIds?d:{...d,optionDependencies:{...a,...l?{includeInputIds:l}:{},...s?{excludeInputIds:s}:{}}}});return i?o:e}function Me(e,t){const n=se(e.dependencies,t);return n===e.dependencies?e:{...e,dependencies:n}}function se(e,t){if(!(t!=null&&t.length)||e.mode!=="explicit")return e;const n=new Set(e.includeInputIds||[]),i=Array.from(new Set(t)).filter(r=>n.has(r));return i.length?{...e,omitInputIds:i}:e}class de extends Error{constructor(n){super(n.map(i=>i.message).join(" "));L(this,"issues");this.name="DashboardFilterMappingContractError",this.issues=n}}const Pe={string:!0,number:!0,boolean:!0,date:!0,datetime:!0};function D(e){return typeof e=="string"&&e.trim().length>0}function g(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function A(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")}function ze(e){if(!g(e))return!1;switch(e.kind){case"allSheets":return e.sheetKinds===void 0||A(e.sheetKinds)&&e.sheetKinds.every(t=>t==="dashboard"||t==="document");case"sheets":return A(e.sheetIds);case"cards":return A(e.cardIds);case"documentSections":return D(e.sheetId)&&A(e.sectionIds);default:return!1}}function Be(e){return e==="shared"||e==="perSheet"||e==="perCard"||e==="perDocumentSection"}function Le(e){return g(e)?D(e.id)&&D(e.column)&&D(e.dataType):!1}function je(e,t,n,i){var a;if(!g(t)){i.push({code:"invalid_option_source",path:n,message:`${n} must be a semantic or physical option source.`,inputId:e});return}const r=t.source,o=[["labelField",t.labelField],["valueField",t.valueField],["searchField",t.searchField]];if(!g(r)||r.kind!=="semantic"&&r.kind!=="physical"||!p.hasCompleteSemaphorSourceIdentity(r)||!g(t.labelField)||!g(t.valueField)||t.searchField!==void 0&&!g(t.searchField)||t.disambiguationFields!==void 0&&(!Array.isArray(t.disambiguationFields)||!t.disambiguationFields.every(g))){i.push({code:"invalid_option_source",path:n,message:`${n} must contain a valid semantic or physical source and field references.`,inputId:e});return}for(const[l,s]of o)s!==void 0&&g(s)&&(!D(s.name)||s.source!==void 0&&!p.semaphorSourcesReferToSameDataset(s.source,r))&&i.push({code:"invalid_option_source",path:`${n}.${l}`,message:`${n}.${l} must be a named field belonging to the declared option source.`,inputId:e});for(const[l,s]of((a=t.disambiguationFields)==null?void 0:a.entries())||[])(!g(s)||!D(s.name)||s.source!==void 0&&!p.semaphorSourcesReferToSameDataset(s.source,r))&&i.push({code:"invalid_option_source",path:`${n}.disambiguationFields[${l}]`,message:`${n}.disambiguationFields[${l}] must be a named field belonging to the declared option source.`,inputId:e});const d=t.valueField;["string","number","boolean","date","datetime"].includes(String(d.dataType))||i.push({code:"invalid_option_source",path:`${n}.valueField.dataType`,message:`${n}.valueField.dataType must be a known option-value datatype.`,inputId:e})}function qe(e,t,n){var i;if(e.optionDependencies!==void 0){const r=oe(e.optionDependencies);r.ok?g(e.optionDependencies)&&e.optionDependencies.omitInputIds!==void 0&&n.push({code:"invalid_option_dependencies",path:`${t}.optionDependencies.omitInputIds`,message:`${t}.optionDependencies cannot persist a browse override (omitInputIds).`,inputId:e.id}):n.push({code:"invalid_option_dependencies",path:`${t}.optionDependencies`,message:`${t}.optionDependencies ${r.issues.join("; ")||r.error}`,inputId:e.id})}if(e.optionPopulation!==void 0){const r=ae(e.optionPopulation);r.ok?((i=r.population)==null?void 0:i.kind)==="related_population"&&!He(e.optionSource)&&n.push({code:"invalid_option_population",path:`${t}.optionPopulation`,message:`${t}.optionPopulation related_population requires an authored semantic optionSource.`,inputId:e.id}):n.push({code:"invalid_option_population",path:`${t}.optionPopulation`,message:`${t}.optionPopulation must be option_source or a related_population with a complete semantic baseSource.`,inputId:e.id})}}function He(e){return g(e)&&g(e.source)&&e.source.kind==="semantic"}function Ue(e,t,n,i,r,o){var s;if(D(t.bindingId)||r.push({code:"invalid_binding_id",path:`${n}.bindingId`,message:`${n}.bindingId must be an opaque non-empty id.`,inputId:e,cardId:t.cardId}),((s=t.target)==null?void 0:s.kind)!=="field"){r.push({code:"unsupported_target",path:`${n}.target`,message:`${n}.target must be one direct field target.`,inputId:e,cardId:t.cardId,bindingId:t.bindingId});return}const d=t.target.field;if(!D(d==null?void 0:d.name)||!d.source||d.source.kind!=="semantic"&&d.source.kind!=="physical"||!p.hasCompleteSemaphorSourceIdentity(d.source)){r.push({code:"invalid_target_field",path:`${n}.target.field`,message:`${n}.target.field must have a name and a source-qualified semantic or physical identity.`,inputId:e,cardId:t.cardId,bindingId:t.bindingId});return}if(Object.prototype.hasOwnProperty.call(Pe,d.dataType)||r.push({code:"unknown_target_data_type",path:`${n}.target.field.dataType`,message:`${n}.target.field.dataType must be known.`,inputId:e,cardId:t.cardId,bindingId:t.bindingId}),d.sourceField!==void 0&&!D(d.sourceField)&&r.push({code:"invalid_target_field",path:`${n}.target.field.sourceField`,message:`${n}.target.field.sourceField must be a non-empty catalog-grounded column when provided.`,inputId:e,cardId:t.cardId,bindingId:t.bindingId}),!o)return;const a=i.get(t.cardId);if(!a){r.push({code:"unknown_card",path:`${n}.cardId`,message:`${n}.cardId '${t.cardId}' does not exist.`,inputId:e,cardId:t.cardId,bindingId:t.bindingId});return}const l=R.buildDashboardCardSourceIndex(a);(l.kind==="unconfigured"||!R.dashboardCardFilterSourceInventoryContains(l,d.source))&&r.push({code:"unavailable_card_source",path:`${n}.target.field.source`,message:`${n}.target field source is not declared by card '${a.id}'.`,inputId:e,cardId:a.id,bindingId:t.bindingId})}function We(e,t,n,i,r,o){if(t===void 0)return;if(!g(t)||t.kind!=="cardMappings"||!Array.isArray(t.cards)){r.push({code:"invalid_application",path:n,message:`${n} must be a cardMappings application with a cards array.`,inputId:e});return}const d=new Set;t.cards.forEach((a,l)=>{const s=`${n}.cards[${l}]`;if(!D(a==null?void 0:a.cardId)){r.push({code:"unknown_card",path:`${s}.cardId`,message:`${s}.cardId is required.`,inputId:e});return}if(d.has(a.cardId)){r.push({code:"duplicate_card_application",path:`${s}.cardId`,message:`${n} contains more than one entry for card '${a.cardId}'.`,inputId:e,cardId:a.cardId});return}if(d.add(a.cardId),o&&!i.has(a.cardId)){r.push({code:"unknown_card",path:`${s}.cardId`,message:`${s}.cardId '${a.cardId}' does not exist.`,inputId:e,cardId:a.cardId});return}a.kind==="bound"?Ue(e,a,s,i,r,o):a.kind!=="excluded"&&r.push({code:"invalid_application",path:s,message:`${s}.kind must be 'bound' or 'excluded'.`,inputId:e,cardId:a.cardId})})}function le({inputs:e,dashboardFilters:t,cards:n=[],validateCardTargets:i=!1}){const r=[],o=new Map((t||[]).map(s=>[s.id,s])),d=new Map(i?n.map(s=>[s.id,s]):[]),a=[],l=new Map;return e!=null&&!Array.isArray(e)?(r.push({code:"invalid_input",path:"dashboard.inputs",message:"dashboard.inputs must be an array when present."}),{ok:!1,inputs:a,issues:r}):((Array.isArray(e)?e:[]).forEach((s,m)=>{const f=`dashboard.inputs[${m}]`;if(!g(s)||s.kind!=="filter"&&s.kind!=="control"||!D(s.id)||!D(s.label)||!D(s.variableName)||!ze(s.scope)||!Be(s.runtimeScope)){r.push({code:"invalid_input",path:f,message:`${f} must be a complete filter or control Dashboard Input envelope.`,inputId:g(s)&&typeof s.id=="string"?s.id:void 0});return}if(s.kind==="control"&&!g(s.control)){r.push({code:"invalid_input",path:`${f}.control`,message:`${f}.control must be a control definition.`,inputId:s.id});return}const u=s;if(u.kind==="control"){a.push(u);return}const h=u.filter,F=u.filterReference,S=h!==void 0,T=!!F;if(S&&T){r.push({code:"both_filter_definitions",path:f,message:`${f} must contain either filter or filterReference, not both.`,inputId:u.id});return}if(!S&&!T){r.push({code:"missing_filter_definition",path:f,message:`${f} must contain filter or filterReference.`,inputId:u.id});return}if(S&&!Le(h)){r.push({code:"invalid_input",path:`${f}.filter`,message:`${f}.filter must be a complete dashboard filter definition.`,inputId:u.id});return}let I,c;if(S)I=h,c="embedded";else{if((F==null?void 0:F.kind)!=="dashboardFilter"){r.push({code:"invalid_filter_reference",path:`${f}.filterReference.kind`,message:`${f}.filterReference.kind must be 'dashboardFilter'.`,inputId:u.id});return}const w=typeof(F==null?void 0:F.filterId)=="string"?F.filterId:void 0;if(I=w?o.get(w):void 0,c="dashboardFilter",!I){r.push({code:"orphaned_filter_reference",path:`${f}.filterReference.filterId`,message:`${f}.filterReference cannot resolve dashboard filter '${w||""}'.`,inputId:u.id});return}if(I.kind==="global-date"){r.push({code:"global_date_reference",path:`${f}.filterReference`,message:`${f}.filterReference cannot reference the Global Date filter.`,inputId:u.id});return}const B=l.get(I.id);if(B){r.push({code:"duplicate_filter_reference",path:`${f}.filterReference.filterId`,message:`${f}.filterReference duplicates dashboard filter '${I.id}' already owned by Dashboard Input '${B}'.`,inputId:u.id});return}l.set(I.id,u.id)}if(!I)return;if(u.forceSelection!==void 0&&typeof u.forceSelection!="boolean"&&r.push({code:"invalid_input",path:`${f}.forceSelection`,message:`${f}.forceSelection must be a boolean.`,inputId:u.id}),u.optionSource!==void 0&&je(u.id,u.optionSource,`${f}.optionSource`,r),qe(u,f,r),u.application&&I.kind==="global-date"){r.push({code:"global_date_reference",path:`${f}.application`,message:`${f}.application cannot map the Global Date filter.`,inputId:u.id});return}u.application&&u.scope.kind!=="allSheets"&&u.scope.kind!=="sheets"&&r.push({code:"unsupported_mapped_scope",path:`${f}.scope`,message:`${f}.scope must be allSheets or sheets when cardMappings are present.`,inputId:u.id}),We(u.id,u.application,`${f}.application`,d,r,i);const{filter:_,filterReference:y,compatibility:v,...b}=u;a.push({...b,filter:I,...S&&v?{compatibility:v}:{},...u.optionSource?{optionSource:u.optionSource}:{},...u.optionDependencies?{optionDependencies:u.optionDependencies}:{},...u.optionPopulation?{optionPopulation:u.optionPopulation}:{},definitionOrigin:c})}),r.length?{ok:!1,inputs:a,issues:r}:{ok:!0,inputs:a})}function Ve(e){const t=le(e);if(!t.ok)throw new de(t.issues);return t.inputs}function Ke(e=()=>globalThis.crypto.randomUUID()){return e()}const Ye={date:new Set(["between","not between","=","!=",">",">=","<","<=","is null","is not null"]),number:new Set(["between","not between","=","!=",">",">=","<","<=","in","not in","is null","is not null"]),string:new Set(["=","!=","in","not in","like","not like","is null","is not null"]),boolean:new Set(["=","!=","in","not in","is null","is not null"])};function ce(e){const t=p.normalizeAnalyticsCatalogDataType(e);return t==="number"||t==="boolean"?t:t==="date"||t==="datetime"?"date":"string"}function Ge(e,t){return typeof t!="string"?!1:Ye[ce(e)].has(t)}function C(e,t,n=i=>{var r;return((r=i.derivedField)==null?void 0:r.dataType)??i.dataType}){return t==="sql_param"||t==="presentation_currency"?[]:t==="config_metric_selector"||t==="config_aggregation"?e.measures.flatMap(i=>i.kind==="aggregate"?[{id:i.id,kind:"measure",measure:i}]:[]):["rows","columns"].flatMap(i=>e[i].filter(r=>t!=="config_grain"||p.isAnalyticsDateLikeDataType(n(r.field))).map(r=>({id:r.id,kind:"level",axis:i,level:r})))}function Je(e,t,n,i){const r=[...e.rows,...e.columns].find(s=>s.id===t);if(!r)throw new Error("Matrix level is no longer present.");if(i===t)return{kind:"structure",rows:e.rows,columns:e.columns};const o=e.rows.filter(s=>s.id!==t),d=e.columns.filter(s=>s.id!==t),a=n==="rows"?o:d,l=i?a.findIndex(s=>s.id===i):-1;return a.splice(l<0?a.length:l,0,r),{kind:"structure",rows:o,columns:d}}function z(e,t){const n=j.getMatrixAnalyticalDefinition(e),i=j.getMatrixAnalyticalDefinition(t),r=(a,l)=>k.stableSerialize(n[a][l])===k.stableSerialize(i[a][l]),o=a=>{const l=n.rankings.find(m=>m.id===a),s=i.rankings.find(m=>m.id===a);return!!l&&!!s&&k.stableSerialize(l)===k.stableSerialize(s)};return(a,l,s=!1)=>l.length<=t[a].length&&l.every((m,f)=>{var u;return(m.member.kind==="value"||s&&o(m.member.rankingId))&&m.levelId===((u=t[a][f])==null?void 0:u.id)&&r(a,f)})}function E(e,t,n,i){if(!n)return n;const r=z(e,t),o=new Set(t.measures.map(d=>d.id));return{...n,rules:n.rules.filter(d=>{const a=d.target.matrix,l=!a||(a.levelId===void 0||t[a.axis].some(m=>m.id===a.levelId))&&(a.oppositePath===void 0||r(a.axis==="rows"?"columns":"rows",a.oppositePath,!0)),{validationRefs:s}=p.conditionalRuleMeasureRefs(d);return l&&s.every(m=>o.has(m))?!0:(i.push({kind:"conditional_format",id:d.id,message:"Removed a conditional rule whose measure, level or member path changed."}),!1)})}}function ue(e,t,n=!1){const i={...t},r=[],o=z(e,i),d=new Set(i.measures.map(l=>l.id)),a=(l,s,m)=>r.push({kind:l,id:s,message:m});return i.sorts=i.sorts.filter(l=>{const s=i[l.axis].findIndex(f=>f.id===l.levelId),m=s>=0&&(l.scope.kind==="level"||l.scope.parent.length===s&&o(l.axis,l.scope.parent))&&(l.target.kind==="member"||d.has(l.target.measureId)&&o(l.axis==="rows"?"columns":"rows",l.target.oppositePath));return m||a("sort",l.levelId,"Removed a sort whose level, measure or member path changed."),m}),i.rankings=i.rankings.filter(l=>{const s=i[l.axis].some(m=>m.id===l.levelId)&&d.has(l.measureId)&&o(l.axis==="rows"?"columns":"rows",l.oppositePath);return s||a("ranking",l.id,"Removed a ranking whose level, measure or member path changed."),s}),{spec:(n?p.matrixAuthoringSpecSchema:p.matrixSpecSchema).parse(i),notices:r}}function Xe(e,t,n=[],i,r=!1){const o=[];if(t.kind!=="structure"){const c=t.kind==="presentation"?{...e,presentation:t.presentation}:t.kind==="defaults"?{...e,defaultView:t.defaultView}:t.kind==="sorts"?{...e,spec:{...e.spec,sorts:t.sorts}}:{...e,spec:{...e.spec,rankings:t.rankings}};return t.kind==="rankings"&&c.presentation.conditionalFormatting&&(c.presentation={...c.presentation,conditionalFormatting:E(e.spec,c.spec,c.presentation.conditionalFormatting,o)}),{config:(r?p.matrixAuthoringConfigSchema:p.matrixConfigSchema).parse(c),notices:o,removedBindings:[],bindings:n}}const d=ue(e.spec,{...e.spec,rows:t.rows??e.spec.rows,columns:t.columns??e.spec.columns,measures:t.measures??e.spec.measures},r),a=d.spec;o.push(...d.notices);const l=z(e.spec,a),s=new Set(a.measures.map(c=>c.id)),m=[...a.rows,...a.columns],f=new Set(m.map(c=>c.id)),u=(c,_,y)=>o.push({kind:c,id:_,message:y}),h=[],F=n.flatMap(c=>{if(c.target==="sql_param"||c.target==="presentation_currency")return[c];const _=C(e.spec,c.target,i),y=c.matrixTargetId??(_.length===1?_[0].id:void 0);return C(a,c.target,i).some(b=>b.id===y)?c.matrixTargetId?[c]:(u("binding",c.controlId,"Pinned the control binding to its original Matrix target after a structural change."),[{...c,matrixTargetId:y}]):(u("binding",c.controlId,"Removed a control binding whose original Matrix target is missing, ambiguous or no longer eligible."),h.push(c),[])}),S=(c,_,y)=>Object.fromEntries(Object.entries(c).filter(([v])=>_.has(v)?!0:(u(y,v,`Removed a ${y} override for a removed field.`),!1))),T={...e.presentation,levelLabels:S(e.presentation.levelLabels,f,"label"),measureLabels:S(e.presentation.measureLabels,s,"label"),levelFormats:S(e.presentation.levelFormats,f,"format"),measureFormats:S(e.presentation.measureFormats,s,"format"),totals:{...e.presentation.totals}};T.levelFormats=Object.fromEntries(Object.entries(T.levelFormats).filter(([c,_])=>{const y=m.find(b=>b.id===c),v=[...e.spec.rows,...e.spec.columns].find(b=>b.id===c);return _.type!=="temporal_bucket"||y.grain&&y.grain===(v==null?void 0:v.grain)?!0:(u("format",c,"Removed a temporal format because its grain changed."),!1)})),T.conditionalFormatting&&(T.conditionalFormatting=E(e.spec,a,T.conditionalFormatting,o));const I={...e.defaultView};for(const c of["rows","columns"]){const _={...e.presentation.totals.rows.levels,...e.presentation.totals.columns.levels};for(const b of Object.keys(e.presentation.totals[c].levels))f.has(b)||u("total",b,"Removed subtotal settings for a removed level.");T.totals[c]={...e.presentation.totals[c],levels:Object.fromEntries(a[c].map(b=>[b.id,_[b.id]??{visible:!0,position:"before"}]))};const y=e.defaultView[c],v=Math.min(y.depth,Math.max(0,a[c].length-1));v!==y.depth&&u("depth",c,`Reduced ${c} expansion depth to fit the hierarchy.`),I[c]={depth:v,overrides:y.overrides.filter(b=>b.path.length<a[c].length&&l(c,b.path)?!0:(u("expansion",c,`Removed a ${c} expansion override whose path changed or became a leaf.`),!1))}}return{config:(r?p.matrixAuthoringConfigSchema:p.matrixConfigSchema).parse({...e,spec:a,presentation:T,defaultView:I}),notices:o,removedBindings:h,bindings:F}}function fe(e){return!e.entityName||e.entityName===p.CALCULATED_FIELD_ENTITY_MARKER||e.entityName==="calculated_fields"||e.qualifiedEntityName===p.CALCULATED_FIELD_ENTITY_MARKER||e.qualifiedEntityName==="calculated_fields"?"root":e.qualifiedEntityName||e.entityName}function pe(e){return["domain",e.role||"field",fe(e),e.name].join("::")}function Qe(e){var r,o;if(e.fieldScope!=="domain")return;const t=e.calculatedFieldOrigin;if((r=t==null?void 0:t.id)!=null&&r.startsWith("domain::"))return t.id;const n=(o=e.derivedField)==null?void 0:o.resultRole,i=n==="measure"?"metric":n==="dimension"||n==="date"?"groupby":e.derivedField||t==null?void 0:t.role;if(!(i!=="metric"&&i!=="groupby"))return pe({...e,role:i})}exports.DASHBOARD_DEFAULT_OPTION_DEPENDENCIES=re;exports.DashboardFilterMappingContractError=de;exports.applyCardReferenceRemapping=ve;exports.applyOptionDependencyOverride=se;exports.cloneDeep=N;exports.composeCardReferenceRemapping=Ie;exports.createDashboardFilterBindingId=Ke;exports.dashboardFilterTargetMatchesLogicalValue=ne;exports.dashboardFilterValueTypeForDataType=ce;exports.extractParamControlIdsFromSql=M;exports.extractReferencedControlIds=be;exports.extractSqlParamReferences=X;exports.getCalculatedFieldNamespace=fe;exports.getDashboardFilterSubscriptionHint=$e;exports.getMatrixBindingTargets=C;exports.getObjectDiff=J;exports.getStableDomainCalculatedFieldId=pe;exports.hasDashboardFilterSubscription=ie;exports.isDashboardFilterOperationCompatible=Ge;exports.materializeFilterDefinitionNativeDataType=Se;exports.materializeFilterValueNativeDataType=Z;exports.materializeFilterValuesNativeDataType=_e;exports.moveMatrixLevel=Je;exports.normalizeDashboardInputs=le;exports.readExactDomainCalculatedFieldReference=Qe;exports.rebindDashboardOptionDependencyInputId=Ee;exports.reconcileMatrixSpecStructure=ue;exports.requireNormalizedDashboardInputs=Ve;exports.resolveDashboardFilterAutomaticTarget=ke;exports.resolveDashboardFilterInheritedTarget=Ae;exports.resolveDashboardOptionDependencies=oe;exports.resolveDashboardOptionPopulation=ae;exports.resolveDashboardSqlFilterTarget=Oe;exports.retainMatrixConditionalFormatting=E;exports.selectDashboardOptionDependencyInputIds=Ce;exports.updateMatrixConfig=Xe;exports.withDashboardOptionDependencyOverride=Me;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const y=require("./validators-DVYAnnX0.cjs"),V=require("./matrix-operation-contract-D9dLX-Wr.cjs");require("./matrix-continuation-6nhDy-lF.cjs");require("../value-format-preferences/index.cjs");const F=require("./temporal-bucket-4YEPEKlJ.cjs"),m=require("./field-aggregations-CDCamEsQ.cjs"),M=require("./matrix-definition-CBJW_4ii.cjs"),Q=require("./matrix-card-CRXcmAjp.cjs"),S=require("./color-CyB5o13F.cjs");let A;const J=new Uint8Array(16);function z(){if(!A&&(A=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!A))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return A(J)}const g=[];for(let e=0;e<256;++e)g.push((e+256).toString(16).slice(1));function H(e,t=0){return g[e[t+0]]+g[e[t+1]]+g[e[t+2]]+g[e[t+3]]+"-"+g[e[t+4]]+g[e[t+5]]+"-"+g[e[t+6]]+g[e[t+7]]+"-"+g[e[t+8]]+g[e[t+9]]+"-"+g[e[t+10]]+g[e[t+11]]+g[e[t+12]]+g[e[t+13]]+g[e[t+14]]+g[e[t+15]]}const $=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),O={randomUUID:$};function Z(e,t,a){if(O.randomUUID&&!e)return O.randomUUID();e=e||{};const r=e.random||(e.rng||z)();return r[6]=r[6]&15|64,r[8]=r[8]&63|128,H(r)}function X(e){return e.format!=null||e.dateFormat!=null}const P={"Week of MMM DD, YYYY":{type:"temporal_bucket",presentation:{mode:"preset",preset:"week_of_short"}},"Week of MMMM DD, YYYY":{type:"temporal_bucket",presentation:{mode:"preset",preset:"week_of_long"}},"Q1 YYYY":{type:"temporal_bucket",presentation:{mode:"preset",preset:"quarter_short"}},"1st Quarter YYYY":{type:"temporal_bucket",presentation:{mode:"preset",preset:"quarter_long"}},"YYYY Q1":void 0,"YYYY-Q1":void 0,"Quarter 1, YYYY":void 0,"YYYY-WW":void 0};function ee(e,t,a,r){return{code:t,severity:"warning",fieldId:e.fieldId,...r?{ignoredPattern:r}:{},effectiveFormat:a}}function te(e,t){if(e.dateFormat===void 0||e.dateFormat===null)return{format:m.AUTOMATIC_TEMPORAL_BUCKET_FORMAT};if(typeof e.dateFormat!="string")return{format:m.AUTOMATIC_TEMPORAL_BUCKET_FORMAT,repairCode:"unsupported_pattern"};const a=e.dateFormat==="custom"?typeof e.customFormat=="string"?e.customFormat.trim():"":e.dateFormat.trim();if(!a)return{format:m.AUTOMATIC_TEMPORAL_BUCKET_FORMAT,repairCode:"missing_custom_pattern"};if(Object.prototype.hasOwnProperty.call(P,a)){const i=P[a];return i?F.validateTemporalBucketFormatApplicability(i,t).ok?{format:i}:{format:m.AUTOMATIC_TEMPORAL_BUCKET_FORMAT,repairCode:"grain_incompatible_pattern",ignoredPattern:a}:{format:m.AUTOMATIC_TEMPORAL_BUCKET_FORMAT,repairCode:"unsupported_pattern",ignoredPattern:a}}const r={type:"temporal_bucket",presentation:{mode:"pattern",pattern:a}},n=F.validateTemporalBucketFormatApplicability(r,t);return n.ok?{format:r}:{format:m.AUTOMATIC_TEMPORAL_BUCKET_FORMAT,repairCode:n.code==="incompatible_temporal_bucket_pattern"||n.code==="incompatible_temporal_bucket_preset"?"grain_incompatible_pattern":"unsupported_pattern",ignoredPattern:a}}function re(e){if(y.isSemaphorTimeGrain(e.granularity))return{granularity:e.granularity,assumedDay:!1};if(!(e.granularity!==void 0&&e.granularity!==null))return y.normalizeAnalyticsCatalogDataType(e.dataType)==="date"?{granularity:"day",assumedDay:!0}:void 0}function ae(e){const t=re(e);if(!t)return{ok:!1,error:{code:"ambiguous_temporal_grain",fieldId:e.fieldId}};let a,r,n;if(e.format!==void 0&&e.format!==null){const d=y.temporalBucketFormatSchema.safeParse(e.format);if(!d.success)a=m.AUTOMATIC_TEMPORAL_BUCKET_FORMAT,r="unsupported_pattern";else{const l=F.validateTemporalBucketFormatApplicability(d.data,t.granularity);a=l.ok?d.data:m.AUTOMATIC_TEMPORAL_BUCKET_FORMAT,l.ok||(r=l.code==="invalid_temporal_bucket_pattern"?"unsupported_pattern":"grain_incompatible_pattern",n=d.data.presentation.mode==="pattern"?d.data.presentation.pattern:d.data.presentation.mode==="preset"?d.data.presentation.preset:void 0)}}else({format:a,repairCode:r,ignoredPattern:n}=te(e,t.granularity));const i=t.assumedDay?"missing_grain_assumed_day":r;return{ok:!0,format:a,...i?{diagnostic:ee(e,i,a,n)}:{}}}var oe=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function x(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function ne(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var a=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};a.prototype=t.prototype}else a={};return Object.defineProperty(a,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(a,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}),a}function R(e,t){var n,i;if((n=e.config)!=null&&n.matrix)return e.config.matrix;const a=((i=e.dataSource)==null?void 0:i.selectedEntities)??[],r=t??(a.length===1?m.resolveDashboardEntitySource(a[0],e.dataSource):void 0);if(!r)throw new Error("Select a base dataset before configuring Matrix fields or filters.");return M.createMatrixAuthoringDraft({source:r,rows:[],columns:[],measures:[],sorts:[],rankings:[]})}function ie(e){const{spec:t,window:a,queryContext:r,reportContext:n}=e;if(!e.cardId)throw new Error("Matrix query requires its card identity.");return{cardId:e.cardId,cardType:"matrixTable",cardConfig:{matrix:{spec:t}},matrixWindowRequest:a,...V.parseMatrixRuntimeInputs({runtimeFilters:r.resolvedFilters,runtimeSorts:e.runtimeSorts}),active_filters:r.cardFilterValues,calendarContext:n.calendar,controlDefinitions:r.controlDefinitions,cardControlDefinitions:r.cardControlDefinitions,controlBindings:r.controlBindings,controlValues:r.controlValues}}function Y(e){return(t,a)=>{const r=e.filter(n=>n.field.name===t.name&&!!n.field.source&&y.semaphorSourcesReferToSameDataset(n.field.source,t.source??a));return r.length===1?r[0]:void 0}}function B(e){const t=Y(e);return(a,r)=>{var n;return(n=t(a,r))==null?void 0:n.resolvedField}}function se(e){const t=B(e);return(a,r)=>a.derivedField?void 0:t(a,r)}function U(e,t,a){if(e.derivedField)return e.derivedField.dataType;const r=a.filter(i=>!i.derivedField&&i.name===e.name&&y.semaphorSourcesReferToSameDataset(i.source??t,e.source??t));return r.length?new Set(r.map(i=>i.dataType)).size===1?r[0].dataType??e.dataType:void 0:e.dataType}function T(e,t,a){var l;const r=(l=e.config)==null?void 0:l.matrix;if(!r)return[];const n=B(a),i=(o,u,p)=>{const c=n(o,r.spec.source);return{...c,source:o.source??r.spec.source,id:u,name:o.name,label:p,dataType:U(o,r.spec.source,a.map(b=>b.field))??"unknown",qualifiedFieldName:(c==null?void 0:c.qualifiedFieldName)??o.name,entityId:(c==null?void 0:c.entityId)??"",entityName:(c==null?void 0:c.entityName)??"",entityType:(c==null?void 0:c.entityType)??"table",...o.derivedField?{derivedField:o.derivedField}:{}}},d=t==="groupBy"?"rows":t==="pivotBy"?"columns":void 0;return d?r.spec[d].map(o=>({...i(o.field,o.id,M.getMatrixLevelLabel(o,r.presentation)),granularity:o.grain,role:d==="rows"?"groupby":"pivotby"})):t!=="metrics"?[]:r.spec.measures.map(o=>({...i(o.kind==="aggregate"?o.field:{name:o.definition.name,derivedField:o.definition},o.id,M.getMatrixMeasureLabel(o,r.presentation)),role:"metric",...o.kind==="aggregate"?{aggregate:o.aggregate}:{}}))}function I(e){return Q.inspectMatrixCardConfig(e,{authoringDraft:!0})}function L(e){return e.type!=="matrixTable"}function D(e){var t,a,r,n;return{rows:((t=e.config)==null?void 0:t.groupByColumns)??[],columns:((a=e.config)==null?void 0:a.pivotByColumns)??[],metrics:((r=e.config)==null?void 0:r.metricColumns)??[],details:((n=e.config)==null?void 0:n.detailColumns)??[]}}function h(e,t=[]){var i,d,l,o,u,p,c,b;if(L(e)){const C=D(e);return{kind:"shelf",status:e.config?"ready":"absent",fields:C,filters:(i=e.config)==null?void 0:i.filters,joinPlan:(d=e.config)==null?void 0:d.joinPlan,configured:Object.values(C).some(_=>_.length>0),supportsSql:!0}}const a=I(e),r=a.status==="ready"?a.config:void 0,n={config:{matrix:r}};return{kind:"matrix",status:a.status,matrix:r,error:a.status==="invalid"?a.error:void 0,get fields(){return r?{rows:T(n,"groupBy",t),columns:T(n,"pivotBy",t),metrics:T(n,"metrics",t),details:[]}:{rows:[],columns:[],metrics:[],details:[]}},filters:(u=(o=(l=e.config)==null?void 0:l.matrix)==null?void 0:o.spec)==null?void 0:u.filters,joinPlan:(b=(c=(p=e.config)==null?void 0:p.matrix)==null?void 0:c.spec)==null?void 0:b.joinPlan,get configured(){return y.matrixConfigSchema.safeParse(r).success},supportsSql:!1}}function de(e){return e?Object.values(D({config:e})).some(t=>t.length>0):!1}function fe(e){return h({type:e}).supportsSql}function le(e,t){return e.type!==t&&(e.type==="matrixTable"||t==="matrixTable")?{config:{},controlBindings:[],sql:"",python:""}:{}}function ce(e,t){var n,i;const a=e.type==="matrixTable"?(i=(n=e.config)==null?void 0:n.matrix)==null?void 0:i.spec.source:void 0;return!a||(t.selectedEntities??[]).some(d=>{const l=m.resolveDashboardEntitySource(d,t);return l&&y.semaphorSourcesReferToSameDataset(a,l)})?{dataSource:t}:{dataSource:t,config:{},controlBindings:[]}}function ue(e){return h(e).joinPlan}function pe(e,t){var i;if(e.type!=="matrixTable")return{...e.config,joinPlan:t};const a=(i=e.config)==null?void 0:i.matrix,r=t?m.resolveDashboardEntitySource(t.baseEntity,e.dataSource):a==null?void 0:a.spec.source;if(!r){if(!t)return e.config??{};throw new Error("Matrix joins require a configured base source.")}const n=R(e,r);return{matrix:{...n,spec:{...n.spec,source:r,joinPlan:t}}}}function ge(e){return e?h(e).filters:void 0}function me(e,t){var r;if(e.type!=="matrixTable")return{...e.config,filters:t};if(!t&&!((r=e.config)!=null&&r.matrix))return e.config??{};const a=R(e);return{matrix:{...a,spec:{...a.spec,filters:t}}}}function q(e,t){return e?t?h({type:t,config:e}).configured:de(e):!1}function be(e,t){var d,l,o;if(t!=null&&t.skipSetupCheck||e.type==="text")return!1;const a=h(e);if(!a.supportsSql)return!a.configured;if((d=e.customCardPreferences)!=null&&d.url)return!1;const r=!!(e.connectionId||(l=e.dataSource)!=null&&l.connectionId),n=!!((o=e.sql)!=null&&o.trim()),i=q(e.config);return!r||!i&&!n}var G={},N={},k={exports:{}},s=String,j=function(){return{isColorSupported:!1,reset:s,bold:s,dim:s,italic:s,underline:s,inverse:s,hidden:s,strikethrough:s,black:s,red:s,green:s,yellow:s,blue:s,magenta:s,cyan:s,white:s,gray:s,bgBlack:s,bgRed:s,bgGreen:s,bgYellow:s,bgBlue:s,bgMagenta:s,bgCyan:s,bgWhite:s,blackBright:s,redBright:s,greenBright:s,yellowBright:s,blueBright:s,magentaBright:s,cyanBright:s,whiteBright:s,bgBlackBright:s,bgRedBright:s,bgGreenBright:s,bgYellowBright:s,bgBlueBright:s,bgMagentaBright:s,bgCyanBright:s,bgWhiteBright:s}};k.exports=j();k.exports.createColors=j;var ye=k.exports;(function(e){Object.defineProperty(e,"__esModule",{value:!0});function t(o,u){for(var p in u)Object.defineProperty(o,p,{enumerable:!0,get:u[p]})}t(e,{dim:function(){return d},default:function(){return l}});const a=r(ye);function r(o){return o&&o.__esModule?o:{default:o}}let n=new Set;function i(o,u,p){typeof process<"u"&&process.env.JEST_WORKER_ID||p&&n.has(p)||(p&&n.add(p),console.warn(""),u.forEach(c=>console.warn(o,"-",c)))}function d(o){return a.default.dim(o)}const l={info(o,u){i(a.default.bold(a.default.cyan("info")),...Array.isArray(o)?[o]:[u,o])},warn(o,u){i(a.default.bold(a.default.yellow("warn")),...Array.isArray(o)?[o]:[u,o])},risk(o,u){i(a.default.bold(a.default.magenta("risk")),...Array.isArray(o)?[o]:[u,o])}}})(N);(function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return n}});const t=a(N);function a(i){return i&&i.__esModule?i:{default:i}}function r({version:i,from:d,to:l}){t.default.warn(`${d}-color-renamed`,[`As of Tailwind CSS ${i}, \`${d}\` has been renamed to \`${l}\`.`,"Update your configuration file to silence this warning."])}const n={inherit:"inherit",current:"currentColor",transparent:"transparent",black:"#000",white:"#fff",slate:{50:"#f8fafc",100:"#f1f5f9",200:"#e2e8f0",300:"#cbd5e1",400:"#94a3b8",500:"#64748b",600:"#475569",700:"#334155",800:"#1e293b",900:"#0f172a",950:"#020617"},gray:{50:"#f9fafb",100:"#f3f4f6",200:"#e5e7eb",300:"#d1d5db",400:"#9ca3af",500:"#6b7280",600:"#4b5563",700:"#374151",800:"#1f2937",900:"#111827",950:"#030712"},zinc:{50:"#fafafa",100:"#f4f4f5",200:"#e4e4e7",300:"#d4d4d8",400:"#a1a1aa",500:"#71717a",600:"#52525b",700:"#3f3f46",800:"#27272a",900:"#18181b",950:"#09090b"},neutral:{50:"#fafafa",100:"#f5f5f5",200:"#e5e5e5",300:"#d4d4d4",400:"#a3a3a3",500:"#737373",600:"#525252",700:"#404040",800:"#262626",900:"#171717",950:"#0a0a0a"},stone:{50:"#fafaf9",100:"#f5f5f4",200:"#e7e5e4",300:"#d6d3d1",400:"#a8a29e",500:"#78716c",600:"#57534e",700:"#44403c",800:"#292524",900:"#1c1917",950:"#0c0a09"},red:{50:"#fef2f2",100:"#fee2e2",200:"#fecaca",300:"#fca5a5",400:"#f87171",500:"#ef4444",600:"#dc2626",700:"#b91c1c",800:"#991b1b",900:"#7f1d1d",950:"#450a0a"},orange:{50:"#fff7ed",100:"#ffedd5",200:"#fed7aa",300:"#fdba74",400:"#fb923c",500:"#f97316",600:"#ea580c",700:"#c2410c",800:"#9a3412",900:"#7c2d12",950:"#431407"},amber:{50:"#fffbeb",100:"#fef3c7",200:"#fde68a",300:"#fcd34d",400:"#fbbf24",500:"#f59e0b",600:"#d97706",700:"#b45309",800:"#92400e",900:"#78350f",950:"#451a03"},yellow:{50:"#fefce8",100:"#fef9c3",200:"#fef08a",300:"#fde047",400:"#facc15",500:"#eab308",600:"#ca8a04",700:"#a16207",800:"#854d0e",900:"#713f12",950:"#422006"},lime:{50:"#f7fee7",100:"#ecfccb",200:"#d9f99d",300:"#bef264",400:"#a3e635",500:"#84cc16",600:"#65a30d",700:"#4d7c0f",800:"#3f6212",900:"#365314",950:"#1a2e05"},green:{50:"#f0fdf4",100:"#dcfce7",200:"#bbf7d0",300:"#86efac",400:"#4ade80",500:"#22c55e",600:"#16a34a",700:"#15803d",800:"#166534",900:"#14532d",950:"#052e16"},emerald:{50:"#ecfdf5",100:"#d1fae5",200:"#a7f3d0",300:"#6ee7b7",400:"#34d399",500:"#10b981",600:"#059669",700:"#047857",800:"#065f46",900:"#064e3b",950:"#022c22"},teal:{50:"#f0fdfa",100:"#ccfbf1",200:"#99f6e4",300:"#5eead4",400:"#2dd4bf",500:"#14b8a6",600:"#0d9488",700:"#0f766e",800:"#115e59",900:"#134e4a",950:"#042f2e"},cyan:{50:"#ecfeff",100:"#cffafe",200:"#a5f3fc",300:"#67e8f9",400:"#22d3ee",500:"#06b6d4",600:"#0891b2",700:"#0e7490",800:"#155e75",900:"#164e63",950:"#083344"},sky:{50:"#f0f9ff",100:"#e0f2fe",200:"#bae6fd",300:"#7dd3fc",400:"#38bdf8",500:"#0ea5e9",600:"#0284c7",700:"#0369a1",800:"#075985",900:"#0c4a6e",950:"#082f49"},blue:{50:"#eff6ff",100:"#dbeafe",200:"#bfdbfe",300:"#93c5fd",400:"#60a5fa",500:"#3b82f6",600:"#2563eb",700:"#1d4ed8",800:"#1e40af",900:"#1e3a8a",950:"#172554"},indigo:{50:"#eef2ff",100:"#e0e7ff",200:"#c7d2fe",300:"#a5b4fc",400:"#818cf8",500:"#6366f1",600:"#4f46e5",700:"#4338ca",800:"#3730a3",900:"#312e81",950:"#1e1b4b"},violet:{50:"#f5f3ff",100:"#ede9fe",200:"#ddd6fe",300:"#c4b5fd",400:"#a78bfa",500:"#8b5cf6",600:"#7c3aed",700:"#6d28d9",800:"#5b21b6",900:"#4c1d95",950:"#2e1065"},purple:{50:"#faf5ff",100:"#f3e8ff",200:"#e9d5ff",300:"#d8b4fe",400:"#c084fc",500:"#a855f7",600:"#9333ea",700:"#7e22ce",800:"#6b21a8",900:"#581c87",950:"#3b0764"},fuchsia:{50:"#fdf4ff",100:"#fae8ff",200:"#f5d0fe",300:"#f0abfc",400:"#e879f9",500:"#d946ef",600:"#c026d3",700:"#a21caf",800:"#86198f",900:"#701a75",950:"#4a044e"},pink:{50:"#fdf2f8",100:"#fce7f3",200:"#fbcfe8",300:"#f9a8d4",400:"#f472b6",500:"#ec4899",600:"#db2777",700:"#be185d",800:"#9d174d",900:"#831843",950:"#500724"},rose:{50:"#fff1f2",100:"#ffe4e6",200:"#fecdd3",300:"#fda4af",400:"#fb7185",500:"#f43f5e",600:"#e11d48",700:"#be123c",800:"#9f1239",900:"#881337",950:"#4c0519"},get lightBlue(){return r({version:"v2.2",from:"lightBlue",to:"sky"}),this.sky},get warmGray(){return r({version:"v3.0",from:"warmGray",to:"stone"}),this.stone},get trueGray(){return r({version:"v3.0",from:"trueGray",to:"neutral"}),this.neutral},get coolGray(){return r({version:"v3.0",from:"coolGray",to:"gray"}),this.gray},get blueGray(){return r({version:"v3.0",from:"blueGray",to:"slate"}),this.slate}}})(G);let E=G;var he=(E.__esModule?E:{default:E}).default;const f=x(he),Ce=".semaphor-scope";function _e(e){return e?e.closest(Ce):null}function Ae(e){if(!e)return"light";const t=e.dataset.semaphorTheme;return t==="dark"||t==="light"?t:e.classList.contains("dark")?"dark":"light"}const Te=!1,ve=["table","view","materialized view"],Ee=["_forecast"],Fe="dm",Me="semaphor_calculated_fields",Se="calculated_fields",we=["lg","md","sm","xs","xxs"],Re={default:{dashboardPanel:"",dashboardTabsContainer:"",gridLayout:{className:""},chart:{font:{family:S.SEMAPHOR_DEFAULT_FONT_FAMILY},dataset:{backgroundColor:[f.teal[500],f.teal[300],f.gray[700],f.gray[500],f.gray[300]],borderColor:[f.teal[500],f.teal[300],f.gray[700],f.gray[500],f.gray[300]]},options:{interaction:{mode:"index"},plugins:{datalabels:{display:!1,color:w},title:{display:!0},tooltip:{backgroundColor:"#fff",bodyColor:"#000",borderWidth:.25,titleColor:"#000",borderColor:"rgb(128,131,139)",cornerRadius:4,usePointStyle:!0,pointStyle:"rectRounded",boxPadding:4},legend:{position:"top",align:"center",maxHeight:0,labels:{useBorderRadius:!0,borderRadius:2}}},scales:{y:{grid:{display:!0},title:{display:!0,text:""},beginAtZero:!0,ticks:{precision:0}},x:{grid:{display:!0},title:{display:!0}}},layout:{padding:{top:-40}},borderRadius:2,responsive:!0,maintainAspectRatio:!1}}},dark:{chart:{dataset:{datalables:{color:w},backgroundColor:[f.teal[500],f.teal[300],f.gray[700],f.gray[500],f.gray[300]],borderColor:[f.teal[500],f.teal[300],f.gray[700],f.gray[500],f.gray[300]]},options:{plugins:{tooltip:{backgroundColor:"#000",bodyColor:"#fff",borderWidth:.25,titleColor:"#fff",borderColor:"rgb(128,131,139)",cornerRadius:2,boxPadding:4}},datalabels:{display:!1},scales:{x:{grid:{display:!0,color:f.slate[800]}},y:{grid:{display:!0,color:f.slate[800]}}}}}}};function w(e){var r,n,i,d,l,o,u,p,c;const t=(l=(d=(i=(n=(r=e==null?void 0:e.chart)==null?void 0:r.config)==null?void 0:n._config)==null?void 0:i.options)==null?void 0:d.plugins)==null?void 0:l.datalabels;let a=(o=e==null?void 0:e.dataset)==null?void 0:o.backgroundColor;return(t==null?void 0:t.align)==="end"&&(t==null?void 0:t.anchor)==="end"&&(a=v((u=e==null?void 0:e.chart)==null?void 0:u.canvas)),(t==null?void 0:t.align)==="start"&&(t==null?void 0:t.anchor)==="start"&&(a=v((p=e==null?void 0:e.chart)==null?void 0:p.canvas)),K(a,{baseColor:v((c=e==null?void 0:e.chart)==null?void 0:c.canvas)})}function v(e){if(typeof document<"u"){const t=_e(e);if(t){const r=window.getComputedStyle(t).getPropertyValue("--semaphor-background").trim();return r?`hsl(${r})`:Ae(t)==="dark"?"#000000":"#FFFFFF"}const a=document.documentElement;if(a.classList.contains("dark"))return"#000000";if(a.classList.contains("light"))return"#FFFFFF"}return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches?"#000000":"#FFFFFF"}function K(e,t={}){let a=0,r=0,n=0,i=0;const d=t.baseColor?S.parseRuntimeColor(t.baseColor):null,l=b=>{if(!b)return f.gray[500];const C=S.parseRuntimeColor(b);if(!C)return f.gray[500];const _=W(C,d);a+=_.r,r+=_.g,n+=_.b,i++};if(Array.isArray(e)?e.forEach(b=>{l(b)}):l(e),i===0)return f.gray[500];const o=a/i,u=r/i,p=n/i;return(o*299+u*587+p*114)/1e3>=180?"black":"white"}function W(e,t){if(e.alpha>=1)return e;const a=t?W(t,null):Be;return{r:e.r*e.alpha+a.r*(1-e.alpha),g:e.g*e.alpha+a.g*(1-e.alpha),b:e.b*e.alpha+a.b*(1-e.alpha)}}const Be={r:255,g:255,b:255};exports.BREAKPOINTS=we;exports.CALCULATED_FIELDS_GROUP_ID=Me;exports.CALCULATED_FIELDS_GROUP_NAME=Se;exports.DATABASE_ENTITY_TYPES=ve;exports.DATAMODEL_NAMESPCACE=Fe;exports.DEFAULT_STYLE=Re;exports.METADATA_KEYS=Ee;exports.buildMatrixCardQueryPayload=ie;exports.colors=f;exports.commonjsGlobal=oe;exports.createMatrixCatalogResolver=Y;exports.createMatrixFieldResolver=B;exports.createMatrixInteractionFieldResolver=se;exports.getAugmentedNamespace=ne;exports.getAuthoredCardFilters=ge;exports.getAuthoredCardJoinPlan=ue;exports.getCanvasBackgroundColor=v;exports.getCardDefinition=h;exports.getContrastColor=K;exports.getDatalabelColor=w;exports.getDefaultExportFromCjs=x;exports.hasSavedTemporalBucketPresentation=X;exports.hasValidCardConfig=q;exports.initializeMatrixCardDraft=R;exports.isCardUnconfigured=be;exports.isDevEnv=Te;exports.isShelfCard=L;exports.matrixAuthoringDataType=U;exports.matrixEditorFields=T;exports.readMatrixEditorConfig=I;exports.readSavedTemporalBucketFormat=ae;exports.readShelfCardFields=D;exports.resetMatrixRepresentation=le;exports.supportsSqlEditor=fe;exports.v4=Z;exports.withAuthoredCardDataSource=ce;exports.withAuthoredCardFilters=me;exports.withAuthoredCardJoinPlan=pe;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("./switch-BytP6QY8.cjs"),a=require("./index-DSa6RSdg.cjs"),T=require("./x-B6ghREd2.cjs");require("./constants-vtu7_IUo.cjs");require("./validators-DVYAnnX0.cjs");require("./matrix-operation-contract-D9dLX-Wr.cjs");require("../value-format-preferences/index.cjs");const j=require("react");require("./appearance-context-tNjvTJj3.cjs");require("./index-C8XCKzB6.cjs");require("./field-aggregations-CDCamEsQ.cjs");require("zod");require("./matrix-continuation-6nhDy-lF.cjs");require("./color-CyB5o13F.cjs");const ls=require("react-dom");require("./index-BlYf8gNa.cjs");require("./appearance-runtime-provider-Ca8rxO86.cjs");const U=require("./dashboard-briefing-launcher-C8nDSDnV.cjs"),St=require("./search-BqqhaMx9.cjs"),wt=require("./semantic-format-BhIL1PXP.cjs"),Be=require("./calculated-field-identity-rMuXuzEY.cjs"),us=require("./report-preferences-dialog-7Vsc_fsG.cjs"),ms=require("./use-debounced-dirty-check-XHSwAefL.cjs"),hs=require("./normalize-dashboard-for-dirty-check-BYtBA708.cjs"),ft=require("./save-3dYRmehL.cjs"),ps=require("./palette-BN-jYtaK.cjs"),xs=require("./braces-v55uLCAK.cjs");function fs(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const s=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,s.get?s:{enumerable:!0,get:()=>t[r]})}}return n.default=t,Object.freeze(n)}const E=fs(j);/**
|
|
2
|
-
* @license lucide-react v0.453.0 - ISC
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the ISC license.
|
|
5
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const gs=T.createLucideIcon("Glasses",[["circle",{cx:"6",cy:"15",r:"4",key:"vux9w4"}],["circle",{cx:"18",cy:"15",r:"4",key:"18o8ve"}],["path",{d:"M14 15a2 2 0 0 0-2-2 2 2 0 0 0-2 2",key:"1ag4bs"}],["path",{d:"M2.5 13 5 7c.7-1.3 1.4-2 3-2",key:"1hm1gs"}],["path",{d:"M21.5 13 19 7c-.7-1.3-1.5-2-3-2",key:"1r31ai"}]]);/**
|
|
7
|
-
* @license lucide-react v0.453.0 - ISC
|
|
8
|
-
*
|
|
9
|
-
* This source code is licensed under the ISC license.
|
|
10
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const bs=T.createLucideIcon("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);/**
|
|
12
|
-
* @license lucide-react v0.453.0 - ISC
|
|
13
|
-
*
|
|
14
|
-
* This source code is licensed under the ISC license.
|
|
15
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/const vs=T.createLucideIcon("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/**
|
|
17
|
-
* @license lucide-react v0.453.0 - ISC
|
|
18
|
-
*
|
|
19
|
-
* This source code is licensed under the ISC license.
|
|
20
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
-
*/const ys=T.createLucideIcon("ShieldX",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m14.5 9.5-5 5",key:"17q4r4"}],["path",{d:"m9.5 9.5 5 5",key:"18nt4w"}]]);/**
|
|
22
|
-
* @license lucide-react v0.453.0 - ISC
|
|
23
|
-
*
|
|
24
|
-
* This source code is licensed under the ISC license.
|
|
25
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
-
*/const js=T.createLucideIcon("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/**
|
|
27
|
-
* @license lucide-react v0.453.0 - ISC
|
|
28
|
-
*
|
|
29
|
-
* This source code is licensed under the ISC license.
|
|
30
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
31
|
-
*/const Ss=T.createLucideIcon("UserPlus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);/**
|
|
32
|
-
* @license lucide-react v0.453.0 - ISC
|
|
33
|
-
*
|
|
34
|
-
* This source code is licensed under the ISC license.
|
|
35
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
36
|
-
*/const Dt=T.createLucideIcon("UserRound",[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]]);var $e={exports:{}},qe={};/**
|
|
37
|
-
* @license React
|
|
38
|
-
* use-sync-external-store-shim.production.js
|
|
39
|
-
*
|
|
40
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
41
|
-
*
|
|
42
|
-
* This source code is licensed under the MIT license found in the
|
|
43
|
-
* LICENSE file in the root directory of this source tree.
|
|
44
|
-
*/var gt;function ws(){if(gt)return qe;gt=1;var t=j;function n(u,f){return u===f&&(u!==0||1/u===1/f)||u!==u&&f!==f}var r=typeof Object.is=="function"?Object.is:n,s=t.useState,o=t.useEffect,l=t.useLayoutEffect,h=t.useDebugValue;function x(u,f){var d=f(),v=s({inst:{value:d,getSnapshot:f}}),y=v[0].inst,w=v[1];return l(function(){y.value=d,y.getSnapshot=f,b(y)&&w({inst:y})},[u,d,f]),o(function(){return b(y)&&w({inst:y}),u(function(){b(y)&&w({inst:y})})},[u]),h(d),d}function b(u){var f=u.getSnapshot;u=u.value;try{var d=f();return!r(u,d)}catch{return!0}}function g(u,f){return f()}var m=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?g:x;return qe.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:m,qe}var Ve={};/**
|
|
45
|
-
* @license React
|
|
46
|
-
* use-sync-external-store-shim.development.js
|
|
47
|
-
*
|
|
48
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
49
|
-
*
|
|
50
|
-
* This source code is licensed under the MIT license found in the
|
|
51
|
-
* LICENSE file in the root directory of this source tree.
|
|
52
|
-
*/var bt;function Ds(){return bt||(bt=1,process.env.NODE_ENV!=="production"&&function(){function t(d,v){return d===v&&(d!==0||1/d===1/v)||d!==d&&v!==v}function n(d,v){m||o.startTransition===void 0||(m=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var y=v();if(!u){var w=v();l(y,w)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),u=!0)}w=h({inst:{value:y,getSnapshot:v}});var D=w[0].inst,C=w[1];return b(function(){D.value=y,D.getSnapshot=v,r(D)&&C({inst:D})},[d,y,v]),x(function(){return r(D)&&C({inst:D}),d(function(){r(D)&&C({inst:D})})},[d]),g(y),y}function r(d){var v=d.getSnapshot;d=d.value;try{var y=v();return!l(d,y)}catch{return!0}}function s(d,v){return v()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var o=j,l=typeof Object.is=="function"?Object.is:t,h=o.useState,x=o.useEffect,b=o.useLayoutEffect,g=o.useDebugValue,m=!1,u=!1,f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?s:n;Ve.useSyncExternalStore=o.useSyncExternalStore!==void 0?o.useSyncExternalStore:f,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),Ve}process.env.NODE_ENV==="production"?$e.exports=ws():$e.exports=Ds();var Ns=$e.exports;const Me=["light","dark","system"];function Cs(){const{theme:t,setTheme:n}=a.useTheme(),r=i.useDashboardStore(h=>h.actions.setDashboardTheme);function s(){const h=Me.includes(t)?t:"system",x=Me[(Me.indexOf(h)+1)%Me.length];n(x),r(x)}const o=t==="light"?js:t==="dark"?vs:bs,l=t==="light"?"Theme: light (click for dark)":t==="dark"?"Theme: dark (click for system)":"Theme: system (click for light)";return e.jsx(i.Button,{type:"button",variant:"ghost",size:"xs",className:"h-7 w-7 p-0 text-muted-foreground hover:text-foreground",onClick:s,"aria-label":l,title:l,children:e.jsx(o,{className:"h-3.5 w-3.5",strokeWidth:1.5})})}function Nt(t){const n=new Date().toISOString(),r=a.buildDashboardSheetsInputExecutionSnapshot({dashboard:t.dashboard,sheetIds:(t.dashboard.sheets||[]).filter(s=>s.kind!=="document").map(s=>s.id),sheetKind:"dashboard",mode:"dashboard",generatedAt:n,runtimeValues:{dashboardInputValues:t.dashboardInputValues,filterValues:t.filterValues,controlValues:t.controlValues,inlineFilterValuesMap:t.inlineFilterValuesMap,cardControlValuesMap:t.cardControlValuesMap}}).snapshot;return{generatedAt:n,dashboardInputValues:r.dashboardInputValues}}async function ks(t,n,r,s,o,l){if(!l)return null;const h=JSON.stringify(r),x=`${t}/v1/lens`;return await i.postRequest(x,l,{name:n,template:h,filterValues:s,inputValues:o,operation:"create"})}async function Ge(t,n,r){if(!r)return null;const{id:s,template:o,filterValues:l,inputValues:h,isDefault:x,shared:b}=n,g=`${t}/v1/lens`;return await i.postRequest(g,r,{lensId:s,template:o,filterValues:l,inputValues:h,isDefault:x,shared:b,operation:"update"})}async function Ms(t,n,r){if(!r)return null;const s=`${t}/v1/lens`;return await i.postRequest(s,r,{operation:"delete",lensId:n})}const Es="text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground";function Is({open:t,onOpenChange:n}={}){const[r,s]=j.useState(""),[o,l]=j.useState(!1),h=i.useDashboardStore(p=>p.lenses),{setLenses:x,setSelectedLensId:b}=i.useDashboardActions(),[g,m]=j.useState(!1),[u,f]=j.useState(!1),d=t!==void 0,v=d?t:u,y=p=>{d||f(p),n==null||n(p)},w=i.useDashboardStore(p=>p.dashboard),D=i.useDashboardStore(p=>p.filterValues),{authToken:C,tokenProps:_}=a.useSemaphorContext();async function M(){m(!0);const p=i.useDashboardStore.getState(),F=Nt({dashboard:w,dashboardInputValues:p.dashboardInputValues,filterValues:D,controlValues:p.controlValues,inlineFilterValuesMap:p.inlineFilterValuesMap,cardControlValuesMap:p.cardControlValuesMap}),O=await ks(_.apiServiceUrl,r,w,D,F,C==null?void 0:C.accessToken);O&&(x([...h||[],O]),b(O.id),y(!1)),m(!1)}return e.jsxs(a.Dialog,{open:v,onOpenChange:y,children:[d?null:e.jsx(a.DialogTrigger,{asChild:!0,children:e.jsxs(i.Button,{variant:"secondary",size:"xs",children:[e.jsx(a.Plus,{className:"h-3.5 w-3.5"}),"Lens"]})}),e.jsxs(a.DialogContent,{className:"rounded-control border-border/60 sm:max-w-[420px] sm:rounded-control",children:[e.jsxs(a.DialogHeader,{children:[e.jsx(a.DialogTitle,{className:"text-[15px]",children:"Create lens"}),e.jsx(a.DialogDescription,{className:"text-[13px] leading-5",children:"Lenses are private by default and are only visible to you."})]}),e.jsxs("div",{className:"space-y-1.5 py-1",children:[e.jsx(i.Label,{htmlFor:"lens-name",className:Es,children:"Name"}),e.jsx(i.Input,{id:"lens-name",size:"xs",value:r,placeholder:"Monthly review, West region, …",onChange:p=>s(p.target.value)}),o&&e.jsx("p",{className:"text-[12px] text-destructive",children:"A lens with this name already exists. Pick a different one."})]}),e.jsxs(a.DialogFooter,{children:[e.jsx(i.Button,{variant:"outline",size:"xs",onClick:()=>y(!1),children:"Cancel"}),e.jsx(i.Button,{size:"xs",type:"submit",onClick:M,disabled:g||!r.trim(),children:g?"Creating…":"Create"})]})]})]})}function Ls({includeLabel:t=!1}={}){const n=i.useDashboardStore(m=>m.lenses),r=i.useDashboardStore(m=>m.selectedLensId),{setLenses:s,setSelectedLensId:o}=i.useDashboardActions(),{authToken:l,tokenProps:h}=a.useSemaphorContext();async function x(m){o(m)}async function b(m){if(await Ms(h.apiServiceUrl,m,l==null?void 0:l.accessToken)){const f=n==null?void 0:n.filter(d=>d.id!==m);s(f||[]),o("original")}}async function g(m){const u=n==null?void 0:n.map(v=>v.id===m.id?{...v,isDefault:!m.isDefault}:{...v,isDefault:!1});s(u||[]);const f={...m,isDefault:!m.isDefault};await Ge(h.apiServiceUrl,f,l==null?void 0:l.accessToken);const d=n==null?void 0:n.find(v=>v.isDefault);if(d&&d.id!==m.id){const v={...d,isDefault:!1};await Ge(h.apiServiceUrl,v,l==null?void 0:l.accessToken)}}return e.jsxs(e.Fragment,{children:[t?e.jsxs(e.Fragment,{children:[e.jsx(a.DropdownMenuLabel,{className:"px-3",children:"Lenses"}),e.jsx(a.DropdownMenuSeparator,{})]}):null,e.jsxs(a.DropdownMenuRadioGroup,{value:r,onValueChange:x,children:[e.jsx(a.DropdownMenuRadioItem,{value:"original",children:"Original"}),n==null?void 0:n.map(m=>e.jsxs(a.DropdownMenuRadioItem,{className:"group flex justify-between gap-2",value:m.id,children:[e.jsx("p",{children:m.name}),e.jsxs("span",{className:"flex items-center gap-3",children:[e.jsx(a.House,{onClick:u=>{u.preventDefault(),g(m)},className:i.cn("size-3.5 text-muted-foreground hover:cursor-pointer hover:text-foreground group-hover:visible",{invisible:!m.isDefault,"text-green-500":m.isDefault}),strokeWidth:1.5}),e.jsx(a.Cross2Icon,{onClick:u=>{u.preventDefault(),b(m.id)},className:"invisible size-3.5 text-muted-foreground hover:cursor-pointer hover:text-foreground group-hover:visible",strokeWidth:1.5})]})]},m.id))]})]})}function As(){const{displayPreferences:t,shouldShowElement:n}=a.useDisplayPreferences(),{currentUser:r,userContext:s}=a.useCurrentUserInfo(),o=j.useMemo(()=>a.getRoleBasedDisplayOverrides(r),[r]),l=j.useMemo(()=>x=>o&&o[x]!==void 0&&o[x]===!1?!1:n(x),[o,n,t]),h=j.useMemo(()=>{var x,b,g,m,u;return{canEdit:((x=s==null?void 0:s.permissions)==null?void 0:x.canEdit)??a.canUserEdit(r),canUseFilters:((b=s==null?void 0:s.permissions)==null?void 0:b.canEdit)??a.canUserUseFilters(r),canManageDashboards:((g=s==null?void 0:s.permissions)==null?void 0:g.canCreateDashboard)??a.canUserManageDashboards(r),canCreateDashboards:((m=s==null?void 0:s.permissions)==null?void 0:m.canCreateDashboard)??a.canUserCreateDashboards(r),canAccessVisuals:((u=s==null?void 0:s.permissions)==null?void 0:u.canEdit)??a.canUserAccessVisuals(r)}},[r,s]);return{displayPreferences:t,shouldShowElement:l,permissions:h,currentUser:r}}function Ps(t,n=[]){let r=[];function s(l,h){const x=E.createContext(h);x.displayName=l+"Context";const b=r.length;r=[...r,h];const g=u=>{var D;const{scope:f,children:d,...v}=u,y=((D=f==null?void 0:f[t])==null?void 0:D[b])||x,w=E.useMemo(()=>v,Object.values(v));return e.jsx(y.Provider,{value:w,children:d})};g.displayName=l+"Provider";function m(u,f){var y;const d=((y=f==null?void 0:f[t])==null?void 0:y[b])||x,v=E.useContext(d);if(v)return v;if(h!==void 0)return h;throw new Error(`\`${u}\` must be used within \`${l}\``)}return[g,m]}const o=()=>{const l=r.map(h=>E.createContext(h));return function(x){const b=(x==null?void 0:x[t])||l;return E.useMemo(()=>({[`__scope${t}`]:{...x,[t]:b}}),[x,b])}};return o.scopeName=t,[s,Rs(o,...n)]}function Rs(...t){const n=t[0];if(t.length===1)return n;const r=()=>{const s=t.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(l){const h=s.reduce((x,{useScope:b,scopeName:g})=>{const u=b(l)[`__scope${g}`];return{...x,...u}},{});return E.useMemo(()=>({[`__scope${n.scopeName}`]:h}),[h])}};return r.scopeName=n.scopeName,r}var Os=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ze=Os.reduce((t,n)=>{const r=i.createSlot(`Primitive.${n}`),s=E.forwardRef((o,l)=>{const{asChild:h,...x}=o,b=h?r:n;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),e.jsx(b,{...x,ref:l})});return s.displayName=`Primitive.${n}`,{...t,[n]:s}},{});function _s(){return Ns.useSyncExternalStore(Us,()=>!0,()=>!1)}function Us(){return()=>{}}var He="Avatar",[Ts]=Ps(He),[Fs,Ct]=Ts(He),kt=E.forwardRef((t,n)=>{const{__scopeAvatar:r,...s}=t,[o,l]=E.useState("idle");return e.jsx(Fs,{scope:r,imageLoadingStatus:o,onImageLoadingStatusChange:l,children:e.jsx(ze.span,{...s,ref:n})})});kt.displayName=He;var Mt="AvatarImage",Et=E.forwardRef((t,n)=>{const{__scopeAvatar:r,src:s,onLoadingStatusChange:o=()=>{},...l}=t,h=Ct(Mt,r),x=qs(s,l),b=i.useCallbackRef(g=>{o(g),h.onImageLoadingStatusChange(g)});return i.useLayoutEffect2(()=>{x!=="idle"&&b(x)},[x,b]),x==="loaded"?e.jsx(ze.img,{...l,ref:n,src:s}):null});Et.displayName=Mt;var It="AvatarFallback",Lt=E.forwardRef((t,n)=>{const{__scopeAvatar:r,delayMs:s,...o}=t,l=Ct(It,r),[h,x]=E.useState(s===void 0);return E.useEffect(()=>{if(s!==void 0){const b=window.setTimeout(()=>x(!0),s);return()=>window.clearTimeout(b)}},[s]),h&&l.imageLoadingStatus!=="loaded"?e.jsx(ze.span,{...o,ref:n}):null});Lt.displayName=It;function vt(t,n){return t?n?(t.src!==n&&(t.src=n),t.complete&&t.naturalWidth>0?"loaded":"loading"):"error":"idle"}function qs(t,{referrerPolicy:n,crossOrigin:r}){const s=_s(),o=E.useRef(null),l=s?(o.current||(o.current=new window.Image),o.current):null,[h,x]=E.useState(()=>vt(l,t));return i.useLayoutEffect2(()=>{x(vt(l,t))},[l,t]),i.useLayoutEffect2(()=>{const b=u=>()=>{x(u)};if(!l)return;const g=b("loaded"),m=b("error");return l.addEventListener("load",g),l.addEventListener("error",m),n&&(l.referrerPolicy=n),typeof r=="string"&&(l.crossOrigin=r),()=>{l.removeEventListener("load",g),l.removeEventListener("error",m)}},[l,r,n]),h}var At=kt,Pt=Et,Rt=Lt;const Ot=E.forwardRef(({className:t,...n},r)=>e.jsx(At,{ref:r,className:i.cn("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",t),...n}));Ot.displayName=At.displayName;const Vs=E.forwardRef(({className:t,...n},r)=>e.jsx(Pt,{ref:r,className:i.cn("aspect-square h-full w-full",t),...n}));Vs.displayName=Pt.displayName;const _t=E.forwardRef(({className:t,...n},r)=>e.jsx(Rt,{ref:r,className:i.cn("flex h-full w-full items-center justify-center rounded-full bg-muted",t),...n}));_t.displayName=Rt.displayName;const Bs=async(t,n,r)=>{const s=`${t}/management/v1/groups`;return await i.postRequestRegular(s,n,r)},$s=async(t,n,r,s)=>{const o=`${t}/management/v1/groups/${r}`;return i.requestJsonRegular(o,n,"PATCH",s)},Gs=async(t,n,r)=>{const s=`${t}/management/v1/groups/${r}`;await i.requestJsonRegular(s,n,"DELETE")},zs=async(t,n,r,s)=>{const o=`${t}/management/v1/groups/${r}/members`;return await i.postRequestRegular(o,n,s)},Hs=async(t,n,r,s)=>{const o=`${t}/management/v1/groups/${r}/members`;await i.requestJsonRegular(o,n,"DELETE",s)};function Ks(){const{authToken:t,tokenProps:n}=a.useSemaphorContext(),r=a.useQueryClient();return a.useMutation({mutationFn:s=>Bs(n.apiServiceUrl,(t==null?void 0:t.accessToken)||"",s),onSuccess:()=>{r.invalidateQueries({queryKey:["groups"]}),i.ue.success("Group created successfully")},onError:s=>{console.error("Failed to create group:",s),i.ue.error("Failed to create group",{description:i.getRequestErrorMessage(s,"Failed to create group")})}})}function Qs(){const{authToken:t,tokenProps:n}=a.useSemaphorContext(),r=a.useQueryClient();return a.useMutation({mutationFn:({groupId:s,data:o})=>$s(n.apiServiceUrl,(t==null?void 0:t.accessToken)||"",s,o),onSuccess:(s,o)=>{r.invalidateQueries({queryKey:["group",o.groupId]}),r.invalidateQueries({queryKey:["groups"]}),i.ue.success("Group updated successfully")},onError:s=>{console.error("Failed to update group:",s),i.ue.error("Failed to update group",{description:i.getRequestErrorMessage(s,"Failed to update group")})}})}function Ws(){const{authToken:t,tokenProps:n}=a.useSemaphorContext(),r=a.useQueryClient();return a.useMutation({mutationFn:s=>Gs(n.apiServiceUrl,(t==null?void 0:t.accessToken)||"",s),onSuccess:(s,o)=>{r.invalidateQueries({queryKey:["groups"]}),r.removeQueries({queryKey:["group",o]}),i.ue.success("Group deleted successfully")},onError:s=>{console.error("Failed to delete group:",s),i.ue.error("Failed to delete group",{description:i.getRequestErrorMessage(s,"Failed to delete group")})}})}function Js(){const{authToken:t,tokenProps:n}=a.useSemaphorContext(),r=a.useQueryClient();return a.useMutation({mutationFn:({groupId:s,data:o})=>zs(n.apiServiceUrl,(t==null?void 0:t.accessToken)||"",s,o),onSuccess:(s,o)=>{r.invalidateQueries({queryKey:["group",o.groupId]}),r.invalidateQueries({queryKey:["group-members",o.groupId]}),r.invalidateQueries({queryKey:["groups"]}),i.ue.success("Members added successfully")},onError:s=>{console.error("Failed to add group members:",s),i.ue.error("Failed to add members",{description:i.getRequestErrorMessage(s,"Failed to add members")})}})}function Xs(){const{authToken:t,tokenProps:n}=a.useSemaphorContext(),r=a.useQueryClient();return a.useMutation({mutationFn:({groupId:s,data:o})=>Hs(n.apiServiceUrl,(t==null?void 0:t.accessToken)||"",s,o),onSuccess:(s,o)=>{r.invalidateQueries({queryKey:["group",o.groupId]}),r.invalidateQueries({queryKey:["group-members",o.groupId]}),r.invalidateQueries({queryKey:["groups"]}),i.ue.success("Members removed successfully")},onError:s=>{console.error("Failed to remove group members:",s),i.ue.error("Failed to remove members",{description:i.getRequestErrorMessage(s,"Failed to remove members")})}})}const Ys=[];function Zs({open:t,onOpenChange:n}){var C,_,M;const{tokenProps:r}=a.useSemaphorContext(),{currentUser:s}=a.useCurrentUserInfo(),o=(s==null?void 0:s.type)==="tenant",l=r==null?void 0:r.tenantId,{groups:h,isLoading:x,error:b,refetch:g}=a.useGroups({type:o?"TENANT_GROUP":"all",tenantId:o?l:void 0,includeMembers:!1}),m=b?Ut(b,"Unable to load groups."):null,[u,f]=j.useState({kind:"list"}),[d,v]=j.useState(null),y=Ws();j.useEffect(()=>{t||(f({kind:"list"}),v(null))},[t]);const w=u.kind==="members"&&h.find(p=>p.id===u.groupId)||null,D=async()=>{if(d)try{await y.mutateAsync(d.id),v(null),f({kind:"list"}),g()}catch{}};return e.jsx(a.Dialog,{open:t,onOpenChange:n,children:e.jsxs(a.DialogContent,{className:"flex max-h-[640px] w-[720px] max-w-[92vw] flex-col gap-0 overflow-hidden p-0",children:[u.kind==="list"?e.jsxs("div",{className:"shrink-0 border-b border-border px-5 pt-4 pb-3.5",children:[e.jsx(a.DialogTitle,{className:"text-[15px] font-semibold tracking-tight",children:"Group management"}),e.jsx(a.DialogDescription,{className:"mt-1 text-[12px] leading-[1.5] text-muted-foreground",children:"Organize people into groups for shared access."})]}):u.kind==="create"?e.jsxs("div",{className:"flex h-10 shrink-0 items-center gap-1.5 border-b border-border px-5",children:[e.jsx("button",{type:"button",onClick:()=>f({kind:"list"}),"aria-label":"Back",className:"-ml-1 flex h-6 w-6 items-center justify-center rounded-[3px] text-muted-foreground hover:bg-accent hover:text-foreground",children:e.jsx(a.ArrowLeft,{className:"h-3.5 w-3.5"})}),e.jsx(a.DialogTitle,{className:"truncate text-[13px] font-medium",children:"New group"}),e.jsx(a.DialogDescription,{className:"sr-only",children:"Create a new group to organize members."})]}):null,u.kind==="list"&&e.jsx(er,{groups:h,isLoading:x,errorMessage:m,onRetry:()=>g(),currentUserId:s==null?void 0:s.id,onOpenGroup:p=>f({kind:"members",groupId:p}),onCreate:()=>f({kind:"create"}),onDeleteRequest:p=>v(p)}),u.kind==="members"&&w&&e.jsx(rr,{group:w,isTenantViewer:o,canEdit:((C=w.permissions)==null?void 0:C.canEdit)??w.createdBy===(s==null?void 0:s.id),canDelete:((_=w.permissions)==null?void 0:_.canDelete)??w.createdBy===(s==null?void 0:s.id),canManageMembers:((M=w.permissions)==null?void 0:M.canManageMembers)??w.createdBy===(s==null?void 0:s.id),onBack:()=>f({kind:"list"}),onMembersChanged:g,onUpdated:g,onRequestDelete:()=>v(w)},w.id),u.kind==="create"&&e.jsx(nr,{isTenantUser:o,tenantId:l,onCancel:()=>f({kind:"list"}),onCreated:p=>{g(),f({kind:"members",groupId:p})}}),d&&e.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 border-t border-border bg-muted/40 px-5 py-2.5",children:[e.jsxs("div",{className:"min-w-0 text-[12px] text-foreground",children:["Delete ",e.jsx("span",{className:"font-medium",children:d.name}),"?",e.jsx("span",{className:"ml-2 text-muted-foreground",children:"Members lose any access granted via this group."})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[e.jsx("button",{type:"button",onClick:()=>v(null),disabled:y.isPending,className:"h-7 rounded-[5px] px-2.5 text-[12px] font-medium text-foreground/80 hover:bg-background",children:"Cancel"}),e.jsxs("button",{type:"button",onClick:D,disabled:y.isPending,className:"inline-flex h-7 items-center gap-1.5 rounded-[5px] bg-rose-600 px-2.5 text-[12px] font-medium text-white hover:bg-rose-700 disabled:opacity-60",children:[y.isPending?e.jsx(i.LoaderCircle,{className:"h-3 w-3 animate-spin"}):e.jsx(a.Trash2,{className:"h-3 w-3"}),"Delete group"]})]})]})]})})}function er({groups:t,isLoading:n,errorMessage:r,onRetry:s,currentUserId:o,onOpenGroup:l,onCreate:h,onDeleteRequest:x}){const[b,g]=j.useState(""),m=j.useMemo(()=>t.filter(u=>!b.trim()||u.name.toLowerCase().includes(b.toLowerCase())||(u.description||"").toLowerCase().includes(b.toLowerCase())),[t,b]);return e.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[e.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-5 py-2.5",children:[e.jsxs("div",{className:"flex flex-1 items-center gap-2 rounded-[5px] border border-border bg-background px-2 focus-within:border-foreground/40",children:[e.jsx(St.Search,{className:"h-3 w-3 text-muted-foreground"}),e.jsx("input",{value:b,onChange:u=>g(u.target.value),placeholder:"Search groups…",className:"h-7 flex-1 bg-transparent text-[12px] text-foreground placeholder:text-muted-foreground focus:outline-none"}),b&&e.jsx("button",{type:"button",onClick:()=>g(""),className:"flex h-4 w-4 items-center justify-center rounded-[3px] text-muted-foreground hover:bg-accent hover:text-foreground",children:e.jsx(T.X,{className:"h-2.5 w-2.5"})})]}),e.jsxs("button",{type:"button",onClick:h,className:"inline-flex h-7 items-center gap-1.5 rounded-[5px] bg-foreground px-2.5 text-[12px] font-medium text-background hover:opacity-90",children:[e.jsx(a.Plus,{className:"h-3 w-3"}),"New group"]})]}),e.jsx("div",{className:"flex-1 overflow-y-auto",children:n?e.jsx("div",{className:"space-y-px p-3",children:[1,2,3].map(u=>e.jsx("div",{className:"h-12 animate-pulse rounded-[4px] bg-muted/60"},u))}):r?e.jsx(Tt,{title:"Can't load groups",message:r,onRetry:s}):m.length===0&&t.length===0?e.jsx(sr,{onCreate:h}):m.length===0?e.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-1 py-10 text-center",children:[e.jsxs("div",{className:"text-[12px] text-foreground",children:['No groups match "',b,'"']}),e.jsx("div",{className:"text-[11px] text-muted-foreground",children:"Try a different search."})]}):m.map(u=>{var f;return e.jsx(tr,{group:u,canDelete:((f=u.permissions)==null?void 0:f.canDelete)??u.createdBy===o,onClick:()=>l(u.id),onDelete:()=>x(u)},u.id)})})]})}function tr({group:t,canDelete:n,onClick:r,onDelete:s}){let o="";try{o=wt.format(new Date(t.createdAt),"MMM d, yyyy")}catch{o=""}return e.jsxs("button",{type:"button",onClick:r,className:"group flex w-full items-center gap-3 border-b border-border/60 px-5 py-2.5 text-left hover:bg-accent/40",children:[e.jsx("div",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-[4px] border border-border bg-background text-muted-foreground",children:e.jsx(a.UsersRound,{className:"h-3.5 w-3.5"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"truncate text-[13px] font-medium text-foreground",children:t.name}),e.jsxs("div",{className:"mt-0.5 flex items-center gap-2 text-[11px] text-muted-foreground",children:[e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(Dt,{className:"h-2.5 w-2.5"}),t.memberCount," member",t.memberCount===1?"":"s"]}),o&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-border",children:"·"}),e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(a.Calendar,{className:"h-2.5 w-2.5"}),o]})]}),t.description&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-border",children:"·"}),e.jsx("span",{className:"truncate text-muted-foreground",children:t.description})]})]})]}),e.jsxs("div",{className:"flex items-center gap-0.5 opacity-0 transition-opacity group-hover:opacity-100",children:[n&&e.jsx("span",{role:"button",tabIndex:0,onClick:l=>{l.stopPropagation(),s()},onKeyDown:l=>{(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),l.stopPropagation(),s())},"aria-label":`Delete ${t.name}`,className:"flex h-6 w-6 items-center justify-center rounded-[3px] text-muted-foreground hover:bg-accent hover:text-foreground",children:e.jsx(a.Trash2,{className:"h-3 w-3"})}),e.jsx(St.ChevronRight,{className:"h-3.5 w-3.5 text-muted-foreground"})]})]})}function sr({onCreate:t}){return e.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 py-12 text-center",children:[e.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-full border border-border bg-muted/40 text-muted-foreground",children:e.jsx(a.Users,{className:"h-4 w-4"})}),e.jsx("div",{className:"text-[13px] font-medium text-foreground",children:"No groups yet"}),e.jsx("div",{className:"max-w-[320px] text-[11.5px] leading-[1.55] text-muted-foreground",children:"Groups let you grant shared access to dashboards. Create one and add members."}),e.jsxs("button",{type:"button",onClick:t,className:"mt-1 inline-flex h-7 items-center gap-1.5 rounded-[5px] bg-foreground px-2.5 text-[12px] font-medium text-background hover:opacity-90",children:[e.jsx(a.Plus,{className:"h-3 w-3"}),"New group"]})]})}function rr({group:t,isTenantViewer:n,canEdit:r,canDelete:s,canManageMembers:o,onBack:l,onMembersChanged:h,onUpdated:x,onRequestDelete:b}){const{data:g,isLoading:m,error:u,refetch:f}=a.useGroupMembers(t.id),d=(g==null?void 0:g.members)??Ys,v=u?Ut(u,"Unable to load members for this group."):null,y=t.type==="TENANT_GROUP"?"tenant":"organization",{users:w}=a.useUnifiedUsers({type:y,tenantId:t.tenantId||void 0,active:!0,limit:200}),D=j.useMemo(()=>new Set(d.map(S=>S.userId)),[d]),C=Js(),_=Xs(),M=Qs(),[p,F]=j.useState(!1),[O,q]=j.useState(t.name),[A,N]=j.useState(!1),[J,X]=j.useState(t.description||""),[z,me]=j.useState(""),[he,pe]=j.useState(!1),xe=j.useMemo(()=>{const S=z.trim().toLowerCase();return w.filter(V=>!D.has(V.id)).filter(V=>!S||(V.name||"").toLowerCase().includes(S)||(V.email||"").toLowerCase().includes(S)).slice(0,50)},[w,D,z]),fe=async()=>{const S=O.trim();if(F(!1),S.length>=3&&S!==t.name)try{await M.mutateAsync({groupId:t.id,data:{name:S}}),x()}catch{}},te=async()=>{const S=J.trim();if(N(!1),S!==(t.description||""))try{await M.mutateAsync({groupId:t.id,data:{description:S}}),x()}catch{}},ge=async S=>{if(o){me(""),pe(!1);try{await C.mutateAsync({groupId:t.id,data:{userIds:[S.id],userType:y==="tenant"?"tenant":"org"}}),f(),h()}catch{}}},se=async S=>{if(o)try{await _.mutateAsync({groupId:t.id,data:{userIds:[S]}}),f(),h()}catch{}};let Y="";try{Y=wt.format(new Date(t.createdAt),"MMM d, yyyy")}catch{Y=""}return e.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[e.jsxs("div",{className:"flex h-10 shrink-0 items-center gap-1.5 border-b border-border px-5",children:[e.jsx("button",{type:"button",onClick:l,"aria-label":"Back",className:"-ml-1 flex h-6 w-6 items-center justify-center rounded-[3px] text-muted-foreground hover:bg-accent hover:text-foreground",children:e.jsx(a.ArrowLeft,{className:"h-3.5 w-3.5"})}),p?e.jsx("input",{autoFocus:!0,value:O,onChange:S=>q(S.target.value),onBlur:fe,onKeyDown:S=>{S.key==="Enter"&&fe(),S.key==="Escape"&&(q(t.name),F(!1))},className:"h-6 min-w-0 flex-1 rounded-[3px] border border-border bg-background px-1.5 text-[13px] font-medium text-foreground focus:border-foreground/40 focus:outline-none"}):e.jsx("button",{type:"button",onClick:()=>{r&&(q(t.name),F(!0))},title:r?"Click to rename":t.name,disabled:!r,className:"truncate rounded-[3px] px-1 text-[13px] font-medium text-foreground enabled:hover:bg-accent disabled:cursor-default",children:t.name}),e.jsxs("span",{className:"ml-1 inline-flex shrink-0 items-center gap-1 text-[10.5px] text-muted-foreground",children:[e.jsx(Dt,{className:"h-2.5 w-2.5"}),d.length," member",d.length===1?"":"s"]})]}),e.jsx("div",{className:"shrink-0 border-b border-border px-5 py-2.5",children:A?e.jsxs("div",{children:[e.jsx("textarea",{autoFocus:!0,rows:2,value:J,onChange:S=>X(S.target.value),maxLength:200,onKeyDown:S=>{S.key==="Escape"&&(X(t.description||""),N(!1)),S.key==="Enter"&&(S.metaKey||S.ctrlKey)&&te()},placeholder:"What is this group for?",className:"block w-full resize-none rounded-[5px] border border-border bg-background px-2 py-1.5 text-[12px] text-foreground placeholder:text-muted-foreground focus:border-foreground/40 focus:outline-none"}),e.jsxs("div",{className:"mt-1.5 flex items-center justify-between",children:[e.jsxs("span",{className:"text-[10.5px] text-muted-foreground",children:[J.length,"/200 · Esc to cancel · ⌘↩ to save"]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("button",{type:"button",onClick:()=>{X(t.description||""),N(!1)},className:"h-6 rounded-[5px] px-2 text-[11px] font-medium text-foreground/80 hover:bg-accent",children:"Cancel"}),e.jsx("button",{type:"button",onClick:te,className:"inline-flex h-6 items-center rounded-[5px] bg-foreground px-2 text-[11px] font-medium text-background hover:opacity-90",children:"Save"})]})]})]}):e.jsxs("button",{type:"button",onClick:()=>{r&&(X(t.description||""),N(!0))},disabled:!r,title:r?"Click to edit description":void 0,className:"block w-full rounded-[3px] px-1 py-0.5 text-left enabled:hover:bg-accent/40 disabled:cursor-default",children:[t.description?e.jsx("p",{className:"text-[12px] leading-[1.55] text-foreground/90",children:t.description}):e.jsx("p",{className:"text-[12px] leading-[1.55] text-muted-foreground",children:r?"Add a description…":"No description"}),e.jsxs("p",{className:"mt-1 text-[10.5px] text-muted-foreground",children:[Y?`Created ${Y}`:"Recently created",r?" · You can edit this group":""]})]})}),o&&e.jsx(ar,{query:z,setQuery:me,open:he,setOpen:pe,candidates:xe,showKindChip:!n,onAdd:ge,busy:C.isPending}),e.jsx("div",{className:"flex-1 overflow-y-auto",children:m?e.jsx("div",{className:"space-y-px p-3",children:[1,2,3].map(S=>e.jsx("div",{className:"h-10 animate-pulse rounded-[4px] bg-muted/60"},S))}):v?e.jsx(Tt,{title:"Can't load members",message:v,onRetry:()=>f()}):d.length===0?e.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-1 py-10 text-center",children:[e.jsx("div",{className:"text-[12px] text-foreground",children:"No members yet"}),e.jsx("div",{className:"text-[11px] text-muted-foreground",children:o?"Search above to add people to this group.":"This group does not have any members."})]}):d.map(S=>{var V,re,be,H,K,Q;return e.jsxs("div",{className:"group flex items-center gap-2 border-b border-border/60 px-5 py-2",children:[e.jsx(Ft,{name:((V=S.user)==null?void 0:V.name)||((re=S.user)==null?void 0:re.email)||"?"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"truncate text-[12.5px] font-medium text-foreground",children:((be=S.user)==null?void 0:be.name)||((H=S.user)==null?void 0:H.email)||"Unknown"}),((K=S.user)==null?void 0:K.email)&&S.user.name&&e.jsx("div",{className:"truncate text-[10.5px] text-muted-foreground",children:S.user.email})]}),!n&&e.jsx("span",{className:"text-[10px] uppercase tracking-[0.06em] text-muted-foreground",children:S.userType}),e.jsx("button",{type:"button",onClick:()=>se(S.userId),disabled:!o||_.isPending,"aria-label":`Remove ${((Q=S.user)==null?void 0:Q.name)||"member"}`,className:"flex h-6 w-6 items-center justify-center rounded-[3px] text-muted-foreground opacity-0 transition-opacity hover:bg-accent hover:text-foreground group-hover:opacity-100 disabled:opacity-30",children:e.jsx(T.X,{className:"h-3 w-3"})})]},S.id)})}),s&&e.jsx("div",{className:"flex shrink-0 items-center justify-end gap-1.5 border-t border-border bg-muted/30 px-5 py-2.5",children:e.jsxs("button",{type:"button",onClick:b,className:"inline-flex h-7 items-center gap-1.5 rounded-[5px] border border-rose-200 bg-background px-2.5 text-[12px] font-medium text-rose-600 hover:bg-rose-50 dark:border-rose-900/60 dark:text-rose-400 dark:hover:bg-rose-950/30",children:[e.jsx(a.Trash2,{className:"h-3 w-3"}),"Delete group"]})})]})}function nr({isTenantUser:t,tenantId:n,onCancel:r,onCreated:s}){const[o,l]=j.useState(""),[h,x]=j.useState(""),[b,g]=j.useState(null),m=Ks(),u=o.trim().length>=3&&o.trim().length<=50,f=async()=>{if(!u)return;g(null);const d={name:o.trim(),description:h.trim()||void 0,type:t?"TENANT_GROUP":"ORG_GROUP",...t&&n?{tenantId:n}:{}};try{const v=await m.mutateAsync(d),y=v==null?void 0:v.id;y?s(y):r()}catch(v){g(v instanceof Error?v.message:"Failed to create group")}};return e.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[e.jsxs("div",{className:"flex-1 overflow-y-auto px-5 py-4",children:[e.jsx(yt,{children:"Name"}),e.jsx("input",{autoFocus:!0,value:o,onChange:d=>l(d.target.value),placeholder:"Marketing leads, North America sales, …",maxLength:50,className:"mt-1 block h-7 w-full rounded-[5px] border border-border bg-background px-2 text-[12px] text-foreground placeholder:text-muted-foreground focus:border-foreground/40 focus:outline-none"}),e.jsx("div",{className:"mt-1 text-[10.5px] text-muted-foreground",children:"3–50 characters."}),e.jsxs("div",{className:"mt-4",children:[e.jsx(yt,{children:"Description (optional)"}),e.jsx("textarea",{rows:2,value:h,onChange:d=>x(d.target.value),maxLength:200,placeholder:"What is this group for?",className:"mt-1 block w-full resize-none rounded-[5px] border border-border bg-background px-2 py-1.5 text-[12px] text-foreground placeholder:text-muted-foreground focus:border-foreground/40 focus:outline-none"}),e.jsxs("div",{className:"mt-1 flex justify-end text-[10.5px] text-muted-foreground",children:[h.length,"/200"]})]}),b&&e.jsx("div",{className:"mt-3 rounded-[5px] border border-rose-200 bg-rose-50 px-2 py-1.5 text-[11.5px] text-rose-700 dark:border-rose-900/60 dark:bg-rose-950/30 dark:text-rose-300",children:b})]}),e.jsxs("div",{className:"flex shrink-0 items-center justify-end gap-1.5 border-t border-border bg-muted/30 px-5 py-2.5",children:[e.jsx("button",{type:"button",onClick:r,disabled:m.isPending,className:"h-7 rounded-[5px] px-2.5 text-[12px] font-medium text-foreground/80 hover:bg-accent",children:"Cancel"}),e.jsx("button",{type:"button",onClick:f,disabled:!u||m.isPending,className:"inline-flex h-7 items-center gap-1.5 rounded-[5px] bg-foreground px-2.5 text-[12px] font-medium text-background hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-60",children:m.isPending?e.jsxs(e.Fragment,{children:[e.jsx(i.LoaderCircle,{className:"h-3 w-3 animate-spin"}),"Creating…"]}):e.jsxs(e.Fragment,{children:[e.jsx(a.Plus,{className:"h-3 w-3"}),"Create group"]})})]})]})}function ar({query:t,setQuery:n,open:r,setOpen:s,candidates:o,showKindChip:l,onAdd:h,busy:x}){const b=j.useRef(null),g=j.useRef(null),[m,u]=j.useState(null);j.useLayoutEffect(()=>{if(!r){u(null);return}const d=()=>{const v=b.current;if(!v)return;const y=v.getBoundingClientRect(),w=240,C=window.innerHeight-y.bottom<w+16&&y.top>w;u({left:y.left,top:C?y.top-6:y.bottom+6,width:y.width,above:C})};return d(),window.addEventListener("resize",d),window.addEventListener("scroll",d,!0),()=>{window.removeEventListener("resize",d),window.removeEventListener("scroll",d,!0)}},[r,o.length]),j.useEffect(()=>{if(!r)return;const d=v=>{var w,D;const y=v.target;(w=b.current)!=null&&w.contains(y)||(D=g.current)!=null&&D.contains(y)||s(!1)};return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[r,s]);const f=r&&o.length>0&&m;return e.jsxs("div",{className:"shrink-0 border-b border-border px-5 py-2.5",children:[e.jsxs("div",{ref:b,className:"flex items-center gap-2 rounded-[5px] border border-border bg-background px-2 focus-within:border-foreground/40",children:[e.jsx(Ss,{className:"h-3 w-3 text-muted-foreground"}),e.jsx("input",{value:t,onChange:d=>{n(d.target.value),s(!0)},onFocus:()=>s(!0),placeholder:"Add a member by name or email…",disabled:x,className:"h-7 flex-1 bg-transparent text-[12px] text-foreground placeholder:text-muted-foreground focus:outline-none disabled:cursor-not-allowed"})]}),f&&typeof document<"u"&&ls.createPortal(e.jsx("div",{ref:g,style:{position:"fixed",left:m.left,top:m.top,width:m.width,transform:m.above?"translateY(-100%)":void 0},className:"z-[60] max-h-[240px] overflow-y-auto rounded-[5px] border border-border bg-background shadow-[0_8px_24px_-12px_rgba(0,0,0,0.18)]",children:o.map(d=>e.jsxs("button",{type:"button",onClick:()=>h(d),className:"flex w-full items-center gap-2 border-b border-border/60 px-2.5 py-2 text-left last:border-b-0 hover:bg-accent",children:[e.jsx(Ft,{name:d.name||d.email||"?"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"truncate text-[12px] font-medium text-foreground",children:d.name||d.email||"Unknown"}),d.email&&d.name&&e.jsx("div",{className:"truncate text-[10.5px] text-muted-foreground",children:d.email})]}),l&&d.type&&e.jsx("span",{className:"text-[10px] uppercase tracking-[0.06em] text-muted-foreground",children:d.type==="tenant"?"tenant":"org"})]},d.id))}),document.body)]})}function Ut(t,n){if(!t)return n;if(t instanceof Error){const r=t.message||"",s=r.match(/\{[\s\S]*"error"\s*:\s*"([^"]+)"[\s\S]*\}/);return s?s[1]:r||n}return typeof t=="string"?t:n}function Tt({title:t,message:n,onRetry:r}){return e.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 px-6 py-10 text-center",children:[e.jsx("div",{className:"text-[12.5px] font-medium text-foreground",children:t}),e.jsx("div",{className:"max-w-[360px] text-[11.5px] leading-[1.55] text-muted-foreground",children:n}),r&&e.jsx("button",{type:"button",onClick:r,className:"mt-1 inline-flex h-7 items-center rounded-[5px] border border-border bg-background px-2.5 text-[11.5px] font-medium text-foreground hover:bg-accent",children:"Try again"})]})}function yt({children:t}){return e.jsx("label",{className:"text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground",children:t})}function Ft({name:t}){const n=t.split(" ").map(r=>r[0]).filter(Boolean).slice(0,2).join("").toUpperCase();return e.jsx(Ot,{className:"h-6 w-6 shrink-0",children:e.jsx(_t,{className:"text-[9px] font-semibold",children:n||"?"})})}function le(t,n,r){var l,h;const s=(t.controls||[]).find(x=>x.id===r);if(s)return s.label;const o=(h=(l=i.findCardById(t,n))==null?void 0:l.controls)==null?void 0:h.find(x=>x.id===r);return(o==null?void 0:o.label)||r}function ue(t,n){var r;return((r=i.findCardById(t,n))==null?void 0:r.title)||n}function or(t){const{errors:n,dashboard:r}=t;if(!r)return n;const s=new Map;for(const o of n){const l=o.match(/^Card '(.+)' binding for control '(.+)' maps to missing metric '(.+)'\.$/);if(l){const[,m,u]=l,f=`${m}:${u}:missing-metric`;s.has(f)||s.set(f,`"${ue(r,m)}" has an outdated "${le(r,m,u)}" mapping. Some choices still point to metrics that are no longer available on this card. Open the card controls and choose replacements.`);continue}const h=o.match(/^Card '(.+)' binding for control '(.+)' maps to missing group-by field '(.+)'\.$/);if(h){const[,m,u]=h,f=`${m}:${u}:missing-group-by`;s.has(f)||s.set(f,`"${ue(r,m)}" has an outdated "${le(r,m,u)}" mapping. Some choices still point to fields that are no longer available on this card. Open the card controls and choose replacements.`);continue}const x=o.match(/^Card '(.+)' binding for control '(.+)' maps to an invalid metric target\.$/);if(x){const[,m,u]=x,f=`${m}:${u}:invalid-metric`;s.has(f)||s.set(f,`"${ue(r,m)}" has an invalid "${le(r,m,u)}" metric mapping. Open the card controls and choose a valid metric for each option.`);continue}const b=o.match(/^Card '(.+)' binding for control '(.+)' maps to an invalid group-by target\.$/);if(b){const[,m,u]=b,f=`${m}:${u}:invalid-group-by`;s.has(f)||s.set(f,`"${ue(r,m)}" has an invalid "${le(r,m,u)}" field mapping. Open the card controls and choose a valid field for each option.`);continue}const g=o.match(/^Card '(.+)' binding for control '(.+)' requires at least one temporal group-by field\.$/);if(g){const[,m,u]=g,f=`${m}:${u}:missing-temporal-group-by`;s.has(f)||s.set(f,`"${ue(r,m)}" can no longer use "${le(r,m,u)}" for time grain because the card does not currently group by a date field.`);continue}s.set(o,o)}return Array.from(s.values())}function ir({visible:t,onSelect:n}){return t?e.jsxs(a.DropdownMenuItem,{onSelect:n,children:[e.jsx(a.CalendarClock,{className:"h-3.5 w-3.5"}),"Schedule email report"]}):null}function dr({scheduleReportVisible:t,analyticalBriefingVisible:n,onScheduleReport:r,onCreateAnalyticalBriefing:s}){return e.jsxs(e.Fragment,{children:[e.jsx(ir,{visible:t,onSelect:r}),n?e.jsxs(a.DropdownMenuItem,{onSelect:s,children:[e.jsx(a.Plus,{className:"h-3.5 w-3.5"}),"Create analytical briefing"]}):null]})}function jt(t,n){return{dashboard:Be.cloneDeep(t),semanticExecutionPayload:Be.cloneDeep(n)}}function cr(){var lt,ut,mt,ht,pt;U.useExportRecovery(),U.useExportPolling();const{authToken:t,tokenProps:n,id:r,showBriefings:s}=a.useSemaphorContext(),o=a.useBriefingUiCapabilities(),{isLocalDev:l}=a.useDashboardPreferences(),{canEditDashboard:h,hasInspectionUser:x,inspectionMessage:b,isInspectionMode:g,isInspectionSurface:m}=a.useDashboardInteractionMode(),{openBrandStudioPreview:u}=a.useBrandStudioPreview(),{permissions:f}=As(),d=a.useHasDashboardId(),{isLoading:v}=a.useDashboardQuery(),y=i.useDashboardStore(c=>c.theme),w=i.useDashboardStore(c=>c.isDownloadingPdf),D=i.useDashboardStore(c=>c.dashboardAssistantDraftScopeKey),C=i.useDashboardStore(c=>c.lenses),_=i.useDashboardStore(c=>c.selectedLensId),M=C==null?void 0:C.find(c=>c.id===_),p=i.useDashboardStore(c=>c.dashboard),F=i.useDashboardStore(c=>c.selectedSheetId),O=(lt=p==null?void 0:p.sheets)==null?void 0:lt.find(c=>c.id===F),q=i.isDocumentSheet(O),A=q?(ut=O==null?void 0:O.document)==null?void 0:ut.page:void 0,N=i.useDashboardStore(c=>c.isDashboardEditing),{setDashboardTitle:J}=i.useDashboardStore(c=>c.actions),[X,z]=j.useState(!1),[me,he]=j.useState(!1),[pe,xe]=j.useState(!1),[fe,te]=j.useState(!1),[ge,se]=j.useState(null),[Y,S]=j.useState(!1),[V,re]=j.useState(!1),[be,H]=j.useState(!1),[K,Q]=j.useState(null),[Ke,ve]=j.useState([]),[Qe,ye]=j.useState(!1),[qt,We]=j.useState(!1),Je=i.useDashboardStore(c=>c.filterValues),P=i.useDashboardStore(c=>c.isVisualEditing);i.useEditorStore(c=>c.card);const Vt=a.useManagementStore(c=>c.selectedDashboard),Bt=a.useManagementStore(c=>c.initialDashboard);a.useManagementStore(c=>c.selectedVisual),i.useDashboardStore(c=>c.selectedFrameId),i.useEditorStore(c=>c.frame);const Xe=i.useDashboardStore(c=>c.showDashboardJSON),Ee=i.useDashboardStore(c=>c.onSaveFunction),{setIsDashboardEditing:Ye,setShowDashboardJSON:Ze}=i.useDashboardStore(c=>c.actions),{setInitialDashboard:et,clearSelectedDashboard:Ie}=a.useManagementStore(c=>c.actions),ne=!!n.orgUserId||!!(n.tenantId&&n.endUserId&&n.endUserEmail),{resources:je}=a.useResourceManagement(a.ResourceType.DASHBOARD),{data:Le}=a.useUserPreferences(),$t=((mt=Le==null?void 0:Le.preference)==null?void 0:mt.defaultDashboardId)||null,{mutate:Gt,isPending:zt}=a.useDefaultDashboardMutation(),{currentUser:Ht}=a.useCurrentUserInfo(),Kt=a.canUserManageGroups(Ht),B=Vt||Bt,Z=a.resolveDashboardControlsVisibility({config:n.config,canNavigateDashboardHub:ne,canShareDashboard:((ht=B==null?void 0:B.permissions)==null?void 0:ht.canShare)===!0,canManageGroups:Kt}),tt=B?{id:B.id,title:(p==null?void 0:p.title)||B.title||"Dashboard"}:null,{handleAddNewFrame:Qt}=a.useAddNewFrame(),[Ae,Pe]=j.useState(!1),[Wt,ae]=j.useState(!1),[Re,Se]=j.useState("close"),oe=a.useUpdateResource(a.ResourceType.DASHBOARD),[L,ie]=j.useState(null),Jt=async(c,I)=>{if(!g){if(!(p!=null&&p.id)){console.log("No dashboard ID found");return}console.log("Updating dashboard title:",{dashboardId:p.id,newTitle:c,previousTitle:I}),oe.mutate({resourceId:p.id,data:{title:c}},{onSuccess:()=>{ie(k=>(k==null?void 0:k.dashboard.id)===p.id?{...k,dashboard:{...k.dashboard,title:c}}:k),i.ue.success("Dashboard title updated")},onError:k=>{console.error("Failed to update dashboard title:",k),i.ue.error("Failed to update dashboard title");const G=i.useDashboardStore.getState().dashboard;(G==null?void 0:G.id)===p.id&&G.title===c&&J(I)}})}};j.useEffect(()=>{if(je&&je.length>0){const c=p==null?void 0:p.id;if(c){const I=je.find(k=>k.id===c);I&&et(I)}}},[je,p==null?void 0:p.id,et]);const de=n.orgUserId||n.tenantId,Oe=j.useMemo(()=>lr({accessToken:t==null?void 0:t.accessToken,dashboardId:(p==null?void 0:p.id)||r||n.dashboard_id,selectedSheetId:q?F:void 0,pageSize:A==null?void 0:A.size,orientation:A==null?void 0:A.orientation,theme:y}),[t==null?void 0:t.accessToken,r,p==null?void 0:p.id,q,A==null?void 0:A.orientation,A==null?void 0:A.size,F,y,n.dashboard_id]),st=N&&!P&&!g&&de&&h,{setDashboard:_e}=i.useDashboardStore(c=>c.actions),rt=i.useDashboardStore(c=>c.semanticExecutionPayload),Xt=()=>{Ye(!0)},we=()=>{Ye(!1),Ze(!1),ie(null)};j.useEffect(()=>{if(!N){L&&ie(null);return}L||!p||v||ie(jt(p,rt))},[p,L,N,v,rt]);const nt=(L==null?void 0:L.dashboard)??null,{isDirty:at,isDirtyPending:Yt,resetDirty:ce}=ms.useDebouncedDirtyCheck(p,nt,300,1e3,hs.serializeDashboardForDirtyCheck),ot=U.useDashboardUnsavedChangesCheck(nt,g,h),it=at||Yt,De=Ae||oe.isPending,Zt=()=>{if(g){L&&_e(L.dashboard,{semanticExecutionPayload:L.semanticExecutionPayload}),we(),ce();return}ot()?(Se("close"),ae(!0)):(we(),ce())},es=async()=>{await Ue({closeAfterSave:!0,navigateHomeAfterSave:Re==="home"})},ts=()=>{const c=Re==="home"&&!!ne;L&&_e(L.dashboard,{semanticExecutionPayload:L.semanticExecutionPayload}),we(),c&&Ie(),Se("close"),ae(!1),ce()},ss=()=>{L&&(_e(L.dashboard,{semanticExecutionPayload:L.semanticExecutionPayload}),ce())},rs=()=>{if(ne){if(N&&ot()){Se("home"),ae(!0);return}Ie()}};async function Ue(c){if(g)return;const I=i.useDashboardStore.getState().dashboard;if(!I)return;const k=(c==null?void 0:c.closeAfterSave)??Qe,G=(c==null?void 0:c.navigateHomeAfterSave)??!1;ye(k),k&&ae(!1);const Te=Be.cloneDeep(I);H(!0),Q(null),ve([]),Pe(!0);const cs={template:I};oe.mutate({resourceId:I.id,data:cs},{onSuccess:R=>{var Ne,Ce,xt;const W=(R==null?void 0:R.id)||((Ne=R==null?void 0:R.dashboard)==null?void 0:Ne.id)||((Ce=R==null?void 0:R.resource)==null?void 0:Ce.id)||((xt=R==null?void 0:R.template)==null?void 0:xt.id)||null;if(!I.id&&W){const Fe=i.useAIInteractionStore.getState(),ke=Fe.pendingDashboardDraftMigration;(ke==null?void 0:ke.scopeKey)===D?Fe.actions.setPendingDashboardDraftMigrationExpectedDashboardId(W):ke&&Fe.actions.clearPendingDashboardDraftMigration()}Pe(!1),i.ue.success("Dashboard saved!"),ie(jt(Te,i.useDashboardStore.getState().semanticExecutionPayload)),H(!1),ye(!1),k&&(we(),ce(),G&&ne&&Ie()),Se("close")},onError:R=>{Pe(!1),Q("Failed to save dashboard. Please try again.");const W=R.details,Ne=Array.isArray(W==null?void 0:W.errors)?(W.errors||[]).filter(Ce=>typeof Ce=="string"):[];ve(or({errors:Ne,dashboard:I||void 0})),i.ue.error("Failed to save dashboard")}})}async function ns(){if(g||(z(!0),!_||!M))return;const c=i.useDashboardStore.getState().dashboard;if(!c){z(!1);return}const I=JSON.stringify(c),k=i.useDashboardStore.getState(),G=Nt({dashboard:c,dashboardInputValues:k.dashboardInputValues,filterValues:Je,controlValues:k.controlValues,inlineFilterValuesMap:k.inlineFilterValuesMap,cardControlValuesMap:k.cardControlValuesMap}),Te={...M,template:I,filterValues:Je,inputValues:G};await Ge(n.apiServiceUrl,Te,t==null?void 0:t.accessToken),i.ue.success("Lens saved"),Ee==null||Ee(c),z(!1)}const dt=(M==null?void 0:M.name)||p.title;oe.isPending&&console.log("Title during update:",{title:dt,dashboardStateTitle:p.title,dashboardId:p==null?void 0:p.id,currentLensName:M==null?void 0:M.name});const as=ne&&!!(t!=null&&t.accessToken)&&!!(n!=null&&n.apiServiceUrl),os=!g&&Z.showDashboardHub&&as,is=!g&&d&&Z.showDashboardHub,$=(p==null?void 0:p.id)||null,ct=a.resolveDashboardBriefingsVisibility((pt=n.config)==null?void 0:pt.showBriefings,s),ee=!!$&&$t===$,ds=()=>{!$||g||Gt({dashboardId:ee?null:$})};return!d&&!P?null:e.jsxs("div",{className:"flex min-h-11 shrink-0 items-center justify-between gap-2 overflow-x-auto border-b px-4 py-1.5",role:"dashboard-controls",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[is&&!P&&e.jsx(a.IconButton,{"aria-label":"Dashboard Hub",tooltip:"Dashboard Hub",onClick:rs,className:"h-7 w-7 px-0",buttonProps:{size:"xs"},children:e.jsx(a.LayoutDashboard,{className:"h-3.5 w-3.5"})}),!P&&d&&(v?e.jsx("div",{className:"h-4 w-28 animate-pulse rounded-md bg-muted/70","aria-label":"Loading dashboard title",role:"status",children:e.jsx("span",{className:"sr-only",children:"Loading dashboard title"})}):e.jsxs(e.Fragment,{children:[e.jsx(a.EditableText,{value:dt||"Untitled Dashboard",onSave:c=>{console.log("EditableText onSave called:",{newTitle:c,canEditDashboard:h,dashboardId:p==null?void 0:p.id});const I=(p==null?void 0:p.title)||"";J(c),Jt(c,I)},isEditable:a.resolveDashboardTitleEditability({isDashboardEditing:N,canEditDashboard:h===!0&&!g,hasCurrentLens:!!M}),displayClassName:"text-[13px] font-medium",inputClassName:"text-[13px] font-medium",placeholder:"Dashboard Title",isPending:oe.isPending}),Z.showDashboardHub&&ee&&e.jsx("span",{className:"shrink-0 rounded-[4px] border border-border/60 px-1.5 py-px text-[10px] font-medium uppercase tracking-[0.06em] text-muted-foreground",title:"Default dashboard",children:"Default"}),os&&$&&e.jsx(i.TooltipProvider,{children:e.jsxs(i.Tooltip,{children:[e.jsx(i.TooltipTrigger,{asChild:!0,children:e.jsx(i.Button,{variant:"ghost",size:"xs",onClick:ds,disabled:zt||!(t!=null&&t.accessToken)||!(n!=null&&n.apiServiceUrl),className:i.cn("w-7 px-0",ee?"bg-primary/10 text-primary hover:bg-primary/15 hover:text-primary focus-visible:bg-primary/15":"text-muted-foreground hover:text-foreground"),"aria-pressed":ee,"aria-label":ee?"Remove as default dashboard":"Set as default dashboard",children:e.jsx(a.House,{className:"h-3.5 w-3.5"})})}),e.jsx(i.TooltipContent,{children:e.jsx("p",{children:ee?"Remove as default dashboard":"Set as default dashboard"})})]})})]}))]}),e.jsxs("div",{className:"flex items-center gap-2",children:[P&&e.jsxs(e.Fragment,{children:[e.jsx(U.AdvancedModeToggle,{}),e.jsx(U.VisualEditingControls,{})]}),!P&&d&&!g&&Z.showDashboardSharing&&e.jsxs(i.Button,{variant:"outline",size:"xs",onClick:()=>he(!0),children:[e.jsx(a.Share2,{className:"h-3.5 w-3.5"}),"Share"]}),!P&&N&&!g&&f.canUseFilters&&d&&e.jsx(U.DashboardFilterControlsLauncher,{}),N&&!P&&!g&&de&&M&&l&&d&&e.jsxs(i.Button,{variant:"secondary",size:"xs",disabled:X,onClick:ns,children:[e.jsx(ft.Save,{className:"h-3.5 w-3.5"}),"Save Lens"]}),N&&!P&&!g&&d&&!q&&e.jsxs("div",{className:"inline-flex h-7 items-stretch overflow-hidden rounded-control border border-input bg-background",children:[e.jsxs(i.Button,{variant:"ghost",size:"xs",disabled:!N,onClick:()=>void Qt(),className:"h-full rounded-none border-0 shadow-none hover:bg-accent",children:[e.jsx(a.Plus,{className:"h-3.5 w-3.5"}),"Visual"]}),e.jsxs(a.DropdownMenu,{modal:!1,children:[e.jsx(a.DropdownMenuTrigger,{asChild:!0,children:e.jsx(i.Button,{variant:"ghost",size:"xs",className:"h-full w-7 rounded-none border-0 border-l border-border/60 px-0 shadow-none hover:bg-accent","aria-label":"Open visual options",disabled:!N,children:e.jsx(T.ChevronDown,{className:"h-3.5 w-3.5"})})}),e.jsx(a.DropdownMenuContent,{align:"end",className:"z-[60] w-48 rounded-[6px] border-border/60 p-1 shadow-sm",children:e.jsxs(a.DropdownMenuItem,{onClick:()=>We(!0),children:[e.jsx(a.Plus,{className:"h-3.5 w-3.5"}),"From library..."]})})]}),e.jsx(U.VisualsLibraryDialog,{open:qt,onOpenChange:We})]}),!P&&!N&&(h||g)&&(!m||!x||h!==void 0)&&d&&e.jsxs("div",{className:"inline-flex items-center gap-1",children:[e.jsxs(i.Button,{size:"xs",onClick:Xt,children:[e.jsx(a.Pencil,{className:"h-3.5 w-3.5"}),g?"Inspect":"Edit"]}),b?e.jsx(i.TooltipProvider,{children:e.jsxs(i.Tooltip,{children:[e.jsx(i.TooltipTrigger,{asChild:!0,children:e.jsx("button",{type:"button","aria-label":b,className:"inline-flex size-6 items-center justify-center rounded-control text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",children:e.jsx(i.Info,{"aria-hidden":"true",className:"size-3.5"})})}),e.jsx(i.TooltipContent,{children:e.jsx("p",{children:b})})]})}):null]}),st&&d&&at&&e.jsxs(i.Button,{variant:"outline",size:"xs",onClick:ss,disabled:De,children:[e.jsx(a.Undo2,{className:"h-3.5 w-3.5"}),"Undo"]}),st&&d&&e.jsxs(i.Button,{size:"xs",className:i.cn(!it&&"opacity-60"),disabled:De||!it,onClick:()=>Ue(),children:[De?e.jsx(i.LoaderCircle,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(ft.Save,{className:"h-3.5 w-3.5"}),De?"Saving...":"Save"]}),N&&!P&&d&&e.jsxs(i.Button,{variant:"outline",size:"xs",onClick:Zt,children:[e.jsx(a.Cross2Icon,{className:"h-3.5 w-3.5"}),"Close"]}),!P&&d&&e.jsx("div",{className:"ml-2 flex items-center",children:e.jsx(U.NotificationBell,{})}),!P&&l&&e.jsx(Cs,{}),!P&&d&&!g&&e.jsxs(a.DropdownMenu,{children:[e.jsx(a.DropdownMenuTrigger,{asChild:!0,children:e.jsx(a.IconButton,{tooltip:"More Options",className:"w-7 px-0 text-muted-foreground hover:text-foreground",buttonProps:{size:"xs",variant:"ghost","aria-label":"More dashboard options"},children:e.jsx(a.EllipsisVertical,{className:"h-3.5 w-3.5"})})}),e.jsxs(a.DropdownMenuContent,{align:"end",className:"w-56 rounded-control border border-border/60 p-1 shadow-sm",children:[e.jsx(a.DropdownMenuLabel,{children:"Reports & briefings"}),e.jsxs(a.DropdownMenuItem,{disabled:w,onSelect:()=>re(!0),children:[e.jsx(a.Download,{className:"h-3.5 w-3.5"}),"Export"]}),e.jsx(dr,{scheduleReportVisible:!!(ct&&o.surfaceVisible&&$&&!N),analyticalBriefingVisible:!!(ct&&o.surfaceVisible&&$&&!N),onScheduleReport:()=>se("scheduled_report"),onCreateAnalyticalBriefing:()=>se("analytical_briefing")}),e.jsx(a.DropdownMenuSeparator,{}),Z.showGroupManagement&&e.jsxs(e.Fragment,{children:[e.jsx(a.DropdownMenuLabel,{children:"Access"}),e.jsxs(a.DropdownMenuItem,{onClick:()=>xe(!0),children:[e.jsx(a.Users,{className:"h-3.5 w-3.5"}),"Manage Groups"]}),e.jsx(a.DropdownMenuSeparator,{})]}),e.jsx(a.DropdownMenuLabel,{children:"Preferences"}),e.jsxs(a.DropdownMenuItem,{onClick:()=>te(!0),children:[e.jsx(a.Calendar,{className:"h-3.5 w-3.5"}),"Report preferences"]}),l&&d&&e.jsxs(e.Fragment,{children:[e.jsx(a.DropdownMenuSeparator,{}),e.jsx(a.DropdownMenuLabel,{children:"Developer"}),e.jsxs(a.DropdownMenuItem,{onSelect:()=>{var c;t!=null&&t.accessToken&&((c=navigator==null?void 0:navigator.clipboard)!=null&&c.writeText?navigator.clipboard.writeText(t.accessToken).then(()=>i.ue.success("Token copied to clipboard")).catch(()=>i.ue.error("Unable to copy token")):i.ue.error("Clipboard not available"))},children:[e.jsx(a.Copy,{className:"h-3.5 w-3.5"}),"Copy token"]}),q&&e.jsxs(a.DropdownMenuItem,{disabled:!Oe,onSelect:()=>{var c;if(!Oe){i.ue.error("Open a document sheet with a token to copy the local PDF URL");return}(c=navigator==null?void 0:navigator.clipboard)!=null&&c.writeText?navigator.clipboard.writeText(Oe).then(()=>i.ue.success("Local document PDF URL copied to clipboard")).catch(()=>i.ue.error("Unable to copy local document PDF URL")):i.ue.error("Clipboard not available")},children:[e.jsx(a.Copy,{className:"h-3.5 w-3.5"}),"Copy local document PDF URL"]}),e.jsxs(a.DropdownMenuItem,{onSelect:()=>i.invalidateToken(n.apiServiceUrl),children:[e.jsx(ys,{className:"h-3.5 w-3.5"}),"Invalidate token"]}),e.jsxs(a.DropdownMenuItem,{onSelect:u,children:[e.jsx(ps.Palette,{className:"h-3.5 w-3.5"}),"Brand Studio"]}),N&&e.jsxs(a.DropdownMenuItem,{onSelect:()=>Ze(!Xe),children:[e.jsx(xs.Braces,{className:"h-3.5 w-3.5"}),Xe?"Hide dashboard JSON":"Show dashboard JSON"]}),de&&N&&e.jsxs(a.DropdownMenuItem,{onSelect:()=>S(!0),children:[e.jsx(a.Plus,{className:"h-3.5 w-3.5"}),"Add lens"]}),de&&e.jsxs(a.DropdownMenuSub,{children:[e.jsxs(a.DropdownMenuSubTrigger,{children:[e.jsx(gs,{className:"h-3.5 w-3.5"}),"Lenses"]}),e.jsx(a.DropdownMenuSubContent,{className:"w-60",children:e.jsx(Ls,{})})]})]})]})]}),me&&tt&&e.jsx(a.ShareDialog,{resource:tt,resourceType:a.ResourceType.DASHBOARD,onClose:()=>he(!1)}),Z.showGroupManagement&&e.jsx(Zs,{open:pe,onOpenChange:xe}),e.jsx(us.ReportPreferencesDialog,{open:fe,onOpenChange:te}),$&&ge?e.jsx(U.DashboardBriefingLauncher,{dashboardId:$,dashboardTitle:(p==null?void 0:p.title)||(B==null?void 0:B.title),open:!0,onOpenChange:c=>{c||se(null)},hideTrigger:!0,workflowIntent:ge}):null,l&&de&&d&&e.jsx(Is,{open:Y,onOpenChange:S}),d&&e.jsx(a.DownloadPdf,{open:V,onOpenChange:re}),e.jsx(a.AlertDialog,{open:be,onOpenChange:c=>{!c&&Ae&&!K||(H(c),c||(Q(null),ve([]),ye(!1)))},children:e.jsxs(a.AlertDialogContent,{className:"max-w-sm",children:[e.jsxs(a.AlertDialogHeader,{children:[e.jsx(a.AlertDialogTitle,{children:K?"Save failed":"Saving dashboard"}),e.jsx(a.AlertDialogDescription,{className:"pt-2",children:K?"We could not save the dashboard. Please try again.":"Please wait while we save your changes."}),Ke.length>0&&e.jsxs("div",{className:"space-y-1 rounded-md border border-destructive/20 bg-destructive/5 p-3 text-left",children:[e.jsx("div",{className:"text-sm font-medium text-destructive",children:"What needs attention"}),e.jsx("ul",{className:"list-disc space-y-1 pl-4 text-xs text-muted-foreground",children:Ke.slice(0,5).map(c=>e.jsx("li",{children:c},c))})]})]}),e.jsx(a.AlertDialogFooter,{className:"flex-col gap-2 sm:flex-row sm:justify-end",children:K?e.jsxs(e.Fragment,{children:[e.jsx(a.AlertDialogCancel,{onClick:()=>{H(!1),Q(null),ve([]),ye(!1)},className:"m-0",children:"Close"}),e.jsx(a.AlertDialogAction,{onClick:()=>Ue({closeAfterSave:Qe,navigateHomeAfterSave:Re==="home"}),className:"m-0",children:"Retry"})]}):e.jsxs(a.AlertDialogAction,{disabled:!0,className:"m-0 cursor-default",children:[e.jsx(i.LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Saving..."]})})]})}),e.jsx(U.UnsavedChangesAlert,{open:Wt,onOpenChange:c=>{ae(c)},onSave:es,onDiscard:ts,isSaving:Ae,saveLabel:"Save",discardLabel:"Discard changes"})]})]})}function lr({accessToken:t,dashboardId:n,selectedSheetId:r,pageSize:s,orientation:o,theme:l}){if(!t||!r)return null;const h=new URL("http://localhost:5173/print-document");h.searchParams.set("token",t),n&&h.searchParams.set("dashboardId",n),h.searchParams.set("selectedSheetId",r),l&&h.searchParams.set("theme",l);const x=new URL("http://127.0.0.1:3002/");return x.searchParams.set("pdfMode","document"),x.searchParams.set("pageSize",s||"letter"),x.searchParams.set("orientation",o||"portrait"),x.searchParams.set("url",h.toString()),x.toString()}exports.default=cr;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),o=require("react"),b=require("./x-B6ghREd2.cjs"),r=require("./switch-BytP6QY8.cjs");require("./constants-vtu7_IUo.cjs");require("./validators-DVYAnnX0.cjs");require("./matrix-operation-contract-D9dLX-Wr.cjs");require("../value-format-preferences/index.cjs");require("./index-DSa6RSdg.cjs");require("./appearance-runtime-provider-Ca8rxO86.cjs");require("./appearance-context-tNjvTJj3.cjs");require("./index-C8XCKzB6.cjs");require("./field-aggregations-CDCamEsQ.cjs");require("zod");require("./matrix-continuation-6nhDy-lF.cjs");require("./color-CyB5o13F.cjs");require("react-dom");require("./index-BlYf8gNa.cjs");function q(){const t=r.useDashboardStore(e=>e.dashboard),d=r.useDashboardStore(e=>e.actions.setDashboard),c=r.useDashboardStore(e=>e.showDashboardJSON),h=r.useDashboardStore(e=>e.actions.setShowDashboardJSON),s=o.useMemo(()=>t?JSON.stringify(t,null,2):"",[t]),[l,u]=o.useState(s),i=o.useRef(s);return o.useEffect(()=>{s!==i.current&&(u(s),i.current=s)},[s]),a.jsxs("div",{className:r.cn("relative p-2",{hidden:!c}),children:[a.jsxs(r.Button,{variant:"secondary",size:"sm",className:"absolute right-2 top-2 z-10 h-8",onClick:()=>h(!1),children:[a.jsx(b.X,{className:"mr-2 h-4 w-4"}),"Close"]}),a.jsx("div",{className:"h-[550px] overflow-hidden",children:a.jsx(r.CodeEditor,{value:l,onValueChange:e=>{u(e);try{const n=JSON.parse(e);i.current=JSON.stringify(n,null,2),d(n)}catch{}},language:"json"})})]})}exports.default=q;
|