@aglyn/aglyn 1.19.0 → 1.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -50,3 +50,25 @@ export declare function registerPluginScopeSharingPatch(collections: readonly st
50
50
  export declare function scopeSharingPatchFor(collection: string): ScopeSharingPatch | null;
51
51
  /** Test seam: forget every patch. */
52
52
  export declare function resetScopeSharingPatchesForTests(): void;
53
+ /**
54
+ * What a plugin keeps level itself after a workspace's sites change, for
55
+ * sharing it stores somewhere other than a document's own marker: the CRM's
56
+ * grants shared with all sites except some, which sit inside a record's
57
+ * `sharing` map. Called after the sweep, with the time it may spend inline;
58
+ * work left past it is the plugin's to finish. It must never throw.
59
+ */
60
+ export type ScopeSharingSiteChangeHook = (input: {
61
+ orgId: string;
62
+ reason: 'site-added' | 'site-removed' | 'drift-repair';
63
+ hostId?: string;
64
+ budgetMs: number;
65
+ }) => Promise<void>;
66
+ /** Registers a plugin's {@link ScopeSharingSiteChangeHook}. One per plugin; again replaces it. */
67
+ export declare function registerPluginScopeSharingSiteChange(hook: ScopeSharingSiteChangeHook, options?: {
68
+ pluginId?: string;
69
+ }): void;
70
+ /** Every registered site-change hook, by plugin. */
71
+ export declare function listScopeSharingSiteChangeHooks(): Array<{
72
+ pluginId: string;
73
+ hook: ScopeSharingSiteChangeHook;
74
+ }>;
@@ -1,5 +1,5 @@
1
1
  import { _ as _extends } from "@swc/helpers/_/_extends";
2
- var _globalScope_PATCHES_KEY;
2
+ var _globalScope_PATCHES_KEY, _globalHooks_SITE_CHANGE_KEY;
3
3
  /**
4
4
  * @license
5
5
  * Copyright 2026 Aglyn LLC
@@ -80,6 +80,26 @@ const patches = (_globalScope_PATCHES_KEY = globalScope[PATCHES_KEY]) != null ?
80
80
  }
81
81
  /** Test seam: forget every patch. */ export function resetScopeSharingPatchesForTests() {
82
82
  patches.clear();
83
+ siteChangeHooks.clear();
84
+ }
85
+ const SITE_CHANGE_KEY = Symbol.for('@aglyn/aglyn:plugin-scope-sharing-site-change');
86
+ const globalHooks = globalThis;
87
+ const siteChangeHooks = (_globalHooks_SITE_CHANGE_KEY = globalHooks[SITE_CHANGE_KEY]) != null ? _globalHooks_SITE_CHANGE_KEY : globalHooks[SITE_CHANGE_KEY] = new Map();
88
+ /** Registers a plugin's {@link ScopeSharingSiteChangeHook}. One per plugin; again replaces it. */ export function registerPluginScopeSharingSiteChange(hook, options) {
89
+ var _ref, _getRegisteringPluginId;
90
+ const pluginId = ((_ref = (_getRegisteringPluginId = getRegisteringPluginId()) != null ? _getRegisteringPluginId : options == null ? void 0 : options.pluginId) != null ? _ref : '').trim();
91
+ if (!pluginId) {
92
+ throw new Error('a scope-sharing site-change hook was registered with no owner: pass { pluginId } ' + 'when registering outside a plugin register fn');
93
+ }
94
+ siteChangeHooks.set(pluginId, hook);
95
+ }
96
+ /** Every registered site-change hook, by plugin. */ export function listScopeSharingSiteChangeHooks() {
97
+ return [
98
+ ...siteChangeHooks.entries()
99
+ ].map(([pluginId, hook])=>({
100
+ pluginId,
101
+ hook
102
+ }));
83
103
  }
84
104
 
85
105
  //# sourceMappingURL=plugin-scope-sharing.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../libs/aglyn/src/lib/plugin-manager/plugin-scope-sharing.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * WHICH COLLECTIONS HOLD DOCUMENTS SHARED WITH \"ALL SITES EXCEPT…\" (AGL-4047).\n *\n * Such a document names its included sites in `visibleTo`, so that list has\n * to change when a site joins or leaves the workspace. One sweep does that for\n * every collection (`scope-sharing-sweep.ts`), and it can only walk what it\n * has been told about, so a plugin declares its collections in the\n * `scopeSharingCollections` block of `plugins.config.json`, compiled like its\n * other storage. Media belongs to the platform and is listed here.\n *\n * A collection whose documents store fields derived from `visibleTo` declares\n * `patch: true` and registers the function that recomputes them. The sweep\n * refuses to write such a collection while the function is missing, because a\n * `visibleTo` written without them leaves a document its list cannot find.\n */\n\nimport { getRegisteringPluginId } from '../app-utils/registering-plugin'\nimport { PLUGIN_SCOPE_SHARING_COLLECTIONS_DECLARED } from './plugin-scope-sharing.generated'\n\n/** One collection under `orgs/{orgId}` whose documents can be all-except. */\nexport interface ScopeSharingCollection {\n /** The subcollection, spelled as Firestore holds it. */\n name: string\n /** Stored fields follow `visibleTo`: a patch function is registered. */\n patch?: boolean\n /** The most sites one document may reach; past it the list stops widening. */\n maxIncluded?: number\n /** Fields naming sites that stay included though they are excluded. */\n keepSiteFields?: string[]\n}\n\n/** A declaration with its owner; `core` for what the platform holds itself. */\nexport type ResolvedScopeSharingCollection = ScopeSharingCollection & {\n pluginId: string\n}\n\n/** The platform's own: media belongs to no plugin. */\nconst CORE_SCOPE_SHARING_COLLECTIONS: readonly ResolvedScopeSharingCollection[] = [\n { pluginId: 'core', name: 'media' },\n { pluginId: 'core', name: 'mediaFolders' },\n]\n\n/**\n * Every collection the sweep walks, in a stable order: a sweep's cursor names\n * a position in this list, and resuming relies on the ones before it being done.\n */\nexport function listScopeSharingCollections(): ResolvedScopeSharingCollection[] {\n return [\n ...CORE_SCOPE_SHARING_COLLECTIONS,\n ...PLUGIN_SCOPE_SHARING_COLLECTIONS_DECLARED,\n ].map((row) => ({ ...row }))\n}\n\n/**\n * Recomputes the fields a document derives from its scope: `next` is the whole\n * document as it will be stored, and the answer is merged into the write.\n */\nexport type ScopeSharingPatch = (\n collection: string,\n next: Record<string, unknown>,\n) => Promise<Record<string, unknown>> | Record<string, unknown>\n\n/**\n * One map per process, on `globalThis`, for the reason `plugin-site-resources`\n * gives: the declarations register from `instrumentation.ts`, which Next\n * compiles apart from the route that runs the sweep.\n */\nconst PATCHES_KEY = Symbol.for('@aglyn/aglyn:plugin-scope-sharing-patches')\n\nconst globalScope = globalThis as typeof globalThis & {\n [PATCHES_KEY]?: Map<string, ScopeSharingPatch>\n}\n\nconst patches: Map<string, ScopeSharingPatch> =\n globalScope[PATCHES_KEY] ?? (globalScope[PATCHES_KEY] = new Map())\n\n/**\n * Registers the patch for collections a plugin declared with `patch: true`.\n * Refuses a collection another plugin declared, or one declared without it.\n */\nexport function registerPluginScopeSharingPatch(\n collections: readonly string[],\n patch: ScopeSharingPatch,\n options?: { pluginId?: string },\n): void {\n const pluginId = (getRegisteringPluginId() ?? options?.pluginId ?? '').trim()\n if (!pluginId) {\n throw new Error(\n 'a scope-sharing patch was registered with no owner: pass { pluginId } ' +\n 'when registering outside a plugin register fn',\n )\n }\n for (const name of collections) {\n const declared = PLUGIN_SCOPE_SHARING_COLLECTIONS_DECLARED.find((row) => row.name === name)\n if (declared?.pluginId !== pluginId || !declared.patch) {\n throw new Error(`${pluginId} did not declare ${name} with patch: true in scopeSharingCollections`)\n }\n }\n for (const name of collections) patches.set(name, patch)\n}\n\n/** The patch registered for a collection, or `null`. */\nexport function scopeSharingPatchFor(collection: string): ScopeSharingPatch | null {\n return patches.get(collection) ?? null\n}\n\n/** Test seam: forget every patch. */\nexport function resetScopeSharingPatchesForTests(): void {\n patches.clear()\n}\n"],"names":["globalScope","getRegisteringPluginId","PLUGIN_SCOPE_SHARING_COLLECTIONS_DECLARED","CORE_SCOPE_SHARING_COLLECTIONS","pluginId","name","listScopeSharingCollections","map","row","PATCHES_KEY","Symbol","for","globalThis","patches","Map","registerPluginScopeSharingPatch","collections","patch","options","trim","Error","declared","find","set","scopeSharingPatchFor","collection","get","resetScopeSharingPatchesForTests","clear"],"mappings":";IA2FEA;AA3FF;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;;;;;CAcC,GAED,SAASC,sBAA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Qe,KAAK;AACf"}
1
+ {"version":3,"sources":["../../../../../../libs/aglyn/src/lib/plugin-manager/plugin-scope-sharing.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * WHICH COLLECTIONS HOLD DOCUMENTS SHARED WITH \"ALL SITES EXCEPT…\" (AGL-4047).\n *\n * Such a document names its included sites in `visibleTo`, so that list has\n * to change when a site joins or leaves the workspace. One sweep does that for\n * every collection (`scope-sharing-sweep.ts`), and it can only walk what it\n * has been told about, so a plugin declares its collections in the\n * `scopeSharingCollections` block of `plugins.config.json`, compiled like its\n * other storage. Media belongs to the platform and is listed here.\n *\n * A collection whose documents store fields derived from `visibleTo` declares\n * `patch: true` and registers the function that recomputes them. The sweep\n * refuses to write such a collection while the function is missing, because a\n * `visibleTo` written without them leaves a document its list cannot find.\n */\n\nimport { getRegisteringPluginId } from '../app-utils/registering-plugin'\nimport { PLUGIN_SCOPE_SHARING_COLLECTIONS_DECLARED } from './plugin-scope-sharing.generated'\n\n/** One collection under `orgs/{orgId}` whose documents can be all-except. */\nexport interface ScopeSharingCollection {\n /** The subcollection, spelled as Firestore holds it. */\n name: string\n /** Stored fields follow `visibleTo`: a patch function is registered. */\n patch?: boolean\n /** The most sites one document may reach; past it the list stops widening. */\n maxIncluded?: number\n /** Fields naming sites that stay included though they are excluded. */\n keepSiteFields?: string[]\n}\n\n/** A declaration with its owner; `core` for what the platform holds itself. */\nexport type ResolvedScopeSharingCollection = ScopeSharingCollection & {\n pluginId: string\n}\n\n/** The platform's own: media belongs to no plugin. */\nconst CORE_SCOPE_SHARING_COLLECTIONS: readonly ResolvedScopeSharingCollection[] = [\n { pluginId: 'core', name: 'media' },\n { pluginId: 'core', name: 'mediaFolders' },\n]\n\n/**\n * Every collection the sweep walks, in a stable order: a sweep's cursor names\n * a position in this list, and resuming relies on the ones before it being done.\n */\nexport function listScopeSharingCollections(): ResolvedScopeSharingCollection[] {\n return [\n ...CORE_SCOPE_SHARING_COLLECTIONS,\n ...PLUGIN_SCOPE_SHARING_COLLECTIONS_DECLARED,\n ].map((row) => ({ ...row }))\n}\n\n/**\n * Recomputes the fields a document derives from its scope: `next` is the whole\n * document as it will be stored, and the answer is merged into the write.\n */\nexport type ScopeSharingPatch = (\n collection: string,\n next: Record<string, unknown>,\n) => Promise<Record<string, unknown>> | Record<string, unknown>\n\n/**\n * One map per process, on `globalThis`, for the reason `plugin-site-resources`\n * gives: the declarations register from `instrumentation.ts`, which Next\n * compiles apart from the route that runs the sweep.\n */\nconst PATCHES_KEY = Symbol.for('@aglyn/aglyn:plugin-scope-sharing-patches')\n\nconst globalScope = globalThis as typeof globalThis & {\n [PATCHES_KEY]?: Map<string, ScopeSharingPatch>\n}\n\nconst patches: Map<string, ScopeSharingPatch> =\n globalScope[PATCHES_KEY] ?? (globalScope[PATCHES_KEY] = new Map())\n\n/**\n * Registers the patch for collections a plugin declared with `patch: true`.\n * Refuses a collection another plugin declared, or one declared without it.\n */\nexport function registerPluginScopeSharingPatch(\n collections: readonly string[],\n patch: ScopeSharingPatch,\n options?: { pluginId?: string },\n): void {\n const pluginId = (getRegisteringPluginId() ?? options?.pluginId ?? '').trim()\n if (!pluginId) {\n throw new Error(\n 'a scope-sharing patch was registered with no owner: pass { pluginId } ' +\n 'when registering outside a plugin register fn',\n )\n }\n for (const name of collections) {\n const declared = PLUGIN_SCOPE_SHARING_COLLECTIONS_DECLARED.find((row) => row.name === name)\n if (declared?.pluginId !== pluginId || !declared.patch) {\n throw new Error(`${pluginId} did not declare ${name} with patch: true in scopeSharingCollections`)\n }\n }\n for (const name of collections) patches.set(name, patch)\n}\n\n/** The patch registered for a collection, or `null`. */\nexport function scopeSharingPatchFor(collection: string): ScopeSharingPatch | null {\n return patches.get(collection) ?? null\n}\n\n/** Test seam: forget every patch. */\nexport function resetScopeSharingPatchesForTests(): void {\n patches.clear()\n siteChangeHooks.clear()\n}\n\n/**\n * What a plugin keeps level itself after a workspace's sites change, for\n * sharing it stores somewhere other than a document's own marker: the CRM's\n * grants shared with all sites except some, which sit inside a record's\n * `sharing` map. Called after the sweep, with the time it may spend inline;\n * work left past it is the plugin's to finish. It must never throw.\n */\nexport type ScopeSharingSiteChangeHook = (input: {\n orgId: string\n reason: 'site-added' | 'site-removed' | 'drift-repair'\n hostId?: string\n budgetMs: number\n}) => Promise<void>\n\nconst SITE_CHANGE_KEY = Symbol.for('@aglyn/aglyn:plugin-scope-sharing-site-change')\n\nconst globalHooks = globalThis as typeof globalThis & {\n [SITE_CHANGE_KEY]?: Map<string, ScopeSharingSiteChangeHook>\n}\n\nconst siteChangeHooks: Map<string, ScopeSharingSiteChangeHook> =\n globalHooks[SITE_CHANGE_KEY] ?? (globalHooks[SITE_CHANGE_KEY] = new Map())\n\n/** Registers a plugin's {@link ScopeSharingSiteChangeHook}. One per plugin; again replaces it. */\nexport function registerPluginScopeSharingSiteChange(\n hook: ScopeSharingSiteChangeHook,\n options?: { pluginId?: string },\n): void {\n const pluginId = (getRegisteringPluginId() ?? options?.pluginId ?? '').trim()\n if (!pluginId) {\n throw new Error(\n 'a scope-sharing site-change hook was registered with no owner: pass { pluginId } ' +\n 'when registering outside a plugin register fn',\n )\n }\n siteChangeHooks.set(pluginId, hook)\n}\n\n/** Every registered site-change hook, by plugin. */\nexport function listScopeSharingSiteChangeHooks(): Array<{\n pluginId: string\n hook: ScopeSharingSiteChangeHook\n}> {\n return [...siteChangeHooks.entries()].map(([pluginId, hook]) => ({ pluginId, hook }))\n}\n"],"names":["globalScope","globalHooks","getRegisteringPluginId","PLUGIN_SCOPE_SHARING_COLLECTIONS_DECLARED","CORE_SCOPE_SHARING_COLLECTIONS","pluginId","name","listScopeSharingCollections","map","row","PATCHES_KEY","Symbol","for","globalThis","patches","Map","registerPluginScopeSharingPatch","collections","patch","options","trim","Error","declared","find","set","scopeSharingPatchFor","collection","get","resetScopeSharingPatchesForTests","clear","siteChangeHooks","SITE_CHANGE_KEY","registerPluginScopeSharingSiteChange","hook","listScopeSharingSiteChangeHooks","entries"],"mappings":";IA2FEA,0BA2DAC;AAtJF;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;;;;;CAcC,GAED,SAASC,sBAAsB,QAAQ,qCAAiC;AACxE,SAASC,yCAAyC,QAAQ,sCAAkC;AAmB5F,oDAAoD,GACpD,MAAMC,iCAA4E;IAChF;QAAEC,UAAU;QAAQC,MAAM;IAAQ;IAClC;QAAED,UAAU;QAAQC,MAAM;IAAe;CAC1C;AAED;;;CAGC,GACD,OAAO,SAASC;IACd,OAAO;WACFH;WACAD;KACJ,CAACK,GAAG,CAAC,CAACC,MAAS,aAAKA;AACvB;AAWA;;;;CAIC,GACD,MAAMC,cAAcC,OAAOC,GAAG,CAAC;AAE/B,MAAMZ,cAAca;AAIpB,MAAMC,WACJd,2BAAAA,WAAW,CAACU,YAAY,YAAxBV,2BAA6BA,WAAW,CAACU,YAAY,GAAG,IAAIK;AAE9D;;;CAGC,GACD,OAAO,SAASC,gCACdC,WAA8B,EAC9BC,KAAwB,EACxBC,OAA+B;QAEbjB,MAAAA;IAAlB,MAAMG,WAAW,EAACH,QAAAA,0BAAAA,oCAAAA,0BAA4BiB,2BAAAA,QAASd,QAAQ,YAA7CH,OAAiD,IAAIkB,IAAI;IAC3E,IAAI,CAACf,UAAU;QACb,MAAM,IAAIgB,MACR,2EACE;IAEN;IACA,KAAK,MAAMf,QAAQW,YAAa;QAC9B,MAAMK,WAAWnB,0CAA0CoB,IAAI,CAAC,CAACd,MAAQA,IAAIH,IAAI,KAAKA;QACtF,IAAIgB,CAAAA,4BAAAA,SAAUjB,QAAQ,MAAKA,YAAY,CAACiB,SAASJ,KAAK,EAAE;YACtD,MAAM,IAAIG,MAAM,GAAGhB,SAAS,iBAAiB,EAAEC,KAAK,4CAA4C,CAAC;QACnG;IACF;IACA,KAAK,MAAMA,QAAQW,YAAaH,QAAQU,GAAG,CAAClB,MAAMY;AACpD;AAEA,sDAAsD,GACtD,OAAO,SAASO,qBAAqBC,UAAkB;QAC9CZ;IAAP,QAAOA,eAAAA,QAAQa,GAAG,CAACD,uBAAZZ,eAA2B;AACpC;AAEA,mCAAmC,GACnC,OAAO,SAASc;IACdd,QAAQe,KAAK;IACbC,gBAAgBD,KAAK;AACvB;AAgBA,MAAME,kBAAkBpB,OAAOC,GAAG,CAAC;AAEnC,MAAMX,cAAcY;AAIpB,MAAMiB,mBACJ7B,+BAAAA,WAAW,CAAC8B,gBAAgB,YAA5B9B,+BAAiCA,WAAW,CAAC8B,gBAAgB,GAAG,IAAIhB;AAEtE,gGAAgG,GAChG,OAAO,SAASiB,qCACdC,IAAgC,EAChCd,OAA+B;QAEbjB,MAAAA;IAAlB,MAAMG,WAAW,EAACH,QAAAA,0BAAAA,oCAAAA,0BAA4BiB,2BAAAA,QAASd,QAAQ,YAA7CH,OAAiD,IAAIkB,IAAI;IAC3E,IAAI,CAACf,UAAU;QACb,MAAM,IAAIgB,MACR,sFACE;IAEN;IACAS,gBAAgBN,GAAG,CAACnB,UAAU4B;AAChC;AAEA,kDAAkD,GAClD,OAAO,SAASC;IAId,OAAO;WAAIJ,gBAAgBK,OAAO;KAAG,CAAC3B,GAAG,CAAC,CAAC,CAACH,UAAU4B,KAAK,GAAM,CAAA;YAAE5B;YAAU4B;QAAK,CAAA;AACpF"}
@@ -0,0 +1,107 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ /** One site, as far as where a plugin runs is concerned. */
18
+ export interface PluginSiteEntry {
19
+ /** The host document id. */
20
+ id: string;
21
+ disabledPlugins?: readonly string[] | null;
22
+ enabledPlugins?: readonly string[] | null;
23
+ }
24
+ /** Where a plugin runs, as a person would choose it. */
25
+ export type PluginRunsOn = {
26
+ mode: 'all';
27
+ } | {
28
+ mode: 'allExcept';
29
+ exceptHostIds: readonly string[];
30
+ };
31
+ /** Whether a site's deny-list names this plugin. */
32
+ export declare function siteLeavesOutPlugin(site: Pick<PluginSiteEntry, 'disabledPlugins'> | null | undefined, pluginId: string): boolean;
33
+ /**
34
+ * Where a plugin runs today, read across the workspace's sites: All sites
35
+ * when no site's deny-list names it, else all sites except the ones that do.
36
+ *
37
+ * Every site may be named, which is a state a site's own switches can reach
38
+ * and a choice this module refuses to WRITE (see {@link planPluginRunsOn}).
39
+ * It is read as what it is, so the field can say so rather than pretend.
40
+ */
41
+ export declare function pluginRunsOnOf(pluginId: string, sites: readonly Pick<PluginSiteEntry, 'id' | 'disabledPlugins'>[]): PluginRunsOn;
42
+ /** One site whose deny-list a choice changes. */
43
+ export interface PluginSiteWrite {
44
+ hostId: string;
45
+ /** The whole deny-list as it should be stored. */
46
+ disabledPlugins: string[];
47
+ /** True when the plugin is taken off this site, false when it comes back. */
48
+ leftOut: boolean;
49
+ }
50
+ /** A plugin that would be left running on a site without one it needs. */
51
+ export interface PluginSiteStranding {
52
+ hostId: string;
53
+ pluginId: string;
54
+ missing: string[];
55
+ }
56
+ export type PluginRunsOnPlan = {
57
+ writes: PluginSiteWrite[];
58
+ problem: null;
59
+ stranded: [];
60
+ } | {
61
+ writes: null;
62
+ problem: string;
63
+ stranded: PluginSiteStranding[];
64
+ };
65
+ /**
66
+ * What a "Runs on" choice writes to each site, or why it can't be written.
67
+ *
68
+ * - The base library runs on every site and can't be left out anywhere.
69
+ * - A plugin the workspace has switched off runs on no site, so there is no
70
+ * choice to make until it is switched back on.
71
+ * - "All sites except…" must leave out at least one site and keep at least
72
+ * one in: leaving every site out is switching it off for the workspace,
73
+ * which is a different switch with a different reach.
74
+ * - A site the choice names that the workspace doesn't hold is dropped, not
75
+ * refused: it is out either way.
76
+ * - Leaving a site out is refused, naming the site and the plugin, when a
77
+ * plugin running there needs this one. Only what THIS choice would strand
78
+ * is counted, so a site already in that state doesn't block the others.
79
+ * - Only sites whose deny-list changes are written. A site's opt-in list
80
+ * (`enabledPlugins`, for User Accounts) is never touched: a deny beats it.
81
+ */
82
+ export declare function planPluginRunsOn(input: {
83
+ pluginId: string;
84
+ choice: PluginRunsOn;
85
+ org: {
86
+ enabledPlugins?: string[];
87
+ } | null | undefined;
88
+ sites: readonly PluginSiteEntry[];
89
+ /** The workspace's pinned marketplace listings, as `resolveEnabledPlugins` reads them. */
90
+ installedListings?: readonly string[] | null;
91
+ /** How a site reads in a refusal. Its id when absent. */
92
+ siteName?: (hostId: string) => string;
93
+ /**
94
+ * The plugin's name in a refusal, for one the catalog can't name: a
95
+ * marketplace plugin, whose id is its listing's (AGL-4047). The catalog's
96
+ * label, else the id, when absent.
97
+ */
98
+ label?: string;
99
+ }): PluginRunsOnPlan;
100
+ /**
101
+ * The sentence the console shows for a plugin that is still off on a site it
102
+ * runs on by this choice, because that site never turned it on: User
103
+ * Accounts, which a site opts into (`defaultOffPerSite`). Null for every other
104
+ * plugin. The choice only ever takes a site out; it never turns a plugin on
105
+ * for a site that hasn't asked for it.
106
+ */
107
+ export declare function pluginRunsOnOptInNote(pluginId: string): string | null;
@@ -0,0 +1,169 @@
1
+ import { _ as _extends } from "@swc/helpers/_/_extends";
2
+ /**
3
+ * @license
4
+ * Copyright 2026 Aglyn LLC
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */ /**
18
+ * Where a plugin runs across a workspace's sites: All sites, or all sites
19
+ * except some (AGL-4047).
20
+ *
21
+ * NO NEW STORAGE AND NO MARKER. A site that is left out is a site whose own
22
+ * `disabledPlugins` deny-list names the plugin, which is exactly what that
23
+ * site's Admin › Plugins switch writes. So the workspace's "Runs on" choice
24
+ * is READ across the sites' deny-lists and WRITTEN into them, and nothing
25
+ * else needs to know it exists:
26
+ *
27
+ * - A site added later has no entry, so it runs the plugin. That is what
28
+ * "all sites except…" promises, with no sweep to keep it true.
29
+ * - A deleted site takes its entry with it.
30
+ * - Anyone who may change a site's plugins can still turn it back on there,
31
+ * as today, and the workspace's choice then reads that site as included.
32
+ *
33
+ * "Selected sites" is not offered for an ordinary plugin: a site's deny-list
34
+ * can't say "on only here", so it would have to deny every other site, and a
35
+ * site added later would then get the plugin, which is the opposite of what
36
+ * "selected" means.
37
+ *
38
+ * Pure: the console reads it to draw the field, and the route that writes it
39
+ * (`/api/orgs/plugin-sites`) asks it again against what it read in its own
40
+ * transaction.
41
+ */ import { canonicalPluginId, FIRST_PARTY_PLUGINS, isDefaultOffPerSite, isLockedOnForSite, resolveEnabledPlugins, resolveHostEnabledPlugins, strandedDependents } from "./enabled-plugins.js";
42
+ /** Whether a site's deny-list names this plugin. */ export function siteLeavesOutPlugin(site, pluginId) {
43
+ const id = canonicalPluginId(pluginId);
44
+ return Array.isArray(site == null ? void 0 : site.disabledPlugins) ? site.disabledPlugins.some((one)=>canonicalPluginId(String(one)) === id) : false;
45
+ }
46
+ /**
47
+ * Where a plugin runs today, read across the workspace's sites: All sites
48
+ * when no site's deny-list names it, else all sites except the ones that do.
49
+ *
50
+ * Every site may be named, which is a state a site's own switches can reach
51
+ * and a choice this module refuses to WRITE (see {@link planPluginRunsOn}).
52
+ * It is read as what it is, so the field can say so rather than pretend.
53
+ */ export function pluginRunsOnOf(pluginId, sites) {
54
+ const exceptHostIds = sites.filter((site)=>siteLeavesOutPlugin(site, pluginId)).map((site)=>site.id);
55
+ return exceptHostIds.length ? {
56
+ mode: 'allExcept',
57
+ exceptHostIds
58
+ } : {
59
+ mode: 'all'
60
+ };
61
+ }
62
+ /** A site's deny-list with this plugin added or taken out, or null when unchanged. */ function nextDisabled(site, pluginId, leaveOut) {
63
+ const current = Array.isArray(site.disabledPlugins) ? site.disabledPlugins.map(String) : [];
64
+ const listed = siteLeavesOutPlugin(site, pluginId);
65
+ if (leaveOut === listed) return null;
66
+ if (leaveOut) return [
67
+ ...current,
68
+ pluginId
69
+ ];
70
+ const id = canonicalPluginId(pluginId);
71
+ return current.filter((one)=>canonicalPluginId(one) !== id);
72
+ }
73
+ const labelOf = (pluginId)=>{
74
+ var _ref;
75
+ var _FIRST_PARTY_PLUGINS_find;
76
+ return (_ref = (_FIRST_PARTY_PLUGINS_find = FIRST_PARTY_PLUGINS.find((plugin)=>plugin.id === pluginId)) == null ? void 0 : _FIRST_PARTY_PLUGINS_find.label) != null ? _ref : pluginId;
77
+ };
78
+ /**
79
+ * What a "Runs on" choice writes to each site, or why it can't be written.
80
+ *
81
+ * - The base library runs on every site and can't be left out anywhere.
82
+ * - A plugin the workspace has switched off runs on no site, so there is no
83
+ * choice to make until it is switched back on.
84
+ * - "All sites except…" must leave out at least one site and keep at least
85
+ * one in: leaving every site out is switching it off for the workspace,
86
+ * which is a different switch with a different reach.
87
+ * - A site the choice names that the workspace doesn't hold is dropped, not
88
+ * refused: it is out either way.
89
+ * - Leaving a site out is refused, naming the site and the plugin, when a
90
+ * plugin running there needs this one. Only what THIS choice would strand
91
+ * is counted, so a site already in that state doesn't block the others.
92
+ * - Only sites whose deny-list changes are written. A site's opt-in list
93
+ * (`enabledPlugins`, for User Accounts) is never touched: a deny beats it.
94
+ */ export function planPluginRunsOn(input) {
95
+ var _input_siteName;
96
+ var _input_label;
97
+ const { pluginId, choice, org, sites } = input;
98
+ const refuse = (problem, stranded = [])=>({
99
+ writes: null,
100
+ problem,
101
+ stranded
102
+ });
103
+ const label = ((_input_label = input.label) == null ? void 0 : _input_label.trim()) || labelOf(pluginId);
104
+ if (isLockedOnForSite(pluginId)) {
105
+ return refuse(`${label} runs on every site, because sites are built out of it, so it can’t be left out.`);
106
+ }
107
+ if (!resolveEnabledPlugins(org, input.installedListings).includes(pluginId)) {
108
+ return refuse(`${label} is switched off for this workspace, so it runs on no site. Switch it on first.`);
109
+ }
110
+ const siteIds = sites.map((site)=>site.id);
111
+ const except = choice.mode === 'allExcept' ? [
112
+ ...new Set(choice.exceptHostIds.map(String))
113
+ ].filter((id)=>siteIds.includes(id)) : [];
114
+ if (choice.mode === 'allExcept') {
115
+ if (!except.length) {
116
+ return refuse('Choose at least one site to leave out, or choose All sites.');
117
+ }
118
+ if (except.length === siteIds.length) {
119
+ return refuse(`Keep at least one site in. To stop ${label} on every site, switch it off for the workspace.`);
120
+ }
121
+ }
122
+ const name = (_input_siteName = input.siteName) != null ? _input_siteName : (hostId)=>hostId;
123
+ const writes = [];
124
+ const stranded = [];
125
+ for (const site of sites){
126
+ const leaveOut = except.includes(site.id);
127
+ const disabledPlugins = nextDisabled(site, pluginId, leaveOut);
128
+ if (!disabledPlugins) continue;
129
+ if (leaveOut) {
130
+ const optedIn = Array.isArray(site.enabledPlugins) ? site.enabledPlugins.map(String) : undefined;
131
+ const runs = (denied)=>resolveHostEnabledPlugins(org, {
132
+ disabledPlugins: Array.isArray(denied) ? denied.map(String) : undefined,
133
+ enabledPlugins: optedIn
134
+ }, input.installedListings);
135
+ const before = new Set(strandedDependents(runs(site.disabledPlugins)).map((entry)=>entry.pluginId));
136
+ const after = strandedDependents(runs(disabledPlugins));
137
+ for (const entry of after){
138
+ if (!before.has(entry.pluginId)) stranded.push(_extends({
139
+ hostId: site.id
140
+ }, entry));
141
+ }
142
+ }
143
+ writes.push({
144
+ hostId: site.id,
145
+ disabledPlugins,
146
+ leftOut: leaveOut
147
+ });
148
+ }
149
+ if (stranded.length) {
150
+ const sentences = stranded.map((entry)=>`${labelOf(entry.pluginId)} on ${name(entry.hostId)} needs ${entry.missing.map(labelOf).join(' and ')}`);
151
+ return refuse(`${sentences.join('; ')}. Switch ${stranded.length === 1 ? 'it' : 'them'} off on ` + `${stranded.length === 1 ? 'that site' : 'those sites'} first, or keep ` + `${stranded.length === 1 ? 'the site' : 'those sites'} in.`, stranded);
152
+ }
153
+ return {
154
+ writes,
155
+ problem: null,
156
+ stranded: []
157
+ };
158
+ }
159
+ /**
160
+ * The sentence the console shows for a plugin that is still off on a site it
161
+ * runs on by this choice, because that site never turned it on: User
162
+ * Accounts, which a site opts into (`defaultOffPerSite`). Null for every other
163
+ * plugin. The choice only ever takes a site out; it never turns a plugin on
164
+ * for a site that hasn't asked for it.
165
+ */ export function pluginRunsOnOptInNote(pluginId) {
166
+ return isDefaultOffPerSite(pluginId) ? `${labelOf(pluginId)} still runs only on the sites that turned it on. Leaving a site out ` + 'here keeps it off there even if that site turned it on.' : null;
167
+ }
168
+
169
+ //# sourceMappingURL=plugin-site-exclusions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../libs/aglyn/src/lib/plugin-manager/plugin-site-exclusions.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Where a plugin runs across a workspace's sites: All sites, or all sites\n * except some (AGL-4047).\n *\n * NO NEW STORAGE AND NO MARKER. A site that is left out is a site whose own\n * `disabledPlugins` deny-list names the plugin, which is exactly what that\n * site's Admin › Plugins switch writes. So the workspace's \"Runs on\" choice\n * is READ across the sites' deny-lists and WRITTEN into them, and nothing\n * else needs to know it exists:\n *\n * - A site added later has no entry, so it runs the plugin. That is what\n * \"all sites except…\" promises, with no sweep to keep it true.\n * - A deleted site takes its entry with it.\n * - Anyone who may change a site's plugins can still turn it back on there,\n * as today, and the workspace's choice then reads that site as included.\n *\n * \"Selected sites\" is not offered for an ordinary plugin: a site's deny-list\n * can't say \"on only here\", so it would have to deny every other site, and a\n * site added later would then get the plugin, which is the opposite of what\n * \"selected\" means.\n *\n * Pure: the console reads it to draw the field, and the route that writes it\n * (`/api/orgs/plugin-sites`) asks it again against what it read in its own\n * transaction.\n */\n\nimport {\n canonicalPluginId,\n FIRST_PARTY_PLUGINS,\n isDefaultOffPerSite,\n isLockedOnForSite,\n resolveEnabledPlugins,\n resolveHostEnabledPlugins,\n strandedDependents,\n} from './enabled-plugins'\n\n/** One site, as far as where a plugin runs is concerned. */\nexport interface PluginSiteEntry {\n /** The host document id. */\n id: string\n disabledPlugins?: readonly string[] | null\n enabledPlugins?: readonly string[] | null\n}\n\n/** Where a plugin runs, as a person would choose it. */\nexport type PluginRunsOn =\n | { mode: 'all' }\n | { mode: 'allExcept'; exceptHostIds: readonly string[] }\n\n/** Whether a site's deny-list names this plugin. */\nexport function siteLeavesOutPlugin(\n site: Pick<PluginSiteEntry, 'disabledPlugins'> | null | undefined,\n pluginId: string,\n): boolean {\n const id = canonicalPluginId(pluginId)\n return Array.isArray(site?.disabledPlugins)\n ? site.disabledPlugins.some((one) => canonicalPluginId(String(one)) === id)\n : false\n}\n\n/**\n * Where a plugin runs today, read across the workspace's sites: All sites\n * when no site's deny-list names it, else all sites except the ones that do.\n *\n * Every site may be named, which is a state a site's own switches can reach\n * and a choice this module refuses to WRITE (see {@link planPluginRunsOn}).\n * It is read as what it is, so the field can say so rather than pretend.\n */\nexport function pluginRunsOnOf(\n pluginId: string,\n sites: readonly Pick<PluginSiteEntry, 'id' | 'disabledPlugins'>[],\n): PluginRunsOn {\n const exceptHostIds = sites\n .filter((site) => siteLeavesOutPlugin(site, pluginId))\n .map((site) => site.id)\n return exceptHostIds.length ? { mode: 'allExcept', exceptHostIds } : { mode: 'all' }\n}\n\n/** A site's deny-list with this plugin added or taken out, or null when unchanged. */\nfunction nextDisabled(\n site: PluginSiteEntry,\n pluginId: string,\n leaveOut: boolean,\n): string[] | null {\n const current = Array.isArray(site.disabledPlugins)\n ? site.disabledPlugins.map(String)\n : []\n const listed = siteLeavesOutPlugin(site, pluginId)\n if (leaveOut === listed) return null\n if (leaveOut) return [...current, pluginId]\n const id = canonicalPluginId(pluginId)\n return current.filter((one) => canonicalPluginId(one) !== id)\n}\n\n/** One site whose deny-list a choice changes. */\nexport interface PluginSiteWrite {\n hostId: string\n /** The whole deny-list as it should be stored. */\n disabledPlugins: string[]\n /** True when the plugin is taken off this site, false when it comes back. */\n leftOut: boolean\n}\n\n/** A plugin that would be left running on a site without one it needs. */\nexport interface PluginSiteStranding {\n hostId: string\n pluginId: string\n missing: string[]\n}\n\nexport type PluginRunsOnPlan =\n | { writes: PluginSiteWrite[]; problem: null; stranded: [] }\n | { writes: null; problem: string; stranded: PluginSiteStranding[] }\n\nconst labelOf = (pluginId: string): string =>\n FIRST_PARTY_PLUGINS.find((plugin) => plugin.id === pluginId)?.label ?? pluginId\n\n/**\n * What a \"Runs on\" choice writes to each site, or why it can't be written.\n *\n * - The base library runs on every site and can't be left out anywhere.\n * - A plugin the workspace has switched off runs on no site, so there is no\n * choice to make until it is switched back on.\n * - \"All sites except…\" must leave out at least one site and keep at least\n * one in: leaving every site out is switching it off for the workspace,\n * which is a different switch with a different reach.\n * - A site the choice names that the workspace doesn't hold is dropped, not\n * refused: it is out either way.\n * - Leaving a site out is refused, naming the site and the plugin, when a\n * plugin running there needs this one. Only what THIS choice would strand\n * is counted, so a site already in that state doesn't block the others.\n * - Only sites whose deny-list changes are written. A site's opt-in list\n * (`enabledPlugins`, for User Accounts) is never touched: a deny beats it.\n */\nexport function planPluginRunsOn(input: {\n pluginId: string\n choice: PluginRunsOn\n org: { enabledPlugins?: string[] } | null | undefined\n sites: readonly PluginSiteEntry[]\n /** The workspace's pinned marketplace listings, as `resolveEnabledPlugins` reads them. */\n installedListings?: readonly string[] | null\n /** How a site reads in a refusal. Its id when absent. */\n siteName?: (hostId: string) => string\n /**\n * The plugin's name in a refusal, for one the catalog can't name: a\n * marketplace plugin, whose id is its listing's (AGL-4047). The catalog's\n * label, else the id, when absent.\n */\n label?: string\n}): PluginRunsOnPlan {\n const { pluginId, choice, org, sites } = input\n const refuse = (problem: string, stranded: PluginSiteStranding[] = []): PluginRunsOnPlan => ({\n writes: null,\n problem,\n stranded,\n })\n const label = input.label?.trim() || labelOf(pluginId)\n if (isLockedOnForSite(pluginId)) {\n return refuse(`${label} runs on every site, because sites are built out of it, so it can’t be left out.`)\n }\n if (!resolveEnabledPlugins(org, input.installedListings).includes(pluginId)) {\n return refuse(`${label} is switched off for this workspace, so it runs on no site. Switch it on first.`)\n }\n const siteIds = sites.map((site) => site.id)\n const except =\n choice.mode === 'allExcept'\n ? [...new Set(choice.exceptHostIds.map(String))].filter((id) => siteIds.includes(id))\n : []\n if (choice.mode === 'allExcept') {\n if (!except.length) {\n return refuse('Choose at least one site to leave out, or choose All sites.')\n }\n if (except.length === siteIds.length) {\n return refuse(\n `Keep at least one site in. To stop ${label} on every site, switch it off for the workspace.`,\n )\n }\n }\n const name = input.siteName ?? ((hostId: string) => hostId)\n const writes: PluginSiteWrite[] = []\n const stranded: PluginSiteStranding[] = []\n for (const site of sites) {\n const leaveOut = except.includes(site.id)\n const disabledPlugins = nextDisabled(site, pluginId, leaveOut)\n if (!disabledPlugins) continue\n if (leaveOut) {\n const optedIn = Array.isArray(site.enabledPlugins) ? site.enabledPlugins.map(String) : undefined\n const runs = (denied: readonly string[] | null | undefined) =>\n resolveHostEnabledPlugins(\n org,\n { disabledPlugins: Array.isArray(denied) ? denied.map(String) : undefined, enabledPlugins: optedIn },\n input.installedListings,\n )\n const before = new Set(strandedDependents(runs(site.disabledPlugins)).map((entry) => entry.pluginId))\n const after = strandedDependents(runs(disabledPlugins))\n for (const entry of after) {\n if (!before.has(entry.pluginId)) stranded.push({ hostId: site.id, ...entry })\n }\n }\n writes.push({ hostId: site.id, disabledPlugins, leftOut: leaveOut })\n }\n if (stranded.length) {\n const sentences = stranded.map(\n (entry) =>\n `${labelOf(entry.pluginId)} on ${name(entry.hostId)} needs ${entry.missing.map(labelOf).join(' and ')}`,\n )\n return refuse(\n `${sentences.join('; ')}. Switch ${stranded.length === 1 ? 'it' : 'them'} off on ` +\n `${stranded.length === 1 ? 'that site' : 'those sites'} first, or keep ` +\n `${stranded.length === 1 ? 'the site' : 'those sites'} in.`,\n stranded,\n )\n }\n return { writes, problem: null, stranded: [] }\n}\n\n/**\n * The sentence the console shows for a plugin that is still off on a site it\n * runs on by this choice, because that site never turned it on: User\n * Accounts, which a site opts into (`defaultOffPerSite`). Null for every other\n * plugin. The choice only ever takes a site out; it never turns a plugin on\n * for a site that hasn't asked for it.\n */\nexport function pluginRunsOnOptInNote(pluginId: string): string | null {\n return isDefaultOffPerSite(pluginId)\n ? `${labelOf(pluginId)} still runs only on the sites that turned it on. Leaving a site out ` +\n 'here keeps it off there even if that site turned it on.'\n : null\n}\n"],"names":["canonicalPluginId","FIRST_PARTY_PLUGINS","isDefaultOffPerSite","isLockedOnForSite","resolveEnabledPlugins","resolveHostEnabledPlugins","strandedDependents","siteLeavesOutPlugin","site","pluginId","id","Array","isArray","disabledPlugins","some","one","String","pluginRunsOnOf","sites","exceptHostIds","filter","map","length","mode","nextDisabled","leaveOut","current","listed","labelOf","find","plugin","label","planPluginRunsOn","input","choice","org","refuse","problem","stranded","writes","trim","installedListings","includes","siteIds","except","Set","name","siteName","hostId","optedIn","enabledPlugins","undefined","runs","denied","before","entry","after","has","push","leftOut","sentences","missing","join","pluginRunsOnOptInNote"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;;;;;;;;;;;;;;;CAwBC,GAED,SACEA,iBAAiB,EACjBC,mBAAmB,EACnBC,mBAAmB,EACnBC,iBAAiB,EACjBC,qBAAqB,EACrBC,yBAAyB,EACzBC,kBAAkB,QACb,uBAAmB;AAe1B,kDAAkD,GAClD,OAAO,SAASC,oBACdC,IAAiE,EACjEC,QAAgB;IAEhB,MAAMC,KAAKV,kBAAkBS;IAC7B,OAAOE,MAAMC,OAAO,CAACJ,wBAAAA,KAAMK,eAAe,IACtCL,KAAKK,eAAe,CAACC,IAAI,CAAC,CAACC,MAAQf,kBAAkBgB,OAAOD,UAAUL,MACtE;AACN;AAEA;;;;;;;CAOC,GACD,OAAO,SAASO,eACdR,QAAgB,EAChBS,KAAiE;IAEjE,MAAMC,gBAAgBD,MACnBE,MAAM,CAAC,CAACZ,OAASD,oBAAoBC,MAAMC,WAC3CY,GAAG,CAAC,CAACb,OAASA,KAAKE,EAAE;IACxB,OAAOS,cAAcG,MAAM,GAAG;QAAEC,MAAM;QAAaJ;IAAc,IAAI;QAAEI,MAAM;IAAM;AACrF;AAEA,oFAAoF,GACpF,SAASC,aACPhB,IAAqB,EACrBC,QAAgB,EAChBgB,QAAiB;IAEjB,MAAMC,UAAUf,MAAMC,OAAO,CAACJ,KAAKK,eAAe,IAC9CL,KAAKK,eAAe,CAACQ,GAAG,CAACL,UACzB,EAAE;IACN,MAAMW,SAASpB,oBAAoBC,MAAMC;IACzC,IAAIgB,aAAaE,QAAQ,OAAO;IAChC,IAAIF,UAAU,OAAO;WAAIC;QAASjB;KAAS;IAC3C,MAAMC,KAAKV,kBAAkBS;IAC7B,OAAOiB,QAAQN,MAAM,CAAC,CAACL,MAAQf,kBAAkBe,SAASL;AA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