{"version":3,"file":"registry-CUpRQBHQ.js","sources":["../../../src/packages/core/extension-registry/conditions/condition-base.controller.ts","../../../src/packages/core/extension-registry/conditions/switch.condition.ts","../../../src/packages/core/extension-registry/registry.ts"],"sourcesContent":["import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';\nimport { UmbControllerBase } from '@umbraco-cms/backoffice/class-api';\nimport type { UmbConditionConfigBase, UmbExtensionCondition } from '@umbraco-cms/backoffice/extension-api';\n\nexport class UmbConditionBase\n\textends UmbControllerBase\n\timplements UmbExtensionCondition\n{\n\tpublic readonly config: ConditionConfigType;\n\t#permitted = false;\n\tpublic get permitted() {\n\t\treturn this.#permitted;\n\t}\n\tpublic set permitted(value) {\n\t\tif (value === this.#permitted) return;\n\t\tthis.#permitted = value;\n\t\tthis.#onChange();\n\t}\n\t#onChange: () => void;\n\n\tconstructor(host: UmbControllerHost, args: { config: ConditionConfigType; onChange: () => void }) {\n\t\tsuper(host);\n\t\tthis.config = args.config;\n\t\tthis.#onChange = args.onChange;\n\t}\n\n\toverride destroy() {\n\t\tsuper.destroy();\n\t\t(this.config as unknown) = undefined;\n\t\t(this.#onChange as unknown) = undefined;\n\t}\n}\n","import { UmbConditionBase } from './condition-base.controller.js';\nimport type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';\nimport type {\n\tManifestCondition,\n\tUmbConditionConfigBase,\n\tUmbConditionControllerArguments,\n\tUmbExtensionCondition,\n} from '@umbraco-cms/backoffice/extension-api';\n\nexport class UmbSwitchCondition extends UmbConditionBase implements UmbExtensionCondition {\n\t#timer?: ReturnType;\n\n\tconstructor(host: UmbControllerHost, args: UmbConditionControllerArguments) {\n\t\tsuper(host, args);\n\t\tthis.startApprove();\n\t}\n\n\tstartApprove() {\n\t\tclearTimeout(this.#timer);\n\t\tthis.#timer = setTimeout(() => {\n\t\t\tthis.permitted = true;\n\t\t\tthis.startDisapprove();\n\t\t}, parseInt(this.config.frequency));\n\t}\n\n\tstartDisapprove() {\n\t\tclearTimeout(this.#timer);\n\t\tthis.#timer = setTimeout(() => {\n\t\t\tthis.permitted = false;\n\t\t\tthis.startApprove();\n\t\t}, parseInt(this.config.frequency));\n\t}\n\n\toverride destroy() {\n\t\tclearTimeout(this.#timer);\n\t\tsuper.destroy();\n\t}\n}\n\nexport const manifest: ManifestCondition = {\n\ttype: 'condition',\n\tname: 'Switch Condition',\n\talias: 'Umb.Condition.Switch',\n\tapi: UmbSwitchCondition,\n};\n\nexport type SwitchConditionConfig = UmbConditionConfigBase<'Umb.Condition.Switch'> & {\n\tfrequency: string;\n};\n","import type { ManifestTypes } from './models/index.js';\nimport type { ManifestKind } from '@umbraco-cms/backoffice/extension-api';\nimport { UmbExtensionRegistry } from '@umbraco-cms/backoffice/extension-api';\n\nexport type UmbBackofficeManifestKind = ManifestKind;\nexport type UmbBackofficeExtensionRegistry = UmbExtensionRegistry;\n\nexport const umbExtensionsRegistry = new UmbExtensionRegistry() as UmbBackofficeExtensionRegistry;\n"],"names":["UmbConditionBase","UmbControllerBase","#permitted","value","#onChange","host","args","UmbSwitchCondition","#timer","manifest","umbExtensionsRegistry","UmbExtensionRegistry"],"mappings":";;AAIO,MAAMA,UACJC,EAET;AAAA,EAECC,KAAa;AAAA,EACb,IAAW,YAAY;AACtB,WAAO,KAAKA;AAAA,EACb;AAAA,EACA,IAAW,UAAUC,GAAO;AACvB,IAAAA,MAAU,KAAKD,OACnB,KAAKA,KAAaC,GAClB,KAAKC,GAAU;AAAA,EAChB;AAAA,EACAA;AAAA,EAEA,YAAYC,GAAyBC,GAA6D;AACjG,UAAMD,CAAI,GACV,KAAK,SAASC,EAAK,QACnB,KAAKF,KAAYE,EAAK;AAAA,EACvB;AAAA,EAES,UAAU;AAClB,UAAM,QAAQ,GACb,KAAK,SAAqB,QAC1B,KAAKF,KAAwB;AAAA,EAC/B;AACD;ACtBO,MAAMG,UAA2BP,EAAyE;AAAA,EAChHQ;AAAA,EAEA,YAAYH,GAAyBC,GAA8D;AAClG,UAAMD,GAAMC,CAAI,GAChB,KAAK,aAAa;AAAA,EACnB;AAAA,EAEA,eAAe;AACd,iBAAa,KAAKE,EAAM,GACnB,KAAAA,KAAS,WAAW,MAAM;AAC9B,WAAK,YAAY,IACjB,KAAK,gBAAgB;AAAA,IACnB,GAAA,SAAS,KAAK,OAAO,SAAS,CAAC;AAAA,EACnC;AAAA,EAEA,kBAAkB;AACjB,iBAAa,KAAKA,EAAM,GACnB,KAAAA,KAAS,WAAW,MAAM;AAC9B,WAAK,YAAY,IACjB,KAAK,aAAa;AAAA,IAChB,GAAA,SAAS,KAAK,OAAO,SAAS,CAAC;AAAA,EACnC;AAAA,EAES,UAAU;AAClB,iBAAa,KAAKA,EAAM,GACxB,MAAM,QAAQ;AAAA,EACf;AACD;AAEO,MAAMC,IAA8B;AAAA,EAC1C,MAAM;AAAA,EACN,MAAM;AAAA,EACN,OAAO;AAAA,EACP,KAAKF;AACN,GCrCaG,IAAwB,IAAIC,EAAoC;"}