diff --git a/app.ts b/app.ts index cdbb8d43..30a3c075 100644 --- a/app.ts +++ b/app.ts @@ -31,7 +31,7 @@ const createServer = (): express.Application => { }) app.use('/health', healthRoutes) app.use('/api', validateRoutes) - app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(swaggerDocument)); + app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(swaggerDocument)) return app } diff --git a/controller/validate/index.ts b/controller/validate/index.ts index a09840e4..66c38b3b 100644 --- a/controller/validate/index.ts +++ b/controller/validate/index.ts @@ -26,7 +26,7 @@ const controller = { domain, payload, version, - flow.toString(), + flow, bap_id, bpp_id, ) @@ -95,22 +95,22 @@ const controller = { validateToken: async (req: Request, res: Response): Promise => { try { - const { success, response, signature, signTimestamp } = req.body; - + const { success, response, signature, signTimestamp } = req.body + // Validate required fields exist if ( - signature === undefined || - signTimestamp === undefined || - response === undefined || + signature === undefined || + signTimestamp === undefined || + response === undefined || success === undefined || - response.payload === undefined // Check payload inside response + response.payload === undefined // Check payload inside response ) { - throw new Error('Payload must contain: signature, signTimestamp, success, response (with payload)'); + throw new Error('Payload must contain: signature, signTimestamp, success, response (with payload)') } - const publicKey = process.env.SIGN_PUBLIC_KEY as string; + const publicKey = process.env.SIGN_PUBLIC_KEY as string if (!publicKey) { - throw new Error('Server configuration error: SIGN_PUBLIC_KEY not set'); + throw new Error('Server configuration error: SIGN_PUBLIC_KEY not set') } // Create httpResponse from the response object @@ -120,34 +120,34 @@ const controller = { bpp_id: response.bpp_id, bap_id: response.bap_id, domain: response.domain, - payload: response.payload, // Get payload from response + payload: response.payload, // Get payload from response reportTimestamp: response.reportTimestamp, - }; + } - const hashString = await hash({ message: JSON.stringify(httpResponse) }); - const signingString = `${hashString}|${signTimestamp}`; + const hashString = await hash({ message: JSON.stringify(httpResponse) }) + const signingString = `${hashString}|${signTimestamp}` - const isVerified = await verify({ - signedMessage: signature, - message: signingString, - publicKey - }); + const isVerified = await verify({ + signedMessage: signature, + message: signingString, + publicKey, + }) - return res.status(200).send({ - success: true, - response: { + return res.status(200).send({ + success: true, + response: { message: isVerified ? 'Signature verification successful' : 'Invalid signature', - verified: isVerified - } - }); + verified: isVerified, + }, + }) } catch (error: any) { - logger.error('Signature verification failed:', error); - return res.status(400).send({ - success: false, - response: { - message: error?.message || 'Signature verification failed' - } - }); + logger.error('Signature verification failed:', error) + return res.status(400).send({ + success: false, + response: { + message: error?.message || 'Signature verification failed', + }, + }) } }, diff --git a/package.json b/package.json index dcb7707b..d7525e95 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,6 @@ "libsodium-wrappers": "^0.7.13", "lmdb": "^2.9.2", "lodash": "^4.17.21", - "ngrok": "^5.0.0-beta.2", "pino": "^7.6.4", "swagger-autogen": "^2.23.7", "swagger-jsdoc": "^6.2.8", @@ -71,6 +70,7 @@ "eslint-plugin-prettier": "^3.4.0", "eslint-plugin-security": "^1.4.0", "jest": "^27.5.1", + "ngrok": "^5.0.0-beta.2", "nodemon": "^2.0.15", "pino-pretty": "^7.5.0", "supertest": "^6.2.2", diff --git a/schema/Retail_1.2.5/RET/on_search.ts b/schema/Retail_1.2.5/RET/on_search.ts new file mode 100644 index 00000000..6ee42dca --- /dev/null +++ b/schema/Retail_1.2.5/RET/on_search.ts @@ -0,0 +1,3049 @@ +import { combinedCategory } from '../../../utils/enum' + +export const onSearchSchema = { + type: 'object', + properties: { + context: { + type: 'object', + properties: { + domain: { + type: 'string', + minLength: 1, + }, + action: { + type: 'string', + const: 'on_search', + }, + country: { + type: 'string', + const: 'IND', + }, + city: { + type: 'string', + minLength: 1, + not: { + type: 'string', + pattern: '\\*', + }, + errorMessage: `City Code can't be * for on_search request`, + }, + core_version: { + type: 'string', + const: '1.2.5', + minLength: 1, + }, + bap_id: { + type: 'string', + minLength: 1, + }, + bap_uri: { + type: 'string', + minLength: 1, + format: 'url', + }, + bpp_id: { + type: 'string', + }, + bpp_uri: { + type: 'string', + format: 'url', + }, + transaction_id: { + type: 'string', + minLength: 1, + }, + message_id: { + type: 'string', + minLength: 1, + }, + timestamp: { + type: 'string', + format: 'rfc3339-date-time', + errorMessage: 'Time must be RFC3339 UTC timestamp format.', + }, + ttl: { + type: 'string', + format: 'duration', + errorMessage: 'Duration must be RFC3339 duration.', + }, + }, + required: [ + 'domain', + 'country', + 'city', + 'action', + 'core_version', + 'bap_id', + 'bap_uri', + 'bpp_id', + 'bpp_uri', + 'transaction_id', + 'message_id', + 'timestamp', + ], + additionalProperties: false, + }, + message: { + type: 'object', + properties: { + catalog: { + type: 'object', + properties: { + 'bpp/fulfillments': { + type: 'array', + items: { + type: 'object', + properties: { + id: { + type: 'string', + }, + type: { + type: 'string', + enum: ['Delivery', 'Self-Pickup', 'Buyer-Delivery'], + }, + }, + required: ['id', 'type'], + }, + }, + 'bpp/descriptor': { + type: 'object', + properties: { + name: { + type: 'string', + }, + symbol: { + type: 'string', + }, + short_desc: { + type: 'string', + }, + long_desc: { + type: 'string', + }, + images: { + type: 'array', + items: { + type: 'string', + pattern: '^$|^https?:\\/\\/[^\\s]*', + errorMessage: 'descriptor/images [] should be URLs or can be empty strings as well', + }, + }, + tags: { + type: 'array', + items: { + type: 'object', + properties: { + code: { + type: 'string', + enum: ['bpp_terms'], + }, + list: { + type: 'array', + items: { + oneOf: [ + { + if: { + type: 'object', + properties: { + code: { const: 'np_type' }, + }, + }, + then: { + type: 'object', + properties: { + code: { + type: 'string', + const: 'np_type', + }, + value: { + type: 'string', + enum: ['MSN', 'ISN'], + }, + }, + required: ['code', 'value'], + additionalProperties: false, + }, + }, + { + if: { + type: 'object', + properties: { + code: { + const: 'accept_bap_terms', + }, + }, + required: ['code'], + }, + then: { + type: 'object', + properties: { + code: { + type: 'string', + enum: ['accept_bap_terms'], + }, + value: { + type: 'string', + enum: ['Y', 'N'], + }, + }, + required: ['code', 'value'], + additionalProperties: false, + }, + }, + { + if: { + type: 'object', + properties: { + code: { const: 'collect_payment' }, + }, + }, + then: { + type: 'object', + properties: { + code: { + type: 'string', + enum: ['collect_payment'], + }, + value: { + type: 'string', + enum: ['Y', 'N'], + }, + }, + required: ['code', 'value'], + additionalProperties: false, + }, + }, + ], + }, + minItems: 1, + }, + }, + required: ['code', 'list'], + additionalProperties: false, + }, + }, + required: ['name', 'symbol','short_desc', 'long_desc'], + additionalProperties: true, + }, + }, + 'bpp/providers': { + type: 'array', + items: { + type: 'object', + properties: { + id: { + type: 'string', + }, + rating: { + type: 'number', + minimum: 1, + maximum: 5, + default: null, + }, + time: { + type: 'object', + properties: { + label: { + type: 'string', + enum: ['enable', 'disable'], + }, + timestamp: { + type: 'string', + format: 'rfc3339-date-time', + }, + }, + required: ['label', 'timestamp'], + }, + fulfillments: { + type: 'array', + items: { + type: 'object', + properties: { + id: { + type: 'string', + }, + type: { + type: 'string', + }, + contact: { + type: 'object', + properties: { + phone: { + type: 'string', + minLength: 10, + maxLength: 11, + }, + email: { + type: 'string', + format: 'email', + }, + }, + required: ['phone', 'email'], + }, + }, + required: ['id', 'type', 'contact'], + }, + }, + descriptor: { + type: 'object', + properties: { + name: { + type: 'string', + }, + symbol: { + type: 'string', + }, + short_desc: { + type: 'string', + }, + long_desc: { + type: 'string', + }, + images: { + type: 'array', + items: { + type: 'string', + }, + }, + }, + required: ['name', 'symbol', 'short_desc', 'long_desc', 'images'], + }, + ttl: { + type: 'string', + format: 'duration', + errorMessage: 'Duration must be RFC3339 duration.', + }, + locations: { + type: 'array', + items: { + type: 'object', + properties: { + id: { + type: 'string', + }, + time: { + type: 'object', + properties: { + label: { + type: 'string', + enum: ['enable', 'disable', 'open', 'close'], + }, + timestamp: { + type: 'string', + format: 'rfc3339-date-time', + }, + days: { + type: 'string', + }, + schedule: { + type: 'object', + properties: { + holidays: { + type: 'array', + items: { + type: 'string', + format: 'date', + }, + }, + frequency: { + type: 'string', + }, + times: { + type: 'array', + minItems: 1, + items: { + type: 'string', + minLength: 4, + maxLength: 4, + }, + }, + }, + required: ['holidays'], + }, + range: { + type: 'object', + properties: { + start: { + type: 'string', + }, + end: { + type: 'string', + }, + }, + required: ['start', 'end'], + }, + }, + required: ['label', 'timestamp', 'schedule'], + }, + gps: { + type: 'string', + }, + address: { + type: 'object', + properties: { + locality: { + type: 'string', + }, + street: { + type: 'string', + }, + city: { + type: 'string', + }, + area_code: { + type: 'string', + minLength: 6, + maxLength: 6, + }, + state: { + type: 'string', + }, + }, + required: ['locality', 'street', 'city', 'area_code', 'state'], + additionalProperties: false, + }, + circle: { + type: 'object', + properties: { + gps: { + type: 'string', + }, + radius: { + type: 'object', + properties: { + unit: { + type: 'string', + }, + value: { + type: 'string', + }, + }, + required: ['unit', 'value'], + }, + }, + required: ['gps', 'radius'], + }, + }, + required: ['id', 'time', 'gps', 'address'], + }, + }, + categories: { + type: 'array', + items: { + type: 'object', + properties: { + id: { + type: 'string', + pattern: '^[a-zA-Z0-9-]{1,12}$', + }, + descriptor: { + type: 'object', + properties: { + name: { + type: 'string', + }, + short_desc: { + type: 'string', + }, + long_desc: { + type: 'string', + }, + images: { + type: 'array', + items: { + type: 'string', + format: 'url', + }, + }, + }, + }, + tags: { + type: 'array', + items: { + oneOf: [ + { + type: 'object', + if: { + properties: { + code: { + const: 'np_fees', + }, + }, + }, + then: { + properties: { + list: { + type: 'array', + items: { + type: 'object', + properties: { + code: { + type: 'string', + enum: ['channel_margin_type', 'channel_margin_value'], + }, + value: { + type: 'string', + }, + }, + }, + }, + }, + }, + }, + { + type: 'object', + if: { + not: { + properties: { + code: { + const: 'np_fees', + }, + }, + }, + }, + then: { + properties: { + list: { + type: 'array', + items: { + type: 'object', + properties: { + code: { + type: 'string', + }, + value: { + type: 'string', + }, + }, + }, + }, + }, + }, + }, + ], + }, + }, + }, + }, + }, + items: { + type: 'array', + items: { + type: 'object', + properties: { + id: { + type: 'string', + }, + replacement_terms: { + type: 'array', + items: { + type: 'object', + properties: { + replace_within: { + type: 'object', + properties: { + duration: { + type: 'string', + pattern: '^P(\\d+D|\\d+W|\\d+M|\\d+Y)$', + }, + }, + required: ['duration'], + }, + }, + required: ['replace_within'], + }, + optional: true, + }, + rating: { + type: 'number', + + minimum: 1, + maximum: 5, + default: null, + }, + time: { + type: 'object', + properties: { + label: { + type: 'string', + enum: ['enable', 'disable'], + }, + timestamp: { + type: 'string', + format: 'rfc3339-date-time', + }, + }, + required: ['label', 'timestamp'], + }, + parent_item_id: { + type: 'string', + }, + descriptor: { + type: 'object', + properties: { + name: { + type: 'string', + }, + code: { + type: 'string', + oneOf: [ + { + type: 'string', + pattern: '^(1|2|3|4|5):[a-zA-Z0-9]+$', + errorMessage: + 'item/descriptor/code should be in this format - "type:code" where type is 1 - EAN, 2 - ISBN, 3 - GTIN, 4 - HSN, 5 - others', + }, + { + if: { + type: 'object', + properties: { domain: { enum: ['ONDC:RET1A', 'ONDC:AGR10'] } }, + }, + then: { + type: 'string', + }, + }, + ], + }, + symbol: { + type: 'string', + }, + short_desc: { + type: 'string', + }, + long_desc: { + type: 'string', + }, + images: { + type: 'array', + items: { + type: 'string', + }, + }, + }, + required: ['name', 'symbol', 'short_desc', 'long_desc', 'images'], + }, + quantity: { + type: 'object', + properties: { + unitized: { + type: 'object', + properties: { + measure: { + type: 'object', + properties: { + unit: { + type: 'string', + enum: ['unit', 'dozen', 'gram', 'kilogram', 'tonne', 'litre', 'millilitre'], + }, + value: { + type: 'string', + pattern: '^[0-9]+(.[0-9]+)?$', + errorMessage: 'value should be stringified number', + }, + }, + required: ['unit', 'value'], + }, + }, + required: ['measure'], + }, + available: { + type: 'object', + properties: { + count: { + type: 'string', + enum: ['99', '0'], + errorMessage: 'available count must be either 99 or 0 only', + }, + }, + required: ['count'], + }, + maximum: { + type: 'object', + properties: { + count: { + type: 'string', + pattern: '^[0-9]+$', + errorMessage: 'maximum count must be in stringified number format. ', + }, + }, + required: ['count'], + }, + }, + required: ['unitized', 'available', 'maximum'], + }, + price: { + type: 'object', + properties: { + currency: { + type: 'string', + }, + value: { + type: 'string', + pattern: '^[0-9]+(.[0-9]{1,2})?$', + errorMessage: 'Price value should be a number in string with upto 2 decimal places', + }, + maximum_value: { + type: 'string', + }, + }, + required: ['currency', 'value', 'maximum_value'], + }, + category_id: { + type: 'string', + enum: combinedCategory, + errorMessage: `Invalid category ID found for item for on_search`, + }, + fulfillment_id: { + type: 'string', + }, + location_id: { + type: 'string', + }, + '@ondc/org/returnable': { + type: 'boolean', + }, + '@ondc/org/cancellable': { + type: 'boolean', + }, + '@ondc/org/return_window': { + type: ['string', 'null'], + format: 'duration', + }, + '@ondc/org/seller_pickup_return': { + type: 'boolean', + }, + '@ondc/org/time_to_ship': { + type: 'string', + format: 'duration', + }, + '@ondc/org/available_on_cod': { + type: 'boolean', + }, + '@ondc/org/contact_details_consumer_care': { + type: 'string', + }, + '@ondc/org/statutory_reqs_packaged_commodities': { + type: 'object', + properties: { + manufacturer_or_packer_name: { + type: 'string', + }, + manufacturer_or_packer_address: { + type: 'string', + }, + common_or_generic_name_of_commodity: { + type: 'string', + }, + month_year_of_manufacture_packing_import: { + type: 'string', + }, + }, + required: [ + 'manufacturer_or_packer_name', + 'manufacturer_or_packer_address', + 'common_or_generic_name_of_commodity', + 'month_year_of_manufacture_packing_import', + ], + }, + '@ondc/org/statutory_reqs_prepackaged_food': { + type: 'object', + properties: { + nutritional_info: { + type: 'string', + }, + additives_info: { + type: 'string', + }, + brand_owner_FSSAI_license_no: { + type: 'string', + }, + other_FSSAI_license_no: { + type: 'string', + }, + importer_FSSAI_license_no: { + type: 'string', + }, + ingredients_info: { + type: 'string', + }, + }, + }, + tags: { + type: 'array', + items: { + type: 'object', + properties: { + code: { + type: 'string', + }, + list: { + type: 'array', + items: { + type: 'object', + properties: { + code: { + type: 'string', + }, + value: { + type: 'string', + }, + }, + required: ['code', 'value'], + }, + }, + }, + required: ['code', 'list'], + if: { + type: 'object', + properties: { code: { const: 'origin' } }, + }, + then: { + type: 'object', + properties: { + list: { + type: 'array', + items: { + type: 'object', + properties: { + value: { + type: 'string', + pattern: + '/^A(BW|FG|GO|IA|L[AB]|ND|R[EGM]|SM|T[AFG]|U[ST]|ZE)|B(DI|E[LNS]|FA|G[DR]|H[RS]|IH|L[MRZ]|MU|OL|R[ABN]|TN|VT|WA)|C(A[FN]|CK|H[ELN]|IV|MR|O[DGKLM]|PV|RI|U[BW]|XR|Y[MP]|ZE)|D(EU|JI|MA|NK|OM|ZA)|E(CU|GY|RI|S[HPT]|TH)|F(IN|JI|LK|R[AO]|SM)|G(AB|BR|EO|GY|HA|I[BN]|LP|MB|N[BQ]|R[CDL]|TM|U[FMY])|H(KG|MD|ND|RV|TI|UN)|I(DN|MN|ND|OT|R[LNQ]|S[LR]|TA)|J(AM|EY|OR|PN)|K(AZ|EN|GZ|HM|IR|NA|OR|WT)|L(AO|B[NRY]|CA|IE|KA|SO|TU|UX|VA)|M(A[CFR]|CO|D[AGV]|EX|HL|KD|L[IT]|MR|N[EGP]|OZ|RT|SR|TQ|US|WI|Y[ST])|N(AM|CL|ER|FK|GA|I[CU]|LD|OR|PL|RU|ZL)|OMN|P(A[KN]|CN|ER|HL|LW|NG|OL|R[IKTY]|SE|YF)|QAT|R(EU|OU|US|WA)|S(AU|DN|EN|G[PS]|HN|JM|L[BEV]|MR|OM|PM|RB|SD|TP|UR|V[KN]|W[EZ]|XM|Y[CR])|T(C[AD]|GO|HA|JK|K[LM]|LS|ON|TO|U[NRV]|WN|ZA)|U(GA|KR|MI|RY|SA|ZB)|V(AT|CT|EN|GB|IR|NM|UT)|W(LF|SM)|YEM|Z(AF|MB|WE)$/ix', + errorMessage: + 'Country must be in ISO 3166-1 format (three-letter country code)', + }, + }, + }, + }, + }, + }, + }, + }, + }, + required: [ + 'id', + 'time', + 'descriptor', + 'quantity', + 'price', + 'category_id', + 'fulfillment_id', + 'location_id', + '@ondc/org/returnable', + '@ondc/org/cancellable', + '@ondc/org/return_window', + '@ondc/org/seller_pickup_return', + '@ondc/org/time_to_ship', + '@ondc/org/available_on_cod', + '@ondc/org/contact_details_consumer_care', + 'rating', + 'tags', + ], + }, + }, + creds: { + type: 'array', + items: { + type: 'object', + properties: { + id: { + type: 'string', + description: 'Unique identifier for the credential, format: ESG-XXXXXXXX (8 digits).', + }, + descriptor: { + type: 'object', + properties: { + code: { + type: 'string', + description: 'Code of the credential, format: ESG-XXXXXXXX (8 digits).', + }, + short_desc: { + type: 'string', + description: 'Short description of the credential.', + }, + name: { + type: 'string', + description: 'Name of the credential.', + }, + }, + required: ['code', 'short_desc', 'name'], + additionalProperties: false, + }, + url: { + type: 'string', + format: 'uri', + description: 'URL to the credential or badge image.', + }, + tags: { + type: 'array', + items: { + type: 'object', + properties: { + code: { + type: 'string', + description: "Code representing the tag (e.g., 'verification').", + }, + list: { + type: 'array', + items: { + type: 'object', + properties: { + code: { + type: 'string', + description: "Code representing the specific tag value (e.g., 'verify_url').", + }, + value: { + type: 'string', + format: 'uri', + description: 'URL or other values associated with the tag.', + }, + }, + required: ['code', 'value'], + additionalProperties: false, + }, + description: 'List of key-value pairs for additional tag data.', + }, + }, + required: ['code', 'list'], + additionalProperties: false, + }, + description: 'Tags associated with the credential, including verification details.', + }, + }, + required: ['id', 'descriptor'], + additionalProperties: false, + }, + }, + // offers: { + // type: 'array', + // items: { + // anyOf: [ + // // Discount offer validation + // { + // if: { + // type: 'object', + // properties: { + // descriptor: { + // type: 'object', + // properties: { + // code: { const: 'discount' } + // } + // } + // } + // }, + // then: { + // type: 'object', + // properties: { + // id: { type: 'string' }, + // descriptor: { + // type: 'object', + // properties: { + // code: { const: 'discount' }, + // images: { + // type: 'array', + // items: { type: 'string', format: 'uri' } + // } + // }, + // required: ['code', 'images'] + // }, + // location_ids: { type: 'array', items: { type: 'string' } }, + // item_ids: { type: 'array', items: { type: 'string' } }, + // time: { + // type: 'object', + // properties: { + // label: { type: 'string' }, + // range: { + // type: 'object', + // properties: { + // start: { type: 'string', format: 'date-time' }, + // end: { type: 'string', format: 'date-time' } + // }, + // required: ['start', 'end'] + // } + // }, + // required: ['label', 'range'] + // }, + // tags: { + // type: 'array', + // items: { + // oneOf: [ + // { + // if: { + // type: 'object', + // properties: { + // code: { const: 'qualifier' } + // } + // }, + // then: { + // type: 'object', + // properties: { + // code: { const: 'qualifier' }, + // list: { + // type: 'array', + // items: { + // oneOf: [ + // { + // if: { + // type: 'object', + // properties: { + // code: { const: 'min_value' } + // } + // }, + // then: { + // type: 'object', + // properties: { + // code: { const: 'min_value' }, + // value: { + // type: 'string', + // pattern: '^[0-9]+(\\.[0-9]{1,2})?$' + // } + // }, + // required: ['code', 'value'] + // } + // } + // ] + // } + // } + // }, + // required: ['code', 'list'] + // } + // }, + // { + // if: { + // type: 'object', + // properties: { + // code: { const: 'benefit' } + // } + // }, + // then: { + // type: 'object', + // properties: { + // code: { const: 'benefit' }, + // list: { + // type: 'array', + // items: { + // oneOf: [ + // { + // if: { + // type: 'object', + // properties: { + // code: { const: 'value_type' } + // } + // }, + // then: { + // type: 'object', + // properties: { + // code: { const: 'value_type' }, + // value: { + // type: 'string', + // enum: ['percent', 'amount'] + // } + // }, + // required: ['code', 'value'] + // } + // }, + // { + // if: { + // type: 'object', + // properties: { + // code: { const: 'value' } + // } + // }, + // then: { + // type: 'object', + // properties: { + // code: { const: 'value' }, + // value: { + // type: 'string', + // pattern: '^-?[0-9]+(\\.[0-9]{1,2})?$' + // } + // }, + // required: ['code', 'value'] + // } + // }, + // { + // if: { + // type: 'object', + // properties: { + // code: { const: 'value_cap' } + // } + // }, + // then: { + // type: 'object', + // properties: { + // code: { const: 'value_cap' }, + // value: { + // type: 'string', + // pattern: '^-?[0-9]+(\\.[0-9]{1,2})?$' + // } + // }, + // required: ['code', 'value'] + // } + // } + // ] + // }, + // minItems: 2, + // errorMessage: 'Benefit tag must contain value_type and value' + // } + // }, + // required: ['code', 'list'] + // } + // }, + // { + // if: { + // type: 'object', + // properties: { + // code: { const: 'meta' } + // } + // }, + // then: { + // type: 'object', + // properties: { + // code: { const: 'meta' }, + // list: { + // type: 'array', + // items: { + // oneOf: [ + // { + // if: { + // type: 'object', + // properties: { + // code: { const: 'additive' } + // } + // }, + // then: { + // type: 'object', + // properties: { + // code: { const: 'additive' }, + // value: { + // type: 'string', + // enum: ['yes', 'no'] + // } + // }, + // required: ['code', 'value'] + // } + // }, + // { + // if: { + // type: 'object', + // properties: { + // code: { const: 'auto' } + // } + // }, + // then: { + // type: 'object', + // properties: { + // code: { const: 'auto' }, + // value: { + // type: 'string', + // enum: ['yes', 'no'] + // } + // }, + // required: ['code', 'value'] + // } + // } + // ] + // }, + // minItems: 2, + // errorMessage: 'Meta tag must contain both additive and auto' + // } + // }, + // required: ['code', 'list'] + // } + // } + // ] + // }, + // minItems: 3, + // errorMessage: 'Tags must contain qualifier, benefit, and meta' + // } + // }, + // required: ['id', 'descriptor', 'location_ids', 'item_ids', 'time', 'tags'] + // } + // }, + // // BuyXgetY offer validation + // { + // if: { + // type: 'object', + // properties: { + // descriptor: { + // type: 'object', + // properties: { + // code: { const: 'buyXgetY' } + // } + // } + // } + // }, + // then: { + // type: 'object', + // properties: { + // id: { type: 'string' }, + // descriptor: { + // type: 'object', + // properties: { + // code: { const: 'buyXgetY' }, + // images: { + // type: 'array', + // items: { type: 'string', format: 'uri' } + // } + // }, + // required: ['code', 'images'] + // }, + // location_ids: { type: 'array', items: { type: 'string' } }, + // item_ids: { type: 'array', items: { type: 'string' } }, + // time: { + // type: 'object', + // properties: { + // label: { type: 'string' }, + // range: { + // type: 'object', + // properties: { + // start: { type: 'string', format: 'date-time' }, + // end: { type: 'string', format: 'date-time' } + // }, + // required: ['start', 'end'] + // } + // }, + // required: ['label', 'range'] + // }, + // tags: { + // type: 'array', + // items: { + // oneOf: [ + // { + // if: { + // type: 'object', + // properties: { + // code: { const: 'qualifier' } + // } + // }, + // then: { + // type: 'object', + // properties: { + // code: { const: 'qualifier' }, + // list: { + // type: 'array', + // items: { + // oneOf: [ + // { + // if: { + // type: 'object', + // properties: { + // code: { const: 'min_value' } + // } + // }, + // then: { + // type: 'object', + // properties: { + // code: { const: 'min_value' }, + // value: { + // type: 'string', + // pattern: '^[0-9]+(\\.[0-9]{1,2})?$' + // } + // }, + // required: ['code', 'value'] + // } + // }, + // { + // if: { + // type: 'object', + // properties: { + // code: { const: 'item_count' } + // } + // }, + // then: { + // type: 'object', + // properties: { + // code: { const: 'item_count' }, + // value: { + // type: 'string', + // pattern: '^[0-9]+$' + // } + // }, + // required: ['code', 'value'] + // } + // } + // ] + // }, + // minItems: 1, + // errorMessage: 'Qualifier tag must contain item_count' + // } + // }, + // required: ['code', 'list'] + // } + // }, + // { + // if: { + // type: 'object', + // properties: { + // code: { const: 'benefit' } + // } + // }, + // then: { + // type: 'object', + // properties: { + // code: { const: 'benefit' }, + // list: { + // type: 'array', + // items: { + // oneOf: [ + // { + // if: { + // type: 'object', + // properties: { + // code: { const: 'item_count' } + // } + // }, + // then: { + // type: 'object', + // properties: { + // code: { const: 'item_count' }, + // value: { + // type: 'string', + // pattern: '^[0-9]+$' + // } + // }, + // required: ['code', 'value'] + // } + // }, + // { + // if: { + // type: 'object', + // properties: { + // code: { const: 'item_id' } + // } + // }, + // then: { + // type: 'object', + // properties: { + // code: { const: 'item_id' }, + // value: { type: 'string' } + // }, + // required: ['code', 'value'] + // } + // } + // ] + // }, + // minItems: 1, + // errorMessage: 'Benefit tag must contain item_count' + // } + // }, + // required: ['code', 'list'] + // } + // }, + // { + // if: { + // type: 'object', + // properties: { + // code: { const: 'meta' } + // } + // }, + // then: { + // type: 'object', + // properties: { + // code: { const: 'meta' }, + // list: { + // type: 'array', + // items: { + // oneOf: [ + // { + // if: { + // type: 'object', + // properties: { + // code: { const: 'additive' } + // } + // }, + // then: { + // type: 'object', + // properties: { + // code: { const: 'additive' }, + // value: { + // type: 'string', + // enum: ['yes', 'no'] + // } + // }, + // required: ['code', 'value'] + // } + // }, + // { + // if: { + // type: 'object', + // properties: { + // code: { const: 'auto' } + // } + // }, + // then: { + // type: 'object', + // properties: { + // code: { const: 'auto' }, + // value: { + // type: 'string', + // enum: ['yes', 'no'] + // } + // }, + // required: ['code', 'value'] + // } + // } + // ] + // }, + // minItems: 2, + // errorMessage: 'Meta tag must contain both additive and auto' + // } + // }, + // required: ['code', 'list'] + // } + // } + // ] + // }, + // minItems: 3, + // errorMessage: 'Tags must contain qualifier, benefit, and meta' + // } + // }, + // required: ['id', 'descriptor', 'location_ids', 'item_ids', 'time', 'tags'] + // } + // }, + // // Freebie offer validation + // { + // if: { + // type: 'object', + // properties: { + // descriptor: { + // type: 'object', + // properties: { + // code: { const: 'freebie' } + // } + // } + // } + // }, + // then: { + // type: 'object', + // properties: { + // id: { type: 'string' }, + // descriptor: { + // type: 'object', + // properties: { + // code: { const: 'freebie' }, + // images: { + // type: 'array', + // items: { type: 'string', format: 'uri' } + // } + // }, + // required: ['code', 'images'] + // }, + // location_ids: { type: 'array', items: { type: 'string' } }, + // item_ids: { type: 'array', items: { type: 'string' } }, + // time: { + // type: 'object', + // properties: { + // label: { type: 'string' }, + // range: { + // type: 'object', + // properties: { + // start: { type: 'string', format: 'date-time' }, + // end: { type: 'string', format: 'date-time' } + // }, + // required: ['start', 'end'] + // } + // }, + // required: ['label', 'range'] + // }, + // tags: { + // type: 'array', + // items: { + // oneOf: [ + // { + // if: { + // type: 'object', + // properties: { + // code: { const: 'qualifier' } + // } + // }, + // then: { + // type: 'object', + // properties: { + // code: { const: 'qualifier' }, + // list: { + // type: 'array', + // items: { + // oneOf: [ + // { + // if: { + // type: 'object', + // properties: { + // code: { const: 'min_value' } + // } + // }, + // then: { + // type: 'object', + // properties: { + // code: { const: 'min_value' }, + // value: { + // type: 'string', + // pattern: '^[0-9]+(\\.[0-9]{1,2})?$' + // } + // }, + // required: ['code', 'value'] + // } + // } + // ] + // } + // } + // }, + // required: ['code', 'list'] + // } + // }, + // { + // if: { + // type: 'object', + // properties: { + // code: { const: 'benefit' } + // } + // }, + // then: { + // type: 'object', + // properties: { + // code: { const: 'benefit' }, + // list: { + // type: 'array', + // items: { + // oneOf: [ + // { + // if: { + // type: 'object', + // properties: { + // code: { const: 'item_count' } + // } + // }, + // then: { + // type: 'object', + // properties: { + // code: { const: 'item_count' }, + // value: { + // type: 'string', + // pattern: '^[0-9]+$' + // } + // }, + // required: ['code', 'value'] + // } + // }, + // { + // if: { + // type: 'object', + // properties: { + // code: { const: 'item_id' } + // } + // }, + // then: { + // type: 'object', + // properties: { + // code: { const: 'item_id' }, + // value: { type: 'string' } + // }, + // required: ['code', 'value'] + // } + // }, + // { + // if: { + // type: 'object', + // properties: { + // code: { const: 'item_value' } + // } + // }, + // then: { + // type: 'object', + // properties: { + // code: { const: 'item_value' }, + // value: { + // type: 'string', + // pattern: '^[0-9]+(\\.[0-9]{1,2})?$' + // } + // }, + // required: ['code', 'value'] + // } + // } + // ] + // }, + // minItems: 3, + // errorMessage: 'Benefit tag must contain item_count, item_id, and item_value' + // } + // }, + // required: ['code', 'list'] + // } + // }, + // { + // if: { + // type: 'object', + // properties: { + // code: { const: 'meta' } + // } + // }, + // then: { + // type: 'object', + // properties: { + // code: { const: 'meta' }, + // list: { + // type: 'array', + // items: { + // oneOf: [ + // { + // if: { + // type: 'object', + // properties: { + // code: { const: 'additive' } + // } + // }, + // then: { + // type: 'object', + // properties: { + // code: { const: 'additive' }, + // value: { + // type: 'string', + // enum: ['yes', 'no'] + // } + // }, + // required: ['code', 'value'] + // } + // }, + // { + // if: { + // type: 'object', + // properties: { + // code: { const: 'auto' } + // } + // }, + // then: { + // type: 'object', + // properties: { + // code: { const: 'auto' }, + // value: { + // type: 'string', + // enum: ['yes', 'no'] + // } + // }, + // required: ['code', 'value'] + // } + // } + // ] + // }, + // minItems: 2, + // errorMessage: 'Meta tag must contain both additive and auto' + // } + // }, + // required: ['code', 'list'] + // } + // } + // ] + // }, + // minItems: 3, + // errorMessage: 'Tags must contain qualifier, benefit, and meta' + // } + // }, + // required: ['id', 'descriptor', 'location_ids', 'item_ids', 'time', 'tags'] + // } + // }, + // // Slab offer validation + // { + // if: { + // type: 'object', + // properties: { + // descriptor: { + // type: 'object', + // properties: { + // code: { const: 'slab' } + // } + // } + // } + // }, + // then: { + // type: 'object', + // properties: { + // id: { type: 'string' }, + // descriptor: { + // type: 'object', + // properties: { + // code: { const: 'slab' }, + // images: { + // type: 'array', + // items: { type: 'string', format: 'uri' } + // } + // }, + // required: ['code', 'images'] + // }, + // location_ids: { type: 'array', items: { type: 'string' } }, + // item_ids: { type: 'array', items: { type: 'string' } }, + // time: { + // type: 'object', + // properties: { + // label: { type: 'string' }, + // range: { + // type: 'object', + // properties: { + // start: { type: 'string', format: 'date-time' }, + // end: { type: 'string', format: 'date-time' } + // }, + // required: ['start', 'end'] + // } + // }, + // required: ['label', 'range'] + // }, + // tags: { + // type: 'array', + // items: { + // oneOf: [ + // { + // if: { + // type: 'object', + // properties: { + // code: { const: 'qualifier' } + // } + // }, + // then: { + // type: 'object', + // properties: { + // code: { const: 'qualifier' }, + // list: { + // type: 'array', + // items: { + // oneOf: [ + // { + // if: { + // type: 'object', + // properties: { + // code: { const: 'min_value' } + // } + // }, + // then: { + // type: 'object', + // properties: { + // code: { const: 'min_value' }, + // value: { + // type: 'string', + // pattern: '^[0-9]+(\\.[0-9]{1,2})?$' + // } + // }, + // required: ['code', 'value'] + // } + // } + // ] + // } + // } + // }, + // required: ['code', 'list'] + // } + // }, + // { + // if: { + // type: 'object', + // properties: { + // code: { const: 'benefit' } + // } + // }, + // then: { + // type: 'object', + // properties: { + // code: { const: 'benefit' }, + // list: { + // type: 'array', + // items: { + // oneOf: [ + // { + // if: { + // type: 'object', + // properties: { + // code: { const: 'value_type' } + // } + // }, + // then: { + // type: 'object', + // properties: { + // code: { const: 'value_type' }, + // value: { + // type: 'string', + // enum: ['percent', 'amount'] + // } + // }, + // required: ['code', 'value'] + // } + // }, + // { + // if: { + // type: 'object', + // properties: { + // code: { const: 'value' } + // } + // }, + // then: { + // type: 'object', + // properties: { + // code: { const: 'value' }, + // value: { + // type: 'string', + // pattern: '^-?[0-9]+(\\.[0-9]{1,2})?$' + // } + // }, + // required: ['code', 'value'] + // } + // }, + // { + // if: { + // type: 'object', + // properties: { + // code: { const: 'value_cap' } + // } + // }, + // then: { + // type: 'object', + // properties: { + // code: { const: 'value_cap' }, + // value: { + // type: 'string', + // pattern: '^-?[0-9]+(\\.[0-9]{1,2})?$' + // } + // }, + // required: ['code', 'value'] + // } + // } + // ] + // }, + // minItems: 3, + // errorMessage: 'Benefit tag must contain value_type, value, and value_cap' + // } + // }, + // required: ['code', 'list'] + // } + // }, + // { + // if: { + // type: 'object', + // properties: { + // code: { const: 'meta' } + // } + // }, + // then: { + // type: 'object', + // properties: { + // code: { const: 'meta' }, + // list: { + // type: 'array', + // items: { + // oneOf: [ + // { + // if: { + // type: 'object', + // properties: { + // code: { const: 'additive' } + // } + // }, + // then: { + // type: 'object', + // properties: { + // code: { const: 'additive' }, + // value: { + // type: 'string', + // enum: ['yes', 'no'] + // } + // }, + // required: ['code', 'value'] + // } + // }, + // { + // if: { + // type: 'object', + // properties: { + // code: { const: 'auto' } + // } + // }, + // then: { + // type: 'object', + // properties: { + // code: { const: 'auto' }, + // value: { + // type: 'string', + // enum: ['yes', 'no'] + // } + // }, + // required: ['code', 'value'] + // } + // } + // ] + // }, + // minItems: 2, + // errorMessage: 'Meta tag must contain both additive and auto' + // } + // }, + // required: ['code', 'list'] + // } + // } + // ] + // }, + // minItems: 3, + // errorMessage: 'Tags must contain qualifier, benefit, and meta' + // } + // }, + // required: ['id', 'descriptor', 'location_ids', 'item_ids', 'time', 'tags'] + // } + // }, + // // Combo offer validation + // { + // if: { + // type: 'object', + // properties: { + // descriptor: { + // type: 'object', + // properties: { + // code: { const: 'combo' } + // } + // } + // } + // }, + // then: { + // type: 'object', + // properties: { + // id: { type: 'string' }, + // descriptor: { + // type: 'object', + // properties: { + // code: { const: 'combo' }, + // images: { + // type: 'array', + // items: { type: 'string', format: 'uri' } + // } + // }, + // required: ['code', 'images'] + // }, + // location_ids: { type: 'array', items: { type: 'string' } }, + // item_ids: { type: 'array', items: { type: 'string' } }, + // time: { + // type: 'object', + // properties: { + // label: { type: 'string' }, + // range: { + // type: 'object', + // properties: { + // start: { type: 'string', format: 'date-time' }, + // end: { type: 'string', format: 'date-time' } + // }, + // required: ['start', 'end'] + // } + // }, + // required: ['label', 'range'] + // }, + // tags: { + // type: 'array', + // items: { + // oneOf: [ + // { + // if: { + // type: 'object', + // properties: { + // code: { const: 'qualifier' } + // } + // }, + // then: { + // type: 'object', + // properties: { + // code: { const: 'qualifier' }, + // list: { + // type: 'array', + // items: { + // oneOf: [ + // { + // if: { + // type: 'object', + // properties: { + // code: { const: 'min_value' } + // } + // }, + // then: { + // type: 'object', + // properties: { + // code: { const: 'min_value' }, + // value: { + // type: 'string', + // pattern: '^[0-9]+(\\.[0-9]{1,2})?$' + // } + // }, + // required: ['code', 'value'] + // } + // } + // ] + // } + // } + // }, + // required: ['code', 'list'] + // } + // }, + // { + // if: { + // type: 'object', + // properties: { + // code: { const: 'benefit' } + // } + // }, + // then: { + // type: 'object', + // properties: { + // code: { const: 'benefit' }, + // list: { + // type: 'array', + // items: { + // oneOf: [ + // { + // if: { + // type: 'object', + // properties: { + // code: { const: 'value' } + // } + // }, + // then: { + // type: 'object', + // properties: { + // code: { const: 'value' }, + // value: { + // type: 'string', + // pattern: '^-?[0-9]+(\\.[0-9]{1,2})?$' + // } + // }, + // required: ['code', 'value'] + // } + // }, + // { + // if: { + // type: 'object', + // properties: { + // code: { const: 'value_cap' } + // } + // }, + // then: { + // type: 'object', + // properties: { + // code: { const: 'value_cap' }, + // value: { + // type: 'string', + // pattern: '^-?[0-9]+(\\.[0-9]{1,2})?$' + // } + // }, + // required: ['code', 'value'] + // } + // } + // ] + // }, + // minItems: 2, + // errorMessage: 'Benefit tag must contain value and value_cap' + // } + // }, + // required: ['code', 'list'] + // } + // }, + // { + // if: { + // type: 'object', + // properties: { + // code: { const: 'meta' } + // } + // }, + // then: { + // type: 'object', + // properties: { + // code: { const: 'meta' }, + // list: { + // type: 'array', + // items: { + // oneOf: [ + // { + // if: { + // type: 'object', + // properties: { + // code: { const: 'additive' } + // } + // }, + // then: { + // type: 'object', + // properties: { + // code: { const: 'additive' }, + // value: { + // type: 'string', + // enum: ['yes', 'no'] + // } + // }, + // required: ['code', 'value'] + // } + // }, + // { + // if: { + // type: 'object', + // properties: { + // code: { const: 'auto' } + // } + // }, + // then: { + // type: 'object', + // properties: { + // code: { const: 'auto' }, + // value: { + // type: 'string', + // enum: ['yes', 'no'] + // } + // }, + // required: ['code', 'value'] + // } + // } + // ] + // }, + // minItems: 2, + // errorMessage: 'Meta tag must contain both additive and auto' + // } + // }, + // required: ['code', 'list'] + // } + // } + // ] + // }, + // minItems: 3, + // errorMessage: 'Tags must contain qualifier, benefit, and meta' + // } + // }, + // required: ['id', 'descriptor', 'location_ids', 'item_ids', 'time', 'tags'] + // } + // }, + // // Delivery offer validation + // { + // if: { + // type: 'object', + // properties: { + // descriptor: { + // type: 'object', + // properties: { + // code: { const: 'delivery' } + // } + // } + // } + // }, + // then: { + // type: 'object', + // properties: { + // id: { type: 'string' }, + // descriptor: { + // type: 'object', + // properties: { + // code: { const: 'delivery' }, + // images: { + // type: 'array', + // items: { type: 'string', format: 'uri' } + // } + // }, + // required: ['code', 'images'] + // }, + // location_ids: { type: 'array', items: { type: 'string' } }, + // item_ids: { type: 'array', items: { type: 'string' } }, + // time: { + // type: 'object', + // properties: { + // label: { type: 'string' }, + // range: { + // type: 'object', + // properties: { + // start: { type: 'string', format: 'date-time' }, + // end: { type: 'string', format: 'date-time' } + // }, + // required: ['start', 'end'] + // } + // }, + // required: ['label', 'range'] + // }, + // tags: { + // type: 'array', + // items: { + // oneOf: [ + // { + // if: { + // type: 'object', + // properties: { + // code: { const: 'qualifier' } + // } + // }, + // then: { + // type: 'object', + // properties: { + // code: { const: 'qualifier' }, + // list: { + // type: 'array', + // items: { + // oneOf: [ + // { + // if: { + // type: 'object', + // properties: { + // code: { const: 'min_value' } + // } + // }, + // then: { + // type: 'object', + // properties: { + // code: { const: 'min_value' }, + // value: { + // type: 'string', + // pattern: '^[0-9]+(\\.[0-9]{1,2})?$' + // } + // }, + // required: ['code', 'value'] + // } + // } + // ] + // } + // } + // }, + // required: ['code', 'list'] + // } + // }, + // { + // if: { + // type: 'object', + // properties: { + // code: { const: 'benefit' } + // } + // }, + // then: { + // type: 'object', + // properties: { + // code: { const: 'benefit' }, + // list: { + // type: 'array', + // items: { + // oneOf: [ + // { + // if: { + // type: 'object', + // properties: { + // code: { const: 'value_type' } + // } + // }, + // then: { + // type: 'object', + // properties: { + // code: { const: 'value_type' }, + // value: { + // type: 'string', + // enum: ['percent', 'amount'] + // } + // }, + // required: ['code', 'value'] + // } + // }, + // { + // if: { + // type: 'object', + // properties: { + // code: { const: 'value' } + // } + // }, + // then: { + // type: 'object', + // properties: { + // code: { const: 'value' }, + // value: { + // type: 'string', + // pattern: '^-?[0-9]+(\\.[0-9]{1,2})?$' + // } + // }, + // required: ['code', 'value'] + // } + // }, + // { + // if: { + // type: 'object', + // properties: { + // code: { const: 'value_cap' } + // } + // }, + // then: { + // type: 'object', + // properties: { + // code: { const: 'value_cap' }, + // value: { + // type: 'string', + // pattern: '^-?[0-9]+(\\.[0-9]{1,2})?$' + // } + // }, + // required: ['code', 'value'] + // } + // } + // ] + // }, + // minItems: 2, + // errorMessage: 'Benefit tag must contain value_type and value' + // } + // }, + // required: ['code', 'list'] + // } + // }, + // { + // if: { + // type: 'object', + // properties: { + // code: { const: 'meta' } + // } + // }, + // then: { + // type: 'object', + // properties: { + // code: { const: 'meta' }, + // list: { + // type: 'array', + // items: { + // oneOf: [ + // { + // if: { + // type: 'object', + // properties: { + // code: { const: 'additive' } + // } + // }, + // then: { + // type: 'object', + // properties: { + // code: { const: 'additive' }, + // value: { + // type: 'string', + // enum: ['yes', 'no'] + // } + // }, + // required: ['code', 'value'] + // } + // }, + // { + // if: { + // type: 'object', + // properties: { + // code: { const: 'auto' } + // } + // }, + // then: { + // type: 'object', + // properties: { + // code: { const: 'auto' }, + // value: { + // type: 'string', + // enum: ['yes', 'no'] + // } + // }, + // required: ['code', 'value'] + // } + // } + // ] + // }, + // minItems: 2, + // errorMessage: 'Meta tag must contain both additive and auto' + // } + // }, + // required: ['code', 'list'] + // } + // } + // ] + // }, + // minItems: 3, + // errorMessage: 'Tags must contain qualifier, benefit, and meta' + // } + // }, + // required: ['id', 'descriptor', 'location_ids', 'item_ids', 'time', 'tags'] + // } + // }, + // // Exchange offer validation + // { + // if: { + // type: 'object', + // properties: { + // descriptor: { + // type: 'object', + // properties: { + // code: { const: 'exchange' } + // } + // } + // } + // }, + // then: { + // type: 'object', + // properties: { + // id: { type: 'string' }, + // descriptor: { + // type: 'object', + // properties: { + // code: { const: 'exchange' }, + // images: { + // type: 'array', + // items: { type: 'string', format: 'uri' } + // } + // }, + // required: ['code', 'images'] + // }, + // location_ids: { type: 'array', items: { type: 'string' } }, + // item_ids: { type: 'array', items: { type: 'string' } }, + // time: { + // type: 'object', + // properties: { + // label: { type: 'string' }, + // range: { + // type: 'object', + // properties: { + // start: { type: 'string', format: 'date-time' }, + // end: { type: 'string', format: 'date-time' } + // }, + // required: ['start', 'end'] + // } + // }, + // required: ['label', 'range'] + // }, + // tags: { + // type: 'array', + // items: { + // oneOf: [ + // { + // if: { + // type: 'object', + // properties: { + // code: { const: 'qualifier' } + // } + // }, + // then: { + // type: 'object', + // properties: { + // code: { const: 'qualifier' }, + // list: { + // type: 'array', + // items: { + // oneOf: [ + // { + // if: { + // type: 'object', + // properties: { + // code: { const: 'min_value' } + // } + // }, + // then: { + // type: 'object', + // properties: { + // code: { const: 'min_value' }, + // value: { + // type: 'string', + // pattern: '^[0-9]+(\\.[0-9]{1,2})?$' + // } + // }, + // required: ['code', 'value'] + // } + // } + // ] + // } + // } + // }, + // required: ['code', 'list'] + // } + // }, + // { + // if: { + // type: 'object', + // properties: { + // code: { const: 'benefit' } + // } + // }, + // then: { + // type: 'object', + // properties: { + // code: { const: 'benefit' }, + // list: { + // type: 'array', + // items: { + // oneOf: [ + // { + // if: { + // type: 'object', + // properties: { + // code: { const: 'value_type' } + // } + // }, + // then: { + // type: 'object', + // properties: { + // code: { const: 'value_type' }, + // value: { + // type: 'string', + // enum: ['percent', 'amount'] + // } + // }, + // required: ['code', 'value'] + // } + // }, + // { + // if: { + // type: 'object', + // properties: { + // code: { const: 'value' } + // } + // }, + // then: { + // type: 'object', + // properties: { + // code: { const: 'value' }, + // value: { + // type: 'string', + // pattern: '^-?[0-9]+(\\.[0-9]{1,2})?$' + // } + // }, + // required: ['code', 'value'] + // } + // } + // ] + // }, + // minItems: 2, + // errorMessage: 'Benefit tag must contain value_type and value' + // } + // }, + // required: ['code', 'list'] + // } + // }, + // { + // if: { + // type: 'object', + // properties: { + // code: { const: 'meta' } + // } + // }, + // then: { + // type: 'object', + // properties: { + // code: { const: 'meta' }, + // list: { + // type: 'array', + // items: { + // oneOf: [ + // { + // if: { + // type: 'object', + // properties: { + // code: { const: 'additive' } + // } + // }, + // then: { + // type: 'object', + // properties: { + // code: { const: 'additive' }, + // value: { + // type: 'string', + // enum: ['yes', 'no'] + // } + // }, + // required: ['code', 'value'] + // } + // }, + // { + // if: { + // type: 'object', + // properties: { + // code: { const: 'auto' } + // } + // }, + // then: { + // type: 'object', + // properties: { + // code: { const: 'auto' }, + // value: { + // type: 'string', + // enum: ['yes', 'no'] + // } + // }, + // required: ['code', 'value'] + // } + // } + // ] + // }, + // minItems: 2, + // errorMessage: 'Meta tag must contain both additive and auto' + // } + // }, + // required: ['code', 'list'] + // } + // } + // ] + // }, + // minItems: 3, + // errorMessage: 'Tags must contain qualifier, benefit, and meta' + // } + // }, + // required: ['id', 'descriptor', 'location_ids', 'item_ids', 'time', 'tags'] + // } + // } + // ] + // } + // }, + offers: { + type: 'array', + items: { + type: 'object', + properties: { + id: { + type: 'string', + description: 'Unique identifier for the offer.', + }, + descriptor: { + type: 'object', + properties: { + code: { + type: 'string', + description: 'Type of the offer (e.g., discount, buyXgetY, freebie).', + enum: [ + 'discount', + 'buyXgetY', + 'freebie', + 'slab', + 'combo', + 'delivery', + 'exchange', + 'financing', + ], + }, + images: { + type: 'array', + items: { + type: 'string', + format: 'uri', + description: 'URL to images related to the offer.', + }, + }, + }, + required: ['code', 'images'], + }, + location_ids: { + type: 'array', + items: { + type: 'string', + description: 'List of location identifiers where the offer is valid.', + }, + }, + item_ids: { + type: 'array', + items: { + type: 'string', + description: 'List of item identifiers applicable for the offer.', + }, + }, + time: { + type: 'object', + properties: { + label: { + type: 'string', + description: 'Label for the time validity of the offer (e.g., valid).', + }, + range: { + type: 'object', + properties: { + start: { + type: 'string', + format: 'date-time', + description: 'Start date and time for the offer.', + }, + end: { + type: 'string', + format: 'date-time', + description: 'End date and time for the offer.', + }, + }, + required: ['start', 'end'], + }, + }, + required: ['label', 'range'], + }, + tags: { + type: 'array', + items: { + type: 'object', + properties: { + code: { + type: 'string', + description: 'Type of the tag (e.g., qualifier, benefit, meta).', + enum: ['qualifier', 'benefit', 'meta'], + }, + list: { + type: 'array', + items: { + type: 'object', + properties: { + code: { + type: 'string', + description: 'Code representing the specific tag property.', + enum: [ + 'min_value', + 'value_type', + 'value', + 'additive', + 'item_count', + 'item_id', + 'item_value', + ], + }, + value: { + type: 'string', + description: 'Value for the tag property.', + }, + }, + }, + required: ['code', 'value'], + }, + }, + }, + required: ['code', 'list'], + }, + }, + }, + + required: ['id', 'descriptor', 'location_ids', 'item_ids', 'time', 'tags'], + }, + tags: { + type: 'array', + items: { + allOf: [ + { + if: { + properties: { + code: { + const: 'timing', + }, + }, + }, + then: { + properties: { + list: { + type: 'array', + items: { + allOf: [ + { + if: { + properties: { + code: { + const: 'type', + }, + }, + }, + then: { + properties: { + value: { + type: 'string', + enum: ['Self-Pickup', 'Order', 'Delivery', 'All'], + errorMessage: + "timing for fulfillment type, enum - 'Order' (online order processing timings 'Delivery' (order shipment timings, will be same as delivery timings for hyperlocal), 'Self-Pickup' (self-pickup timings)", + }, + }, + required: ['code', 'value'], + }, + }, + { + if: { + properties: { + code: { + const: 'location', + }, + }, + }, + then: { + properties: { + value: { + type: 'string', + }, + }, + required: ['code', 'value'], + }, + }, + { + if: { + properties: { + code: { + const: 'day_from', + }, + }, + }, + then: { + properties: { + value: { + type: 'string', + pattern: '^[1-7]$', + errorMessage: + "Value for 'day_from' must be numeric characters only from 1 to 7", + }, + }, + required: ['code', 'value'], + }, + }, + { + if: { + properties: { + code: { + const: 'day_to', + }, + }, + }, + then: { + properties: { + value: { + type: 'string', + pattern: '^[1-7]$', + errorMessage: + "Value for 'day_to' must be numeric characters only from 1 to 7", + }, + }, + required: ['code', 'value'], + }, + }, + { + if: { + properties: { + code: { + const: 'time_from', + }, + }, + }, + then: { + properties: { + value: { + type: 'string', + pattern: '^([01][0-9]|2[0-3])[0-5][0-9]$', + errorMessage: + "Value for 'time_from' must be a 4-digit numeric value in HHMM format", + }, + }, + required: ['code', 'value'], + }, + }, + { + if: { + properties: { + code: { + const: 'time_to', + }, + }, + }, + then: { + properties: { + value: { + type: 'string', + pattern: '^(2[0-3]|[01]?[0-9]|24)[0-5]?[0-9]$', + errorMessage: + "Value for 'time_to' must be a 4-digit numeric value in HHMM format", + }, + }, + required: ['code', 'value'], + }, + }, + ], + }, + }, + }, + }, + }, + { + if: { + properties: { + code: { + const: 'serviceability', + }, + }, + }, + then: { + properties: { + list: { + type: 'array', + items: { + type: 'object', + properties: { + code: { + type: 'string', + enum: ['location', 'category', 'type', 'val', 'unit','day_from','day_to','time_from','time_to'], + }, + value: { + type: 'string', + }, + }, + required: ['code', 'value'], + additionalProperties: false, + }, + minItems: 5, + maxItems: 9, + uniqueItems: true, + errorMessage: { + minItems: 'Serviceability must have minimum 5 values', + uniqueItems: 'Serviceability must have unique items', + _: "Serviceability must have these values 'location', 'category', 'type', 'val', 'unit' and no duplicacy or other elements allowed", + }, + }, + }, + }, + }, + { + if: { + properties: { + code: { + const: 'catalog_link', + }, + }, + }, + then: { + properties: { + list: { + type: 'array', + items: { + allOf: [ + { + if: { + properties: { + code: { + const: 'type_validity', + }, + }, + required: ['code'], + }, + then: { + properties: { + value: { + format: 'duration', + errorMessage: 'Duration must be RFC3339 duration.', + }, + }, + required: ['value'], + }, + }, + { + if: { + properties: { + code: { + const: 'last_update', + }, + }, + required: ['code'], + }, + then: { + properties: { + value: { + description: 'RFC3339 UTC timestamp format', + format: 'rfc3339-date-time', + errorMessage: 'Time must be RFC3339 UTC timestamp format.', + }, + }, + required: ['value'], + }, + }, + { + if: { + properties: { + code: { + const: 'type_value', + }, + }, + required: ['code'], + }, + then: { + properties: { + value: { + format: 'url', + errorMessage: 'Type value must be url', + }, + }, + required: ['value'], + }, + }, + { + if: { + properties: { + code: { + const: 'last_update', + }, + }, + required: ['code'], + }, + then: { + properties: { + value: { + description: 'RFC3339 UTC timestamp format', + format: 'rfc3339-date-time', + errorMessage: 'Time must be RFC3339 UTC timestamp format.', + }, + }, + required: ['value'], + }, + }, + { + if: { + properties: { + code: { + const: 'type', + }, + }, + required: ['code'], + }, + then: { + properties: { + value: { + enum: ['inline', 'link'], + errorMessage: + "Type value must be 'inline'(items array in inline response, which is the default today) or 'link'(link to zip file for items array for the provider)", + }, + }, + required: ['value'], + }, + }, + ], + }, + }, + }, + }, + }, + { + if: { + properties: { + code: { + const: 'order_value', + }, + }, + }, + then: { + properties: { + list: { + type: 'array', + items: { + allOf: [ + { + if: { + properties: { + code: { + const: 'min_value', + }, + }, + required: ['code'], + }, + then: { + properties: { + value: { + pattern: '^[0-9]+(?:\.[0-9]{1,2})?$', + errorMessage: 'min_value must be number with exactly two decimal places', + }, + }, + required: ['value'], + }, + }, + ], + }, + }, + }, + }, + }, + ], + }, + }, + required: ['id', 'time', 'fulfillments', 'descriptor', 'ttl', 'locations', 'items', 'tags', 'rating'], + }, + }, + }, + required: ['bpp/descriptor', 'bpp/providers'], + }, + }, + }, + required: ['catalog'], + }, + }, + required: ['context', 'message'], +} diff --git a/schema/Retail_1.2.5/RET/search.ts b/schema/Retail_1.2.5/RET/search.ts new file mode 100644 index 00000000..d3d75ec3 --- /dev/null +++ b/schema/Retail_1.2.5/RET/search.ts @@ -0,0 +1,425 @@ +export const searchSchema = { + type: 'object', + properties: { + context: { + type: 'object', + properties: { + domain: { + type: 'string', + minLength: 1, + }, + action: { + type: 'string', + const: 'search', + }, + country: { + type: 'string', + minLength: 1, + }, + city: { + type: 'string', + minLength: 1, + }, + core_version: { + type: 'string', + const: '1.2.5', + minLength: 1, + }, + bap_id: { + type: 'string', + minLength: 1, + }, + bap_uri: { + type: 'string', + minLength: 1, + format: 'url', + }, + transaction_id: { + type: 'string', + minLength: 1, + }, + message_id: { + type: 'string', + minLength: 1, + }, + timestamp: { + type: 'string', + format: 'rfc3339-date-time', + }, + ttl: { + type: 'string', + format: 'duration', + }, + }, + required: [ + 'domain', + 'action', + 'country', + 'city', + 'core_version', + 'bap_id', + 'bap_uri', + 'transaction_id', + 'message_id', + 'timestamp', + 'ttl', + ], + additionalProperties: false, + }, + message: { + type: 'object', + properties: { + intent: { + type: 'object', + properties: { + fulfillment: { + type: 'object', + properties: { + type: { + type: 'string', + enum: ['Delivery', 'Self-Pickup', 'Buyer-Delivery'], + }, + end: { + type: 'object', + properties: { + location: { + type: 'object', + properties: { + gps: { + type: 'string', + }, + address: { + type: 'object', + properties: { + area_code: { + type: 'string', + }, + }, + required: ['area_code'], + }, + }, + required: ['gps', 'address'], + }, + }, + required: ['location'], + }, + }, + }, + item: { + type: 'object', + properties: { + descriptor: { + type: 'object', + properties: { + name: { + type: 'string', + }, + }, + required: ['name'], + }, + }, + required: ['descriptor'], + }, + category: { + type: 'object', + properties: { + id: { + type: 'string', + }, + }, + required: ['id'], + }, + payment: { + type: 'object', + properties: { + '@ondc/org/buyer_app_finder_fee_type': { + type: 'string', + const: 'percent', + }, + '@ondc/org/buyer_app_finder_fee_amount': { + type: 'string', + pattern: '^(\\d*.?\\d{1,2})$', + }, + }, + required: ['@ondc/org/buyer_app_finder_fee_type', '@ondc/org/buyer_app_finder_fee_amount'], + }, + tags: { + type: 'array', + items: { + type: 'object', + properties: { + code: { + type: 'string', + enum: ['catalog_inc', 'bap_terms', 'catalog_full', 'bap_features'], + }, + list: { + type: 'array', + items: { + type: 'object', + properties: { + code: { + type: 'string', + enum: [ + 'start_time', + 'end_time', + 'mode', + 'static_terms', + 'effective_date', + 'static_terms_new', + 'payload_type', + '000', + '001', + '002', + '003', + '004', + '005', + '006', + '007', + '008', + '0091', + '0092', + '0093', + '0094', + '0095', + '0096', + '0097', + '0098', + '0099', + '00A', + '00B', + '00C', + '00D', + '00E', + '00F', + '010', + '011', + '012', + '013', + '014', + '015', + '016', + '017', + '018', + '019', + '01A', + '01B', + '01C', + '01D', + '01E', + '01F', + '020', + '021', + '022', + '023', + '024', + '025', + ], + }, + value: { + type: 'string', + }, + }, + additionalProperties: false, + required: ['code', 'value'], + }, + minItems: 1, + }, + }, + required: ['code', 'list'], + anyOf: [ + { + properties: { + code: { const: 'bap_features' }, + }, + then: { + properties: { + list: { + contains: { + type: 'object', + properties: { + code: { + type: 'string', + enum: [ + '000', + '001', + '002', + '003', + '004', + '005', + '006', + '007', + '008', + '0091', + '0092', + '0093', + '0094', + '0095', + '0096', + '0097', + '0098', + '0099', + '009A', + '009B', + '009C', + '009D', + '009E', + '00A', + '00B', + '00C', + '00D', + '00E', + '00F', + '010', + '011', + '012', + '013', + '014', + '015', + '016', + '017', + '018', + '019', + '01A', + '01B', + '01C', + '01D', + ], + }, + value: { + type: 'string', + enum: ['yes', 'no'], + }, + }, + required: ['code', 'value'], + }, + }, + }, + }, + }, + // Did changes for catalog_full + { + properties: { + code: { const: 'catalog_full' }, + }, + then: { + properties: { + list: { + type: 'array', + items: { + type: 'object', + properties: { + code: { + type: 'string', + const: 'payload_type', + }, + value: { + type: 'string', + enum: ['link', 'inline'], + }, + }, + required: ['code', 'value'], + }, + }, + }, + }, + }, + { + properties: { + code: { const: 'catalog_inc' }, + }, + then: { + properties: { + list: { + anyOf: [ + { + contains: { + type: 'object', + properties: { + code: { const: 'mode' }, + }, + required: ['code'], + }, + }, + { + contains: { + allOf: [ + { + type: 'object', + properties: { + code: { const: 'start_time' }, + }, + required: ['code'], + }, + { + type: 'object', + properties: { + code: { const: 'end_time' }, + }, + required: ['code'], + }, + ], + }, + }, + ], + }, + }, + }, + }, + { + properties: { + code: { const: 'bap_terms' }, + }, + then: { + properties: { + list: { + contains: { + allOf: [ + { + type: 'object', + properties: { + code: { const: 'static_terms' }, + }, + required: ['code'], + }, + { + type: 'object', + properties: { + code: { const: 'static_terms_new' }, + }, + required: ['code'], + }, + { + type: 'object', + properties: { + code: { const: 'effective_date' }, + }, + required: ['code'], + }, + ], + }, + }, + }, + }, + }, + ], + }, + minItems: 1, + contains: { + type: 'object', + properties: { + code: { enum: ['bap_features', 'catalog_full', 'catalog_inc', 'bap_terms'] }, + }, + required: ['code', 'list'], + }, + }, + }, + required: ['payment'], + }, + }, + required: ['intent'], + additionalProperties: false, + }, + }, + required: ['context', 'message'], + additionalProperties: false, +} diff --git a/shared/validateRetailLogsV2.ts b/shared/validateRetailLogsV2.ts new file mode 100644 index 00000000..f1b61fcb --- /dev/null +++ b/shared/validateRetailLogsV2.ts @@ -0,0 +1,1127 @@ +import _ from 'lodash' +import { dropDB, setValue } from '../shared/dao' +import { logger } from './logger' +import { ApiSequence, retailDomains } from '../constants' +import { validateSchema, isObjectEmpty } from '../utils' +import { checkOnsearchFullCatalogRefresh } from '../utils/Retail_.1.2.5/RET11_onSearch/onSearch' +import { checkSelect } from '../utils/Retail_.1.2.5/Select/select' +import { checkOnSelect } from '../utils/Retail_.1.2.5/Select/onSelect' +import { checkInit } from '../utils/Retail_.1.2.5/Init/init' +import { checkOnInit } from '../utils/Retail_.1.2.5/Init/onInit' +import { checkConfirm } from '../utils/Retail_.1.2.5/Confirm/confirm' +import { checkOnConfirm } from '../utils/Retail_.1.2.5/Confirm/onConfirm' +import { checkOnTrack } from '../utils/Retail_.1.2.5/Track/onTrack' +import { checkTrack } from '../utils/Retail_.1.2.5/Track/track' +import { checkOnStatusPending } from '../utils/Retail_.1.2.5/Status/onStatusPending' +import { checkStatus } from '../utils/Retail_.1.2.5/Status/status' +import { checkSearch } from '../utils/Retail_.1.2.5/Search/search' +import { checkOnsearch } from '../utils/Retail_.1.2.5/Search/on_search' +import { checkSearchIncremental } from '../utils/Retail_.1.2.5/SearchInc/searchIncremental' +import { checkOnsearchIncremental } from '../utils/Retail_.1.2.5/SearchInc/onSearchIncremental' +import { FLOW,OFFERSFLOW } from '../utils/enum' +import { checkSelect_OOS } from '../utils/Retail_.1.2.5/Select_OOS/select_oos' +import { checkOnSelect_OOS } from '../utils/Retail_.1.2.5/Select_OOS/on_select_oos' +import { checkUpdate } from '../utils/Retail_.1.2.5/Update/update' +import { checkOnUpdate } from '../utils/Retail_.1.2.5/Update/onUpdate' +import { checkOnStatusPacked } from '../utils/Retail_.1.2.5/Status/onStatusPacked' +import { checkOnStatusPicked } from '../utils/Retail_.1.2.5/Status/onStatusPicked' +import { checkOnStatusOutForDelivery } from '../utils/Retail_.1.2.5/Status/onStatusOutForDelivery' +import { checkOnStatusDelivered } from '../utils/Retail_.1.2.5/Status/onStatusDelivered' +import { checkOnStatusRTODelivered } from '../utils/Retail_.1.2.5/Status/onStatusRTODelivered' +import { checkCancel } from '../utils/Retail_.1.2.5/Cancel/cancel' +import { checkOnCancel } from '../utils/Retail_.1.2.5/Cancel/onCancel' +import { checkCatalogRejection } from '../utils/Retail_.1.2.5/Catalog_Rejection/catalogRejection' + +// export const validateLogs = async (data: any, domain: string, flow: string) => { +// const msgIdSet = new Set() +// const quoteTrailItemsSet = new Set() +// const settlementDetatilSet = new Set() +// const fulfillmentsItemsSet = new Set() +// let logReport: any = {} +// setValue('flow', flow) +// setValue('domain', domain.split(':')[1]) +// try { +// dropDB() +// } catch (error) { +// logger.error('!!Error while removing LMDB', error) +// } + +// try { +// const validFlows = ['1', '2', '3', '4', '5', '6', '7', '8', '9', ] +// if (!retailDomains.includes(domain)) { +// return 'Domain should be of the 1.2.0 retail domains' +// } +// const flowOneSequence = [ +// ApiSequence.SEARCH, +// ApiSequence.ON_SEARCH, +// ApiSequence.INC_SEARCH, +// ApiSequence.INC_ONSEARCH, +// ] +// const flowTwoSequence = [ +// ApiSequence.SEARCH, +// ApiSequence.ON_SEARCH, +// ApiSequence.SELECT, +// ApiSequence.ON_SELECT, +// ApiSequence.INIT, +// ApiSequence.ON_INIT, +// ApiSequence.CONFIRM, +// ApiSequence.ON_CONFIRM, +// ApiSequence.ON_STATUS_PENDING, +// ApiSequence.ON_STATUS_PACKED, +// ApiSequence.ON_STATUS_PICKED, +// ApiSequence.ON_STATUS_OUT_FOR_DELIVERY, +// ApiSequence.ON_STATUS_DELIVERED, +// ] +// const flowThreeSequence = [ +// ApiSequence.SEARCH, +// ApiSequence.ON_SEARCH, +// ApiSequence.SELECT_OUT_OF_STOCK, +// ApiSequence.ON_SELECT_OUT_OF_STOCK, +// ApiSequence.SELECT, +// ApiSequence.ON_SELECT, +// ApiSequence.INIT, +// ApiSequence.ON_INIT, +// ApiSequence.CONFIRM, +// ApiSequence.ON_CONFIRM, +// ApiSequence.ON_STATUS_PENDING, +// ApiSequence.ON_STATUS_PACKED, +// ApiSequence.ON_STATUS_PICKED, +// ApiSequence.ON_STATUS_OUT_FOR_DELIVERY, +// ApiSequence.ON_STATUS_DELIVERED, +// ] +// const flowFourSequence = [ +// ApiSequence.SEARCH, +// ApiSequence.ON_SEARCH, +// ApiSequence.SELECT, +// ApiSequence.ON_SELECT, +// ApiSequence.INIT, +// ApiSequence.ON_INIT, +// ApiSequence.CONFIRM, +// ApiSequence.ON_CONFIRM, +// ApiSequence.CANCEL, +// ApiSequence.ON_CANCEL, +// ] +// const flowFiveSequence = [ +// ApiSequence.SEARCH, +// ApiSequence.ON_SEARCH, +// ApiSequence.SELECT, +// ApiSequence.ON_SELECT, +// ApiSequence.INIT, +// ApiSequence.ON_INIT, +// ApiSequence.CONFIRM, +// ApiSequence.ON_CONFIRM, +// ApiSequence.ON_STATUS_PENDING, +// ApiSequence.ON_STATUS_PACKED, +// ApiSequence.ON_STATUS_PICKED, +// ApiSequence.ON_STATUS_OUT_FOR_DELIVERY, +// ApiSequence.ON_CANCEL, +// ApiSequence.ON_STATUS_RTO_DELIVERED, +// ] + +// const flowSixSequence = [ +// ApiSequence.SEARCH, +// ApiSequence.ON_SEARCH, +// ApiSequence.SELECT, +// ApiSequence.ON_SELECT, +// ApiSequence.INIT, +// ApiSequence.ON_INIT, +// ApiSequence.CONFIRM, +// ApiSequence.ON_CONFIRM, +// ApiSequence.ON_UPDATE_PART_CANCEL, +// ApiSequence.UPDATE_SETTLEMENT_PART_CANCEL, +// ApiSequence.ON_STATUS_PENDING, +// ApiSequence.ON_STATUS_PACKED, +// ApiSequence.ON_STATUS_PICKED, +// ApiSequence.ON_STATUS_OUT_FOR_DELIVERY, +// ApiSequence.ON_STATUS_DELIVERED, +// ApiSequence.UPDATE_REVERSE_QC, +// ApiSequence.ON_UPDATE_INTERIM_REVERSE_QC, +// ApiSequence.ON_UPDATE_APPROVAL, +// ApiSequence.ON_UPDATE_PICKED, +// ApiSequence.UPDATE_SETTLEMENT_REVERSE_QC, +// ApiSequence.ON_UPDATE_DELIVERED, +// ApiSequence.UPDATE_LIQUIDATED, +// ApiSequence.ON_UPDATE_INTERIM_LIQUIDATED, +// ApiSequence.ON_UPDATE_LIQUIDATED, +// ApiSequence.UPDATE_SETTLEMENT_LIQUIDATED, +// ] +// const flowSevenSequence = [ApiSequence.SEARCH, ApiSequence.ON_SEARCH, ApiSequence.CATALOG_REJECTION] +// const flowEightSequence = [ApiSequence.SEARCH, ApiSequence.ON_SEARCH] +// const flowNineSequence = [ApiSequence.INC_SEARCH, ApiSequence.INC_ONSEARCH, ApiSequence.CATALOG_REJECTION] + +// const processApiSequence = (apiSequence: any, data: any, logReport: any, msgIdSet: any, flow: string) => { +// if (validFlows.includes(flow)) { +// apiSequence.forEach((apiSeq: any) => { +// if (data[apiSeq]) { +// const resp = getResponse(apiSeq, data[apiSeq], msgIdSet, flow) +// if (!_.isEmpty(resp)) { +// logReport = { ...logReport, [apiSeq]: resp } +// } +// } else { +// logReport = { ...logReport, [apiSeq]: `Missing required data of : ${apiSeq}` } +// } +// }) +// logger.info(logReport, 'Report Generated Successfully!!') +// return logReport +// } else { +// return { invldFlow: 'Provided flow is invalid' } +// } +// } +// const getResponse = (apiSeq: any, data: any, msgIdSet: any, flow: string) => { +// switch (apiSeq) { +// case ApiSequence.SEARCH: +// return checkSearch(data, msgIdSet) +// case ApiSequence.ON_SEARCH: +// if (domain === 'ONDC:RET11') { +// return checkOnsearchFullCatalogRefresh(data) +// } else { +// return checkOnsearch(data) +// } +// case ApiSequence.INC_SEARCH: +// return checkSearchIncremental(data, msgIdSet) +// case ApiSequence.INC_ONSEARCH: +// return checkOnsearchIncremental(data, msgIdSet) +// case ApiSequence.SELECT: +// if (flow === FLOW.FLOW3) { +// return checkSelect_OOS(data, msgIdSet) +// } else { +// return checkSelect(data, msgIdSet, ApiSequence.SELECT) +// } +// case ApiSequence.ON_SELECT: +// return checkOnSelect(data,flow) +// case ApiSequence.SELECT_OUT_OF_STOCK: +// return checkSelect(data, msgIdSet, ApiSequence.SELECT_OUT_OF_STOCK) +// case ApiSequence.ON_SELECT_OUT_OF_STOCK: +// return checkOnSelect_OOS(data) +// case ApiSequence.INIT: +// return checkInit(data, msgIdSet,flow) +// case ApiSequence.ON_INIT: +// return checkOnInit(data, flow) +// case ApiSequence.CONFIRM: +// return checkConfirm(data, msgIdSet, flow) +// case ApiSequence.ON_CONFIRM: +// return checkOnConfirm(data, fulfillmentsItemsSet, flow) +// case ApiSequence.CANCEL: +// return checkCancel(data, msgIdSet) +// case ApiSequence.ON_CANCEL: +// return checkOnCancel(data, msgIdSet) +// case ApiSequence.ON_STATUS_RTO_DELIVERED: +// return checkOnStatusRTODelivered(data) +// case ApiSequence.STATUS: +// return checkStatus(data) +// case ApiSequence.ON_STATUS_PENDING: +// return checkOnStatusPending(data, 'pending', msgIdSet, fulfillmentsItemsSet) +// case ApiSequence.ON_STATUS_PACKED: +// return checkOnStatusPacked(data, 'packed', msgIdSet, fulfillmentsItemsSet) +// case ApiSequence.ON_STATUS_PICKED: +// return checkOnStatusPicked(data, 'picked', msgIdSet, fulfillmentsItemsSet) +// case ApiSequence.ON_STATUS_OUT_FOR_DELIVERY: +// return checkOnStatusOutForDelivery(data, 'out-for-delivery', msgIdSet, fulfillmentsItemsSet) +// case ApiSequence.ON_STATUS_DELIVERED: +// return checkOnStatusDelivered(data, 'delivered', msgIdSet, fulfillmentsItemsSet) +// case ApiSequence.ON_UPDATE_PART_CANCEL: +// return checkOnUpdate( +// data, +// msgIdSet, +// ApiSequence.ON_UPDATE_PART_CANCEL, +// settlementDetatilSet, +// quoteTrailItemsSet, +// fulfillmentsItemsSet, +// '6-a', +// ) +// case ApiSequence.UPDATE_SETTLEMENT_PART_CANCEL: +// return checkUpdate(data, msgIdSet, ApiSequence.UPDATE_SETTLEMENT_PART_CANCEL, settlementDetatilSet, '6-a') +// case ApiSequence.UPDATE_REVERSE_QC: +// return checkUpdate(data, msgIdSet, ApiSequence.UPDATE_REVERSE_QC, settlementDetatilSet, '6-b') + +// case ApiSequence.ON_UPDATE_INTERIM_REVERSE_QC: +// return checkOnUpdate( +// data, +// msgIdSet, +// ApiSequence.ON_UPDATE_INTERIM_REVERSE_QC, +// settlementDetatilSet, +// quoteTrailItemsSet, +// fulfillmentsItemsSet, +// '6-b', +// ) +// case ApiSequence.ON_UPDATE_APPROVAL: +// return checkOnUpdate( +// data, +// msgIdSet, +// ApiSequence.ON_UPDATE_APPROVAL, +// settlementDetatilSet, +// quoteTrailItemsSet, +// fulfillmentsItemsSet, +// '6-b', +// ) +// case ApiSequence.ON_UPDATE_PICKED: +// return checkOnUpdate( +// data, +// msgIdSet, +// ApiSequence.ON_UPDATE_PICKED, +// settlementDetatilSet, +// quoteTrailItemsSet, +// fulfillmentsItemsSet, +// '6-b', +// ) +// case ApiSequence.UPDATE_SETTLEMENT_REVERSE_QC: +// return checkUpdate(data, msgIdSet, ApiSequence.UPDATE_SETTLEMENT_REVERSE_QC, settlementDetatilSet, '6-b') +// case ApiSequence.ON_UPDATE_DELIVERED: +// return checkOnUpdate( +// data, +// msgIdSet, +// ApiSequence.ON_UPDATE_DELIVERED, +// settlementDetatilSet, +// quoteTrailItemsSet, +// fulfillmentsItemsSet, +// '6-b', +// ) +// case ApiSequence.UPDATE_LIQUIDATED: +// return checkUpdate(data, msgIdSet, ApiSequence.UPDATE_LIQUIDATED, settlementDetatilSet, '6-c') +// case ApiSequence.ON_UPDATE_INTERIM_LIQUIDATED: +// return checkOnUpdate( +// data, +// msgIdSet, +// ApiSequence.ON_UPDATE_INTERIM_LIQUIDATED, +// settlementDetatilSet, +// quoteTrailItemsSet, +// fulfillmentsItemsSet, +// '6-c', +// ) +// case ApiSequence.ON_UPDATE_LIQUIDATED: +// return checkOnUpdate( +// data, +// msgIdSet, +// ApiSequence.ON_UPDATE_LIQUIDATED, +// settlementDetatilSet, +// quoteTrailItemsSet, +// fulfillmentsItemsSet, +// '6-c', +// ) +// case ApiSequence.UPDATE_SETTLEMENT_LIQUIDATED: +// return checkUpdate(data, msgIdSet, ApiSequence.UPDATE_SETTLEMENT_LIQUIDATED, settlementDetatilSet, '6-c') +// case ApiSequence.TRACK: +// return checkTrack(data) +// case ApiSequence.ON_TRACK: +// return checkOnTrack(data) +// case ApiSequence.CATALOG_REJECTION: +// return checkCatalogRejection(data) +// default: +// return null +// } +// } +// switch (flow) { +// case FLOW.FLOW1: +// logReport = processApiSequence(flowOneSequence, data, logReport, msgIdSet, flow) +// break +// case FLOW.FLOW2: +// logReport = processApiSequence(flowTwoSequence, data, logReport, msgIdSet, flow) +// break +// case FLOW.FLOW3: +// logReport = processApiSequence(flowThreeSequence, data, logReport, msgIdSet, flow) +// break +// case FLOW.FLOW4: +// logReport = processApiSequence(flowFourSequence, data, logReport, msgIdSet, flow) +// break +// case FLOW.FLOW5: +// logReport = processApiSequence(flowFiveSequence, data, logReport, msgIdSet, flow) +// break +// case FLOW.FLOW6: +// logReport = processApiSequence(flowSixSequence, data, logReport, msgIdSet, flow) +// break +// case FLOW.FLOW7: +// logReport = processApiSequence(flowSevenSequence, data, logReport, msgIdSet, flow) +// break +// case FLOW.FLOW8: +// logReport = processApiSequence(flowEightSequence, data, logReport, msgIdSet, flow) +// break +// case FLOW.FLOW9: +// logReport = processApiSequence(flowNineSequence, data, logReport, msgIdSet, flow) +// break +// } +// } catch (error: any) { +// logger.error(error.message) +// return error.message +// } + +// return logReport +// } +export const validateLogsRetailV2 = async (data: any, domain: string, flow: string) => { + const msgIdSet = new Set() + const quoteTrailItemsSet = new Set() + const settlementDetatilSet = new Set() + const fulfillmentsItemsSet = new Set() + let logReport: any = {} + setValue('flow', flow) + setValue('domain', domain.split(':')[1]) + try { + dropDB() + } catch (error) { + logger.error('!!Error while removing LMDB', error) + } + + try { + const validFlows = [ + '1', + '2', + '012', + '3', + '4', + '5', + '6', + '7', + '8', + '9', + '0091','0092','0093','0094','0095','0096','0097','0098','020','00B', + '01C', + '008', + '003', + '00F', + '011', + '017', + '00D', + '00E', + '016', + '01F', + '00C' + ] + if (!retailDomains.includes(domain)) { + return 'Domain should 1.2.5 retail domains' + } + const flowOneSequence = [ + ApiSequence.SEARCH, + ApiSequence.ON_SEARCH, + ApiSequence.INC_SEARCH, + ApiSequence.INC_ONSEARCH, + ] + const flowTwoSequence = [ + ApiSequence.SEARCH, + ApiSequence.ON_SEARCH, + ApiSequence.SELECT, + ApiSequence.ON_SELECT, + ApiSequence.INIT, + ApiSequence.ON_INIT, + ApiSequence.CONFIRM, + ApiSequence.ON_CONFIRM, + ApiSequence.ON_STATUS_PENDING, + ApiSequence.ON_STATUS_PACKED, + ApiSequence.ON_STATUS_PICKED, + ApiSequence.ON_STATUS_OUT_FOR_DELIVERY, + ApiSequence.ON_STATUS_DELIVERED, + ] + const flowThreeSequence = [ + ApiSequence.SEARCH, + ApiSequence.ON_SEARCH, + ApiSequence.SELECT_OUT_OF_STOCK, + ApiSequence.ON_SELECT_OUT_OF_STOCK, + ApiSequence.SELECT, + ApiSequence.ON_SELECT, + ApiSequence.INIT, + ApiSequence.ON_INIT, + ApiSequence.CONFIRM, + ApiSequence.ON_CONFIRM, + ApiSequence.ON_STATUS_PENDING, + ApiSequence.ON_STATUS_PACKED, + ApiSequence.ON_STATUS_PICKED, + ApiSequence.ON_STATUS_OUT_FOR_DELIVERY, + ApiSequence.ON_STATUS_DELIVERED, + ] + const flowFourSequence = [ + ApiSequence.SEARCH, + ApiSequence.ON_SEARCH, + ApiSequence.SELECT, + ApiSequence.ON_SELECT, + ApiSequence.INIT, + ApiSequence.ON_INIT, + ApiSequence.CONFIRM, + ApiSequence.ON_CONFIRM, + ApiSequence.CANCEL, + ApiSequence.ON_CANCEL, + ] + const flowFiveSequence = [ + ApiSequence.SEARCH, + ApiSequence.ON_SEARCH, + ApiSequence.SELECT, + ApiSequence.ON_SELECT, + ApiSequence.INIT, + ApiSequence.ON_INIT, + ApiSequence.CONFIRM, + ApiSequence.ON_CONFIRM, + ApiSequence.ON_UPDATE_PART_CANCEL, + ApiSequence.UPDATE_SETTLEMENT_PART_CANCEL, + ApiSequence.ON_STATUS_PENDING, + ApiSequence.ON_STATUS_PACKED, + ApiSequence.ON_STATUS_PICKED, + ApiSequence.ON_STATUS_OUT_FOR_DELIVERY, + ApiSequence.ON_CANCEL, + ApiSequence.ON_STATUS_RTO_DELIVERED + ] + + const flowSixSequence = [ + ApiSequence.SEARCH, + ApiSequence.ON_SEARCH, + ApiSequence.SELECT, + ApiSequence.ON_SELECT, + ApiSequence.INIT, + ApiSequence.ON_INIT, + ApiSequence.CONFIRM, + ApiSequence.ON_CONFIRM, + ApiSequence.ON_STATUS_PENDING, + ApiSequence.ON_STATUS_PACKED, + ApiSequence.ON_STATUS_PICKED, + ApiSequence.ON_STATUS_OUT_FOR_DELIVERY, + ApiSequence.ON_STATUS_DELIVERED, + ApiSequence.UPDATE_LIQUIDATED, + ApiSequence.ON_UPDATE_INTERIM_LIQUIDATED, + ApiSequence.ON_UPDATE_LIQUIDATED, + ApiSequence.UPDATE_SETTLEMENT_LIQUIDATED, + ] + const flowSevenSequence = [ApiSequence.SEARCH, ApiSequence.ON_SEARCH, ApiSequence.CATALOG_REJECTION] + const flowEightSequence = [ApiSequence.SEARCH, ApiSequence.ON_SEARCH] + const flowNineSequence = [ApiSequence.INC_SEARCH, ApiSequence.INC_ONSEARCH, ApiSequence.CATALOG_REJECTION] + const flow020Sequence = [ + ApiSequence.SEARCH, + ApiSequence.ON_SEARCH, + ApiSequence.SELECT, + ApiSequence.ON_SELECT, + ApiSequence.INIT, + ApiSequence.ON_INIT, + ApiSequence.CONFIRM, + ApiSequence.ON_CONFIRM, + ApiSequence.ON_STATUS_PENDING, + ApiSequence.ON_STATUS_PACKED, + ApiSequence.ON_STATUS_PICKED, + ApiSequence.ON_STATUS_OUT_FOR_DELIVERY, + ApiSequence.ON_STATUS_DELIVERED, + ] + const flowOfferTypeDiscountSequence = [ + ApiSequence.SEARCH, + ApiSequence.ON_SEARCH, + ApiSequence.SELECT, + ApiSequence.ON_SELECT, + ApiSequence.INIT, + ApiSequence.ON_INIT, + ApiSequence.CONFIRM, + ApiSequence.ON_CONFIRM, + ApiSequence.CANCEL, + ApiSequence.ON_CANCEL, + ] + const flowOfferTypeFreebieSequence = [ + ApiSequence.SEARCH, + ApiSequence.ON_SEARCH, + ApiSequence.SELECT, + ApiSequence.ON_SELECT, + ApiSequence.INIT, + ApiSequence.ON_INIT, + ApiSequence.CONFIRM, + ApiSequence.ON_CONFIRM, + ] + const flowOfferTypebuyXgetYSequence = [ + ApiSequence.SEARCH, + ApiSequence.ON_SEARCH, + ApiSequence.SELECT, + ApiSequence.ON_SELECT, + ApiSequence.INIT, + ApiSequence.ON_INIT, + ApiSequence.CONFIRM, + ApiSequence.ON_CONFIRM, + ] + const flowOfferTypeDeliverySequence = [ + ApiSequence.SEARCH, + ApiSequence.ON_SEARCH, + ApiSequence.SELECT, + ApiSequence.ON_SELECT, + ApiSequence.INIT, + ApiSequence.ON_INIT, + ApiSequence.CONFIRM, + ApiSequence.ON_CONFIRM, + ] + const flowOfferTypeSlabSequence = [ + ApiSequence.SEARCH, + ApiSequence.ON_SEARCH, + ApiSequence.SELECT, + ApiSequence.ON_SELECT, + ApiSequence.INIT, + ApiSequence.ON_INIT, + ApiSequence.CONFIRM, + ApiSequence.ON_CONFIRM, + ] + const flowOfferTypeComboSequence = [ + ApiSequence.SEARCH, + ApiSequence.ON_SEARCH, + ApiSequence.SELECT, + ApiSequence.ON_SELECT, + ApiSequence.INIT, + ApiSequence.ON_INIT, + ApiSequence.CONFIRM, + ApiSequence.ON_CONFIRM, + ] + const flowOfferTypeExchangeSequence = [ + ApiSequence.SEARCH, + ApiSequence.ON_SEARCH, + ApiSequence.SELECT, + ApiSequence.ON_SELECT, + ApiSequence.INIT, + ApiSequence.ON_INIT, + ApiSequence.CONFIRM, + ApiSequence.ON_CONFIRM, + ] + const flowOfferTypeFinancingSequence = [ + ApiSequence.SEARCH, + ApiSequence.ON_SEARCH, + ApiSequence.SELECT, + ApiSequence.ON_SELECT, + ApiSequence.INIT, + ApiSequence.ON_INIT, + ApiSequence.CONFIRM, + ApiSequence.ON_CONFIRM, + ] + const flowReplacementSequence = [ + ApiSequence.SEARCH, + ApiSequence.ON_SEARCH, + ApiSequence.SELECT, + ApiSequence.ON_SELECT, + ApiSequence.INIT, + ApiSequence.ON_INIT, + ApiSequence.CONFIRM, + ApiSequence.ON_CONFIRM, + ApiSequence.ON_STATUS_PENDING, + ApiSequence.ON_STATUS_PACKED, + ApiSequence.ON_STATUS_PICKED, + ApiSequence.ON_STATUS_OUT_FOR_DELIVERY, + ApiSequence.ON_STATUS_DELIVERED, + ApiSequence.UPDATE_REPLACEMENT, + ApiSequence.ON_UPDATE_INTERIM_REVERSE_QC, + ApiSequence.ON_UPDATE_APPROVAL, + ApiSequence.ON_UPDATE_REPLACEMENT, + ApiSequence.REPLACEMENT_ON_STATUS_PENDING, + ApiSequence.REPLACEMENT_ON_STATUS_PACKED, + ApiSequence.REPLACEMENT_ON_STATUS_PICKED, + ApiSequence.REPLACEMENT_ON_STATUS_OUT_FOR_DELIVERY, + ApiSequence.REPLACEMENT_ON_STATUS_DELIVERED, + ] + const flow01CSequence = [ + ApiSequence.SEARCH, + ApiSequence.ON_SEARCH, + ApiSequence.SELECT, + ApiSequence.ON_SELECT, + ApiSequence.INIT, + ApiSequence.ON_INIT, + ApiSequence.CONFIRM, + ApiSequence.ON_CONFIRM, + ApiSequence.ON_STATUS_PENDING, + ApiSequence.ON_STATUS_PACKED, + ApiSequence.ON_STATUS_PICKED, + ApiSequence.ON_STATUS_OUT_FOR_DELIVERY, + ApiSequence.ON_STATUS_DELIVERED, + ] + const flow008Sequence = [ + ApiSequence.SEARCH, + ApiSequence.ON_SEARCH, + ApiSequence.SELECT, + ApiSequence.ON_SELECT, + ApiSequence.INIT, + ApiSequence.ON_INIT, + ] + const flow003Sequence = [ + ApiSequence.SEARCH, + ApiSequence.ON_SEARCH, + ApiSequence.SELECT, + ApiSequence.ON_SELECT, + ApiSequence.INIT, + ApiSequence.ON_INIT, + ApiSequence.CONFIRM, + ApiSequence.ON_CONFIRM, + ApiSequence.ON_STATUS_PENDING, + ApiSequence.ON_STATUS_PACKED, + ApiSequence.ON_STATUS_PICKED, + ] + const flow00FSequence = [ + ApiSequence.SEARCH, + ApiSequence.ON_SEARCH, + ApiSequence.SELECT, + ApiSequence.ON_SELECT, + ApiSequence.INIT, + ApiSequence.ON_INIT, + ApiSequence.CONFIRM, + ApiSequence.ON_CONFIRM, + ApiSequence.UPDATE_ADDRESS, + ApiSequence.ON_UPDATE_ADDRESS, + ] + const flow011Sequence = [ + ApiSequence.SEARCH, + ApiSequence.ON_SEARCH, + ApiSequence.SELECT, + ApiSequence.ON_SELECT, + ApiSequence.INIT, + ApiSequence.ON_INIT, + ApiSequence.CONFIRM, + ApiSequence.ON_CONFIRM, + ApiSequence.UPDATE_INSTRUCTIONS, + ApiSequence.ON_UPDATE_INSTRUCTIONS, + ] + const flow017Sequence = [ + ApiSequence.SEARCH, + ApiSequence.ON_SEARCH, + ApiSequence.SELECT, + ApiSequence.ON_SELECT, + ApiSequence.INIT, + ApiSequence.ON_INIT, + ApiSequence.CONFIRM, + ApiSequence.ON_CONFIRM, + ApiSequence.ON_STATUS_PENDING, + ApiSequence.ON_STATUS_PACKED, + ApiSequence.ON_STATUS_PICKED, + ApiSequence.ON_STATUS_OUT_FOR_DELIVERY, + ApiSequence.ON_STATUS_DELIVERED, + ApiSequence.ON_UPDATE, + ApiSequence.ON_CANCEL, + ] + const flow00DSequence = [ + ApiSequence.SEARCH, + ApiSequence.ON_SEARCH, + ApiSequence.SELECT, + ApiSequence.ON_SELECT, + ApiSequence.INIT, + ApiSequence.ON_INIT, + ApiSequence.CONFIRM, + ApiSequence.ON_CONFIRM, + ApiSequence.ON_STATUS_PENDING, + ApiSequence.ON_STATUS_PACKED, + ApiSequence.ON_STATUS_PICKED, + ApiSequence.ON_STATUS_OUT_FOR_DELIVERY, + ApiSequence.ON_STATUS_DELIVERED, + ApiSequence.CANCEL, + ApiSequence.ON_CANCEL, + ] + const flow00ESequence = [ + ApiSequence.SEARCH, + ApiSequence.ON_SEARCH, + ApiSequence.SELECT, + ApiSequence.ON_SELECT, + ApiSequence.INIT, + ApiSequence.ON_INIT, + ApiSequence.CONFIRM, + ApiSequence.ON_CONFIRM, + ApiSequence.ON_STATUS_PENDING, + ApiSequence.ON_STATUS_PACKED, + ApiSequence.ON_STATUS_PICKED, + ApiSequence.UPDATE, + ] + const flow012Sequence = [ + ApiSequence.SEARCH, + ApiSequence.ON_SEARCH, + ApiSequence.SELECT, + ApiSequence.ON_SELECT, + ApiSequence.INIT, + ApiSequence.ON_INIT, + ApiSequence.CONFIRM, + ApiSequence.ON_CONFIRM, + ApiSequence.ON_STATUS_PENDING, + ApiSequence.ON_STATUS_PACKED, + ApiSequence.ON_STATUS_PICKED, + ApiSequence.ON_STATUS_OUT_FOR_DELIVERY, + ApiSequence.ON_STATUS_DELIVERED, + ] + const flow016Sequence = [ + ApiSequence.SEARCH, + ApiSequence.ON_SEARCH, + ApiSequence.SELECT, + ApiSequence.ON_SELECT, + ApiSequence.INIT, + ApiSequence.ON_INIT, + ApiSequence.CONFIRM, + ApiSequence.ON_CONFIRM, + + ] + const flow01FSequence = [ + ApiSequence.SEARCH, + ApiSequence.ON_SEARCH, + ApiSequence.SELECT, + ApiSequence.ON_SELECT, + ApiSequence.INIT, + ApiSequence.ON_INIT, + ApiSequence.CONFIRM, + ApiSequence.ON_CONFIRM, + + ] + const flow00CSequence= [ + ApiSequence.SEARCH, + ApiSequence.ON_SEARCH, + ApiSequence.SELECT, + ApiSequence.ON_SELECT, + ApiSequence.INIT, + ApiSequence.ON_INIT, + ApiSequence.CONFIRM, + ApiSequence.ON_CONFIRM, + ApiSequence.ON_STATUS_PENDING, + ApiSequence.ON_STATUS_PACKED, + ApiSequence.ON_STATUS_PICKED, + ApiSequence.ON_STATUS_OUT_FOR_DELIVERY, + ApiSequence.ON_STATUS_DELIVERED, + ApiSequence.UPDATE, + // ApiSequence.ON_UPDATE_INTERIM_REVERSE_QC, + // ApiSequence.ON_UPDATE_APPROVAL, + // ApiSequence.ON_UPDATE_REPLACEMENT, + // ApiSequence.REPLACEMENT_ON_STATUS_PENDING, + // ApiSequence.REPLACEMENT_ON_STATUS_PACKED, + // ApiSequence.REPLACEMENT_ON_STATUS_PICKED, + // ApiSequence.REPLACEMENT_ON_STATUS_OUT_FOR_DELIVERY, + // ApiSequence.REPLACEMENT_ON_STATUS_DELIVERED, + ] + + const processApiSequence = (apiSequence: any, data: any, logReport: any, msgIdSet: any, flow: string) => { + if (validFlows.includes(flow)) { + apiSequence.forEach((apiSeq: any) => { + if (data[apiSeq]) { + const resp = getResponse(apiSeq, data[apiSeq], msgIdSet, flow) + if (!_.isEmpty(resp)) { + logReport = { ...logReport, [apiSeq]: resp } + } + } else { + logReport = { ...logReport, [apiSeq]: `Missing required data of : ${apiSeq}` } + } + }) + logger.info(logReport, 'Report Generated Successfully!!') + return logReport + } else { + return { invldFlow: 'Provided flow is invalid' } + } + } + const getResponse = (apiSeq: any, data: any, msgIdSet: any, flow: string) => { + switch (apiSeq) { + case ApiSequence.SEARCH: + return checkSearch(data, msgIdSet) + case ApiSequence.ON_SEARCH: + if (domain === 'ONDC:RET11') { + return checkOnsearchFullCatalogRefresh(data) + } else { + return checkOnsearch(data, flow) + } + case ApiSequence.INC_SEARCH: + return checkSearchIncremental(data, msgIdSet) + case ApiSequence.INC_ONSEARCH: + return checkOnsearchIncremental(data, msgIdSet) + case ApiSequence.SELECT: + if (flow === FLOW.FLOW3) { + return checkSelect_OOS(data, msgIdSet) + } else { + return checkSelect(data, msgIdSet, ApiSequence.SELECT) + } + case ApiSequence.ON_SELECT: + return checkOnSelect(data,flow) + case ApiSequence.SELECT_OUT_OF_STOCK: + return checkSelect(data, msgIdSet, ApiSequence.SELECT_OUT_OF_STOCK) + case ApiSequence.ON_SELECT_OUT_OF_STOCK: + return checkOnSelect_OOS(data) + case ApiSequence.INIT: + return checkInit(data, msgIdSet,flow) + case ApiSequence.ON_INIT: + return checkOnInit(data, flow) + case ApiSequence.CONFIRM: + return checkConfirm(data, msgIdSet, flow) + case ApiSequence.ON_CONFIRM: + return checkOnConfirm(data, fulfillmentsItemsSet, flow) + case ApiSequence.CANCEL: + return checkCancel(data, msgIdSet, flow) + case ApiSequence.ON_CANCEL: + return checkOnCancel(data, msgIdSet) + case ApiSequence.ON_STATUS_RTO_DELIVERED: + return checkOnStatusRTODelivered(data) + case ApiSequence.STATUS: + return checkStatus(data) + case ApiSequence.ON_STATUS_PENDING: + return checkOnStatusPending(data, 'pending', msgIdSet, fulfillmentsItemsSet) + case ApiSequence.REPLACEMENT_ON_STATUS_PENDING: + return checkOnStatusPending(data, 'replacement_on_status_pending',msgIdSet,fulfillmentsItemsSet) + case ApiSequence.ON_STATUS_PACKED: + return checkOnStatusPacked(data, 'packed', msgIdSet, fulfillmentsItemsSet) + case ApiSequence.REPLACEMENT_ON_STATUS_PACKED: + return checkOnStatusPacked(data, 'replacement_on_status_packed', msgIdSet, fulfillmentsItemsSet) + case ApiSequence.ON_STATUS_PICKED: + return checkOnStatusPicked(data, 'picked', msgIdSet, fulfillmentsItemsSet) + case ApiSequence.REPLACEMENT_ON_STATUS_PICKED: + return checkOnStatusPicked(data, 'replacement_on_status_picked', msgIdSet, fulfillmentsItemsSet) + case ApiSequence.ON_STATUS_OUT_FOR_DELIVERY: + return checkOnStatusOutForDelivery(data, 'out-for-delivery', msgIdSet, fulfillmentsItemsSet) + case ApiSequence.REPLACEMENT_ON_STATUS_OUT_FOR_DELIVERY: + return checkOnStatusOutForDelivery(data, 'replacement_on_status_out_for_delivery', msgIdSet, fulfillmentsItemsSet) + case ApiSequence.ON_STATUS_DELIVERED: + return checkOnStatusDelivered(data, 'delivered', msgIdSet, fulfillmentsItemsSet) + case ApiSequence.REPLACEMENT_ON_STATUS_DELIVERED: + return checkOnStatusDelivered(data, 'replacement_on_status_delivered', msgIdSet, fulfillmentsItemsSet) + case ApiSequence.UPDATE: + return checkUpdate(data, msgIdSet, ApiSequence.UPDATE, settlementDetatilSet, flow) + case ApiSequence.UPDATE_ADDRESS: + return checkUpdate(data, msgIdSet, ApiSequence.UPDATE_ADDRESS, settlementDetatilSet, flow) + case ApiSequence.UPDATE_INSTRUCTIONS: + return checkUpdate(data, msgIdSet, ApiSequence.UPDATE_INSTRUCTIONS, settlementDetatilSet, flow) + case ApiSequence.ON_UPDATE_PART_CANCEL: + return checkOnUpdate( + data, + msgIdSet, + ApiSequence.ON_UPDATE_PART_CANCEL, + settlementDetatilSet, + quoteTrailItemsSet, + fulfillmentsItemsSet, + '6-a', + ) + case ApiSequence.UPDATE_SETTLEMENT_PART_CANCEL: + return checkUpdate(data, msgIdSet, ApiSequence.UPDATE_SETTLEMENT_PART_CANCEL, settlementDetatilSet, '6-a') + case ApiSequence.UPDATE_REVERSE_QC: + return checkUpdate(data, msgIdSet, ApiSequence.UPDATE_REVERSE_QC, settlementDetatilSet, '6-b') + case ApiSequence.UPDATE_REPLACEMENT: + return checkUpdate(data, msgIdSet, ApiSequence.UPDATE_REPLACEMENT, settlementDetatilSet, '00B') + case ApiSequence.ON_UPDATE_INTERIM_REVERSE_QC: + return checkOnUpdate( + data, + msgIdSet, + ApiSequence.ON_UPDATE_INTERIM_REVERSE_QC, + settlementDetatilSet, + quoteTrailItemsSet, + fulfillmentsItemsSet, + '6-b', + ) + case ApiSequence.ON_UPDATE_ADDRESS: + return checkOnUpdate( + data, + msgIdSet, + ApiSequence.ON_UPDATE_ADDRESS, + settlementDetatilSet, + quoteTrailItemsSet, + fulfillmentsItemsSet, + flow, + ) + case ApiSequence.ON_UPDATE_INSTRUCTIONS: + return checkOnUpdate( + data, + msgIdSet, + ApiSequence.ON_UPDATE_INSTRUCTIONS, + settlementDetatilSet, + quoteTrailItemsSet, + fulfillmentsItemsSet, + flow, + ) + case ApiSequence.ON_UPDATE_ADDRESS: + return checkOnUpdate( + data, + msgIdSet, + ApiSequence.ON_UPDATE_ADDRESS, + settlementDetatilSet, + quoteTrailItemsSet, + fulfillmentsItemsSet, + flow, + ) + case ApiSequence.ON_UPDATE_INSTRUCTIONS: + return checkOnUpdate( + data, + msgIdSet, + ApiSequence.ON_UPDATE_INSTRUCTIONS, + settlementDetatilSet, + quoteTrailItemsSet, + fulfillmentsItemsSet, + flow, + ) + case ApiSequence.ON_UPDATE_APPROVAL: + return checkOnUpdate( + data, + msgIdSet, + ApiSequence.ON_UPDATE_APPROVAL, + settlementDetatilSet, + quoteTrailItemsSet, + fulfillmentsItemsSet, + '6-b', + ) + case ApiSequence.ON_UPDATE_REPLACEMENT: + return checkOnUpdate( + data, + msgIdSet, + ApiSequence.ON_UPDATE_REPLACEMENT, + settlementDetatilSet, + quoteTrailItemsSet, + fulfillmentsItemsSet, + '00B', + ) + case ApiSequence.ON_UPDATE_PICKED: + return checkOnUpdate( + data, + msgIdSet, + ApiSequence.ON_UPDATE_PICKED, + settlementDetatilSet, + quoteTrailItemsSet, + fulfillmentsItemsSet, + '6-b', + ) + case ApiSequence.UPDATE_SETTLEMENT_REVERSE_QC: + return checkUpdate(data, msgIdSet, ApiSequence.UPDATE_SETTLEMENT_REVERSE_QC, settlementDetatilSet, '6-b') + case ApiSequence.ON_UPDATE_DELIVERED: + return checkOnUpdate( + data, + msgIdSet, + ApiSequence.ON_UPDATE_DELIVERED, + settlementDetatilSet, + quoteTrailItemsSet, + fulfillmentsItemsSet, + '6-b', + ) + case ApiSequence.ON_UPDATE: + return checkOnUpdate( + data, + msgIdSet, + ApiSequence.ON_UPDATE, + settlementDetatilSet, + quoteTrailItemsSet, + fulfillmentsItemsSet, + flow, + ) + case ApiSequence.UPDATE_LIQUIDATED: + return checkUpdate(data, msgIdSet, ApiSequence.UPDATE_LIQUIDATED, settlementDetatilSet, '6-c') + case ApiSequence.ON_UPDATE_INTERIM_LIQUIDATED: + return checkOnUpdate( + data, + msgIdSet, + ApiSequence.ON_UPDATE_INTERIM_LIQUIDATED, + settlementDetatilSet, + quoteTrailItemsSet, + fulfillmentsItemsSet, + '6-c', + ) + case ApiSequence.ON_UPDATE_LIQUIDATED: + return checkOnUpdate( + data, + msgIdSet, + ApiSequence.ON_UPDATE_LIQUIDATED, + settlementDetatilSet, + quoteTrailItemsSet, + fulfillmentsItemsSet, + '6-c', + ) + case ApiSequence.UPDATE_SETTLEMENT_LIQUIDATED: + return checkUpdate(data, msgIdSet, ApiSequence.UPDATE_SETTLEMENT_LIQUIDATED, settlementDetatilSet, '6-c') + case ApiSequence.TRACK: + return checkTrack(data) + case ApiSequence.ON_TRACK: + return checkOnTrack(data) + case ApiSequence.CATALOG_REJECTION: + return checkCatalogRejection(data) + default: + return null + } + } + switch (flow) { + case FLOW.FLOW1: + logReport = processApiSequence(flowOneSequence, data, logReport, msgIdSet, flow) + break + case FLOW.FLOW2: + logReport = processApiSequence(flowTwoSequence, data, logReport, msgIdSet, flow) + break + case FLOW.FLOW012: + logReport = processApiSequence(flow012Sequence, data, logReport, msgIdSet, flow) + break + case FLOW.FLOW3: + logReport = processApiSequence(flowThreeSequence, data, logReport, msgIdSet, flow) + break + case FLOW.FLOW4: + logReport = processApiSequence(flowFourSequence, data, logReport, msgIdSet, flow) + break + case FLOW.FLOW5: + logReport = processApiSequence(flowFiveSequence, data, logReport, msgIdSet, flow) + break + case FLOW.FLOW6: + logReport = processApiSequence(flowSixSequence, data, logReport, msgIdSet, flow) + break + case FLOW.FLOW7: + logReport = processApiSequence(flowSevenSequence, data, logReport, msgIdSet, flow) + break + case FLOW.FLOW8: + logReport = processApiSequence(flowEightSequence, data, logReport, msgIdSet, flow) + break + case FLOW.FLOW9: + logReport = processApiSequence(flowNineSequence, data, logReport, msgIdSet, flow) + break + case OFFERSFLOW.FLOW0091: + logReport = processApiSequence(flowOfferTypeDiscountSequence, data, logReport, msgIdSet, flow) + break + case OFFERSFLOW.FLOW0092: + logReport = processApiSequence(flowOfferTypebuyXgetYSequence, data, logReport, msgIdSet, flow) + break + case OFFERSFLOW.FLOW0093: + logReport = processApiSequence(flowOfferTypeFreebieSequence, data, logReport, msgIdSet, flow) + break + case OFFERSFLOW.FLOW0094: + logReport = processApiSequence(flowOfferTypeSlabSequence, data, logReport, msgIdSet, flow) + break + case OFFERSFLOW.FLOW0095: + logReport = processApiSequence(flowOfferTypeComboSequence, data, logReport, msgIdSet, flow) + break + case OFFERSFLOW.FLOW0096: + logReport = processApiSequence(flowOfferTypeDeliverySequence, data, logReport, msgIdSet, flow) + break + case OFFERSFLOW.FLOW0097: + logReport = processApiSequence(flowOfferTypeExchangeSequence, data, logReport, msgIdSet, flow) + break + case OFFERSFLOW.FLOW0098: + logReport = processApiSequence(flowOfferTypeFinancingSequence, data, logReport, msgIdSet, flow) + break + case FLOW.FLOW020: + logReport = processApiSequence(flow020Sequence, data, logReport, msgIdSet, flow) + break + case FLOW.FLOW00B: + logReport = processApiSequence(flowReplacementSequence,data,logReport,msgIdSet,flow) + break + case FLOW.FLOW01C: + logReport = processApiSequence(flow01CSequence, data, logReport, msgIdSet, flow) + break + case FLOW.FLOW008: + logReport = processApiSequence(flow008Sequence, data, logReport, msgIdSet, flow) + break + case FLOW.FLOW003: + logReport = processApiSequence(flow003Sequence, data, logReport, msgIdSet, flow) + break + case FLOW.FLOW00F: + logReport = processApiSequence(flow00FSequence, data, logReport, msgIdSet, flow) + break + case FLOW.FLOW011: + logReport = processApiSequence(flow011Sequence, data, logReport, msgIdSet, flow) + break + case FLOW.FLOW017: + logReport = processApiSequence(flow017Sequence, data, logReport, msgIdSet, flow) + break + case FLOW.FLOW00D: + logReport = processApiSequence(flow00DSequence, data, logReport, msgIdSet, flow) + break + case FLOW.FLOW00E: + logReport = processApiSequence(flow00ESequence, data, logReport, msgIdSet, flow) + break + case FLOW.FLOW012: + logReport = processApiSequence(flow012Sequence, data, logReport, msgIdSet, flow) + break + case FLOW.FLOW016: + logReport = processApiSequence(flow016Sequence, data, logReport, msgIdSet, flow) + break + case FLOW.FLOW01F: + logReport = processApiSequence(flow01FSequence, data, logReport, msgIdSet, flow) + break + case FLOW.FLOW00C: + logReport = processApiSequence(flow00CSequence,data,logReport,msgIdSet,'00C') + } + } catch (error: any) { + logger.error(error.message) + return error.message + } + + return logReport +} +export const validateActionSchema = (data: any, domain: string, action: string) => { + const errorObj: any = {} + + if (domain === 'ONDC:RET11') { + const schemaError = validateSchema('RET11', action, data) + if (schemaError !== 'error') Object.assign(errorObj, schemaError) + return isObjectEmpty(errorObj) ? false : errorObj + } else { + const schemaError = validateSchema('RET10', action, data) + if (schemaError !== 'error') Object.assign(errorObj, schemaError) + return isObjectEmpty(errorObj) ? false : errorObj + } +} diff --git a/tsconfig.json b/tsconfig.json index d4e97628..46a7672e 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,7 +4,7 @@ "incremental": true, "target": "es6", "module": "commonjs", - "outDir": "dist", + "outDir": "ui", "resolveJsonModule": true, /* Strict Type-Checking Options */ diff --git a/ui/assets/index-Cg5AU1QF.js b/ui/assets/index-Cg5AU1QF.js new file mode 100644 index 00000000..1c9bfb00 --- /dev/null +++ b/ui/assets/index-Cg5AU1QF.js @@ -0,0 +1,1668 @@ +var CR=Object.defineProperty;var $R=(e,t,n)=>t in e?CR(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var hi=(e,t,n)=>$R(e,typeof t!="symbol"?t+"":t,n);function t1(e,t){for(var n=0;nr[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const l of o.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();var ho=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Cc(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var rp={exports:{}},Tl={},ip={exports:{}},qt={};/** + * @license React + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var fb;function xR(){if(fb)return qt;fb=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),l=Symbol.for("react.context"),m=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),s=Symbol.for("react.lazy"),c=Symbol.iterator;function d(H){return H===null||typeof H!="object"?null:(H=c&&H[c]||H["@@iterator"],typeof H=="function"?H:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},f=Object.assign,v={};function y(H,Y,U){this.props=H,this.context=Y,this.refs=v,this.updater=U||h}y.prototype.isReactComponent={},y.prototype.setState=function(H,Y){if(typeof H!="object"&&typeof H!="function"&&H!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,H,Y,"setState")},y.prototype.forceUpdate=function(H){this.updater.enqueueForceUpdate(this,H,"forceUpdate")};function b(){}b.prototype=y.prototype;function w(H,Y,U){this.props=H,this.context=Y,this.refs=v,this.updater=U||h}var x=w.prototype=new b;x.constructor=w,f(x,y.prototype),x.isPureReactComponent=!0;var E=Array.isArray,_=Object.prototype.hasOwnProperty,$={current:null},O={key:!0,ref:!0,__self:!0,__source:!0};function N(H,Y,U){var K,G={},q=null,Z=null;if(Y!=null)for(K in Y.ref!==void 0&&(Z=Y.ref),Y.key!==void 0&&(q=""+Y.key),Y)_.call(Y,K)&&!O.hasOwnProperty(K)&&(G[K]=Y[K]);var Q=arguments.length-2;if(Q===1)G.children=U;else if(1>>1,Y=j[H];if(0>>1;Hi(G,V))qi(Z,G)?(j[H]=Z,j[q]=V,H=q):(j[H]=G,j[K]=V,H=K);else if(qi(Z,V))j[H]=Z,j[q]=V,H=q;else break e}}return B}function i(j,B){var V=j.sortIndex-B.sortIndex;return V!==0?V:j.id-B.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var l=Date,m=l.now();e.unstable_now=function(){return l.now()-m}}var u=[],p=[],s=1,c=null,d=3,h=!1,f=!1,v=!1,y=typeof setTimeout=="function"?setTimeout:null,b=typeof clearTimeout=="function"?clearTimeout:null,w=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function x(j){for(var B=n(p);B!==null;){if(B.callback===null)r(p);else if(B.startTime<=j)r(p),B.sortIndex=B.expirationTime,t(u,B);else break;B=n(p)}}function E(j){if(v=!1,x(j),!f)if(n(u)!==null)f=!0,I(_);else{var B=n(p);B!==null&&D(E,B.startTime-j)}}function _(j,B){f=!1,v&&(v=!1,b(N),N=-1),h=!0;var V=d;try{for(x(B),c=n(u);c!==null&&(!(c.expirationTime>B)||j&&!F());){var H=c.callback;if(typeof H=="function"){c.callback=null,d=c.priorityLevel;var Y=H(c.expirationTime<=B);B=e.unstable_now(),typeof Y=="function"?c.callback=Y:c===n(u)&&r(u),x(B)}else r(u);c=n(u)}if(c!==null)var U=!0;else{var K=n(p);K!==null&&D(E,K.startTime-B),U=!1}return U}finally{c=null,d=V,h=!1}}var $=!1,O=null,N=-1,k=5,L=-1;function F(){return!(e.unstable_now()-Lj||125H?(j.sortIndex=V,t(p,j),n(u)===null&&j===n(p)&&(v?(b(N),N=-1):v=!0,D(E,V-H))):(j.sortIndex=Y,t(u,j),f||h||(f=!0,I(_))),j},e.unstable_shouldYield=F,e.unstable_wrapCallback=function(j){var B=d;return function(){var V=d;d=B;try{return j.apply(this,arguments)}finally{d=V}}}}(sp)),sp}var vb;function RR(){return vb||(vb=1,ap.exports=MR()),ap.exports}/** + * @license React + * react-dom.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var yb;function OR(){if(yb)return oi;yb=1;var e=Xs(),t=RR();function n(a){for(var g="https://reactjs.org/docs/error-decoder.html?invariant="+a,S=1;S"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),u=Object.prototype.hasOwnProperty,p=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,s={},c={};function d(a){return u.call(c,a)?!0:u.call(s,a)?!1:p.test(a)?c[a]=!0:(s[a]=!0,!1)}function h(a,g,S,T){if(S!==null&&S.type===0)return!1;switch(typeof g){case"function":case"symbol":return!0;case"boolean":return T?!1:S!==null?!S.acceptsBooleans:(a=a.toLowerCase().slice(0,5),a!=="data-"&&a!=="aria-");default:return!1}}function f(a,g,S,T){if(g===null||typeof g>"u"||h(a,g,S,T))return!0;if(T)return!1;if(S!==null)switch(S.type){case 3:return!g;case 4:return g===!1;case 5:return isNaN(g);case 6:return isNaN(g)||1>g}return!1}function v(a,g,S,T,z,W,X){this.acceptsBooleans=g===2||g===3||g===4,this.attributeName=T,this.attributeNamespace=z,this.mustUseProperty=S,this.propertyName=a,this.type=g,this.sanitizeURL=W,this.removeEmptyString=X}var y={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(a){y[a]=new v(a,0,!1,a,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(a){var g=a[0];y[g]=new v(g,1,!1,a[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(a){y[a]=new v(a,2,!1,a.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(a){y[a]=new v(a,2,!1,a,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(a){y[a]=new v(a,3,!1,a.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(a){y[a]=new v(a,3,!0,a,null,!1,!1)}),["capture","download"].forEach(function(a){y[a]=new v(a,4,!1,a,null,!1,!1)}),["cols","rows","size","span"].forEach(function(a){y[a]=new v(a,6,!1,a,null,!1,!1)}),["rowSpan","start"].forEach(function(a){y[a]=new v(a,5,!1,a.toLowerCase(),null,!1,!1)});var b=/[\-:]([a-z])/g;function w(a){return a[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(a){var g=a.replace(b,w);y[g]=new v(g,1,!1,a,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(a){var g=a.replace(b,w);y[g]=new v(g,1,!1,a,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(a){var g=a.replace(b,w);y[g]=new v(g,1,!1,a,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(a){y[a]=new v(a,1,!1,a.toLowerCase(),null,!1,!1)}),y.xlinkHref=new v("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(a){y[a]=new v(a,1,!1,a.toLowerCase(),null,!0,!0)});function x(a,g,S,T){var z=y.hasOwnProperty(g)?y[g]:null;(z!==null?z.type!==0:T||!(2re||z[X]!==W[re]){var le=` +`+z[X].replace(" at new "," at ");return a.displayName&&le.includes("")&&(le=le.replace("",a.displayName)),le}while(1<=X&&0<=re);break}}}finally{U=!1,Error.prepareStackTrace=S}return(a=a?a.displayName||a.name:"")?Y(a):""}function G(a){switch(a.tag){case 5:return Y(a.type);case 16:return Y("Lazy");case 13:return Y("Suspense");case 19:return Y("SuspenseList");case 0:case 2:case 15:return a=K(a.type,!1),a;case 11:return a=K(a.type.render,!1),a;case 1:return a=K(a.type,!0),a;default:return""}}function q(a){if(a==null)return null;if(typeof a=="function")return a.displayName||a.name||null;if(typeof a=="string")return a;switch(a){case O:return"Fragment";case $:return"Portal";case k:return"Profiler";case N:return"StrictMode";case A:return"Suspense";case M:return"SuspenseList"}if(typeof a=="object")switch(a.$$typeof){case F:return(a.displayName||"Context")+".Consumer";case L:return(a._context.displayName||"Context")+".Provider";case P:var g=a.render;return a=a.displayName,a||(a=g.displayName||g.name||"",a=a!==""?"ForwardRef("+a+")":"ForwardRef"),a;case R:return g=a.displayName||null,g!==null?g:q(a.type)||"Memo";case I:g=a._payload,a=a._init;try{return q(a(g))}catch{}}return null}function Z(a){var g=a.type;switch(a.tag){case 24:return"Cache";case 9:return(g.displayName||"Context")+".Consumer";case 10:return(g._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return a=g.render,a=a.displayName||a.name||"",g.displayName||(a!==""?"ForwardRef("+a+")":"ForwardRef");case 7:return"Fragment";case 5:return g;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return q(g);case 8:return g===N?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof g=="function")return g.displayName||g.name||null;if(typeof g=="string")return g}return null}function Q(a){switch(typeof a){case"boolean":case"number":case"string":case"undefined":return a;case"object":return a;default:return""}}function J(a){var g=a.type;return(a=a.nodeName)&&a.toLowerCase()==="input"&&(g==="checkbox"||g==="radio")}function ie(a){var g=J(a)?"checked":"value",S=Object.getOwnPropertyDescriptor(a.constructor.prototype,g),T=""+a[g];if(!a.hasOwnProperty(g)&&typeof S<"u"&&typeof S.get=="function"&&typeof S.set=="function"){var z=S.get,W=S.set;return Object.defineProperty(a,g,{configurable:!0,get:function(){return z.call(this)},set:function(X){T=""+X,W.call(this,X)}}),Object.defineProperty(a,g,{enumerable:S.enumerable}),{getValue:function(){return T},setValue:function(X){T=""+X},stopTracking:function(){a._valueTracker=null,delete a[g]}}}}function se(a){a._valueTracker||(a._valueTracker=ie(a))}function ae(a){if(!a)return!1;var g=a._valueTracker;if(!g)return!0;var S=g.getValue(),T="";return a&&(T=J(a)?a.checked?"true":"false":a.value),a=T,a!==S?(g.setValue(a),!0):!1}function ge(a){if(a=a||(typeof document<"u"?document:void 0),typeof a>"u")return null;try{return a.activeElement||a.body}catch{return a.body}}function me(a,g){var S=g.checked;return V({},g,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:S??a._wrapperState.initialChecked})}function de(a,g){var S=g.defaultValue==null?"":g.defaultValue,T=g.checked!=null?g.checked:g.defaultChecked;S=Q(g.value!=null?g.value:S),a._wrapperState={initialChecked:T,initialValue:S,controlled:g.type==="checkbox"||g.type==="radio"?g.checked!=null:g.value!=null}}function we(a,g){g=g.checked,g!=null&&x(a,"checked",g,!1)}function Oe(a,g){we(a,g);var S=Q(g.value),T=g.type;if(S!=null)T==="number"?(S===0&&a.value===""||a.value!=S)&&(a.value=""+S):a.value!==""+S&&(a.value=""+S);else if(T==="submit"||T==="reset"){a.removeAttribute("value");return}g.hasOwnProperty("value")?Pe(a,g.type,S):g.hasOwnProperty("defaultValue")&&Pe(a,g.type,Q(g.defaultValue)),g.checked==null&&g.defaultChecked!=null&&(a.defaultChecked=!!g.defaultChecked)}function xe(a,g,S){if(g.hasOwnProperty("value")||g.hasOwnProperty("defaultValue")){var T=g.type;if(!(T!=="submit"&&T!=="reset"||g.value!==void 0&&g.value!==null))return;g=""+a._wrapperState.initialValue,S||g===a.value||(a.value=g),a.defaultValue=g}S=a.name,S!==""&&(a.name=""),a.defaultChecked=!!a._wrapperState.initialChecked,S!==""&&(a.name=S)}function Pe(a,g,S){(g!=="number"||ge(a.ownerDocument)!==a)&&(S==null?a.defaultValue=""+a._wrapperState.initialValue:a.defaultValue!==""+S&&(a.defaultValue=""+S))}var ze=Array.isArray;function Ie(a,g,S,T){if(a=a.options,g){g={};for(var z=0;z"+g.valueOf().toString()+"",g=Re.firstChild;a.firstChild;)a.removeChild(a.firstChild);for(;g.firstChild;)a.appendChild(g.firstChild)}});function De(a,g){if(g){var S=a.firstChild;if(S&&S===a.lastChild&&S.nodeType===3){S.nodeValue=g;return}}a.textContent=g}var He={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},it=["Webkit","ms","Moz","O"];Object.keys(He).forEach(function(a){it.forEach(function(g){g=g+a.charAt(0).toUpperCase()+a.substring(1),He[g]=He[a]})});function Ne(a,g,S){return g==null||typeof g=="boolean"||g===""?"":S||typeof g!="number"||g===0||He.hasOwnProperty(a)&&He[a]?(""+g).trim():g+"px"}function Te(a,g){a=a.style;for(var S in g)if(g.hasOwnProperty(S)){var T=S.indexOf("--")===0,z=Ne(S,g[S],T);S==="float"&&(S="cssFloat"),T?a.setProperty(S,z):a[S]=z}}var We=V({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function te(a,g){if(g){if(We[a]&&(g.children!=null||g.dangerouslySetInnerHTML!=null))throw Error(n(137,a));if(g.dangerouslySetInnerHTML!=null){if(g.children!=null)throw Error(n(60));if(typeof g.dangerouslySetInnerHTML!="object"||!("__html"in g.dangerouslySetInnerHTML))throw Error(n(61))}if(g.style!=null&&typeof g.style!="object")throw Error(n(62))}}function fe(a,g){if(a.indexOf("-")===-1)return typeof g.is=="string";switch(a){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var je=null;function ct(a){return a=a.target||a.srcElement||window,a.correspondingUseElement&&(a=a.correspondingUseElement),a.nodeType===3?a.parentNode:a}var Jt=null,kt=null,rn=null;function Qt(a){if(a=ml(a)){if(typeof Jt!="function")throw Error(n(280));var g=a.stateNode;g&&(g=qc(g),Jt(a.stateNode,a.type,g))}}function Lt(a){kt?rn?rn.push(a):rn=[a]:kt=a}function Nt(){if(kt){var a=kt,g=rn;if(rn=kt=null,Qt(a),g)for(a=0;a>>=0,a===0?32:31-(Gn(a)/qn|0)|0}var Mr=64,Ln=4194304;function Rr(a){switch(a&-a){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return a&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return a}}function Vt(a,g){var S=a.pendingLanes;if(S===0)return 0;var T=0,z=a.suspendedLanes,W=a.pingedLanes,X=S&268435455;if(X!==0){var re=X&~z;re!==0?T=Rr(re):(W&=X,W!==0&&(T=Rr(W)))}else X=S&~z,X!==0?T=Rr(X):W!==0&&(T=Rr(W));if(T===0)return 0;if(g!==0&&g!==T&&(g&z)===0&&(z=T&-T,W=g&-g,z>=W||z===16&&(W&4194240)!==0))return g;if((T&4)!==0&&(T|=S&16),g=a.entangledLanes,g!==0)for(a=a.entanglements,g&=T;0S;S++)g.push(a);return g}function un(a,g,S){a.pendingLanes|=g,g!==536870912&&(a.suspendedLanes=0,a.pingedLanes=0),a=a.eventTimes,g=31-Fn(g),a[g]=S}function dr(a,g){var S=a.pendingLanes&~g;a.pendingLanes=g,a.suspendedLanes=0,a.pingedLanes=0,a.expiredLanes&=g,a.mutableReadLanes&=g,a.entangledLanes&=g,g=a.entanglements;var T=a.eventTimes;for(a=a.expirationTimes;0=sl),oy=" ",ay=!1;function sy(a,g){switch(a){case"keyup":return vM.indexOf(g.keyCode)!==-1;case"keydown":return g.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ly(a){return a=a.detail,typeof a=="object"&&"data"in a?a.data:null}var Qa=!1;function bM(a,g){switch(a){case"compositionend":return ly(g);case"keypress":return g.which!==32?null:(ay=!0,oy);case"textInput":return a=g.data,a===oy&&ay?null:a;default:return null}}function wM(a,g){if(Qa)return a==="compositionend"||!Df&&sy(a,g)?(a=Jr(),vr=Mn=Tn=null,Qa=!1,a):null;switch(a){case"paste":return null;case"keypress":if(!(g.ctrlKey||g.altKey||g.metaKey)||g.ctrlKey&&g.altKey){if(g.char&&1=g)return{node:S,offset:g-a};a=T}e:{for(;S;){if(S.nextSibling){S=S.nextSibling;break e}S=S.parentNode}S=void 0}S=gy(S)}}function vy(a,g){return a&&g?a===g?!0:a&&a.nodeType===3?!1:g&&g.nodeType===3?vy(a,g.parentNode):"contains"in a?a.contains(g):a.compareDocumentPosition?!!(a.compareDocumentPosition(g)&16):!1:!1}function yy(){for(var a=window,g=ge();g instanceof a.HTMLIFrameElement;){try{var S=typeof g.contentWindow.location.href=="string"}catch{S=!1}if(S)a=g.contentWindow;else break;g=ge(a.document)}return g}function jf(a){var g=a&&a.nodeName&&a.nodeName.toLowerCase();return g&&(g==="input"&&(a.type==="text"||a.type==="search"||a.type==="tel"||a.type==="url"||a.type==="password")||g==="textarea"||a.contentEditable==="true")}function OM(a){var g=yy(),S=a.focusedElem,T=a.selectionRange;if(g!==S&&S&&S.ownerDocument&&vy(S.ownerDocument.documentElement,S)){if(T!==null&&jf(S)){if(g=T.start,a=T.end,a===void 0&&(a=g),"selectionStart"in S)S.selectionStart=g,S.selectionEnd=Math.min(a,S.value.length);else if(a=(g=S.ownerDocument||document)&&g.defaultView||window,a.getSelection){a=a.getSelection();var z=S.textContent.length,W=Math.min(T.start,z);T=T.end===void 0?W:Math.min(T.end,z),!a.extend&&W>T&&(z=T,T=W,W=z),z=my(S,W);var X=my(S,T);z&&X&&(a.rangeCount!==1||a.anchorNode!==z.node||a.anchorOffset!==z.offset||a.focusNode!==X.node||a.focusOffset!==X.offset)&&(g=g.createRange(),g.setStart(z.node,z.offset),a.removeAllRanges(),W>T?(a.addRange(g),a.extend(X.node,X.offset)):(g.setEnd(X.node,X.offset),a.addRange(g)))}}for(g=[],a=S;a=a.parentNode;)a.nodeType===1&&g.push({element:a,left:a.scrollLeft,top:a.scrollTop});for(typeof S.focus=="function"&&S.focus(),S=0;S=document.documentMode,Za=null,Bf=null,dl=null,Hf=!1;function by(a,g,S){var T=S.window===S?S.document:S.nodeType===9?S:S.ownerDocument;Hf||Za==null||Za!==ge(T)||(T=Za,"selectionStart"in T&&jf(T)?T={start:T.selectionStart,end:T.selectionEnd}:(T=(T.ownerDocument&&T.ownerDocument.defaultView||window).getSelection(),T={anchorNode:T.anchorNode,anchorOffset:T.anchorOffset,focusNode:T.focusNode,focusOffset:T.focusOffset}),dl&&ul(dl,T)||(dl=T,T=Kc(Bf,"onSelect"),0rs||(a.current=eh[rs],eh[rs]=null,rs--)}function In(a,g){rs++,eh[rs]=a.current,a.current=g}var Bo={},Nr=jo(Bo),ei=jo(!1),ya=Bo;function is(a,g){var S=a.type.contextTypes;if(!S)return Bo;var T=a.stateNode;if(T&&T.__reactInternalMemoizedUnmaskedChildContext===g)return T.__reactInternalMemoizedMaskedChildContext;var z={},W;for(W in S)z[W]=g[W];return T&&(a=a.stateNode,a.__reactInternalMemoizedUnmaskedChildContext=g,a.__reactInternalMemoizedMaskedChildContext=z),z}function ti(a){return a=a.childContextTypes,a!=null}function Qc(){kn(ei),kn(Nr)}function Py(a,g,S){if(Nr.current!==Bo)throw Error(n(168));In(Nr,g),In(ei,S)}function ky(a,g,S){var T=a.stateNode;if(g=g.childContextTypes,typeof T.getChildContext!="function")return S;T=T.getChildContext();for(var z in T)if(!(z in g))throw Error(n(108,Z(a)||"Unknown",z));return V({},S,T)}function Zc(a){return a=(a=a.stateNode)&&a.__reactInternalMemoizedMergedChildContext||Bo,ya=Nr.current,In(Nr,a),In(ei,ei.current),!0}function Ny(a,g,S){var T=a.stateNode;if(!T)throw Error(n(169));S?(a=ky(a,g,ya),T.__reactInternalMemoizedMergedChildContext=a,kn(ei),kn(Nr),In(Nr,a)):kn(ei),In(ei,S)}var yo=null,Jc=!1,th=!1;function Dy(a){yo===null?yo=[a]:yo.push(a)}function BM(a){Jc=!0,Dy(a)}function Ho(){if(!th&&yo!==null){th=!0;var a=0,g=Ot;try{var S=yo;for(Ot=1;a>=X,z-=X,bo=1<<32-Fn(g)+z|S<It?(wr=Rt,Rt=null):wr=Rt.sibling;var pn=Be(ye,Rt,Se[It],Qe);if(pn===null){Rt===null&&(Rt=wr);break}a&&Rt&&pn.alternate===null&&g(ye,Rt),ue=W(pn,ue,It),Mt===null?$t=pn:Mt.sibling=pn,Mt=pn,Rt=wr}if(It===Se.length)return S(ye,Rt),jn&&wa(ye,It),$t;if(Rt===null){for(;ItIt?(wr=Rt,Rt=null):wr=Rt.sibling;var Qo=Be(ye,Rt,pn.value,Qe);if(Qo===null){Rt===null&&(Rt=wr);break}a&&Rt&&Qo.alternate===null&&g(ye,Rt),ue=W(Qo,ue,It),Mt===null?$t=Qo:Mt.sibling=Qo,Mt=Qo,Rt=wr}if(pn.done)return S(ye,Rt),jn&&wa(ye,It),$t;if(Rt===null){for(;!pn.done;It++,pn=Se.next())pn=Ue(ye,pn.value,Qe),pn!==null&&(ue=W(pn,ue,It),Mt===null?$t=pn:Mt.sibling=pn,Mt=pn);return jn&&wa(ye,It),$t}for(Rt=T(ye,Rt);!pn.done;It++,pn=Se.next())pn=ht(Rt,ye,It,pn.value,Qe),pn!==null&&(a&&pn.alternate!==null&&Rt.delete(pn.key===null?It:pn.key),ue=W(pn,ue,It),Mt===null?$t=pn:Mt.sibling=pn,Mt=pn);return a&&Rt.forEach(function(SR){return g(ye,SR)}),jn&&wa(ye,It),$t}function Jn(ye,ue,Se,Qe){if(typeof Se=="object"&&Se!==null&&Se.type===O&&Se.key===null&&(Se=Se.props.children),typeof Se=="object"&&Se!==null){switch(Se.$$typeof){case _:e:{for(var $t=Se.key,Mt=ue;Mt!==null;){if(Mt.key===$t){if($t=Se.type,$t===O){if(Mt.tag===7){S(ye,Mt.sibling),ue=z(Mt,Se.props.children),ue.return=ye,ye=ue;break e}}else if(Mt.elementType===$t||typeof $t=="object"&&$t!==null&&$t.$$typeof===I&&Wy($t)===Mt.type){S(ye,Mt.sibling),ue=z(Mt,Se.props),ue.ref=vl(ye,Mt,Se),ue.return=ye,ye=ue;break e}S(ye,Mt);break}else g(ye,Mt);Mt=Mt.sibling}Se.type===O?(ue=Ra(Se.props.children,ye.mode,Qe,Se.key),ue.return=ye,ye=ue):(Qe=Mu(Se.type,Se.key,Se.props,null,ye.mode,Qe),Qe.ref=vl(ye,ue,Se),Qe.return=ye,ye=Qe)}return X(ye);case $:e:{for(Mt=Se.key;ue!==null;){if(ue.key===Mt)if(ue.tag===4&&ue.stateNode.containerInfo===Se.containerInfo&&ue.stateNode.implementation===Se.implementation){S(ye,ue.sibling),ue=z(ue,Se.children||[]),ue.return=ye,ye=ue;break e}else{S(ye,ue);break}else g(ye,ue);ue=ue.sibling}ue=Zh(Se,ye.mode,Qe),ue.return=ye,ye=ue}return X(ye);case I:return Mt=Se._init,Jn(ye,ue,Mt(Se._payload),Qe)}if(ze(Se))return bt(ye,ue,Se,Qe);if(B(Se))return St(ye,ue,Se,Qe);ru(ye,Se)}return typeof Se=="string"&&Se!==""||typeof Se=="number"?(Se=""+Se,ue!==null&&ue.tag===6?(S(ye,ue.sibling),ue=z(ue,Se),ue.return=ye,ye=ue):(S(ye,ue),ue=Qh(Se,ye.mode,Qe),ue.return=ye,ye=ue),X(ye)):S(ye,ue)}return Jn}var ls=Vy(!0),Uy=Vy(!1),iu=jo(null),ou=null,cs=null,sh=null;function lh(){sh=cs=ou=null}function ch(a){var g=iu.current;kn(iu),a._currentValue=g}function uh(a,g,S){for(;a!==null;){var T=a.alternate;if((a.childLanes&g)!==g?(a.childLanes|=g,T!==null&&(T.childLanes|=g)):T!==null&&(T.childLanes&g)!==g&&(T.childLanes|=g),a===S)break;a=a.return}}function us(a,g){ou=a,sh=cs=null,a=a.dependencies,a!==null&&a.firstContext!==null&&((a.lanes&g)!==0&&(ni=!0),a.firstContext=null)}function Ei(a){var g=a._currentValue;if(sh!==a)if(a={context:a,memoizedValue:g,next:null},cs===null){if(ou===null)throw Error(n(308));cs=a,ou.dependencies={lanes:0,firstContext:a}}else cs=cs.next=a;return g}var Sa=null;function dh(a){Sa===null?Sa=[a]:Sa.push(a)}function Gy(a,g,S,T){var z=g.interleaved;return z===null?(S.next=S,dh(g)):(S.next=z.next,z.next=S),g.interleaved=S,So(a,T)}function So(a,g){a.lanes|=g;var S=a.alternate;for(S!==null&&(S.lanes|=g),S=a,a=a.return;a!==null;)a.childLanes|=g,S=a.alternate,S!==null&&(S.childLanes|=g),S=a,a=a.return;return S.tag===3?S.stateNode:null}var Wo=!1;function fh(a){a.updateQueue={baseState:a.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Ky(a,g){a=a.updateQueue,g.updateQueue===a&&(g.updateQueue={baseState:a.baseState,firstBaseUpdate:a.firstBaseUpdate,lastBaseUpdate:a.lastBaseUpdate,shared:a.shared,effects:a.effects})}function Co(a,g){return{eventTime:a,lane:g,tag:0,payload:null,callback:null,next:null}}function Vo(a,g,S){var T=a.updateQueue;if(T===null)return null;if(T=T.shared,(dn&2)!==0){var z=T.pending;return z===null?g.next=g:(g.next=z.next,z.next=g),T.pending=g,So(a,S)}return z=T.interleaved,z===null?(g.next=g,dh(T)):(g.next=z.next,z.next=g),T.interleaved=g,So(a,S)}function au(a,g,S){if(g=g.updateQueue,g!==null&&(g=g.shared,(S&4194240)!==0)){var T=g.lanes;T&=a.pendingLanes,S|=T,g.lanes=S,zn(a,S)}}function Yy(a,g){var S=a.updateQueue,T=a.alternate;if(T!==null&&(T=T.updateQueue,S===T)){var z=null,W=null;if(S=S.firstBaseUpdate,S!==null){do{var X={eventTime:S.eventTime,lane:S.lane,tag:S.tag,payload:S.payload,callback:S.callback,next:null};W===null?z=W=X:W=W.next=X,S=S.next}while(S!==null);W===null?z=W=g:W=W.next=g}else z=W=g;S={baseState:T.baseState,firstBaseUpdate:z,lastBaseUpdate:W,shared:T.shared,effects:T.effects},a.updateQueue=S;return}a=S.lastBaseUpdate,a===null?S.firstBaseUpdate=g:a.next=g,S.lastBaseUpdate=g}function su(a,g,S,T){var z=a.updateQueue;Wo=!1;var W=z.firstBaseUpdate,X=z.lastBaseUpdate,re=z.shared.pending;if(re!==null){z.shared.pending=null;var le=re,Ce=le.next;le.next=null,X===null?W=Ce:X.next=Ce,X=le;var Ve=a.alternate;Ve!==null&&(Ve=Ve.updateQueue,re=Ve.lastBaseUpdate,re!==X&&(re===null?Ve.firstBaseUpdate=Ce:re.next=Ce,Ve.lastBaseUpdate=le))}if(W!==null){var Ue=z.baseState;X=0,Ve=Ce=le=null,re=W;do{var Be=re.lane,ht=re.eventTime;if((T&Be)===Be){Ve!==null&&(Ve=Ve.next={eventTime:ht,lane:0,tag:re.tag,payload:re.payload,callback:re.callback,next:null});e:{var bt=a,St=re;switch(Be=g,ht=S,St.tag){case 1:if(bt=St.payload,typeof bt=="function"){Ue=bt.call(ht,Ue,Be);break e}Ue=bt;break e;case 3:bt.flags=bt.flags&-65537|128;case 0:if(bt=St.payload,Be=typeof bt=="function"?bt.call(ht,Ue,Be):bt,Be==null)break e;Ue=V({},Ue,Be);break e;case 2:Wo=!0}}re.callback!==null&&re.lane!==0&&(a.flags|=64,Be=z.effects,Be===null?z.effects=[re]:Be.push(re))}else ht={eventTime:ht,lane:Be,tag:re.tag,payload:re.payload,callback:re.callback,next:null},Ve===null?(Ce=Ve=ht,le=Ue):Ve=Ve.next=ht,X|=Be;if(re=re.next,re===null){if(re=z.shared.pending,re===null)break;Be=re,re=Be.next,Be.next=null,z.lastBaseUpdate=Be,z.shared.pending=null}}while(!0);if(Ve===null&&(le=Ue),z.baseState=le,z.firstBaseUpdate=Ce,z.lastBaseUpdate=Ve,g=z.shared.interleaved,g!==null){z=g;do X|=z.lane,z=z.next;while(z!==g)}else W===null&&(z.shared.lanes=0);xa|=X,a.lanes=X,a.memoizedState=Ue}}function Xy(a,g,S){if(a=g.effects,g.effects=null,a!==null)for(g=0;gS?S:4,a(!0);var T=vh.transition;vh.transition={};try{a(!1),g()}finally{Ot=S,vh.transition=T}}function p0(){return _i().memoizedState}function UM(a,g,S){var T=Yo(a);if(S={lane:T,action:S,hasEagerState:!1,eagerState:null,next:null},g0(a))m0(g,S);else if(S=Gy(a,g,S,T),S!==null){var z=Yr();Vi(S,a,T,z),v0(S,g,T)}}function GM(a,g,S){var T=Yo(a),z={lane:T,action:S,hasEagerState:!1,eagerState:null,next:null};if(g0(a))m0(g,z);else{var W=a.alternate;if(a.lanes===0&&(W===null||W.lanes===0)&&(W=g.lastRenderedReducer,W!==null))try{var X=g.lastRenderedState,re=W(X,S);if(z.hasEagerState=!0,z.eagerState=re,zi(re,X)){var le=g.interleaved;le===null?(z.next=z,dh(g)):(z.next=le.next,le.next=z),g.interleaved=z;return}}catch{}finally{}S=Gy(a,g,z,T),S!==null&&(z=Yr(),Vi(S,a,T,z),v0(S,g,T))}}function g0(a){var g=a.alternate;return a===Vn||g!==null&&g===Vn}function m0(a,g){Sl=uu=!0;var S=a.pending;S===null?g.next=g:(g.next=S.next,S.next=g),a.pending=g}function v0(a,g,S){if((S&4194240)!==0){var T=g.lanes;T&=a.pendingLanes,S|=T,g.lanes=S,zn(a,S)}}var hu={readContext:Ei,useCallback:Dr,useContext:Dr,useEffect:Dr,useImperativeHandle:Dr,useInsertionEffect:Dr,useLayoutEffect:Dr,useMemo:Dr,useReducer:Dr,useRef:Dr,useState:Dr,useDebugValue:Dr,useDeferredValue:Dr,useTransition:Dr,useMutableSource:Dr,useSyncExternalStore:Dr,useId:Dr,unstable_isNewReconciler:!1},KM={readContext:Ei,useCallback:function(a,g){return so().memoizedState=[a,g===void 0?null:g],a},useContext:Ei,useEffect:a0,useImperativeHandle:function(a,g,S){return S=S!=null?S.concat([a]):null,du(4194308,4,c0.bind(null,g,a),S)},useLayoutEffect:function(a,g){return du(4194308,4,a,g)},useInsertionEffect:function(a,g){return du(4,2,a,g)},useMemo:function(a,g){var S=so();return g=g===void 0?null:g,a=a(),S.memoizedState=[a,g],a},useReducer:function(a,g,S){var T=so();return g=S!==void 0?S(g):g,T.memoizedState=T.baseState=g,a={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:a,lastRenderedState:g},T.queue=a,a=a.dispatch=UM.bind(null,Vn,a),[T.memoizedState,a]},useRef:function(a){var g=so();return a={current:a},g.memoizedState=a},useState:i0,useDebugValue:xh,useDeferredValue:function(a){return so().memoizedState=a},useTransition:function(){var a=i0(!1),g=a[0];return a=VM.bind(null,a[1]),so().memoizedState=a,[g,a]},useMutableSource:function(){},useSyncExternalStore:function(a,g,S){var T=Vn,z=so();if(jn){if(S===void 0)throw Error(n(407));S=S()}else{if(S=g(),br===null)throw Error(n(349));($a&30)!==0||Jy(T,g,S)}z.memoizedState=S;var W={value:S,getSnapshot:g};return z.queue=W,a0(t0.bind(null,T,W,a),[a]),T.flags|=2048,xl(9,e0.bind(null,T,W,S,g),void 0,null),S},useId:function(){var a=so(),g=br.identifierPrefix;if(jn){var S=wo,T=bo;S=(T&~(1<<32-Fn(T)-1)).toString(32)+S,g=":"+g+"R"+S,S=Cl++,0<\/script>",a=a.removeChild(a.firstChild)):typeof T.is=="string"?a=X.createElement(S,{is:T.is}):(a=X.createElement(S),S==="select"&&(X=a,T.multiple?X.multiple=!0:T.size&&(X.size=T.size))):a=X.createElementNS(a,S),a[oo]=g,a[gl]=T,D0(a,g,!1,!1),g.stateNode=a;e:{switch(X=fe(S,T),S){case"dialog":Pn("cancel",a),Pn("close",a),z=T;break;case"iframe":case"object":case"embed":Pn("load",a),z=T;break;case"video":case"audio":for(z=0;zgs&&(g.flags|=128,T=!0,El(W,!1),g.lanes=4194304)}else{if(!T)if(a=lu(X),a!==null){if(g.flags|=128,T=!0,S=a.updateQueue,S!==null&&(g.updateQueue=S,g.flags|=4),El(W,!0),W.tail===null&&W.tailMode==="hidden"&&!X.alternate&&!jn)return Fr(g),null}else 2*Le()-W.renderingStartTime>gs&&S!==1073741824&&(g.flags|=128,T=!0,El(W,!1),g.lanes=4194304);W.isBackwards?(X.sibling=g.child,g.child=X):(S=W.last,S!==null?S.sibling=X:g.child=X,W.last=X)}return W.tail!==null?(g=W.tail,W.rendering=g,W.tail=g.sibling,W.renderingStartTime=Le(),g.sibling=null,S=Wn.current,In(Wn,T?S&1|2:S&1),g):(Fr(g),null);case 22:case 23:return Yh(),T=g.memoizedState!==null,a!==null&&a.memoizedState!==null!==T&&(g.flags|=8192),T&&(g.mode&1)!==0?(fi&1073741824)!==0&&(Fr(g),g.subtreeFlags&6&&(g.flags|=8192)):Fr(g),null;case 24:return null;case 25:return null}throw Error(n(156,g.tag))}function tR(a,g){switch(rh(g),g.tag){case 1:return ti(g.type)&&Qc(),a=g.flags,a&65536?(g.flags=a&-65537|128,g):null;case 3:return ds(),kn(ei),kn(Nr),mh(),a=g.flags,(a&65536)!==0&&(a&128)===0?(g.flags=a&-65537|128,g):null;case 5:return ph(g),null;case 13:if(kn(Wn),a=g.memoizedState,a!==null&&a.dehydrated!==null){if(g.alternate===null)throw Error(n(340));ss()}return a=g.flags,a&65536?(g.flags=a&-65537|128,g):null;case 19:return kn(Wn),null;case 4:return ds(),null;case 10:return ch(g.type._context),null;case 22:case 23:return Yh(),null;case 24:return null;default:return null}}var vu=!1,zr=!1,nR=typeof WeakSet=="function"?WeakSet:Set,yt=null;function hs(a,g){var S=a.ref;if(S!==null)if(typeof S=="function")try{S(null)}catch(T){Xn(a,g,T)}else S.current=null}function Nh(a,g,S){try{S()}catch(T){Xn(a,g,T)}}var j0=!1;function rR(a,g){if(Yf=he,a=yy(),jf(a)){if("selectionStart"in a)var S={start:a.selectionStart,end:a.selectionEnd};else e:{S=(S=a.ownerDocument)&&S.defaultView||window;var T=S.getSelection&&S.getSelection();if(T&&T.rangeCount!==0){S=T.anchorNode;var z=T.anchorOffset,W=T.focusNode;T=T.focusOffset;try{S.nodeType,W.nodeType}catch{S=null;break e}var X=0,re=-1,le=-1,Ce=0,Ve=0,Ue=a,Be=null;t:for(;;){for(var ht;Ue!==S||z!==0&&Ue.nodeType!==3||(re=X+z),Ue!==W||T!==0&&Ue.nodeType!==3||(le=X+T),Ue.nodeType===3&&(X+=Ue.nodeValue.length),(ht=Ue.firstChild)!==null;)Be=Ue,Ue=ht;for(;;){if(Ue===a)break t;if(Be===S&&++Ce===z&&(re=X),Be===W&&++Ve===T&&(le=X),(ht=Ue.nextSibling)!==null)break;Ue=Be,Be=Ue.parentNode}Ue=ht}S=re===-1||le===-1?null:{start:re,end:le}}else S=null}S=S||{start:0,end:0}}else S=null;for(Xf={focusedElem:a,selectionRange:S},he=!1,yt=g;yt!==null;)if(g=yt,a=g.child,(g.subtreeFlags&1028)!==0&&a!==null)a.return=g,yt=a;else for(;yt!==null;){g=yt;try{var bt=g.alternate;if((g.flags&1024)!==0)switch(g.tag){case 0:case 11:case 15:break;case 1:if(bt!==null){var St=bt.memoizedProps,Jn=bt.memoizedState,ye=g.stateNode,ue=ye.getSnapshotBeforeUpdate(g.elementType===g.type?St:Bi(g.type,St),Jn);ye.__reactInternalSnapshotBeforeUpdate=ue}break;case 3:var Se=g.stateNode.containerInfo;Se.nodeType===1?Se.textContent="":Se.nodeType===9&&Se.documentElement&&Se.removeChild(Se.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(Qe){Xn(g,g.return,Qe)}if(a=g.sibling,a!==null){a.return=g.return,yt=a;break}yt=g.return}return bt=j0,j0=!1,bt}function _l(a,g,S){var T=g.updateQueue;if(T=T!==null?T.lastEffect:null,T!==null){var z=T=T.next;do{if((z.tag&a)===a){var W=z.destroy;z.destroy=void 0,W!==void 0&&Nh(g,S,W)}z=z.next}while(z!==T)}}function yu(a,g){if(g=g.updateQueue,g=g!==null?g.lastEffect:null,g!==null){var S=g=g.next;do{if((S.tag&a)===a){var T=S.create;S.destroy=T()}S=S.next}while(S!==g)}}function Dh(a){var g=a.ref;if(g!==null){var S=a.stateNode;switch(a.tag){case 5:a=S;break;default:a=S}typeof g=="function"?g(a):g.current=a}}function B0(a){var g=a.alternate;g!==null&&(a.alternate=null,B0(g)),a.child=null,a.deletions=null,a.sibling=null,a.tag===5&&(g=a.stateNode,g!==null&&(delete g[oo],delete g[gl],delete g[Jf],delete g[zM],delete g[jM])),a.stateNode=null,a.return=null,a.dependencies=null,a.memoizedProps=null,a.memoizedState=null,a.pendingProps=null,a.stateNode=null,a.updateQueue=null}function H0(a){return a.tag===5||a.tag===3||a.tag===4}function W0(a){e:for(;;){for(;a.sibling===null;){if(a.return===null||H0(a.return))return null;a=a.return}for(a.sibling.return=a.return,a=a.sibling;a.tag!==5&&a.tag!==6&&a.tag!==18;){if(a.flags&2||a.child===null||a.tag===4)continue e;a.child.return=a,a=a.child}if(!(a.flags&2))return a.stateNode}}function Fh(a,g,S){var T=a.tag;if(T===5||T===6)a=a.stateNode,g?S.nodeType===8?S.parentNode.insertBefore(a,g):S.insertBefore(a,g):(S.nodeType===8?(g=S.parentNode,g.insertBefore(a,S)):(g=S,g.appendChild(a)),S=S._reactRootContainer,S!=null||g.onclick!==null||(g.onclick=Xc));else if(T!==4&&(a=a.child,a!==null))for(Fh(a,g,S),a=a.sibling;a!==null;)Fh(a,g,S),a=a.sibling}function zh(a,g,S){var T=a.tag;if(T===5||T===6)a=a.stateNode,g?S.insertBefore(a,g):S.appendChild(a);else if(T!==4&&(a=a.child,a!==null))for(zh(a,g,S),a=a.sibling;a!==null;)zh(a,g,S),a=a.sibling}var Tr=null,Hi=!1;function Uo(a,g,S){for(S=S.child;S!==null;)V0(a,g,S),S=S.sibling}function V0(a,g,S){if(ln&&typeof ln.onCommitFiberUnmount=="function")try{ln.onCommitFiberUnmount($n,S)}catch{}switch(S.tag){case 5:zr||hs(S,g);case 6:var T=Tr,z=Hi;Tr=null,Uo(a,g,S),Tr=T,Hi=z,Tr!==null&&(Hi?(a=Tr,S=S.stateNode,a.nodeType===8?a.parentNode.removeChild(S):a.removeChild(S)):Tr.removeChild(S.stateNode));break;case 18:Tr!==null&&(Hi?(a=Tr,S=S.stateNode,a.nodeType===8?Zf(a.parentNode,S):a.nodeType===1&&Zf(a,S),Ci(a)):Zf(Tr,S.stateNode));break;case 4:T=Tr,z=Hi,Tr=S.stateNode.containerInfo,Hi=!0,Uo(a,g,S),Tr=T,Hi=z;break;case 0:case 11:case 14:case 15:if(!zr&&(T=S.updateQueue,T!==null&&(T=T.lastEffect,T!==null))){z=T=T.next;do{var W=z,X=W.destroy;W=W.tag,X!==void 0&&((W&2)!==0||(W&4)!==0)&&Nh(S,g,X),z=z.next}while(z!==T)}Uo(a,g,S);break;case 1:if(!zr&&(hs(S,g),T=S.stateNode,typeof T.componentWillUnmount=="function"))try{T.props=S.memoizedProps,T.state=S.memoizedState,T.componentWillUnmount()}catch(re){Xn(S,g,re)}Uo(a,g,S);break;case 21:Uo(a,g,S);break;case 22:S.mode&1?(zr=(T=zr)||S.memoizedState!==null,Uo(a,g,S),zr=T):Uo(a,g,S);break;default:Uo(a,g,S)}}function U0(a){var g=a.updateQueue;if(g!==null){a.updateQueue=null;var S=a.stateNode;S===null&&(S=a.stateNode=new nR),g.forEach(function(T){var z=fR.bind(null,a,T);S.has(T)||(S.add(T),T.then(z,z))})}}function Wi(a,g){var S=g.deletions;if(S!==null)for(var T=0;Tz&&(z=X),T&=~W}if(T=z,T=Le()-T,T=(120>T?120:480>T?480:1080>T?1080:1920>T?1920:3e3>T?3e3:4320>T?4320:1960*oR(T/1960))-T,10a?16:a,Ko===null)var T=!1;else{if(a=Ko,Ko=null,$u=0,(dn&6)!==0)throw Error(n(331));var z=dn;for(dn|=4,yt=a.current;yt!==null;){var W=yt,X=W.child;if((yt.flags&16)!==0){var re=W.deletions;if(re!==null){for(var le=0;leLe()-Hh?_a(a,0):Bh|=S),ii(a,g)}function ib(a,g){g===0&&((a.mode&1)===0?g=1:(g=Ln,Ln<<=1,(Ln&130023424)===0&&(Ln=4194304)));var S=Yr();a=So(a,g),a!==null&&(un(a,g,S),ii(a,S))}function dR(a){var g=a.memoizedState,S=0;g!==null&&(S=g.retryLane),ib(a,S)}function fR(a,g){var S=0;switch(a.tag){case 13:var T=a.stateNode,z=a.memoizedState;z!==null&&(S=z.retryLane);break;case 19:T=a.stateNode;break;default:throw Error(n(314))}T!==null&&T.delete(g),ib(a,S)}var ob;ob=function(a,g,S){if(a!==null)if(a.memoizedProps!==g.pendingProps||ei.current)ni=!0;else{if((a.lanes&S)===0&&(g.flags&128)===0)return ni=!1,JM(a,g,S);ni=(a.flags&131072)!==0}else ni=!1,jn&&(g.flags&1048576)!==0&&Fy(g,tu,g.index);switch(g.lanes=0,g.tag){case 2:var T=g.type;mu(a,g),a=g.pendingProps;var z=is(g,Nr.current);us(g,S),z=bh(null,g,T,a,z,S);var W=wh();return g.flags|=1,typeof z=="object"&&z!==null&&typeof z.render=="function"&&z.$$typeof===void 0?(g.tag=1,g.memoizedState=null,g.updateQueue=null,ti(T)?(W=!0,Zc(g)):W=!1,g.memoizedState=z.state!==null&&z.state!==void 0?z.state:null,fh(g),z.updater=pu,g.stateNode=z,z._reactInternals=g,_h(g,T,a,S),g=Ah(null,g,T,!0,W,S)):(g.tag=0,jn&&W&&nh(g),Kr(null,g,z,S),g=g.child),g;case 16:T=g.elementType;e:{switch(mu(a,g),a=g.pendingProps,z=T._init,T=z(T._payload),g.type=T,z=g.tag=pR(T),a=Bi(T,a),z){case 0:g=Oh(null,g,T,a,S);break e;case 1:g=T0(null,g,T,a,S);break e;case 11:g=_0(null,g,T,a,S);break e;case 14:g=M0(null,g,T,Bi(T.type,a),S);break e}throw Error(n(306,T,""))}return g;case 0:return T=g.type,z=g.pendingProps,z=g.elementType===T?z:Bi(T,z),Oh(a,g,T,z,S);case 1:return T=g.type,z=g.pendingProps,z=g.elementType===T?z:Bi(T,z),T0(a,g,T,z,S);case 3:e:{if(I0(g),a===null)throw Error(n(387));T=g.pendingProps,W=g.memoizedState,z=W.element,Ky(a,g),su(g,T,null,S);var X=g.memoizedState;if(T=X.element,W.isDehydrated)if(W={element:T,isDehydrated:!1,cache:X.cache,pendingSuspenseBoundaries:X.pendingSuspenseBoundaries,transitions:X.transitions},g.updateQueue.baseState=W,g.memoizedState=W,g.flags&256){z=fs(Error(n(423)),g),g=L0(a,g,T,S,z);break e}else if(T!==z){z=fs(Error(n(424)),g),g=L0(a,g,T,S,z);break e}else for(di=zo(g.stateNode.containerInfo.firstChild),ui=g,jn=!0,ji=null,S=Uy(g,null,T,S),g.child=S;S;)S.flags=S.flags&-3|4096,S=S.sibling;else{if(ss(),T===z){g=$o(a,g,S);break e}Kr(a,g,T,S)}g=g.child}return g;case 5:return qy(g),a===null&&oh(g),T=g.type,z=g.pendingProps,W=a!==null?a.memoizedProps:null,X=z.children,qf(T,z)?X=null:W!==null&&qf(T,W)&&(g.flags|=32),A0(a,g),Kr(a,g,X,S),g.child;case 6:return a===null&&oh(g),null;case 13:return P0(a,g,S);case 4:return hh(g,g.stateNode.containerInfo),T=g.pendingProps,a===null?g.child=ls(g,null,T,S):Kr(a,g,T,S),g.child;case 11:return T=g.type,z=g.pendingProps,z=g.elementType===T?z:Bi(T,z),_0(a,g,T,z,S);case 7:return Kr(a,g,g.pendingProps,S),g.child;case 8:return Kr(a,g,g.pendingProps.children,S),g.child;case 12:return Kr(a,g,g.pendingProps.children,S),g.child;case 10:e:{if(T=g.type._context,z=g.pendingProps,W=g.memoizedProps,X=z.value,In(iu,T._currentValue),T._currentValue=X,W!==null)if(zi(W.value,X)){if(W.children===z.children&&!ei.current){g=$o(a,g,S);break e}}else for(W=g.child,W!==null&&(W.return=g);W!==null;){var re=W.dependencies;if(re!==null){X=W.child;for(var le=re.firstContext;le!==null;){if(le.context===T){if(W.tag===1){le=Co(-1,S&-S),le.tag=2;var Ce=W.updateQueue;if(Ce!==null){Ce=Ce.shared;var Ve=Ce.pending;Ve===null?le.next=le:(le.next=Ve.next,Ve.next=le),Ce.pending=le}}W.lanes|=S,le=W.alternate,le!==null&&(le.lanes|=S),uh(W.return,S,g),re.lanes|=S;break}le=le.next}}else if(W.tag===10)X=W.type===g.type?null:W.child;else if(W.tag===18){if(X=W.return,X===null)throw Error(n(341));X.lanes|=S,re=X.alternate,re!==null&&(re.lanes|=S),uh(X,S,g),X=W.sibling}else X=W.child;if(X!==null)X.return=W;else for(X=W;X!==null;){if(X===g){X=null;break}if(W=X.sibling,W!==null){W.return=X.return,X=W;break}X=X.return}W=X}Kr(a,g,z.children,S),g=g.child}return g;case 9:return z=g.type,T=g.pendingProps.children,us(g,S),z=Ei(z),T=T(z),g.flags|=1,Kr(a,g,T,S),g.child;case 14:return T=g.type,z=Bi(T,g.pendingProps),z=Bi(T.type,z),M0(a,g,T,z,S);case 15:return R0(a,g,g.type,g.pendingProps,S);case 17:return T=g.type,z=g.pendingProps,z=g.elementType===T?z:Bi(T,z),mu(a,g),g.tag=1,ti(T)?(a=!0,Zc(g)):a=!1,us(g,S),b0(g,T,z),_h(g,T,z,S),Ah(null,g,T,!0,a,S);case 19:return N0(a,g,S);case 22:return O0(a,g,S)}throw Error(n(156,g.tag))};function ab(a,g){return Kt(a,g)}function hR(a,g,S,T){this.tag=a,this.key=S,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=g,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=T,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ri(a,g,S,T){return new hR(a,g,S,T)}function qh(a){return a=a.prototype,!(!a||!a.isReactComponent)}function pR(a){if(typeof a=="function")return qh(a)?1:0;if(a!=null){if(a=a.$$typeof,a===P)return 11;if(a===R)return 14}return 2}function qo(a,g){var S=a.alternate;return S===null?(S=Ri(a.tag,g,a.key,a.mode),S.elementType=a.elementType,S.type=a.type,S.stateNode=a.stateNode,S.alternate=a,a.alternate=S):(S.pendingProps=g,S.type=a.type,S.flags=0,S.subtreeFlags=0,S.deletions=null),S.flags=a.flags&14680064,S.childLanes=a.childLanes,S.lanes=a.lanes,S.child=a.child,S.memoizedProps=a.memoizedProps,S.memoizedState=a.memoizedState,S.updateQueue=a.updateQueue,g=a.dependencies,S.dependencies=g===null?null:{lanes:g.lanes,firstContext:g.firstContext},S.sibling=a.sibling,S.index=a.index,S.ref=a.ref,S}function Mu(a,g,S,T,z,W){var X=2;if(T=a,typeof a=="function")qh(a)&&(X=1);else if(typeof a=="string")X=5;else e:switch(a){case O:return Ra(S.children,z,W,g);case N:X=8,z|=8;break;case k:return a=Ri(12,S,g,z|2),a.elementType=k,a.lanes=W,a;case A:return a=Ri(13,S,g,z),a.elementType=A,a.lanes=W,a;case M:return a=Ri(19,S,g,z),a.elementType=M,a.lanes=W,a;case D:return Ru(S,z,W,g);default:if(typeof a=="object"&&a!==null)switch(a.$$typeof){case L:X=10;break e;case F:X=9;break e;case P:X=11;break e;case R:X=14;break e;case I:X=16,T=null;break e}throw Error(n(130,a==null?a:typeof a,""))}return g=Ri(X,S,g,z),g.elementType=a,g.type=T,g.lanes=W,g}function Ra(a,g,S,T){return a=Ri(7,a,T,g),a.lanes=S,a}function Ru(a,g,S,T){return a=Ri(22,a,T,g),a.elementType=D,a.lanes=S,a.stateNode={isHidden:!1},a}function Qh(a,g,S){return a=Ri(6,a,null,g),a.lanes=S,a}function Zh(a,g,S){return g=Ri(4,a.children!==null?a.children:[],a.key,g),g.lanes=S,g.stateNode={containerInfo:a.containerInfo,pendingChildren:null,implementation:a.implementation},g}function gR(a,g,S,T,z){this.tag=g,this.containerInfo=a,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=an(0),this.expirationTimes=an(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=an(0),this.identifierPrefix=T,this.onRecoverableError=z,this.mutableSourceEagerHydrationData=null}function Jh(a,g,S,T,z,W,X,re,le){return a=new gR(a,g,S,re,le),g===1?(g=1,W===!0&&(g|=8)):g=0,W=Ri(3,null,null,g),a.current=W,W.stateNode=a,W.memoizedState={element:T,isDehydrated:S,cache:null,transitions:null,pendingSuspenseBoundaries:null},fh(W),a}function mR(a,g,S){var T=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),op.exports=OR(),op.exports}var wb;function AR(){if(wb)return ku;wb=1;var e=n1();return ku.createRoot=e.createRoot,ku.hydrateRoot=e.hydrateRoot,ku}var TR=AR(),Hr=function(){return Hr=Object.assign||function(t){for(var n,r=1,i=arguments.length;r0?xr(qs,--Ni):0,zs--,sr===10&&(zs=1,Ud--),sr}function Xi(){return sr=Ni2||bg(sr)>3?"":" "}function BR(e,t){for(;--t&&Xi()&&!(sr<48||sr>102||sr>57&&sr<65||sr>70&&sr<97););return Kd(e,td()+(t<6&&Na()==32&&Xi()==32))}function wg(e){for(;Xi();)switch(sr){case e:return Ni;case 34:case 39:e!==34&&e!==39&&wg(sr);break;case 40:e===41&&wg(e);break;case 92:Xi();break}return Ni}function HR(e,t){for(;Xi()&&e+sr!==57;)if(e+sr===84&&Na()===47)break;return"/*"+Kd(t,Ni-1)+"*"+qm(e===47?e:Xi())}function WR(e){for(;!bg(Na());)Xi();return Kd(e,Ni)}function VR(e){return zR(nd("",null,null,null,[""],e=FR(e),0,[0],e))}function nd(e,t,n,r,i,o,l,m,u){for(var p=0,s=0,c=l,d=0,h=0,f=0,v=1,y=1,b=1,w=0,x="",E=i,_=o,$=r,O=x;y;)switch(f=w,w=Xi()){case 40:if(f!=108&&xr(O,c-1)==58){ed(O+=Wt(lp(w),"&","&\f"),"&\f",o1(p?m[p-1]:0))!=-1&&(b=-1);break}case 34:case 39:case 91:O+=lp(w);break;case 9:case 10:case 13:case 32:O+=jR(f);break;case 92:O+=BR(td()-1,7);continue;case 47:switch(Na()){case 42:case 47:Hl(UR(HR(Xi(),td()),t,n,u),u);break;default:O+="/"}break;case 123*v:m[p++]=fo(O)*b;case 125*v:case 59:case 0:switch(w){case 0:case 125:y=0;case 59+s:b==-1&&(O=Wt(O,/\f/g,"")),h>0&&fo(O)-c&&Hl(h>32?$b(O+";",r,n,c-1,u):$b(Wt(O," ","")+";",r,n,c-2,u),u);break;case 59:O+=";";default:if(Hl($=Cb(O,t,n,p,s,i,m,x,E=[],_=[],c,o),o),w===123)if(s===0)nd(O,t,$,$,E,o,c,m,_);else switch(d===99&&xr(O,3)===110?100:d){case 100:case 108:case 109:case 115:nd(e,$,$,r&&Hl(Cb(e,$,$,0,0,i,m,x,i,E=[],c,_),_),i,_,c,m,r?E:_);break;default:nd(O,$,$,$,[""],_,0,m,_)}}p=s=h=0,v=b=1,x=O="",c=l;break;case 58:c=1+fo(O),h=f;default:if(v<1){if(w==123)--v;else if(w==125&&v++==0&&DR()==125)continue}switch(O+=qm(w),w*v){case 38:b=s>0?1:(O+="\f",-1);break;case 44:m[p++]=(fo(O)-1)*b,b=1;break;case 64:Na()===45&&(O+=lp(Xi())),d=Na(),s=c=fo(x=O+=WR(td())),w++;break;case 45:f===45&&fo(O)==2&&(v=0)}}return o}function Cb(e,t,n,r,i,o,l,m,u,p,s,c){for(var d=i-1,h=i===0?o:[""],f=s1(h),v=0,y=0,b=0;v0?h[w]+" "+x:Wt(x,/&\f/g,h[w])))&&(u[b++]=E);return Gd(e,t,n,i===0?Vd:m,u,p,s,c)}function UR(e,t,n,r){return Gd(e,t,n,r1,qm(NR()),Fs(e,2,-2),0,r)}function $b(e,t,n,r,i){return Gd(e,t,n,Xm,Fs(e,0,r),Fs(e,r+1,-1),r,i)}function c1(e,t,n){switch(PR(e,t)){case 5103:return vn+"print-"+e+e;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return vn+e+e;case 4789:return Kl+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return vn+e+Kl+e+Nn+e+e;case 5936:switch(xr(e,t+11)){case 114:return vn+e+Nn+Wt(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return vn+e+Nn+Wt(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return vn+e+Nn+Wt(e,/[svh]\w+-[tblr]{2}/,"lr")+e}case 6828:case 4268:case 2903:return vn+e+Nn+e+e;case 6165:return vn+e+Nn+"flex-"+e+e;case 5187:return vn+e+Wt(e,/(\w+).+(:[^]+)/,vn+"box-$1$2"+Nn+"flex-$1$2")+e;case 5443:return vn+e+Nn+"flex-item-"+Wt(e,/flex-|-self/g,"")+(Eo(e,/flex-|baseline/)?"":Nn+"grid-row-"+Wt(e,/flex-|-self/g,""))+e;case 4675:return vn+e+Nn+"flex-line-pack"+Wt(e,/align-content|flex-|-self/g,"")+e;case 5548:return vn+e+Nn+Wt(e,"shrink","negative")+e;case 5292:return vn+e+Nn+Wt(e,"basis","preferred-size")+e;case 6060:return vn+"box-"+Wt(e,"-grow","")+vn+e+Nn+Wt(e,"grow","positive")+e;case 4554:return vn+Wt(e,/([^-])(transform)/g,"$1"+vn+"$2")+e;case 6187:return Wt(Wt(Wt(e,/(zoom-|grab)/,vn+"$1"),/(image-set)/,vn+"$1"),e,"")+e;case 5495:case 3959:return Wt(e,/(image-set\([^]*)/,vn+"$1$`$1");case 4968:return Wt(Wt(e,/(.+:)(flex-)?(.*)/,vn+"box-pack:$3"+Nn+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+vn+e+e;case 4200:if(!Eo(e,/flex-|baseline/))return Nn+"grid-column-align"+Fs(e,t)+e;break;case 2592:case 3360:return Nn+Wt(e,"template-","")+e;case 4384:case 3616:return n&&n.some(function(r,i){return t=i,Eo(r.props,/grid-\w+-end/)})?~ed(e+(n=n[t].value),"span",0)?e:Nn+Wt(e,"-start","")+e+Nn+"grid-row-span:"+(~ed(n,"span",0)?Eo(n,/\d+/):+Eo(n,/\d+/)-+Eo(e,/\d+/))+";":Nn+Wt(e,"-start","")+e;case 4896:case 4128:return n&&n.some(function(r){return Eo(r.props,/grid-\w+-start/)})?e:Nn+Wt(Wt(e,"-end","-span"),"span ","")+e;case 4095:case 3583:case 4068:case 2532:return Wt(e,/(.+)-inline(.+)/,vn+"$1$2")+e;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(fo(e)-1-t>6)switch(xr(e,t+1)){case 109:if(xr(e,t+4)!==45)break;case 102:return Wt(e,/(.+:)(.+)-([^]+)/,"$1"+vn+"$2-$3$1"+Kl+(xr(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~ed(e,"stretch",0)?c1(Wt(e,"stretch","fill-available"),t,n)+e:e}break;case 5152:case 5920:return Wt(e,/(.+?):(\d+)(\s*\/\s*(span)?\s*(\d+))?(.*)/,function(r,i,o,l,m,u,p){return Nn+i+":"+o+p+(l?Nn+i+"-span:"+(m?u:+u-+o)+p:"")+e});case 4949:if(xr(e,t+6)===121)return Wt(e,":",":"+vn)+e;break;case 6444:switch(xr(e,xr(e,14)===45?18:11)){case 120:return Wt(e,/(.+:)([^;\s!]+)(;|(\s+)?!.+)?/,"$1"+vn+(xr(e,14)===45?"inline-":"")+"box$3$1"+vn+"$2$3$1"+Nn+"$2box$3")+e;case 100:return Wt(e,":",":"+Nn)+e}break;case 5719:case 2647:case 2135:case 3927:case 2391:return Wt(e,"scroll-","scroll-snap-")+e}return e}function Sd(e,t){for(var n="",r=0;r-1&&!e.return)switch(e.type){case Xm:e.return=c1(e.value,e.length,n);return;case i1:return Sd([ra(e,{value:Wt(e.value,"@","@"+vn)})],r);case Vd:if(e.length)return kR(n=e.props,function(i){switch(Eo(i,r=/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":vs(ra(e,{props:[Wt(i,/:(read-\w+)/,":"+Kl+"$1")]})),vs(ra(e,{props:[i]})),yg(e,{props:Sb(n,r)});break;case"::placeholder":vs(ra(e,{props:[Wt(i,/:(plac\w+)/,":"+vn+"input-$1")]})),vs(ra(e,{props:[Wt(i,/:(plac\w+)/,":"+Kl+"$1")]})),vs(ra(e,{props:[Wt(i,/:(plac\w+)/,Nn+"input-$1")]})),vs(ra(e,{props:[i]})),yg(e,{props:Sb(n,r)});break}return""})}}var qR={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},vi={},js=typeof process<"u"&&vi!==void 0&&(vi.REACT_APP_SC_ATTR||vi.SC_ATTR)||"data-styled",u1="active",d1="data-styled-version",Yd="6.1.18",Qm=`/*!sc*/ +`,Cd=typeof window<"u"&&typeof document<"u",QR=!!(typeof SC_DISABLE_SPEEDY=="boolean"?SC_DISABLE_SPEEDY:typeof process<"u"&&vi!==void 0&&vi.REACT_APP_SC_DISABLE_SPEEDY!==void 0&&vi.REACT_APP_SC_DISABLE_SPEEDY!==""?vi.REACT_APP_SC_DISABLE_SPEEDY!=="false"&&vi.REACT_APP_SC_DISABLE_SPEEDY:typeof process<"u"&&vi!==void 0&&vi.SC_DISABLE_SPEEDY!==void 0&&vi.SC_DISABLE_SPEEDY!==""&&vi.SC_DISABLE_SPEEDY!=="false"&&vi.SC_DISABLE_SPEEDY),ZR={},Xd=Object.freeze([]),Bs=Object.freeze({});function f1(e,t,n){return n===void 0&&(n=Bs),e.theme!==n.theme&&e.theme||t||n.theme}var h1=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","track","u","ul","use","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"]),JR=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,eO=/(^-|-$)/g;function xb(e){return e.replace(JR,"-").replace(eO,"")}var tO=/(a)(d)/gi,Nu=52,Eb=function(e){return String.fromCharCode(e+(e>25?39:97))};function Sg(e){var t,n="";for(t=Math.abs(e);t>Nu;t=t/Nu|0)n=Eb(t%Nu)+n;return(Eb(t%Nu)+n).replace(tO,"$1-$2")}var cp,p1=5381,As=function(e,t){for(var n=t.length;n;)e=33*e^t.charCodeAt(--n);return e},g1=function(e){return As(p1,e)};function m1(e){return Sg(g1(e)>>>0)}function nO(e){return e.displayName||e.name||"Component"}function up(e){return typeof e=="string"&&!0}var v1=typeof Symbol=="function"&&Symbol.for,y1=v1?Symbol.for("react.memo"):60115,rO=v1?Symbol.for("react.forward_ref"):60112,iO={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},oO={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},b1={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},aO=((cp={})[rO]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},cp[y1]=b1,cp);function _b(e){return("type"in(t=e)&&t.type.$$typeof)===y1?b1:"$$typeof"in e?aO[e.$$typeof]:iO;var t}var sO=Object.defineProperty,lO=Object.getOwnPropertyNames,Mb=Object.getOwnPropertySymbols,cO=Object.getOwnPropertyDescriptor,uO=Object.getPrototypeOf,Rb=Object.prototype;function w1(e,t,n){if(typeof t!="string"){if(Rb){var r=uO(t);r&&r!==Rb&&w1(e,r,n)}var i=lO(t);Mb&&(i=i.concat(Mb(t)));for(var o=_b(e),l=_b(t),m=0;m0?" Args: ".concat(t.join(", ")):""))}var dO=function(){function e(t){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=t}return e.prototype.indexOfGroup=function(t){for(var n=0,r=0;r=this.groupSizes.length){for(var r=this.groupSizes,i=r.length,o=i;t>=o;)if((o<<=1)<0)throw $c(16,"".concat(t));this.groupSizes=new Uint32Array(o),this.groupSizes.set(r),this.length=o;for(var l=i;l=this.length||this.groupSizes[t]===0)return n;for(var r=this.groupSizes[t],i=this.indexOfGroup(t),o=i+r,l=i;l=0){var r=document.createTextNode(n);return this.element.insertBefore(r,this.nodes[t]||null),this.length++,!0}return!1},e.prototype.deleteRule=function(t){this.element.removeChild(this.nodes[t]),this.length--},e.prototype.getRule=function(t){return t0&&(y+="".concat(b,","))}),u+="".concat(f).concat(v,'{content:"').concat(y,'"}').concat(Qm)},s=0;s0?".".concat(t):d},s=u.slice();s.push(function(d){d.type===Vd&&d.value.includes("&")&&(d.props[0]=d.props[0].replace(CO,n).replace(r,p))}),l.prefix&&s.push(XR),s.push(GR);var c=function(d,h,f,v){h===void 0&&(h=""),f===void 0&&(f=""),v===void 0&&(v="&"),t=v,n=h,r=new RegExp("\\".concat(n,"\\b"),"g");var y=d.replace($O,""),b=VR(f||h?"".concat(f," ").concat(h," { ").concat(y," }"):y);l.namespace&&(b=C1(b,l.namespace));var w=[];return Sd(b,KR(s.concat(YR(function(x){return w.push(x)})))),w};return c.hash=u.length?u.reduce(function(d,h){return h.name||$c(15),As(d,h.name)},p1).toString():"",c}var EO=new xd,xg=xO(),$1=be.createContext({shouldForwardProp:void 0,styleSheet:EO,stylis:xg});$1.Consumer;be.createContext(void 0);function Eg(){return C.useContext($1)}var _O=function(){function e(t,n){var r=this;this.inject=function(i,o){o===void 0&&(o=xg);var l=r.name+o.hash;i.hasNameForId(r.id,l)||i.insertRules(r.id,l,o(r.rules,l,"@keyframes"))},this.name=t,this.id="sc-keyframes-".concat(t),this.rules=n,Jm(this,function(){throw $c(12,String(r.name))})}return e.prototype.getName=function(t){return t===void 0&&(t=xg),this.name+t.hash},e}(),MO=function(e){return e>="A"&&e<="Z"};function Tb(e){for(var t="",n=0;n>>0);if(!n.hasNameForId(this.componentId,l)){var m=r(o,".".concat(l),void 0,this.componentId);n.insertRules(this.componentId,l,m)}i=Ia(i,l),this.staticRulesId=l}else{for(var u=As(this.baseHash,r.hash),p="",s=0;s>>0);n.hasNameForId(this.componentId,h)||n.insertRules(this.componentId,h,r(p,".".concat(h),void 0,this.componentId)),i=Ia(i,h)}}return i},e}(),ev=be.createContext(void 0);ev.Consumer;var dp={};function AO(e,t,n){var r=Zm(e),i=e,o=!up(e),l=t.attrs,m=l===void 0?Xd:l,u=t.componentId,p=u===void 0?function(E,_){var $=typeof E!="string"?"sc":xb(E);dp[$]=(dp[$]||0)+1;var O="".concat($,"-").concat(m1(Yd+$+dp[$]));return _?"".concat(_,"-").concat(O):O}(t.displayName,t.parentComponentId):u,s=t.displayName,c=s===void 0?function(E){return up(E)?"styled.".concat(E):"Styled(".concat(nO(E),")")}(e):s,d=t.displayName&&t.componentId?"".concat(xb(t.displayName),"-").concat(t.componentId):t.componentId||p,h=r&&i.attrs?i.attrs.concat(m).filter(Boolean):m,f=t.shouldForwardProp;if(r&&i.shouldForwardProp){var v=i.shouldForwardProp;if(t.shouldForwardProp){var y=t.shouldForwardProp;f=function(E,_){return v(E,_)&&y(E,_)}}else f=v}var b=new OO(n,d,r?i.componentStyle:void 0);function w(E,_){return function($,O,N){var k=$.attrs,L=$.componentStyle,F=$.defaultProps,P=$.foldedComponentIds,A=$.styledComponentId,M=$.target,R=be.useContext(ev),I=Eg(),D=$.shouldForwardProp||I.shouldForwardProp,j=f1(O,R,F)||Bs,B=function(G,q,Z){for(var Q,J=Hr(Hr({},q),{className:void 0,theme:Z}),ie=0;ie2&&xd.registerId(this.componentId+t),this.removeStyles(t,r),this.createStyles(t,n,r,i)},e}();function IO(e){for(var t=[],n=1;n{const r=`https://mail.google.com/mail/?view=cm&fs=1&to=${encodeURIComponent(e)}&su=${encodeURIComponent(t)}&body=${encodeURIComponent(n)}`;window.open(r,"_blank")},FO=()=>qe.jsxs(PO,{children:[qe.jsx(kO,{children:"LOG VALIDATION TOOL"}),qe.jsxs(NO,{children:[qe.jsx(Fu,{href:"https://ondc-official.github.io/ONDC-RET-Specifications/",target:"_blank",children:"Developer Docs"}),qe.jsx(Fu,{href:"https://github.com/ONDC-Official",target:"_blank",children:"GitHub"}),qe.jsx(Fu,{onClick:()=>DO("support@ondc.org","Support Request",""),children:"Support"}),qe.jsx(Fu,{href:"https://buddy.ondc.org/",children:"Need Help?"})]})]});var fp={exports:{}};/*! + Copyright (c) 2018 Jed Watson. + Licensed under the MIT License (MIT), see + http://jedwatson.github.io/classnames +*/var Pb;function zO(){return Pb||(Pb=1,function(e){(function(){var t={}.hasOwnProperty;function n(){for(var o="",l=0;l1&&arguments[1]!==void 0?arguments[1]:{},n=[];return be.Children.forEach(e,function(r){r==null&&!t.keepEmpty||(Array.isArray(r)?n=n.concat(li(r)):O1(r)&&r.props?n=n.concat(li(r.props.children,t)):n.push(r))}),n}var Mg={},VO=function(t){};function UO(e,t){}function GO(e,t){}function KO(){Mg={}}function A1(e,t,n){!t&&!Mg[n]&&(e(!1,n),Mg[n]=!0)}function Lr(e,t){A1(UO,e,t)}function YO(e,t){A1(GO,e,t)}Lr.preMessage=VO;Lr.resetWarned=KO;Lr.noteOnce=YO;function XO(e,t){if(wt(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(wt(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function T1(e){var t=XO(e,"string");return wt(t)=="symbol"?t:t+""}function ne(e,t,n){return(t=T1(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function kb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function oe(e){for(var t=1;t=19)return!0;var i=pp.isMemo(t)?t.type.type:t.type;return!(typeof i=="function"&&!((n=i.prototype)!==null&&n!==void 0&&n.render)&&i.$$typeof!==pp.ForwardRef||typeof t=="function"&&!((r=t.prototype)!==null&&r!==void 0&&r.render)&&t.$$typeof!==pp.ForwardRef)};function L1(e){return C.isValidElement(e)&&!O1(e)}var Ka=function(t){if(t&&L1(t)){var n=t;return n.props.propertyIsEnumerable("ref")?n.props.ref:n.ref}return null},Og=C.createContext(null);function eA(e){var t=e.children,n=e.onBatchResize,r=C.useRef(0),i=C.useRef([]),o=C.useContext(Og),l=C.useCallback(function(m,u,p){r.current+=1;var s=r.current;i.current.push({size:m,element:u,data:p}),Promise.resolve().then(function(){s===r.current&&(n==null||n(i.current),i.current=[])}),o==null||o(m,u,p)},[n,o]);return C.createElement(Og.Provider,{value:l},t)}var P1=function(){if(typeof Map<"u")return Map;function e(t,n){var r=-1;return t.some(function(i,o){return i[0]===n?(r=o,!0):!1}),r}return function(){function t(){this.__entries__=[]}return Object.defineProperty(t.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),t.prototype.get=function(n){var r=e(this.__entries__,n),i=this.__entries__[r];return i&&i[1]},t.prototype.set=function(n,r){var i=e(this.__entries__,n);~i?this.__entries__[i][1]=r:this.__entries__.push([n,r])},t.prototype.delete=function(n){var r=this.__entries__,i=e(r,n);~i&&r.splice(i,1)},t.prototype.has=function(n){return!!~e(this.__entries__,n)},t.prototype.clear=function(){this.__entries__.splice(0)},t.prototype.forEach=function(n,r){r===void 0&&(r=null);for(var i=0,o=this.__entries__;i0},e.prototype.connect_=function(){!Ag||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),aA?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},e.prototype.disconnect_=function(){!Ag||!this.connected_||(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},e.prototype.onTransitionEnd_=function(t){var n=t.propertyName,r=n===void 0?"":n,i=oA.some(function(o){return!!~r.indexOf(o)});i&&this.refresh()},e.getInstance=function(){return this.instance_||(this.instance_=new e),this.instance_},e.instance_=null,e}(),k1=function(e,t){for(var n=0,r=Object.keys(t);n"u"||!(Element instanceof Object))){if(!(t instanceof Ws(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var n=this.observations_;n.has(t)||(n.set(t,new gA(t)),this.controller_.addObserver(this),this.controller_.refresh())}},e.prototype.unobserve=function(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(t instanceof Ws(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var n=this.observations_;n.has(t)&&(n.delete(t),n.size||this.controller_.removeObserver(this))}},e.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},e.prototype.gatherActive=function(){var t=this;this.clearActive(),this.observations_.forEach(function(n){n.isActive()&&t.activeObservations_.push(n)})},e.prototype.broadcastActive=function(){if(this.hasActive()){var t=this.callbackCtx_,n=this.activeObservations_.map(function(r){return new mA(r.target,r.broadcastRect())});this.callback_.call(t,n,t),this.clearActive()}},e.prototype.clearActive=function(){this.activeObservations_.splice(0)},e.prototype.hasActive=function(){return this.activeObservations_.length>0},e}(),D1=typeof WeakMap<"u"?new WeakMap:new P1,F1=function(){function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var n=sA.getInstance(),r=new vA(t,n,this);D1.set(this,r)}return e}();["observe","unobserve","disconnect"].forEach(function(e){F1.prototype[e]=function(){var t;return(t=D1.get(this))[e].apply(t,arguments)}});var yA=function(){return typeof Ed.ResizeObserver<"u"?Ed.ResizeObserver:F1}(),sa=new Map;function bA(e){e.forEach(function(t){var n,r=t.target;(n=sa.get(r))===null||n===void 0||n.forEach(function(i){return i(r)})})}var z1=new yA(bA);function wA(e,t){sa.has(e)||(sa.set(e,new Set),z1.observe(e)),sa.get(e).add(t)}function SA(e,t){sa.has(e)&&(sa.get(e).delete(t),sa.get(e).size||(z1.unobserve(e),sa.delete(e)))}function cr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function zb(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=Array(t);n1&&arguments[1]!==void 0?arguments[1]:1;jb+=1;var r=jb;function i(o){if(o===0)W1(r),t();else{var l=B1(function(){i(o-1)});iv.set(r,l)}}return i(n),r};gn.cancel=function(e){var t=iv.get(e);return W1(e),H1(t)};function V1(e){if(Array.isArray(e))return e}function AA(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,i,o,l,m=[],u=!0,p=!1;try{if(o=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=o.call(n)).done)&&(m.push(r.value),m.length!==t);u=!0);}catch(s){p=!0,i=s}finally{try{if(!u&&n.return!=null&&(l=n.return(),Object(l)!==l))return}finally{if(p)throw i}}return m}}function U1(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function pe(e,t){return V1(e)||AA(e,t)||rv(e,t)||U1()}function ac(e){for(var t=0,n,r=0,i=e.length;i>=4;++r,i-=4)n=e.charCodeAt(r)&255|(e.charCodeAt(++r)&255)<<8|(e.charCodeAt(++r)&255)<<16|(e.charCodeAt(++r)&255)<<24,n=(n&65535)*1540483477+((n>>>16)*59797<<16),n^=n>>>24,t=(n&65535)*1540483477+((n>>>16)*59797<<16)^(t&65535)*1540483477+((t>>>16)*59797<<16);switch(i){case 3:t^=(e.charCodeAt(r+2)&255)<<16;case 2:t^=(e.charCodeAt(r+1)&255)<<8;case 1:t^=e.charCodeAt(r)&255,t=(t&65535)*1540483477+((t>>>16)*59797<<16)}return t^=t>>>13,t=(t&65535)*1540483477+((t>>>16)*59797<<16),((t^t>>>15)>>>0).toString(36)}function qr(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}function TA(e,t){if(!e)return!1;if(e.contains)return e.contains(t);for(var n=t;n;){if(n===e)return!0;n=n.parentNode}return!1}var Bb="data-rc-order",Hb="data-rc-priority",IA="rc-util-key",Ig=new Map;function G1(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.mark;return t?t.startsWith("data-")?t:"data-".concat(t):IA}function Qd(e){if(e.attachTo)return e.attachTo;var t=document.querySelector("head");return t||document.body}function LA(e){return e==="queue"?"prependQueue":e?"prepend":"append"}function ov(e){return Array.from((Ig.get(e)||e).children).filter(function(t){return t.tagName==="STYLE"})}function K1(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!qr())return null;var n=t.csp,r=t.prepend,i=t.priority,o=i===void 0?0:i,l=LA(r),m=l==="prependQueue",u=document.createElement("style");u.setAttribute(Bb,l),m&&o&&u.setAttribute(Hb,"".concat(o)),n!=null&&n.nonce&&(u.nonce=n==null?void 0:n.nonce),u.innerHTML=e;var p=Qd(t),s=p.firstChild;if(r){if(m){var c=(t.styles||ov(p)).filter(function(d){if(!["prepend","prependQueue"].includes(d.getAttribute(Bb)))return!1;var h=Number(d.getAttribute(Hb)||0);return o>=h});if(c.length)return p.insertBefore(u,c[c.length-1].nextSibling),u}p.insertBefore(u,s)}else p.appendChild(u);return u}function Y1(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=Qd(t);return(t.styles||ov(n)).find(function(r){return r.getAttribute(G1(t))===e})}function sc(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=Y1(e,t);if(n){var r=Qd(t);r.removeChild(n)}}function PA(e,t){var n=Ig.get(e);if(!n||!TA(document,n)){var r=K1("",t),i=r.parentNode;Ig.set(e,i),e.removeChild(r)}}function Mo(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=Qd(n),i=ov(r),o=oe(oe({},n),{},{styles:i});PA(r,o);var l=Y1(t,o);if(l){var m,u;if((m=o.csp)!==null&&m!==void 0&&m.nonce&&l.nonce!==((u=o.csp)===null||u===void 0?void 0:u.nonce)){var p;l.nonce=(p=o.csp)===null||p===void 0?void 0:p.nonce}return l.innerHTML!==e&&(l.innerHTML=e),l}var s=K1(e,o);return s.setAttribute(G1(o),t),s}function kA(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function At(e,t){if(e==null)return{};var n,r,i=kA(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r2&&arguments[2]!==void 0?arguments[2]:!1,r=new Set;function i(o,l){var m=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,u=r.has(o);if(Lr(!u,"Warning: There may be circular references"),u)return!1;if(o===l)return!0;if(n&&m>1)return!1;r.add(o);var p=m+1;if(Array.isArray(o)){if(!Array.isArray(l)||o.length!==l.length)return!1;for(var s=0;s1&&arguments[1]!==void 0?arguments[1]:!1,l={map:this.cache};return n.forEach(function(m){if(!l)l=void 0;else{var u;l=(u=l)===null||u===void 0||(u=u.map)===null||u===void 0?void 0:u.get(m)}}),(r=l)!==null&&r!==void 0&&r.value&&o&&(l.value[1]=this.cacheCallTimes++),(i=l)===null||i===void 0?void 0:i.value}},{key:"get",value:function(n){var r;return(r=this.internalGet(n,!0))===null||r===void 0?void 0:r[0]}},{key:"has",value:function(n){return!!this.internalGet(n)}},{key:"set",value:function(n,r){var i=this;if(!this.has(n)){if(this.size()+1>e.MAX_CACHE_SIZE+e.MAX_CACHE_OFFSET){var o=this.keys.reduce(function(p,s){var c=pe(p,2),d=c[1];return i.internalGet(s)[1]0,void 0),Wb+=1}return ur(e,[{key:"getDerivativeToken",value:function(n){return this.derivatives.reduce(function(r,i){return i(n,r)},void 0)}}]),e}(),gp=new av;function Pg(e){var t=Array.isArray(e)?e:[e];return gp.has(t)||gp.set(t,new X1(t)),gp.get(t)}var jA=new WeakMap,mp={};function BA(e,t){for(var n=jA,r=0;r3&&arguments[3]!==void 0?arguments[3]:{},o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;if(o)return e;var l=oe(oe({},i),{},(r={},ne(r,Vs,t),ne(r,qi,n),r)),m=Object.keys(l).map(function(u){var p=l[u];return p?"".concat(u,'="').concat(p,'"'):null}).filter(function(u){return u}).join(" ");return"")}var ad=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return"--".concat(n?"".concat(n,"-"):"").concat(t).replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z0-9]+)/g,"$1-$2").replace(/([a-z])([A-Z0-9])/g,"$1-$2").toLowerCase()},HA=function(t,n,r){return Object.keys(t).length?".".concat(n).concat(r!=null&&r.scope?".".concat(r.scope):"","{").concat(Object.entries(t).map(function(i){var o=pe(i,2),l=o[0],m=o[1];return"".concat(l,":").concat(m,";")}).join(""),"}"):""},q1=function(t,n,r){var i={},o={};return Object.entries(t).forEach(function(l){var m,u,p=pe(l,2),s=p[0],c=p[1];if(r!=null&&(m=r.preserve)!==null&&m!==void 0&&m[s])o[s]=c;else if((typeof c=="string"||typeof c=="number")&&!(r!=null&&(u=r.ignore)!==null&&u!==void 0&&u[s])){var d,h=ad(s,r==null?void 0:r.prefix);i[h]=typeof c=="number"&&!(r!=null&&(d=r.unitless)!==null&&d!==void 0&&d[s])?"".concat(c,"px"):String(c),o[s]="var(".concat(h,")")}}),[o,HA(i,n,{scope:r==null?void 0:r.scope})]},Gb=qr()?C.useLayoutEffect:C.useEffect,fn=function(t,n){var r=C.useRef(!0);Gb(function(){return t(r.current)},n),Gb(function(){return r.current=!1,function(){r.current=!0}},[])},Ng=function(t,n){fn(function(r){if(!r)return t()},n)},WA=oe({},Wd),Kb=WA.useInsertionEffect,VA=function(t,n,r){C.useMemo(t,r),fn(function(){return n(!0)},r)},UA=Kb?function(e,t,n){return Kb(function(){return e(),t()},n)}:VA,GA=oe({},Wd),KA=GA.useInsertionEffect,YA=function(t){var n=[],r=!1;function i(o){r||n.push(o)}return C.useEffect(function(){return r=!1,function(){r=!0,n.length&&n.forEach(function(o){return o()})}},t),i},XA=function(){return function(t){t()}},qA=typeof KA<"u"?YA:XA;function sv(e,t,n,r,i){var o=C.useContext(Ec),l=o.cache,m=[e].concat(Ge(t)),u=Lg(m),p=qA([u]),s=function(f){l.opUpdate(u,function(v){var y=v||[void 0,void 0],b=pe(y,2),w=b[0],x=w===void 0?0:w,E=b[1],_=E,$=_||n(),O=[x,$];return f?f(O):O})};C.useMemo(function(){s()},[u]);var c=l.opGet(u),d=c[1];return UA(function(){i==null||i(d)},function(h){return s(function(f){var v=pe(f,2),y=v[0],b=v[1];return h&&y===0&&(i==null||i(d)),[y+1,b]}),function(){l.opUpdate(u,function(f){var v=f||[],y=pe(v,2),b=y[0],w=b===void 0?0:b,x=y[1],E=w-1;return E===0?(p(function(){(h||!l.opGet(u))&&(r==null||r(x,!1))}),null):[w-1,x]})}},[u]),d}var QA={},ZA="css",Aa=new Map;function JA(e){Aa.set(e,(Aa.get(e)||0)+1)}function eT(e,t){if(typeof document<"u"){var n=document.querySelectorAll("style[".concat(Vs,'="').concat(e,'"]'));n.forEach(function(r){if(r[la]===t){var i;(i=r.parentNode)===null||i===void 0||i.removeChild(r)}})}}var tT=0;function nT(e,t){Aa.set(e,(Aa.get(e)||0)-1);var n=Array.from(Aa.keys()),r=n.filter(function(i){var o=Aa.get(i)||0;return o<=0});n.length-r.length>tT&&r.forEach(function(i){eT(i,t),Aa.delete(i)})}var rT=function(t,n,r,i){var o=r.getDerivativeToken(t),l=oe(oe({},o),n);return i&&(l=i(l)),l},Q1="token";function iT(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=C.useContext(Ec),i=r.cache.instanceId,o=r.container,l=n.salt,m=l===void 0?"":l,u=n.override,p=u===void 0?QA:u,s=n.formatToken,c=n.getComputedToken,d=n.cssVar,h=BA(function(){return Object.assign.apply(Object,[{}].concat(Ge(t)))},t),f=Yl(h),v=Yl(p),y=d?Yl(d):"",b=sv(Q1,[m,e.id,f,v,y],function(){var w,x=c?c(h,p,e):rT(h,p,e,s),E=oe({},x),_="";if(d){var $=q1(x,d.key,{prefix:d.prefix,ignore:d.ignore,unitless:d.unitless,preserve:d.preserve}),O=pe($,2);x=O[0],_=O[1]}var N=Ub(x,m);x._tokenKey=N,E._tokenKey=Ub(E,m);var k=(w=d==null?void 0:d.key)!==null&&w!==void 0?w:N;x._themeKey=k,JA(k);var L="".concat(ZA,"-").concat(ac(N));return x._hashId=L,[x,L,E,_,(d==null?void 0:d.key)||""]},function(w){nT(w[0]._themeKey,i)},function(w){var x=pe(w,4),E=x[0],_=x[3];if(d&&_){var $=Mo(_,ac("css-variables-".concat(E._themeKey)),{mark:qi,prepend:"queue",attachTo:o,priority:-999});$[la]=i,$.setAttribute(Vs,E._themeKey)}});return b}var oT=function(t,n,r){var i=pe(t,5),o=i[2],l=i[3],m=i[4],u=r||{},p=u.plain;if(!l)return null;var s=o._tokenKey,c=-999,d={"data-rc-order":"prependQueue","data-rc-priority":"".concat(c)},h=Md(l,m,s,d,p);return[c,s,h]},aT={animationIterationCount:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},Z1="comm",J1="rule",e$="decl",sT="@import",lT="@namespace",cT="@keyframes",uT="@layer",t$=Math.abs,lv=String.fromCharCode;function n$(e){return e.trim()}function sd(e,t,n){return e.replace(t,n)}function dT(e,t,n){return e.indexOf(t,n)}function ks(e,t){return e.charCodeAt(t)|0}function Us(e,t,n){return e.slice(t,n)}function uo(e){return e.length}function fT(e){return e.length}function zu(e,t){return t.push(e),e}var Zd=1,Gs=1,r$=0,Di=0,lr=0,Qs="";function cv(e,t,n,r,i,o,l,m){return{value:e,root:t,parent:n,type:r,props:i,children:o,line:Zd,column:Gs,length:l,return:"",siblings:m}}function hT(){return lr}function pT(){return lr=Di>0?ks(Qs,--Di):0,Gs--,lr===10&&(Gs=1,Zd--),lr}function Qi(){return lr=Di2||cc(lr)>3?"":" "}function yT(e,t){for(;--t&&Qi()&&!(lr<48||lr>102||lr>57&&lr<65||lr>70&&lr<97););return Jd(e,ld()+(t<6&&ca()==32&&Qi()==32))}function Dg(e){for(;Qi();)switch(lr){case e:return Di;case 34:case 39:e!==34&&e!==39&&Dg(lr);break;case 40:e===41&&Dg(e);break;case 92:Qi();break}return Di}function bT(e,t){for(;Qi()&&e+lr!==57;)if(e+lr===84&&ca()===47)break;return"/*"+Jd(t,Di-1)+"*"+lv(e===47?e:Qi())}function wT(e){for(;!cc(ca());)Qi();return Jd(e,Di)}function ST(e){return mT(cd("",null,null,null,[""],e=gT(e),0,[0],e))}function cd(e,t,n,r,i,o,l,m,u){for(var p=0,s=0,c=l,d=0,h=0,f=0,v=1,y=1,b=1,w=0,x="",E=i,_=o,$=r,O=x;y;)switch(f=w,w=Qi()){case 40:if(f!=108&&ks(O,c-1)==58){dT(O+=sd(vp(w),"&","&\f"),"&\f",t$(p?m[p-1]:0))!=-1&&(b=-1);break}case 34:case 39:case 91:O+=vp(w);break;case 9:case 10:case 13:case 32:O+=vT(f);break;case 92:O+=yT(ld()-1,7);continue;case 47:switch(ca()){case 42:case 47:zu(CT(bT(Qi(),ld()),t,n,u),u),(cc(f||1)==5||cc(ca()||1)==5)&&uo(O)&&Us(O,-1,void 0)!==" "&&(O+=" ");break;default:O+="/"}break;case 123*v:m[p++]=uo(O)*b;case 125*v:case 59:case 0:switch(w){case 0:case 125:y=0;case 59+s:b==-1&&(O=sd(O,/\f/g,"")),h>0&&(uo(O)-c||v===0&&f===47)&&zu(h>32?Xb(O+";",r,n,c-1,u):Xb(sd(O," ","")+";",r,n,c-2,u),u);break;case 59:O+=";";default:if(zu($=Yb(O,t,n,p,s,i,m,x,E=[],_=[],c,o),o),w===123)if(s===0)cd(O,t,$,$,E,o,c,m,_);else{switch(d){case 99:if(ks(O,3)===110)break;case 108:if(ks(O,2)===97)break;default:s=0;case 100:case 109:case 115:}s?cd(e,$,$,r&&zu(Yb(e,$,$,0,0,i,m,x,i,E=[],c,_),_),i,_,c,m,r?E:_):cd(O,$,$,$,[""],_,0,m,_)}}p=s=h=0,v=b=1,x=O="",c=l;break;case 58:c=1+uo(O),h=f;default:if(v<1){if(w==123)--v;else if(w==125&&v++==0&&pT()==125)continue}switch(O+=lv(w),w*v){case 38:b=s>0?1:(O+="\f",-1);break;case 44:m[p++]=(uo(O)-1)*b,b=1;break;case 64:ca()===45&&(O+=vp(Qi())),d=ca(),s=c=uo(x=O+=wT(ld())),w++;break;case 45:f===45&&uo(O)==2&&(v=0)}}return o}function Yb(e,t,n,r,i,o,l,m,u,p,s,c){for(var d=i-1,h=i===0?o:[""],f=fT(h),v=0,y=0,b=0;v0?h[w]+" "+x:sd(x,/&\f/g,h[w])))&&(u[b++]=E);return cv(e,t,n,i===0?J1:m,u,p,s,c)}function CT(e,t,n,r){return cv(e,t,n,Z1,lv(hT()),Us(e,2,-2),0,r)}function Xb(e,t,n,r,i){return cv(e,t,n,e$,Us(e,0,r),Us(e,r+1,-1),r,i)}function Fg(e,t){for(var n="",r=0;r1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{root:!0,parentSelectors:[]},i=r.root,o=r.injectHash,l=r.parentSelectors,m=n.hashId,u=n.layer;n.path;var p=n.hashPriority,s=n.transformers,c=s===void 0?[]:s;n.linters;var d="",h={};function f(b){var w=b.getName(m);if(!h[w]){var x=e(b.style,n,{root:!1,parentSelectors:l}),E=pe(x,1),_=E[0];h[w]="@keyframes ".concat(b.getName(m)).concat(_)}}function v(b){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return b.forEach(function(x){Array.isArray(x)?v(x,w):x&&w.push(x)}),w}var y=v(Array.isArray(t)?t:[t]);return y.forEach(function(b){var w=typeof b=="string"&&!i?{}:b;if(typeof w=="string")d+="".concat(w,` +`);else if(w._keyframe)f(w);else{var x=c.reduce(function(E,_){var $;return(_==null||($=_.visit)===null||$===void 0?void 0:$.call(_,E))||E},w);Object.keys(x).forEach(function(E){var _=x[E];if(wt(_)==="object"&&_&&(E!=="animationName"||!_._keyframe)&&!RT(_)){var $=!1,O=E.trim(),N=!1;(i||o)&&m?O.startsWith("@")?$=!0:O==="&"?O=Qb("",m,p):O=Qb(E,m,p):i&&!m&&(O==="&"||O==="")&&(O="",N=!0);var k=e(_,n,{root:N,injectHash:$,parentSelectors:[].concat(Ge(l),[O])}),L=pe(k,2),F=L[0],P=L[1];h=oe(oe({},h),P),d+="".concat(O).concat(F)}else{let R=function(I,D){var j=I.replace(/[A-Z]/g,function(V){return"-".concat(V.toLowerCase())}),B=D;!aT[I]&&typeof B=="number"&&B!==0&&(B="".concat(B,"px")),I==="animationName"&&D!==null&&D!==void 0&&D._keyframe&&(f(D),B=D.getName(m)),d+="".concat(j,":").concat(B,";")};var A,M=(A=_==null?void 0:_.value)!==null&&A!==void 0?A:_;wt(_)==="object"&&_!==null&&_!==void 0&&_[a$]&&Array.isArray(M)?M.forEach(function(I){R(E,I)}):R(E,M)}})}}),i?u&&(d&&(d="@layer ".concat(u.name," {").concat(d,"}")),u.dependencies&&(h["@layer ".concat(u.name)]=u.dependencies.map(function(b){return"@layer ".concat(b,", ").concat(u.name,";")}).join(` +`))):d="{".concat(d,"}"),[d,h]};function s$(e,t){return ac("".concat(e.join("%")).concat(t))}function AT(){return null}var l$="style";function zg(e,t){var n=e.token,r=e.path,i=e.hashId,o=e.layer,l=e.nonce,m=e.clientOnly,u=e.order,p=u===void 0?0:u,s=C.useContext(Ec),c=s.autoClear;s.mock;var d=s.defaultCache,h=s.hashPriority,f=s.container,v=s.ssrInline,y=s.transformers,b=s.linters,w=s.cache,x=s.layer,E=n._tokenKey,_=[E];x&&_.push("layer"),_.push.apply(_,Ge(r));var $=kg,O=sv(l$,_,function(){var P=_.join("|");if(ET(P)){var A=_T(P),M=pe(A,2),R=M[0],I=M[1];if(R)return[R,E,I,{},m,p]}var D=t(),j=OT(D,{hashId:i,hashPriority:h,layer:x?o:void 0,path:r.join("-"),transformers:y,linters:b}),B=pe(j,2),V=B[0],H=B[1],Y=ud(V),U=s$(_,Y);return[Y,E,U,H,m,p]},function(P,A){var M=pe(P,3),R=M[2];(A||c)&&kg&&sc(R,{mark:qi})},function(P){var A=pe(P,4),M=A[0];A[1];var R=A[2],I=A[3];if($&&M!==i$){var D={mark:qi,prepend:x?!1:"queue",attachTo:f,priority:p},j=typeof l=="function"?l():l;j&&(D.csp={nonce:j});var B=[],V=[];Object.keys(I).forEach(function(Y){Y.startsWith("@layer")?B.push(Y):V.push(Y)}),B.forEach(function(Y){Mo(ud(I[Y]),"_layer-".concat(Y),oe(oe({},D),{},{prepend:!0}))});var H=Mo(M,R,D);H[la]=w.instanceId,H.setAttribute(Vs,E),V.forEach(function(Y){Mo(ud(I[Y]),"_effect-".concat(Y),D)})}}),N=pe(O,3),k=N[0],L=N[1],F=N[2];return function(P){var A;if(!v||$||!d)A=C.createElement(AT,null);else{var M;A=C.createElement("style",nt({},(M={},ne(M,Vs,L),ne(M,qi,F),M),{dangerouslySetInnerHTML:{__html:k}}))}return C.createElement(C.Fragment,null,A,P)}}var TT=function(t,n,r){var i=pe(t,6),o=i[0],l=i[1],m=i[2],u=i[3],p=i[4],s=i[5],c=r||{},d=c.plain;if(p)return null;var h=o,f={"data-rc-order":"prependQueue","data-rc-priority":"".concat(s)};return h=Md(o,l,m,f,d),u&&Object.keys(u).forEach(function(v){if(!n[v]){n[v]=!0;var y=ud(u[v]),b=Md(y,l,"_effect-".concat(v),f,d);v.startsWith("@layer")?h=b+h:h+=b}}),[s,m,h]},c$="cssVar",IT=function(t,n){var r=t.key,i=t.prefix,o=t.unitless,l=t.ignore,m=t.token,u=t.scope,p=u===void 0?"":u,s=C.useContext(Ec),c=s.cache.instanceId,d=s.container,h=m._tokenKey,f=[].concat(Ge(t.path),[r,p,h]),v=sv(c$,f,function(){var y=n(),b=q1(y,r,{prefix:i,unitless:o,ignore:l,scope:p}),w=pe(b,2),x=w[0],E=w[1],_=s$(f,E);return[x,E,_,r]},function(y){var b=pe(y,3),w=b[2];kg&&sc(w,{mark:qi})},function(y){var b=pe(y,3),w=b[1],x=b[2];if(w){var E=Mo(w,x,{mark:qi,prepend:"queue",attachTo:d,priority:-999});E[la]=c,E.setAttribute(Vs,r)}});return v},LT=function(t,n,r){var i=pe(t,4),o=i[1],l=i[2],m=i[3],u=r||{},p=u.plain;if(!o)return null;var s=-999,c={"data-rc-order":"prependQueue","data-rc-priority":"".concat(s)},d=Md(o,m,l,c,p);return[s,l,d]},Il;Il={},ne(Il,l$,TT),ne(Il,Q1,oT),ne(Il,c$,LT);var nn=function(){function e(t,n){cr(this,e),ne(this,"name",void 0),ne(this,"style",void 0),ne(this,"_keyframe",!0),this.name=t,this.style=n}return ur(e,[{key:"getName",value:function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return n?"".concat(n,"-").concat(this.name):this.name}}]),e}();function ys(e){return e.notSplit=!0,e}ys(["borderTop","borderBottom"]),ys(["borderTop"]),ys(["borderBottom"]),ys(["borderLeft","borderRight"]),ys(["borderLeft"]),ys(["borderRight"]);var uv=C.createContext({});function u$(e){return V1(e)||j1(e)||rv(e)||U1()}function Pi(e,t){for(var n=e,r=0;r3&&arguments[3]!==void 0?arguments[3]:!1;return t.length&&r&&n===void 0&&!Pi(e,t.slice(0,-1))?e:d$(e,t,n,r)}function PT(e){return wt(e)==="object"&&e!==null&&Object.getPrototypeOf(e)===Object.prototype}function Zb(e){return Array.isArray(e)?[]:{}}var kT=typeof Reflect>"u"?Object.keys:Reflect.ownKeys;function Ts(){for(var e=arguments.length,t=new Array(e),n=0;n{const e=()=>{};return e.deprecated=NT,e},f$=C.createContext(void 0);var FT={items_per_page:"/ page",jump_to:"Go to",jump_to_confirm:"confirm",page:"Page",prev_page:"Previous Page",next_page:"Next Page",prev_5:"Previous 5 Pages",next_5:"Next 5 Pages",prev_3:"Previous 3 Pages",next_3:"Next 3 Pages",page_size:"Page Size"},zT={yearFormat:"YYYY",dayFormat:"D",cellMeridiemFormat:"A",monthBeforeYear:!0},jT=oe(oe({},zT),{},{locale:"en_US",today:"Today",now:"Now",backToToday:"Back to today",ok:"OK",clear:"Clear",week:"Week",month:"Month",year:"Year",timeSelect:"select time",dateSelect:"select date",weekSelect:"Choose a week",monthSelect:"Choose a month",yearSelect:"Choose a year",decadeSelect:"Choose a decade",dateFormat:"M/D/YYYY",dateTimeFormat:"M/D/YYYY HH:mm:ss",previousMonth:"Previous month (PageUp)",nextMonth:"Next month (PageDown)",previousYear:"Last year (Control + left)",nextYear:"Next year (Control + right)",previousDecade:"Last decade",nextDecade:"Next decade",previousCentury:"Last century",nextCentury:"Next century"});const h$={placeholder:"Select time",rangePlaceholder:["Start time","End time"]},Jb={lang:Object.assign({placeholder:"Select date",yearPlaceholder:"Select year",quarterPlaceholder:"Select quarter",monthPlaceholder:"Select month",weekPlaceholder:"Select week",rangePlaceholder:["Start date","End date"],rangeYearPlaceholder:["Start year","End year"],rangeQuarterPlaceholder:["Start quarter","End quarter"],rangeMonthPlaceholder:["Start month","End month"],rangeWeekPlaceholder:["Start week","End week"]},jT),timePickerLocale:Object.assign({},h$)},pi="${label} is not a valid ${type}",za={locale:"en",Pagination:FT,DatePicker:Jb,TimePicker:h$,Calendar:Jb,global:{placeholder:"Please select",close:"Close"},Table:{filterTitle:"Filter menu",filterConfirm:"OK",filterReset:"Reset",filterEmptyText:"No filters",filterCheckAll:"Select all items",filterSearchPlaceholder:"Search in filters",emptyText:"No data",selectAll:"Select current page",selectInvert:"Invert current page",selectNone:"Clear all data",selectionAll:"Select all data",sortTitle:"Sort",expand:"Expand row",collapse:"Collapse row",triggerDesc:"Click to sort descending",triggerAsc:"Click to sort ascending",cancelSort:"Click to cancel sorting"},Tour:{Next:"Next",Previous:"Previous",Finish:"Finish"},Modal:{okText:"OK",cancelText:"Cancel",justOkText:"OK"},Popconfirm:{okText:"OK",cancelText:"Cancel"},Transfer:{titles:["",""],searchPlaceholder:"Search here",itemUnit:"item",itemsUnit:"items",remove:"Remove",selectCurrent:"Select current page",removeCurrent:"Remove current page",selectAll:"Select all data",deselectAll:"Deselect all data",removeAll:"Remove all data",selectInvert:"Invert current page"},Upload:{uploading:"Uploading...",removeFile:"Remove file",uploadError:"Upload error",previewFile:"Preview file",downloadFile:"Download file"},Empty:{description:"No data"},Icon:{icon:"icon"},Text:{edit:"Edit",copy:"Copy",copied:"Copied",expand:"Expand",collapse:"Collapse"},Form:{optional:"(optional)",defaultValidateMessages:{default:"Field validation error for ${label}",required:"Please enter ${label}",enum:"${label} must be one of [${enum}]",whitespace:"${label} cannot be a blank character",date:{format:"${label} date format is invalid",parse:"${label} cannot be converted to a date",invalid:"${label} is an invalid date"},types:{string:pi,method:pi,array:pi,object:pi,number:pi,date:pi,boolean:pi,integer:pi,float:pi,regexp:pi,email:pi,url:pi,hex:pi},string:{len:"${label} must be ${len} characters",min:"${label} must be at least ${min} characters",max:"${label} must be up to ${max} characters",range:"${label} must be between ${min}-${max} characters"},number:{len:"${label} must be equal to ${len}",min:"${label} must be minimum ${min}",max:"${label} must be maximum ${max}",range:"${label} must be between ${min}-${max}"},array:{len:"Must be ${len} ${label}",min:"At least ${min} ${label}",max:"At most ${max} ${label}",range:"The amount of ${label} must be between ${min}-${max}"},pattern:{mismatch:"${label} does not match the pattern ${pattern}"}}},Image:{preview:"Preview"},QRCode:{expired:"QR code expired",refresh:"Refresh",scanned:"Scanned"},ColorPicker:{presetEmpty:"Empty",transparent:"Transparent",singleColor:"Single",gradientColor:"Gradient"}};Object.assign({},za.Modal);let dd=[];const ew=()=>dd.reduce((e,t)=>Object.assign(Object.assign({},e),t),za.Modal);function BT(e){if(e){const t=Object.assign({},e);return dd.push(t),ew(),()=>{dd=dd.filter(n=>n!==t),ew()}}Object.assign({},za.Modal)}const dv=C.createContext(void 0),Mc=(e,t)=>{const n=C.useContext(dv),r=C.useMemo(()=>{var o;const l=za[e],m=(o=n==null?void 0:n[e])!==null&&o!==void 0?o:{};return Object.assign(Object.assign({},typeof l=="function"?l():l),m||{})},[e,t,n]),i=C.useMemo(()=>{const o=n==null?void 0:n.locale;return n!=null&&n.exist&&!o?za.locale:o},[n]);return[r,i]},HT="internalMark",WT=e=>{const{locale:t={},children:n,_ANT_MARK__:r}=e;C.useEffect(()=>BT(t==null?void 0:t.Modal),[t]);const i=C.useMemo(()=>Object.assign(Object.assign({},t),{exist:!0}),[t]);return C.createElement(dv.Provider,{value:i},n)},p$={blue:"#1677FF",purple:"#722ED1",cyan:"#13C2C2",green:"#52C41A",magenta:"#EB2F96",pink:"#EB2F96",red:"#F5222D",orange:"#FA8C16",yellow:"#FADB14",volcano:"#FA541C",geekblue:"#2F54EB",gold:"#FAAD14",lime:"#A0D911"},uc=Object.assign(Object.assign({},p$),{colorPrimary:"#1677ff",colorSuccess:"#52c41a",colorWarning:"#faad14",colorError:"#ff4d4f",colorInfo:"#1677ff",colorLink:"",colorTextBase:"",colorBgBase:"",fontFamily:`-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, +'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', +'Noto Color Emoji'`,fontFamilyCode:"'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace",fontSize:14,lineWidth:1,lineType:"solid",motionUnit:.1,motionBase:0,motionEaseOutCirc:"cubic-bezier(0.08, 0.82, 0.17, 1)",motionEaseInOutCirc:"cubic-bezier(0.78, 0.14, 0.15, 0.86)",motionEaseOut:"cubic-bezier(0.215, 0.61, 0.355, 1)",motionEaseInOut:"cubic-bezier(0.645, 0.045, 0.355, 1)",motionEaseOutBack:"cubic-bezier(0.12, 0.4, 0.29, 1.46)",motionEaseInBack:"cubic-bezier(0.71, -0.46, 0.88, 0.6)",motionEaseInQuint:"cubic-bezier(0.755, 0.05, 0.855, 0.06)",motionEaseOutQuint:"cubic-bezier(0.23, 1, 0.32, 1)",borderRadius:6,sizeUnit:4,sizeStep:4,sizePopupArrow:16,controlHeight:32,zIndexBase:0,zIndexPopupBase:1e3,opacityImage:1,wireframe:!1,motion:!0}),Sr=Math.round;function yp(e,t){const n=e.replace(/^[^(]*\((.*)/,"$1").replace(/\).*/,"").match(/\d*\.?\d+%?/g)||[],r=n.map(i=>parseFloat(i));for(let i=0;i<3;i+=1)r[i]=t(r[i]||0,n[i]||"",i);return n[3]?r[3]=n[3].includes("%")?r[3]/100:r[3]:r[3]=1,r}const tw=(e,t,n)=>n===0?e:e/100;function Ll(e,t){const n=t||255;return e>n?n:e<0?0:e}let Un=class g${constructor(t){ne(this,"isValid",!0),ne(this,"r",0),ne(this,"g",0),ne(this,"b",0),ne(this,"a",1),ne(this,"_h",void 0),ne(this,"_s",void 0),ne(this,"_l",void 0),ne(this,"_v",void 0),ne(this,"_max",void 0),ne(this,"_min",void 0),ne(this,"_brightness",void 0);function n(i){return i[0]in t&&i[1]in t&&i[2]in t}if(t)if(typeof t=="string"){let o=function(l){return i.startsWith(l)};var r=o;const i=t.trim();/^#?[A-F\d]{3,8}$/i.test(i)?this.fromHexString(i):o("rgb")?this.fromRgbString(i):o("hsl")?this.fromHslString(i):(o("hsv")||o("hsb"))&&this.fromHsvString(i)}else if(t instanceof g$)this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this._h=t._h,this._s=t._s,this._l=t._l,this._v=t._v;else if(n("rgb"))this.r=Ll(t.r),this.g=Ll(t.g),this.b=Ll(t.b),this.a=typeof t.a=="number"?Ll(t.a,1):1;else if(n("hsl"))this.fromHsl(t);else if(n("hsv"))this.fromHsv(t);else throw new Error("@ant-design/fast-color: unsupported input "+JSON.stringify(t))}setR(t){return this._sc("r",t)}setG(t){return this._sc("g",t)}setB(t){return this._sc("b",t)}setA(t){return this._sc("a",t,1)}setHue(t){const n=this.toHsv();return n.h=t,this._c(n)}getLuminance(){function t(o){const l=o/255;return l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4)}const n=t(this.r),r=t(this.g),i=t(this.b);return .2126*n+.7152*r+.0722*i}getHue(){if(typeof this._h>"u"){const t=this.getMax()-this.getMin();t===0?this._h=0:this._h=Sr(60*(this.r===this.getMax()?(this.g-this.b)/t+(this.g"u"){const t=this.getMax()-this.getMin();t===0?this._s=0:this._s=t/this.getMax()}return this._s}getLightness(){return typeof this._l>"u"&&(this._l=(this.getMax()+this.getMin())/510),this._l}getValue(){return typeof this._v>"u"&&(this._v=this.getMax()/255),this._v}getBrightness(){return typeof this._brightness>"u"&&(this._brightness=(this.r*299+this.g*587+this.b*114)/1e3),this._brightness}darken(t=10){const n=this.getHue(),r=this.getSaturation();let i=this.getLightness()-t/100;return i<0&&(i=0),this._c({h:n,s:r,l:i,a:this.a})}lighten(t=10){const n=this.getHue(),r=this.getSaturation();let i=this.getLightness()+t/100;return i>1&&(i=1),this._c({h:n,s:r,l:i,a:this.a})}mix(t,n=50){const r=this._c(t),i=n/100,o=m=>(r[m]-this[m])*i+this[m],l={r:Sr(o("r")),g:Sr(o("g")),b:Sr(o("b")),a:Sr(o("a")*100)/100};return this._c(l)}tint(t=10){return this.mix({r:255,g:255,b:255,a:1},t)}shade(t=10){return this.mix({r:0,g:0,b:0,a:1},t)}onBackground(t){const n=this._c(t),r=this.a+n.a*(1-this.a),i=o=>Sr((this[o]*this.a+n[o]*n.a*(1-this.a))/r);return this._c({r:i("r"),g:i("g"),b:i("b"),a:r})}isDark(){return this.getBrightness()<128}isLight(){return this.getBrightness()>=128}equals(t){return this.r===t.r&&this.g===t.g&&this.b===t.b&&this.a===t.a}clone(){return this._c(this)}toHexString(){let t="#";const n=(this.r||0).toString(16);t+=n.length===2?n:"0"+n;const r=(this.g||0).toString(16);t+=r.length===2?r:"0"+r;const i=(this.b||0).toString(16);if(t+=i.length===2?i:"0"+i,typeof this.a=="number"&&this.a>=0&&this.a<1){const o=Sr(this.a*255).toString(16);t+=o.length===2?o:"0"+o}return t}toHsl(){return{h:this.getHue(),s:this.getSaturation(),l:this.getLightness(),a:this.a}}toHslString(){const t=this.getHue(),n=Sr(this.getSaturation()*100),r=Sr(this.getLightness()*100);return this.a!==1?`hsla(${t},${n}%,${r}%,${this.a})`:`hsl(${t},${n}%,${r}%)`}toHsv(){return{h:this.getHue(),s:this.getSaturation(),v:this.getValue(),a:this.a}}toRgb(){return{r:this.r,g:this.g,b:this.b,a:this.a}}toRgbString(){return this.a!==1?`rgba(${this.r},${this.g},${this.b},${this.a})`:`rgb(${this.r},${this.g},${this.b})`}toString(){return this.toRgbString()}_sc(t,n,r){const i=this.clone();return i[t]=Ll(n,r),i}_c(t){return new this.constructor(t)}getMax(){return typeof this._max>"u"&&(this._max=Math.max(this.r,this.g,this.b)),this._max}getMin(){return typeof this._min>"u"&&(this._min=Math.min(this.r,this.g,this.b)),this._min}fromHexString(t){const n=t.replace("#","");function r(i,o){return parseInt(n[i]+n[o||i],16)}n.length<6?(this.r=r(0),this.g=r(1),this.b=r(2),this.a=n[3]?r(3)/255:1):(this.r=r(0,1),this.g=r(2,3),this.b=r(4,5),this.a=n[6]?r(6,7)/255:1)}fromHsl({h:t,s:n,l:r,a:i}){if(this._h=t%360,this._s=n,this._l=r,this.a=typeof i=="number"?i:1,n<=0){const d=Sr(r*255);this.r=d,this.g=d,this.b=d}let o=0,l=0,m=0;const u=t/60,p=(1-Math.abs(2*r-1))*n,s=p*(1-Math.abs(u%2-1));u>=0&&u<1?(o=p,l=s):u>=1&&u<2?(o=s,l=p):u>=2&&u<3?(l=p,m=s):u>=3&&u<4?(l=s,m=p):u>=4&&u<5?(o=s,m=p):u>=5&&u<6&&(o=p,m=s);const c=r-p/2;this.r=Sr((o+c)*255),this.g=Sr((l+c)*255),this.b=Sr((m+c)*255)}fromHsv({h:t,s:n,v:r,a:i}){this._h=t%360,this._s=n,this._v=r,this.a=typeof i=="number"?i:1;const o=Sr(r*255);if(this.r=o,this.g=o,this.b=o,n<=0)return;const l=t/60,m=Math.floor(l),u=l-m,p=Sr(r*(1-n)*255),s=Sr(r*(1-n*u)*255),c=Sr(r*(1-n*(1-u))*255);switch(m){case 0:this.g=c,this.b=p;break;case 1:this.r=s,this.b=p;break;case 2:this.r=p,this.b=c;break;case 3:this.r=p,this.g=s;break;case 4:this.r=c,this.g=p;break;case 5:default:this.g=p,this.b=s;break}}fromHsvString(t){const n=yp(t,tw);this.fromHsv({h:n[0],s:n[1],v:n[2],a:n[3]})}fromHslString(t){const n=yp(t,tw);this.fromHsl({h:n[0],s:n[1],l:n[2],a:n[3]})}fromRgbString(t){const n=yp(t,(r,i)=>i.includes("%")?Sr(r/100*255):r);this.r=n[0],this.g=n[1],this.b=n[2],this.a=n[3]}};var ju=2,nw=.16,VT=.05,UT=.05,GT=.15,m$=5,v$=4,KT=[{index:7,amount:15},{index:6,amount:25},{index:5,amount:30},{index:5,amount:45},{index:5,amount:65},{index:5,amount:85},{index:4,amount:90},{index:3,amount:95},{index:2,amount:97},{index:1,amount:98}];function rw(e,t,n){var r;return Math.round(e.h)>=60&&Math.round(e.h)<=240?r=n?Math.round(e.h)-ju*t:Math.round(e.h)+ju*t:r=n?Math.round(e.h)+ju*t:Math.round(e.h)-ju*t,r<0?r+=360:r>=360&&(r-=360),r}function iw(e,t,n){if(e.h===0&&e.s===0)return e.s;var r;return n?r=e.s-nw*t:t===v$?r=e.s+nw:r=e.s+VT*t,r>1&&(r=1),n&&t===m$&&r>.1&&(r=.1),r<.06&&(r=.06),Math.round(r*100)/100}function ow(e,t,n){var r;return n?r=e.v+UT*t:r=e.v-GT*t,r=Math.max(0,Math.min(1,r)),Math.round(r*100)/100}function dc(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=[],r=new Un(e),i=r.toHsv(),o=m$;o>0;o-=1){var l=new Un({h:rw(i,o,!0),s:iw(i,o,!0),v:ow(i,o,!0)});n.push(l)}n.push(r);for(var m=1;m<=v$;m+=1){var u=new Un({h:rw(i,m),s:iw(i,m),v:ow(i,m)});n.push(u)}return t.theme==="dark"?KT.map(function(p){var s=p.index,c=p.amount;return new Un(t.backgroundColor||"#141414").mix(n[s],c).toHexString()}):n.map(function(p){return p.toHexString()})}var bp={red:"#F5222D",volcano:"#FA541C",orange:"#FA8C16",gold:"#FAAD14",yellow:"#FADB14",lime:"#A0D911",green:"#52C41A",cyan:"#13C2C2",blue:"#1677FF",geekblue:"#2F54EB",purple:"#722ED1",magenta:"#EB2F96",grey:"#666666"},jg=["#fff1f0","#ffccc7","#ffa39e","#ff7875","#ff4d4f","#f5222d","#cf1322","#a8071a","#820014","#5c0011"];jg.primary=jg[5];var Bg=["#fff2e8","#ffd8bf","#ffbb96","#ff9c6e","#ff7a45","#fa541c","#d4380d","#ad2102","#871400","#610b00"];Bg.primary=Bg[5];var Hg=["#fff7e6","#ffe7ba","#ffd591","#ffc069","#ffa940","#fa8c16","#d46b08","#ad4e00","#873800","#612500"];Hg.primary=Hg[5];var Rd=["#fffbe6","#fff1b8","#ffe58f","#ffd666","#ffc53d","#faad14","#d48806","#ad6800","#874d00","#613400"];Rd.primary=Rd[5];var Wg=["#feffe6","#ffffb8","#fffb8f","#fff566","#ffec3d","#fadb14","#d4b106","#ad8b00","#876800","#614700"];Wg.primary=Wg[5];var Vg=["#fcffe6","#f4ffb8","#eaff8f","#d3f261","#bae637","#a0d911","#7cb305","#5b8c00","#3f6600","#254000"];Vg.primary=Vg[5];var Ug=["#f6ffed","#d9f7be","#b7eb8f","#95de64","#73d13d","#52c41a","#389e0d","#237804","#135200","#092b00"];Ug.primary=Ug[5];var Gg=["#e6fffb","#b5f5ec","#87e8de","#5cdbd3","#36cfc9","#13c2c2","#08979c","#006d75","#00474f","#002329"];Gg.primary=Gg[5];var Od=["#e6f4ff","#bae0ff","#91caff","#69b1ff","#4096ff","#1677ff","#0958d9","#003eb3","#002c8c","#001d66"];Od.primary=Od[5];var Kg=["#f0f5ff","#d6e4ff","#adc6ff","#85a5ff","#597ef7","#2f54eb","#1d39c4","#10239e","#061178","#030852"];Kg.primary=Kg[5];var Yg=["#f9f0ff","#efdbff","#d3adf7","#b37feb","#9254de","#722ed1","#531dab","#391085","#22075e","#120338"];Yg.primary=Yg[5];var Xg=["#fff0f6","#ffd6e7","#ffadd2","#ff85c0","#f759ab","#eb2f96","#c41d7f","#9e1068","#780650","#520339"];Xg.primary=Xg[5];var qg=["#a6a6a6","#999999","#8c8c8c","#808080","#737373","#666666","#404040","#1a1a1a","#000000","#000000"];qg.primary=qg[5];var wp={red:jg,volcano:Bg,orange:Hg,gold:Rd,yellow:Wg,lime:Vg,green:Ug,cyan:Gg,blue:Od,geekblue:Kg,purple:Yg,magenta:Xg,grey:qg};function YT(e,{generateColorPalettes:t,generateNeutralColorPalettes:n}){const{colorSuccess:r,colorWarning:i,colorError:o,colorInfo:l,colorPrimary:m,colorBgBase:u,colorTextBase:p}=e,s=t(m),c=t(r),d=t(i),h=t(o),f=t(l),v=n(u,p),y=e.colorLink||e.colorInfo,b=t(y),w=new Un(h[1]).mix(new Un(h[3]),50).toHexString();return Object.assign(Object.assign({},v),{colorPrimaryBg:s[1],colorPrimaryBgHover:s[2],colorPrimaryBorder:s[3],colorPrimaryBorderHover:s[4],colorPrimaryHover:s[5],colorPrimary:s[6],colorPrimaryActive:s[7],colorPrimaryTextHover:s[8],colorPrimaryText:s[9],colorPrimaryTextActive:s[10],colorSuccessBg:c[1],colorSuccessBgHover:c[2],colorSuccessBorder:c[3],colorSuccessBorderHover:c[4],colorSuccessHover:c[4],colorSuccess:c[6],colorSuccessActive:c[7],colorSuccessTextHover:c[8],colorSuccessText:c[9],colorSuccessTextActive:c[10],colorErrorBg:h[1],colorErrorBgHover:h[2],colorErrorBgFilledHover:w,colorErrorBgActive:h[3],colorErrorBorder:h[3],colorErrorBorderHover:h[4],colorErrorHover:h[5],colorError:h[6],colorErrorActive:h[7],colorErrorTextHover:h[8],colorErrorText:h[9],colorErrorTextActive:h[10],colorWarningBg:d[1],colorWarningBgHover:d[2],colorWarningBorder:d[3],colorWarningBorderHover:d[4],colorWarningHover:d[4],colorWarning:d[6],colorWarningActive:d[7],colorWarningTextHover:d[8],colorWarningText:d[9],colorWarningTextActive:d[10],colorInfoBg:f[1],colorInfoBgHover:f[2],colorInfoBorder:f[3],colorInfoBorderHover:f[4],colorInfoHover:f[4],colorInfo:f[6],colorInfoActive:f[7],colorInfoTextHover:f[8],colorInfoText:f[9],colorInfoTextActive:f[10],colorLinkHover:b[4],colorLink:b[6],colorLinkActive:b[7],colorBgMask:new Un("#000").setA(.45).toRgbString(),colorWhite:"#fff"})}const XT=e=>{let t=e,n=e,r=e,i=e;return e<6&&e>=5?t=e+1:e<16&&e>=6?t=e+2:e>=16&&(t=16),e<7&&e>=5?n=4:e<8&&e>=7?n=5:e<14&&e>=8?n=6:e<16&&e>=14?n=7:e>=16&&(n=8),e<6&&e>=2?r=1:e>=6&&(r=2),e>4&&e<8?i=4:e>=8&&(i=6),{borderRadius:e,borderRadiusXS:r,borderRadiusSM:n,borderRadiusLG:t,borderRadiusOuter:i}};function qT(e){const{motionUnit:t,motionBase:n,borderRadius:r,lineWidth:i}=e;return Object.assign({motionDurationFast:`${(n+t).toFixed(1)}s`,motionDurationMid:`${(n+t*2).toFixed(1)}s`,motionDurationSlow:`${(n+t*3).toFixed(1)}s`,lineWidthBold:i+1},XT(r))}const QT=e=>{const{controlHeight:t}=e;return{controlHeightSM:t*.75,controlHeightXS:t*.5,controlHeightLG:t*1.25}};function fd(e){return(e+8)/e}function ZT(e){const t=Array.from({length:10}).map((n,r)=>{const i=r-1,o=e*Math.pow(Math.E,i/5),l=r>1?Math.floor(o):Math.ceil(o);return Math.floor(l/2)*2});return t[1]=e,t.map(n=>({size:n,lineHeight:fd(n)}))}const JT=e=>{const t=ZT(e),n=t.map(s=>s.size),r=t.map(s=>s.lineHeight),i=n[1],o=n[0],l=n[2],m=r[1],u=r[0],p=r[2];return{fontSizeSM:o,fontSize:i,fontSizeLG:l,fontSizeXL:n[3],fontSizeHeading1:n[6],fontSizeHeading2:n[5],fontSizeHeading3:n[4],fontSizeHeading4:n[3],fontSizeHeading5:n[2],lineHeight:m,lineHeightLG:p,lineHeightSM:u,fontHeight:Math.round(m*i),fontHeightLG:Math.round(p*l),fontHeightSM:Math.round(u*o),lineHeightHeading1:r[6],lineHeightHeading2:r[5],lineHeightHeading3:r[4],lineHeightHeading4:r[3],lineHeightHeading5:r[2]}};function eI(e){const{sizeUnit:t,sizeStep:n}=e;return{sizeXXL:t*(n+8),sizeXL:t*(n+4),sizeLG:t*(n+2),sizeMD:t*(n+1),sizeMS:t*n,size:t*n,sizeSM:t*(n-1),sizeXS:t*(n-2),sizeXXS:t*(n-3)}}const Oi=(e,t)=>new Un(e).setA(t).toRgbString(),Pl=(e,t)=>new Un(e).darken(t).toHexString(),tI=e=>{const t=dc(e);return{1:t[0],2:t[1],3:t[2],4:t[3],5:t[4],6:t[5],7:t[6],8:t[4],9:t[5],10:t[6]}},nI=(e,t)=>{const n=e||"#fff",r=t||"#000";return{colorBgBase:n,colorTextBase:r,colorText:Oi(r,.88),colorTextSecondary:Oi(r,.65),colorTextTertiary:Oi(r,.45),colorTextQuaternary:Oi(r,.25),colorFill:Oi(r,.15),colorFillSecondary:Oi(r,.06),colorFillTertiary:Oi(r,.04),colorFillQuaternary:Oi(r,.02),colorBgSolid:Oi(r,1),colorBgSolidHover:Oi(r,.75),colorBgSolidActive:Oi(r,.95),colorBgLayout:Pl(n,4),colorBgContainer:Pl(n,0),colorBgElevated:Pl(n,0),colorBgSpotlight:Oi(r,.85),colorBgBlur:"transparent",colorBorder:Pl(n,15),colorBorderSecondary:Pl(n,6)}};function rI(e){bp.pink=bp.magenta,wp.pink=wp.magenta;const t=Object.keys(p$).map(n=>{const r=e[n]===bp[n]?wp[n]:dc(e[n]);return Array.from({length:10},()=>1).reduce((i,o,l)=>(i[`${n}-${l+1}`]=r[l],i[`${n}${l+1}`]=r[l],i),{})}).reduce((n,r)=>(n=Object.assign(Object.assign({},n),r),n),{});return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},e),t),YT(e,{generateColorPalettes:tI,generateNeutralColorPalettes:nI})),JT(e.fontSize)),eI(e)),QT(e)),qT(e))}const y$=Pg(rI),Qg={token:uc,override:{override:uc},hashed:!0},b$=be.createContext(Qg),fc="ant",ef="anticon",iI=["outlined","borderless","filled","underlined"],oI=(e,t)=>t||(e?`${fc}-${e}`:fc),zt=C.createContext({getPrefixCls:oI,iconPrefixCls:ef}),{Consumer:HW}=zt,aw={};function Ji(e){const t=C.useContext(zt),{getPrefixCls:n,direction:r,getPopupContainer:i}=t,o=t[e];return Object.assign(Object.assign({classNames:aw,styles:aw},o),{getPrefixCls:n,direction:r,getPopupContainer:i})}const aI=`-ant-${Date.now()}-${Math.random()}`;function sI(e,t){const n={},r=(l,m)=>{let u=l.clone();return u=(m==null?void 0:m(u))||u,u.toRgbString()},i=(l,m)=>{const u=new Un(l),p=dc(u.toRgbString());n[`${m}-color`]=r(u),n[`${m}-color-disabled`]=p[1],n[`${m}-color-hover`]=p[4],n[`${m}-color-active`]=p[6],n[`${m}-color-outline`]=u.clone().setA(.2).toRgbString(),n[`${m}-color-deprecated-bg`]=p[0],n[`${m}-color-deprecated-border`]=p[2]};if(t.primaryColor){i(t.primaryColor,"primary");const l=new Un(t.primaryColor),m=dc(l.toRgbString());m.forEach((p,s)=>{n[`primary-${s+1}`]=p}),n["primary-color-deprecated-l-35"]=r(l,p=>p.lighten(35)),n["primary-color-deprecated-l-20"]=r(l,p=>p.lighten(20)),n["primary-color-deprecated-t-20"]=r(l,p=>p.tint(20)),n["primary-color-deprecated-t-50"]=r(l,p=>p.tint(50)),n["primary-color-deprecated-f-12"]=r(l,p=>p.setA(p.a*.12));const u=new Un(m[0]);n["primary-color-active-deprecated-f-30"]=r(u,p=>p.setA(p.a*.3)),n["primary-color-active-deprecated-d-02"]=r(u,p=>p.darken(2))}return t.successColor&&i(t.successColor,"success"),t.warningColor&&i(t.warningColor,"warning"),t.errorColor&&i(t.errorColor,"error"),t.infoColor&&i(t.infoColor,"info"),` + :root { + ${Object.keys(n).map(l=>`--${e}-${l}: ${n[l]};`).join(` +`)} + } + `.trim()}function lI(e,t){const n=sI(e,t);qr()&&Mo(n,`${aI}-dynamic-theme`)}const Ro=C.createContext(!1),w$=({children:e,disabled:t})=>{const n=C.useContext(Ro);return C.createElement(Ro.Provider,{value:t??n},e)},ja=C.createContext(void 0),cI=({children:e,size:t})=>{const n=C.useContext(ja);return C.createElement(ja.Provider,{value:t||n},e)};function uI(){const e=C.useContext(Ro),t=C.useContext(ja);return{componentDisabled:e,componentSize:t}}var S$=ur(function e(){cr(this,e)}),C$="CALC_UNIT",dI=new RegExp(C$,"g");function Sp(e){return typeof e=="number"?"".concat(e).concat(C$):e}var fI=function(e){To(n,e);var t=Io(n);function n(r,i){var o;cr(this,n),o=t.call(this),ne(Ut(o),"result",""),ne(Ut(o),"unitlessCssVar",void 0),ne(Ut(o),"lowPriority",void 0);var l=wt(r);return o.unitlessCssVar=i,r instanceof n?o.result="(".concat(r.result,")"):l==="number"?o.result=Sp(r):l==="string"&&(o.result=r),o}return ur(n,[{key:"add",value:function(i){return i instanceof n?this.result="".concat(this.result," + ").concat(i.getResult()):(typeof i=="number"||typeof i=="string")&&(this.result="".concat(this.result," + ").concat(Sp(i))),this.lowPriority=!0,this}},{key:"sub",value:function(i){return i instanceof n?this.result="".concat(this.result," - ").concat(i.getResult()):(typeof i=="number"||typeof i=="string")&&(this.result="".concat(this.result," - ").concat(Sp(i))),this.lowPriority=!0,this}},{key:"mul",value:function(i){return this.lowPriority&&(this.result="(".concat(this.result,")")),i instanceof n?this.result="".concat(this.result," * ").concat(i.getResult(!0)):(typeof i=="number"||typeof i=="string")&&(this.result="".concat(this.result," * ").concat(i)),this.lowPriority=!1,this}},{key:"div",value:function(i){return this.lowPriority&&(this.result="(".concat(this.result,")")),i instanceof n?this.result="".concat(this.result," / ").concat(i.getResult(!0)):(typeof i=="number"||typeof i=="string")&&(this.result="".concat(this.result," / ").concat(i)),this.lowPriority=!1,this}},{key:"getResult",value:function(i){return this.lowPriority||i?"(".concat(this.result,")"):this.result}},{key:"equal",value:function(i){var o=this,l=i||{},m=l.unit,u=!0;return typeof m=="boolean"?u=m:Array.from(this.unitlessCssVar).some(function(p){return o.result.includes(p)})&&(u=!1),this.result=this.result.replace(dI,u?"px":""),typeof this.lowPriority<"u"?"calc(".concat(this.result,")"):this.result}}]),n}(S$),hI=function(e){To(n,e);var t=Io(n);function n(r){var i;return cr(this,n),i=t.call(this),ne(Ut(i),"result",0),r instanceof n?i.result=r.result:typeof r=="number"&&(i.result=r),i}return ur(n,[{key:"add",value:function(i){return i instanceof n?this.result+=i.result:typeof i=="number"&&(this.result+=i),this}},{key:"sub",value:function(i){return i instanceof n?this.result-=i.result:typeof i=="number"&&(this.result-=i),this}},{key:"mul",value:function(i){return i instanceof n?this.result*=i.result:typeof i=="number"&&(this.result*=i),this}},{key:"div",value:function(i){return i instanceof n?this.result/=i.result:typeof i=="number"&&(this.result/=i),this}},{key:"equal",value:function(){return this.result}}]),n}(S$),pI=function(t,n){var r=t==="css"?fI:hI;return function(i){return new r(i,n)}},sw=function(t,n){return"".concat([n,t.replace(/([A-Z]+)([A-Z][a-z]+)/g,"$1-$2").replace(/([a-z])([A-Z])/g,"$1-$2")].filter(Boolean).join("-"))};function tr(e){var t=C.useRef();t.current=e;var n=C.useCallback(function(){for(var r,i=arguments.length,o=new Array(i),l=0;l1e4){var r=Date.now();this.lastAccessBeat.forEach(function(i,o){r-i>yI&&(n.map.delete(o),n.lastAccessBeat.delete(o))}),this.accessBeat=0}}}]),e}(),dw=new bI;function wI(e,t){return be.useMemo(function(){var n=dw.get(t);if(n)return n;var r=e();return dw.set(t,r),r},t)}var SI=function(){return{}};function CI(e){var t=e.useCSP,n=t===void 0?SI:t,r=e.useToken,i=e.usePrefix,o=e.getResetStyles,l=e.getCommonStyle,m=e.getCompUnitless;function u(d,h,f,v){var y=Array.isArray(d)?d[0]:d;function b(N){return"".concat(String(y)).concat(N.slice(0,1).toUpperCase()).concat(N.slice(1))}var w=(v==null?void 0:v.unitless)||{},x=typeof m=="function"?m(d):{},E=oe(oe({},x),{},ne({},b("zIndexPopup"),!0));Object.keys(w).forEach(function(N){E[b(N)]=w[N]});var _=oe(oe({},v),{},{unitless:E,prefixToken:b}),$=s(d,h,f,_),O=p(y,f,_);return function(N){var k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:N,L=$(N,k),F=pe(L,2),P=F[1],A=O(k),M=pe(A,2),R=M[0],I=M[1];return[R,P,I]}}function p(d,h,f){var v=f.unitless,y=f.injectStyle,b=y===void 0?!0:y,w=f.prefixToken,x=f.ignore,E=function(O){var N=O.rootCls,k=O.cssVar,L=k===void 0?{}:k,F=r(),P=F.realToken;return IT({path:[d],prefix:L.prefix,key:L.key,unitless:v,ignore:x,token:P,scope:N},function(){var A=uw(d,P,h),M=lw(d,P,A,{deprecatedTokens:f==null?void 0:f.deprecatedTokens});return Object.keys(A).forEach(function(R){M[w(R)]=M[R],delete M[R]}),M}),null},_=function(O){var N=r(),k=N.cssVar;return[function(L){return b&&k?be.createElement(be.Fragment,null,be.createElement(E,{rootCls:O,cssVar:k,component:d}),L):L},k==null?void 0:k.key]};return _}function s(d,h,f){var v=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},y=Array.isArray(d)?d:[d,d],b=pe(y,1),w=b[0],x=y.join("-"),E=e.layer||{name:"antd"};return function(_){var $=arguments.length>1&&arguments[1]!==void 0?arguments[1]:_,O=r(),N=O.theme,k=O.realToken,L=O.hashId,F=O.token,P=O.cssVar,A=i(),M=A.rootPrefixCls,R=A.iconPrefixCls,I=n(),D=P?"css":"js",j=wI(function(){var K=new Set;return P&&Object.keys(v.unitless||{}).forEach(function(G){K.add(ad(G,P.prefix)),K.add(ad(G,sw(w,P.prefix)))}),pI(D,K)},[D,w,P==null?void 0:P.prefix]),B=vI(D),V=B.max,H=B.min,Y={theme:N,token:F,hashId:L,nonce:function(){return I.nonce},clientOnly:v.clientOnly,layer:E,order:v.order||-999};typeof o=="function"&&zg(oe(oe({},Y),{},{clientOnly:!1,path:["Shared",M]}),function(){return o(F,{prefix:{rootPrefixCls:M,iconPrefixCls:R},csp:I})});var U=zg(oe(oe({},Y),{},{path:[x,_,R]}),function(){if(v.injectStyle===!1)return[];var K=mI(F),G=K.token,q=K.flush,Z=uw(w,k,f),Q=".".concat(_),J=lw(w,k,Z,{deprecatedTokens:v.deprecatedTokens});P&&Z&&wt(Z)==="object"&&Object.keys(Z).forEach(function(ge){Z[ge]="var(".concat(ad(ge,sw(w,P.prefix)),")")});var ie=Sn(G,{componentCls:Q,prefixCls:_,iconCls:".".concat(R),antCls:".".concat(M),calc:j,max:V,min:H},P?Z:J),se=h(ie,{hashId:L,prefixCls:_,rootPrefixCls:M,iconPrefixCls:R});q(w,J);var ae=typeof l=="function"?l(ie,_,$,v.resetFont):null;return[v.resetStyle===!1?null:ae,se]});return[U,L]}}function c(d,h,f){var v=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},y=s(d,h,f,oe({resetStyle:!1,order:-998},v)),b=function(x){var E=x.prefixCls,_=x.rootCls,$=_===void 0?E:_;return y(E,$),null};return b}return{genStyleHooks:u,genSubStyleComponent:c,genComponentStyleHook:s}}const Ba=["blue","purple","cyan","green","magenta","pink","red","orange","yellow","volcano","geekblue","lime","gold"],$I="5.25.3";function $p(e){return e>=0&&e<=255}function Wl(e,t){const{r:n,g:r,b:i,a:o}=new Un(e).toRgb();if(o<1)return e;const{r:l,g:m,b:u}=new Un(t).toRgb();for(let p=.01;p<=1;p+=.01){const s=Math.round((n-l*(1-p))/p),c=Math.round((r-m*(1-p))/p),d=Math.round((i-u*(1-p))/p);if($p(s)&&$p(c)&&$p(d))return new Un({r:s,g:c,b:d,a:Math.round(p*100)/100}).toRgbString()}return new Un({r:n,g:r,b:i,a:1}).toRgbString()}var xI=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i{delete r[d]});const i=Object.assign(Object.assign({},n),r),o=480,l=576,m=768,u=992,p=1200,s=1600;if(i.motion===!1){const d="0s";i.motionDurationFast=d,i.motionDurationMid=d,i.motionDurationSlow=d}return Object.assign(Object.assign(Object.assign({},i),{colorFillContent:i.colorFillSecondary,colorFillContentHover:i.colorFill,colorFillAlter:i.colorFillQuaternary,colorBgContainerDisabled:i.colorFillTertiary,colorBorderBg:i.colorBgContainer,colorSplit:Wl(i.colorBorderSecondary,i.colorBgContainer),colorTextPlaceholder:i.colorTextQuaternary,colorTextDisabled:i.colorTextQuaternary,colorTextHeading:i.colorText,colorTextLabel:i.colorTextSecondary,colorTextDescription:i.colorTextTertiary,colorTextLightSolid:i.colorWhite,colorHighlight:i.colorError,colorBgTextHover:i.colorFillSecondary,colorBgTextActive:i.colorFill,colorIcon:i.colorTextTertiary,colorIconHover:i.colorText,colorErrorOutline:Wl(i.colorErrorBg,i.colorBgContainer),colorWarningOutline:Wl(i.colorWarningBg,i.colorBgContainer),fontSizeIcon:i.fontSizeSM,lineWidthFocus:i.lineWidth*3,lineWidth:i.lineWidth,controlOutlineWidth:i.lineWidth*2,controlInteractiveSize:i.controlHeight/2,controlItemBgHover:i.colorFillTertiary,controlItemBgActive:i.colorPrimaryBg,controlItemBgActiveHover:i.colorPrimaryBgHover,controlItemBgActiveDisabled:i.colorFill,controlTmpOutline:i.colorFillQuaternary,controlOutline:Wl(i.colorPrimaryBg,i.colorBgContainer),lineType:i.lineType,borderRadius:i.borderRadius,borderRadiusXS:i.borderRadiusXS,borderRadiusSM:i.borderRadiusSM,borderRadiusLG:i.borderRadiusLG,fontWeightStrong:600,opacityLoading:.65,linkDecoration:"none",linkHoverDecoration:"none",linkFocusDecoration:"none",controlPaddingHorizontal:12,controlPaddingHorizontalSM:8,paddingXXS:i.sizeXXS,paddingXS:i.sizeXS,paddingSM:i.sizeSM,padding:i.size,paddingMD:i.sizeMD,paddingLG:i.sizeLG,paddingXL:i.sizeXL,paddingContentHorizontalLG:i.sizeLG,paddingContentVerticalLG:i.sizeMS,paddingContentHorizontal:i.sizeMS,paddingContentVertical:i.sizeSM,paddingContentHorizontalSM:i.size,paddingContentVerticalSM:i.sizeXS,marginXXS:i.sizeXXS,marginXS:i.sizeXS,marginSM:i.sizeSM,margin:i.size,marginMD:i.sizeMD,marginLG:i.sizeLG,marginXL:i.sizeXL,marginXXL:i.sizeXXL,boxShadow:` + 0 6px 16px 0 rgba(0, 0, 0, 0.08), + 0 3px 6px -4px rgba(0, 0, 0, 0.12), + 0 9px 28px 8px rgba(0, 0, 0, 0.05) + `,boxShadowSecondary:` + 0 6px 16px 0 rgba(0, 0, 0, 0.08), + 0 3px 6px -4px rgba(0, 0, 0, 0.12), + 0 9px 28px 8px rgba(0, 0, 0, 0.05) + `,boxShadowTertiary:` + 0 1px 2px 0 rgba(0, 0, 0, 0.03), + 0 1px 6px -1px rgba(0, 0, 0, 0.02), + 0 2px 4px 0 rgba(0, 0, 0, 0.02) + `,screenXS:o,screenXSMin:o,screenXSMax:l-1,screenSM:l,screenSMMin:l,screenSMMax:m-1,screenMD:m,screenMDMin:m,screenMDMax:u-1,screenLG:u,screenLGMin:u,screenLGMax:p-1,screenXL:p,screenXLMin:p,screenXLMax:s-1,screenXXL:s,screenXXLMin:s,boxShadowPopoverArrow:"2px 2px 5px rgba(0, 0, 0, 0.05)",boxShadowCard:` + 0 1px 2px -2px ${new Un("rgba(0, 0, 0, 0.16)").toRgbString()}, + 0 3px 6px 0 ${new Un("rgba(0, 0, 0, 0.12)").toRgbString()}, + 0 5px 12px 4px ${new Un("rgba(0, 0, 0, 0.09)").toRgbString()} + `,boxShadowDrawerRight:` + -6px 0 16px 0 rgba(0, 0, 0, 0.08), + -3px 0 6px -4px rgba(0, 0, 0, 0.12), + -9px 0 28px 8px rgba(0, 0, 0, 0.05) + `,boxShadowDrawerLeft:` + 6px 0 16px 0 rgba(0, 0, 0, 0.08), + 3px 0 6px -4px rgba(0, 0, 0, 0.12), + 9px 0 28px 8px rgba(0, 0, 0, 0.05) + `,boxShadowDrawerUp:` + 0 6px 16px 0 rgba(0, 0, 0, 0.08), + 0 3px 6px -4px rgba(0, 0, 0, 0.12), + 0 9px 28px 8px rgba(0, 0, 0, 0.05) + `,boxShadowDrawerDown:` + 0 -6px 16px 0 rgba(0, 0, 0, 0.08), + 0 -3px 6px -4px rgba(0, 0, 0, 0.12), + 0 -9px 28px 8px rgba(0, 0, 0, 0.05) + `,boxShadowTabsOverflowLeft:"inset 10px 0 8px -8px rgba(0, 0, 0, 0.08)",boxShadowTabsOverflowRight:"inset -10px 0 8px -8px rgba(0, 0, 0, 0.08)",boxShadowTabsOverflowTop:"inset 0 10px 8px -8px rgba(0, 0, 0, 0.08)",boxShadowTabsOverflowBottom:"inset 0 -10px 8px -8px rgba(0, 0, 0, 0.08)"}),r)}var fw=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i{const r=n.getDerivativeToken(e),{override:i}=t,o=fw(t,["override"]);let l=Object.assign(Object.assign({},r),{override:i});return l=x$(l),o&&Object.entries(o).forEach(([m,u])=>{const{theme:p}=u,s=fw(u,["theme"]);let c=s;p&&(c=_$(Object.assign(Object.assign({},l),s),{override:s},p)),l[m]=c}),l};function Si(){const{token:e,hashed:t,theme:n,override:r,cssVar:i}=be.useContext(b$),o=`${$I}-${t||""}`,l=n||y$,[m,u,p]=iT(l,[uc,e],{salt:o,override:r,getComputedToken:_$,formatToken:x$,cssVar:i&&{prefix:i.prefix,key:i.key,unitless:E$,ignore:EI,preserve:_I}});return[l,p,t?u:"",m,i]}const Ys={overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"},ci=(e,t=!1)=>({boxSizing:"border-box",margin:0,padding:0,color:e.colorText,fontSize:e.fontSize,lineHeight:e.lineHeight,listStyle:"none",fontFamily:t?"inherit":e.fontFamily}),Rc=()=>({display:"inline-flex",alignItems:"center",color:"inherit",fontStyle:"normal",lineHeight:0,textAlign:"center",textTransform:"none",verticalAlign:"-0.125em",textRendering:"optimizeLegibility","-webkit-font-smoothing":"antialiased","-moz-osx-font-smoothing":"grayscale","> *":{lineHeight:1},svg:{display:"inline-block"}}),Oc=()=>({"&::before":{display:"table",content:'""'},"&::after":{display:"table",clear:"both",content:'""'}}),MI=e=>({a:{color:e.colorLink,textDecoration:e.linkDecoration,backgroundColor:"transparent",outline:"none",cursor:"pointer",transition:`color ${e.motionDurationSlow}`,"-webkit-text-decoration-skip":"objects","&:hover":{color:e.colorLinkHover},"&:active":{color:e.colorLinkActive},"&:active, &:hover":{textDecoration:e.linkHoverDecoration,outline:0},"&:focus":{textDecoration:e.linkFocusDecoration,outline:0},"&[disabled]":{color:e.colorTextDisabled,cursor:"not-allowed"}}}),RI=(e,t,n,r)=>{const i=`[class^="${t}"], [class*=" ${t}"]`,o=n?`.${n}`:i,l={boxSizing:"border-box","&::before, &::after":{boxSizing:"border-box"}};let m={};return r!==!1&&(m={fontFamily:e.fontFamily,fontSize:e.fontSize}),{[o]:Object.assign(Object.assign(Object.assign({},m),l),{[i]:l})}},fv=(e,t)=>({outline:`${$e(e.lineWidthFocus)} solid ${e.colorPrimaryBorder}`,outlineOffset:t??1,transition:"outline-offset 0s, outline 0s"}),Ha=(e,t)=>({"&:focus-visible":Object.assign({},fv(e,t))}),M$=e=>({[`.${e}`]:Object.assign(Object.assign({},Rc()),{[`.${e} .${e}-icon`]:{display:"block"}})}),R$=e=>Object.assign(Object.assign({color:e.colorLink,textDecoration:e.linkDecoration,outline:"none",cursor:"pointer",transition:`all ${e.motionDurationSlow}`,border:0,padding:0,background:"none",userSelect:"none"},Ha(e)),{"&:focus, &:hover":{color:e.colorLinkHover},"&:active":{color:e.colorLinkActive}}),{genStyleHooks:gr,genComponentStyleHook:OI,genSubStyleComponent:hv}=CI({usePrefix:()=>{const{getPrefixCls:e,iconPrefixCls:t}=C.useContext(zt);return{rootPrefixCls:e(),iconPrefixCls:t}},useToken:()=>{const[e,t,n,r,i]=Si();return{theme:e,realToken:t,hashId:n,token:r,cssVar:i}},useCSP:()=>{const{csp:e}=C.useContext(zt);return e??{}},getResetStyles:(e,t)=>{var n;const r=MI(e);return[r,{"&":r},M$((n=t==null?void 0:t.prefix.iconPrefixCls)!==null&&n!==void 0?n:ef)]},getCommonStyle:RI,getCompUnitless:()=>E$});function AI(e,t){return Ba.reduce((n,r)=>{const i=e[`${r}1`],o=e[`${r}3`],l=e[`${r}6`],m=e[`${r}7`];return Object.assign(Object.assign({},n),t(r,{lightColor:i,lightBorderColor:o,darkColor:l,textColor:m}))},{})}const TI=(e,t)=>{const[n,r]=Si();return zg({token:r,hashId:"",path:["ant-design-icons",e],nonce:()=>t==null?void 0:t.nonce,layer:{name:"antd"}},()=>[M$(e)])},II=Object.assign({},Wd),{useId:hw}=II,LI=()=>"",PI=typeof hw>"u"?LI:hw;function kI(e,t,n){var r;_c();const i=e||{},o=i.inherit===!1||!t?Object.assign(Object.assign({},Qg),{hashed:(r=t==null?void 0:t.hashed)!==null&&r!==void 0?r:Qg.hashed,cssVar:t==null?void 0:t.cssVar}):t,l=PI();return xc(()=>{var m,u;if(!e)return t;const p=Object.assign({},o.components);Object.keys(e.components||{}).forEach(d=>{p[d]=Object.assign(Object.assign({},p[d]),e.components[d])});const s=`css-var-${l.replace(/:/g,"")}`,c=((m=i.cssVar)!==null&&m!==void 0?m:o.cssVar)&&Object.assign(Object.assign(Object.assign({prefix:n==null?void 0:n.prefixCls},typeof o.cssVar=="object"?o.cssVar:{}),typeof i.cssVar=="object"?i.cssVar:{}),{key:typeof i.cssVar=="object"&&((u=i.cssVar)===null||u===void 0?void 0:u.key)||s});return Object.assign(Object.assign(Object.assign({},o),i),{token:Object.assign(Object.assign({},o.token),i.token),components:p,cssVar:c})},[i,o],(m,u)=>m.some((p,s)=>{const c=u[s];return!lc(p,c,!0)}))}var NI=["children"],O$=C.createContext({});function DI(e){var t=e.children,n=At(e,NI);return C.createElement(O$.Provider,{value:n},t)}var FI=function(e){To(n,e);var t=Io(n);function n(){return cr(this,n),t.apply(this,arguments)}return ur(n,[{key:"render",value:function(){return this.props.children}}]),n}(C.Component);function zI(e){var t=C.useReducer(function(m){return m+1},0),n=pe(t,2),r=n[1],i=C.useRef(e),o=tr(function(){return i.current}),l=tr(function(m){i.current=typeof m=="function"?m(i.current):m,r()});return[o,l]}var ia="none",Bu="appear",Hu="enter",Wu="leave",pw="none",Gi="prepare",Is="start",Ls="active",pv="end",A$="prepared";function gw(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit".concat(e)]="webkit".concat(t),n["Moz".concat(e)]="moz".concat(t),n["ms".concat(e)]="MS".concat(t),n["O".concat(e)]="o".concat(t.toLowerCase()),n}function jI(e,t){var n={animationend:gw("Animation","AnimationEnd"),transitionend:gw("Transition","TransitionEnd")};return e&&("AnimationEvent"in t||delete n.animationend.animation,"TransitionEvent"in t||delete n.transitionend.transition),n}var BI=jI(qr(),typeof window<"u"?window:{}),T$={};if(qr()){var HI=document.createElement("div");T$=HI.style}var Vu={};function I$(e){if(Vu[e])return Vu[e];var t=BI[e];if(t)for(var n=Object.keys(t),r=n.length,i=0;i1&&arguments[1]!==void 0?arguments[1]:2;t();var o=gn(function(){i<=1?r({isCanceled:function(){return o!==e.current}}):n(r,i-1)});e.current=o}return C.useEffect(function(){return function(){t()}},[]),[n,t]};var UI=[Gi,Is,Ls,pv],GI=[Gi,A$],D$=!1,KI=!0;function F$(e){return e===Ls||e===pv}const YI=function(e,t,n){var r=Ks(pw),i=pe(r,2),o=i[0],l=i[1],m=VI(),u=pe(m,2),p=u[0],s=u[1];function c(){l(Gi,!0)}var d=t?GI:UI;return N$(function(){if(o!==pw&&o!==pv){var h=d.indexOf(o),f=d[h+1],v=n(o);v===D$?l(f,!0):f&&p(function(y){function b(){y.isCanceled()||l(f,!0)}v===!0?b():Promise.resolve(v).then(b)})}},[e,o]),C.useEffect(function(){return function(){s()}},[]),[c,o]};function XI(e,t,n,r){var i=r.motionEnter,o=i===void 0?!0:i,l=r.motionAppear,m=l===void 0?!0:l,u=r.motionLeave,p=u===void 0?!0:u,s=r.motionDeadline,c=r.motionLeaveImmediately,d=r.onAppearPrepare,h=r.onEnterPrepare,f=r.onLeavePrepare,v=r.onAppearStart,y=r.onEnterStart,b=r.onLeaveStart,w=r.onAppearActive,x=r.onEnterActive,E=r.onLeaveActive,_=r.onAppearEnd,$=r.onEnterEnd,O=r.onLeaveEnd,N=r.onVisibleChanged,k=Ks(),L=pe(k,2),F=L[0],P=L[1],A=zI(ia),M=pe(A,2),R=M[0],I=M[1],D=Ks(null),j=pe(D,2),B=j[0],V=j[1],H=R(),Y=C.useRef(!1),U=C.useRef(null);function K(){return n()}var G=C.useRef(!1);function q(){I(ia),V(null,!0)}var Z=tr(function(Ie){var Ye=R();if(Ye!==ia){var Me=K();if(!(Ie&&!Ie.deadline&&Ie.target!==Me)){var ke=G.current,Je;Ye===Bu&&ke?Je=_==null?void 0:_(Me,Ie):Ye===Hu&&ke?Je=$==null?void 0:$(Me,Ie):Ye===Wu&&ke&&(Je=O==null?void 0:O(Me,Ie)),ke&&Je!==!1&&q()}}}),Q=WI(Z),J=pe(Q,1),ie=J[0],se=function(Ye){switch(Ye){case Bu:return ne(ne(ne({},Gi,d),Is,v),Ls,w);case Hu:return ne(ne(ne({},Gi,h),Is,y),Ls,x);case Wu:return ne(ne(ne({},Gi,f),Is,b),Ls,E);default:return{}}},ae=C.useMemo(function(){return se(H)},[H]),ge=YI(H,!e,function(Ie){if(Ie===Gi){var Ye=ae[Gi];return Ye?Ye(K()):D$}if(we in ae){var Me;V(((Me=ae[we])===null||Me===void 0?void 0:Me.call(ae,K(),null))||null)}return we===Ls&&H!==ia&&(ie(K()),s>0&&(clearTimeout(U.current),U.current=setTimeout(function(){Z({deadline:!0})},s))),we===A$&&q(),KI}),me=pe(ge,2),de=me[0],we=me[1],Oe=F$(we);G.current=Oe;var xe=C.useRef(null);N$(function(){if(!(Y.current&&xe.current===t)){P(t);var Ie=Y.current;Y.current=!0;var Ye;!Ie&&t&&m&&(Ye=Bu),Ie&&t&&o&&(Ye=Hu),(Ie&&!t&&p||!Ie&&c&&!t&&p)&&(Ye=Wu);var Me=se(Ye);Ye&&(e||Me[Gi])?(I(Ye),de()):I(ia),xe.current=t}},[t]),C.useEffect(function(){(H===Bu&&!m||H===Hu&&!o||H===Wu&&!p)&&I(ia)},[m,o,p]),C.useEffect(function(){return function(){Y.current=!1,clearTimeout(U.current)}},[]);var Pe=C.useRef(!1);C.useEffect(function(){F&&(Pe.current=!0),F!==void 0&&H===ia&&((Pe.current||F)&&(N==null||N(F)),Pe.current=!0)},[F,H]);var ze=B;return ae[Gi]&&we===Is&&(ze=oe({transition:"none"},ze)),[H,we,ze,F??t]}function qI(e){var t=e;wt(e)==="object"&&(t=e.transitionSupport);function n(i,o){return!!(i.motionName&&t&&o!==!1)}var r=C.forwardRef(function(i,o){var l=i.visible,m=l===void 0?!0:l,u=i.removeOnLeave,p=u===void 0?!0:u,s=i.forceRender,c=i.children,d=i.motionName,h=i.leavedClassName,f=i.eventProps,v=C.useContext(O$),y=v.motion,b=n(i,y),w=C.useRef(),x=C.useRef();function E(){try{return w.current instanceof HTMLElement?w.current:od(x.current)}catch{return null}}var _=XI(b,m,E,i),$=pe(_,4),O=$[0],N=$[1],k=$[2],L=$[3],F=C.useRef(L);L&&(F.current=!0);var P=C.useCallback(function(j){w.current=j,tv(o,j)},[o]),A,M=oe(oe({},f),{},{visible:m});if(!c)A=null;else if(O===ia)L?A=c(oe({},M),P):!p&&F.current&&h?A=c(oe(oe({},M),{},{className:h}),P):s||!p&&!h?A=c(oe(oe({},M),{},{style:{display:"none"}}),P):A=null;else{var R;N===Gi?R="prepare":F$(N)?R="active":N===Is&&(R="start");var I=yw(d,"".concat(O,"-").concat(R));A=c(oe(oe({},M),{},{className:ve(yw(d,O),ne(ne({},I,I&&R),d,typeof d=="string")),style:k}),P)}if(C.isValidElement(A)&&fa(A)){var D=Ka(A);D||(A=C.cloneElement(A,{ref:P}))}return C.createElement(FI,{ref:x},A)});return r.displayName="CSSMotion",r}const Lo=qI(k$);var Jg="add",em="keep",tm="remove",xp="removed";function QI(e){var t;return e&&wt(e)==="object"&&"key"in e?t=e:t={key:e},oe(oe({},t),{},{key:String(t.key)})}function nm(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return e.map(QI)}function ZI(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=[],r=0,i=t.length,o=nm(e),l=nm(t);o.forEach(function(p){for(var s=!1,c=r;c1});return u.forEach(function(p){n=n.filter(function(s){var c=s.key,d=s.status;return c!==p||d!==tm}),n.forEach(function(s){s.key===p&&(s.status=em)})}),n}var JI=["component","children","onVisibleChanged","onAllRemoved"],eL=["status"],tL=["eventProps","visible","children","motionName","motionAppear","motionEnter","motionLeave","motionLeaveImmediately","motionDeadline","removeOnLeave","leavedClassName","onAppearPrepare","onAppearStart","onAppearActive","onAppearEnd","onEnterStart","onEnterActive","onEnterEnd","onLeaveStart","onLeaveActive","onLeaveEnd"];function nL(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Lo,n=function(r){To(o,r);var i=Io(o);function o(){var l;cr(this,o);for(var m=arguments.length,u=new Array(m),p=0;pnull;var oL=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);it.endsWith("Color"))}const cL=e=>{const{prefixCls:t,iconPrefixCls:n,theme:r,holderRender:i}=e;t!==void 0&&(Ad=t),n!==void 0&&(j$=n),"holderRender"in e&&(H$=i),r&&(lL(r)?lI(hd(),r):B$=r)},W$=()=>({getPrefixCls:(e,t)=>t||(e?`${hd()}-${e}`:hd()),getIconPrefixCls:sL,getRootPrefixCls:()=>Ad||hd(),getTheme:()=>B$,holderRender:H$}),uL=e=>{const{children:t,csp:n,autoInsertSpaceInButton:r,alert:i,anchor:o,form:l,locale:m,componentSize:u,direction:p,space:s,splitter:c,virtual:d,dropdownMatchSelectWidth:h,popupMatchSelectWidth:f,popupOverflow:v,legacyLocale:y,parentContext:b,iconPrefixCls:w,theme:x,componentDisabled:E,segmented:_,statistic:$,spin:O,calendar:N,carousel:k,cascader:L,collapse:F,typography:P,checkbox:A,descriptions:M,divider:R,drawer:I,skeleton:D,steps:j,image:B,layout:V,list:H,mentions:Y,modal:U,progress:K,result:G,slider:q,breadcrumb:Z,menu:Q,pagination:J,input:ie,textArea:se,empty:ae,badge:ge,radio:me,rate:de,switch:we,transfer:Oe,avatar:xe,message:Pe,tag:ze,table:Ie,card:Ye,tabs:Me,timeline:ke,timePicker:Je,upload:ce,notification:Ee,tree:Re,colorPicker:Ae,datePicker:De,rangePicker:He,flex:it,wave:Ne,dropdown:Te,warning:We,tour:te,tooltip:fe,popover:je,popconfirm:ct,floatButtonGroup:Jt,variant:kt,inputNumber:rn,treeSelect:Qt}=e,Lt=C.useCallback((rt,vt)=>{const{prefixCls:on}=e;if(vt)return vt;const Bt=on||b.getPrefixCls("");return rt?`${Bt}-${rt}`:Bt},[b.getPrefixCls,e.prefixCls]),Nt=w||b.iconPrefixCls||ef,Et=n||b.csp;TI(Nt,Et);const dt=kI(x,b.theme,{prefixCls:Lt("")}),et={csp:Et,autoInsertSpaceInButton:r,alert:i,anchor:o,locale:m||y,direction:p,space:s,splitter:c,virtual:d,popupMatchSelectWidth:f??h,popupOverflow:v,getPrefixCls:Lt,iconPrefixCls:Nt,theme:dt,segmented:_,statistic:$,spin:O,calendar:N,carousel:k,cascader:L,collapse:F,typography:P,checkbox:A,descriptions:M,divider:R,drawer:I,skeleton:D,steps:j,image:B,input:ie,textArea:se,layout:V,list:H,mentions:Y,modal:U,progress:K,result:G,slider:q,breadcrumb:Z,menu:Q,pagination:J,empty:ae,badge:ge,radio:me,rate:de,switch:we,transfer:Oe,avatar:xe,message:Pe,tag:ze,table:Ie,card:Ye,tabs:Me,timeline:ke,timePicker:Je,upload:ce,notification:Ee,tree:Re,colorPicker:Ae,datePicker:De,rangePicker:He,flex:it,wave:Ne,dropdown:Te,warning:We,tour:te,tooltip:fe,popover:je,popconfirm:ct,floatButtonGroup:Jt,variant:kt,inputNumber:rn,treeSelect:Qt},Ke=Object.assign({},b);Object.keys(et).forEach(rt=>{et[rt]!==void 0&&(Ke[rt]=et[rt])}),aL.forEach(rt=>{const vt=e[rt];vt&&(Ke[rt]=vt)}),typeof r<"u"&&(Ke.button=Object.assign({autoInsertSpace:r},Ke.button));const _t=xc(()=>Ke,Ke,(rt,vt)=>{const on=Object.keys(rt),Bt=Object.keys(vt);return on.length!==Bt.length||on.some(Gt=>rt[Gt]!==vt[Gt])}),{layer:Tt}=C.useContext(Ec),tt=C.useMemo(()=>({prefixCls:Nt,csp:Et,layer:Tt?"antd":void 0}),[Nt,Et,Tt]);let Ze=C.createElement(C.Fragment,null,C.createElement(iL,{dropdownMatchSelectWidth:h}),t);const at=C.useMemo(()=>{var rt,vt,on,Bt;return Ts(((rt=za.Form)===null||rt===void 0?void 0:rt.defaultValidateMessages)||{},((on=(vt=_t.locale)===null||vt===void 0?void 0:vt.Form)===null||on===void 0?void 0:on.defaultValidateMessages)||{},((Bt=_t.form)===null||Bt===void 0?void 0:Bt.validateMessages)||{},(l==null?void 0:l.validateMessages)||{})},[_t,l==null?void 0:l.validateMessages]);Object.keys(at).length>0&&(Ze=C.createElement(f$.Provider,{value:at},Ze)),m&&(Ze=C.createElement(WT,{locale:m,_ANT_MARK__:HT},Ze)),Ze=C.createElement(uv.Provider,{value:tt},Ze),u&&(Ze=C.createElement(cI,{size:u},Ze)),Ze=C.createElement(rL,null,Ze);const ot=C.useMemo(()=>{const rt=dt||{},{algorithm:vt,token:on,components:Bt,cssVar:Gt}=rt,Dt=oL(rt,["algorithm","token","components","cssVar"]),Ht=vt&&(!Array.isArray(vt)||vt.length>0)?Pg(vt):y$,yn={};Object.entries(Bt||{}).forEach(([Rn,cn])=>{const Kt=Object.assign({},cn);"algorithm"in Kt&&(Kt.algorithm===!0?Kt.theme=Ht:(Array.isArray(Kt.algorithm)||typeof Kt.algorithm=="function")&&(Kt.theme=Pg(Kt.algorithm)),delete Kt.algorithm),yn[Rn]=Kt});const Cn=Object.assign(Object.assign({},uc),on);return Object.assign(Object.assign({},Dt),{theme:Ht,token:Cn,components:yn,override:Object.assign({override:Cn},yn),cssVar:Gt})},[dt]);return x&&(Ze=C.createElement(b$.Provider,{value:ot},Ze)),_t.warning&&(Ze=C.createElement(DT.Provider,{value:_t.warning},Ze)),E!==void 0&&(Ze=C.createElement(w$,{disabled:E},Ze)),C.createElement(zt.Provider,{value:_t},Ze)},ha=e=>{const t=C.useContext(zt),n=C.useContext(dv);return C.createElement(uL,Object.assign({parentContext:t,legacyLocale:n},e))};ha.ConfigContext=zt;ha.SizeContext=ja;ha.config=cL;ha.useConfig=uI;Object.defineProperty(ha,"SizeContext",{get:()=>ja});var dL={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm193.5 301.7l-210.6 292a31.8 31.8 0 01-51.7 0L318.5 484.9c-3.8-5.3 0-12.7 6.5-12.7h46.9c10.2 0 19.9 4.9 25.9 13.3l71.2 98.8 157.2-218c6-8.3 15.6-13.3 25.9-13.3H699c6.5 0 10.3 7.4 6.5 12.7z"}}]},name:"check-circle",theme:"filled"};function V$(e){var t;return e==null||(t=e.getRootNode)===null||t===void 0?void 0:t.call(e)}function fL(e){return V$(e)instanceof ShadowRoot}function Td(e){return fL(e)?V$(e):null}function hL(e){return e.replace(/-(.)/g,function(t,n){return n.toUpperCase()})}function pL(e,t){Lr(e,"[@ant-design/icons] ".concat(t))}function bw(e){return wt(e)==="object"&&typeof e.name=="string"&&typeof e.theme=="string"&&(wt(e.icon)==="object"||typeof e.icon=="function")}function ww(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return Object.keys(e).reduce(function(t,n){var r=e[n];switch(n){case"class":t.className=r,delete t.class;break;default:delete t[n],t[hL(n)]=r}return t},{})}function rm(e,t,n){return n?be.createElement(e.tag,oe(oe({key:t},ww(e.attrs)),n),(e.children||[]).map(function(r,i){return rm(r,"".concat(t,"-").concat(e.tag,"-").concat(i))})):be.createElement(e.tag,oe({key:t},ww(e.attrs)),(e.children||[]).map(function(r,i){return rm(r,"".concat(t,"-").concat(e.tag,"-").concat(i))}))}function U$(e){return dc(e)[0]}function G$(e){return e?Array.isArray(e)?e:[e]:[]}var gL=` +.anticon { + display: inline-flex; + align-items: center; + color: inherit; + font-style: normal; + line-height: 0; + text-align: center; + text-transform: none; + vertical-align: -0.125em; + text-rendering: optimizeLegibility; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +.anticon > * { + line-height: 1; +} + +.anticon svg { + display: inline-block; +} + +.anticon::before { + display: none; +} + +.anticon .anticon-icon { + display: block; +} + +.anticon[tabindex] { + cursor: pointer; +} + +.anticon-spin::before, +.anticon-spin { + display: inline-block; + -webkit-animation: loadingCircle 1s infinite linear; + animation: loadingCircle 1s infinite linear; +} + +@-webkit-keyframes loadingCircle { + 100% { + -webkit-transform: rotate(360deg); + transform: rotate(360deg); + } +} + +@keyframes loadingCircle { + 100% { + -webkit-transform: rotate(360deg); + transform: rotate(360deg); + } +} +`,mL=function(t){var n=C.useContext(uv),r=n.csp,i=n.prefixCls,o=n.layer,l=gL;i&&(l=l.replace(/anticon/g,i)),o&&(l="@layer ".concat(o,` { +`).concat(l,` +}`)),C.useEffect(function(){var m=t.current,u=Td(m);Mo(l,"@ant-design-icons",{prepend:!o,csp:r,attachTo:u})},[])},vL=["icon","className","onClick","style","primaryColor","secondaryColor"],Xl={primaryColor:"#333",secondaryColor:"#E6E6E6",calculated:!1};function yL(e){var t=e.primaryColor,n=e.secondaryColor;Xl.primaryColor=t,Xl.secondaryColor=n||U$(t),Xl.calculated=!!n}function bL(){return oe({},Xl)}var Zs=function(t){var n=t.icon,r=t.className,i=t.onClick,o=t.style,l=t.primaryColor,m=t.secondaryColor,u=At(t,vL),p=C.useRef(),s=Xl;if(l&&(s={primaryColor:l,secondaryColor:m||U$(l)}),mL(p),pL(bw(n),"icon should be icon definiton, but got ".concat(n)),!bw(n))return null;var c=n;return c&&typeof c.icon=="function"&&(c=oe(oe({},c),{},{icon:c.icon(s.primaryColor,s.secondaryColor)})),rm(c.icon,"svg-".concat(c.name),oe(oe({className:r,onClick:i,style:o,"data-icon":c.name,width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},u),{},{ref:p}))};Zs.displayName="IconReact";Zs.getTwoToneColors=bL;Zs.setTwoToneColors=yL;function K$(e){var t=G$(e),n=pe(t,2),r=n[0],i=n[1];return Zs.setTwoToneColors({primaryColor:r,secondaryColor:i})}function wL(){var e=Zs.getTwoToneColors();return e.calculated?[e.primaryColor,e.secondaryColor]:e.primaryColor}var SL=["className","icon","spin","rotate","tabIndex","onClick","twoToneColor"];K$(Od.primary);var rr=C.forwardRef(function(e,t){var n=e.className,r=e.icon,i=e.spin,o=e.rotate,l=e.tabIndex,m=e.onClick,u=e.twoToneColor,p=At(e,SL),s=C.useContext(uv),c=s.prefixCls,d=c===void 0?"anticon":c,h=s.rootClassName,f=ve(h,d,ne(ne({},"".concat(d,"-").concat(r.name),!!r.name),"".concat(d,"-spin"),!!i||r.name==="loading"),n),v=l;v===void 0&&m&&(v=-1);var y=o?{msTransform:"rotate(".concat(o,"deg)"),transform:"rotate(".concat(o,"deg)")}:void 0,b=G$(u),w=pe(b,2),x=w[0],E=w[1];return C.createElement("span",nt({role:"img","aria-label":r.name},p,{ref:t,tabIndex:v,onClick:m,className:f}),C.createElement(Zs,{icon:r,primaryColor:x,secondaryColor:E,style:y}))});rr.displayName="AntdIcon";rr.getTwoToneColor=wL;rr.setTwoToneColor=K$;var CL=function(t,n){return C.createElement(rr,nt({},t,{ref:n,icon:dL}))},gv=C.forwardRef(CL),$L={icon:{tag:"svg",attrs:{"fill-rule":"evenodd",viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64c247.4 0 448 200.6 448 448S759.4 960 512 960 64 759.4 64 512 264.6 64 512 64zm127.98 274.82h-.04l-.08.06L512 466.75 384.14 338.88c-.04-.05-.06-.06-.08-.06a.12.12 0 00-.07 0c-.03 0-.05.01-.09.05l-45.02 45.02a.2.2 0 00-.05.09.12.12 0 000 .07v.02a.27.27 0 00.06.06L466.75 512 338.88 639.86c-.05.04-.06.06-.06.08a.12.12 0 000 .07c0 .03.01.05.05.09l45.02 45.02a.2.2 0 00.09.05.12.12 0 00.07 0c.02 0 .04-.01.08-.05L512 557.25l127.86 127.87c.04.04.06.05.08.05a.12.12 0 00.07 0c.03 0 .05-.01.09-.05l45.02-45.02a.2.2 0 00.05-.09.12.12 0 000-.07v-.02a.27.27 0 00-.05-.06L557.25 512l127.87-127.86c.04-.04.05-.06.05-.08a.12.12 0 000-.07c0-.03-.01-.05-.05-.09l-45.02-45.02a.2.2 0 00-.09-.05.12.12 0 00-.07 0z"}}]},name:"close-circle",theme:"filled"},xL=function(t,n){return C.createElement(rr,nt({},t,{ref:n,icon:$L}))},Ac=C.forwardRef(xL),EL={icon:{tag:"svg",attrs:{"fill-rule":"evenodd",viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M799.86 166.31c.02 0 .04.02.08.06l57.69 57.7c.04.03.05.05.06.08a.12.12 0 010 .06c0 .03-.02.05-.06.09L569.93 512l287.7 287.7c.04.04.05.06.06.09a.12.12 0 010 .07c0 .02-.02.04-.06.08l-57.7 57.69c-.03.04-.05.05-.07.06a.12.12 0 01-.07 0c-.03 0-.05-.02-.09-.06L512 569.93l-287.7 287.7c-.04.04-.06.05-.09.06a.12.12 0 01-.07 0c-.02 0-.04-.02-.08-.06l-57.69-57.7c-.04-.03-.05-.05-.06-.07a.12.12 0 010-.07c0-.03.02-.05.06-.09L454.07 512l-287.7-287.7c-.04-.04-.05-.06-.06-.09a.12.12 0 010-.07c0-.02.02-.04.06-.08l57.7-57.69c.03-.04.05-.05.07-.06a.12.12 0 01.07 0c.03 0 .05.02.09.06L512 454.07l287.7-287.7c.04-.04.06-.05.09-.06a.12.12 0 01.07 0z"}}]},name:"close",theme:"outlined"},_L=function(t,n){return C.createElement(rr,nt({},t,{ref:n,icon:EL}))},tf=C.forwardRef(_L),ML={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm-32 232c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v272c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V296zm32 440a48.01 48.01 0 010-96 48.01 48.01 0 010 96z"}}]},name:"exclamation-circle",theme:"filled"},RL=function(t,n){return C.createElement(rr,nt({},t,{ref:n,icon:ML}))},mv=C.forwardRef(RL),OL={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm32 664c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V456c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v272zm-32-344a48.01 48.01 0 010-96 48.01 48.01 0 010 96z"}}]},name:"info-circle",theme:"filled"},AL=function(t,n){return C.createElement(rr,nt({},t,{ref:n,icon:OL}))},Y$=C.forwardRef(AL),TL=`accept acceptCharset accessKey action allowFullScreen allowTransparency + alt async autoComplete autoFocus autoPlay capture cellPadding cellSpacing challenge + charSet checked classID className colSpan cols content contentEditable contextMenu + controls coords crossOrigin data dateTime default defer dir disabled download draggable + encType form formAction formEncType formMethod formNoValidate formTarget frameBorder + headers height hidden high href hrefLang htmlFor httpEquiv icon id inputMode integrity + is keyParams keyType kind label lang list loop low manifest marginHeight marginWidth max maxLength media + mediaGroup method min minLength multiple muted name noValidate nonce open + optimum pattern placeholder poster preload radioGroup readOnly rel required + reversed role rowSpan rows sandbox scope scoped scrolling seamless selected + shape size sizes span spellCheck src srcDoc srcLang srcSet start step style + summary tabIndex target title type useMap value width wmode wrap`,IL=`onCopy onCut onPaste onCompositionEnd onCompositionStart onCompositionUpdate onKeyDown + onKeyPress onKeyUp onFocus onBlur onChange onInput onSubmit onClick onContextMenu onDoubleClick + onDrag onDragEnd onDragEnter onDragExit onDragLeave onDragOver onDragStart onDrop onMouseDown + onMouseEnter onMouseLeave onMouseMove onMouseOut onMouseOver onMouseUp onSelect onTouchCancel + onTouchEnd onTouchMove onTouchStart onScroll onWheel onAbort onCanPlay onCanPlayThrough + onDurationChange onEmptied onEncrypted onEnded onError onLoadedData onLoadedMetadata + onLoadStart onPause onPlay onPlaying onProgress onRateChange onSeeked onSeeking onStalled onSuspend onTimeUpdate onVolumeChange onWaiting onLoad onError`,LL="".concat(TL," ").concat(IL).split(/[\s\n]+/),PL="aria-",kL="data-";function Sw(e,t){return e.indexOf(t)===0}function Wa(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n;t===!1?n={aria:!0,data:!0,attr:!0}:t===!0?n={aria:!0}:n=oe({},t);var r={};return Object.keys(e).forEach(function(i){(n.aria&&(i==="role"||Sw(i,PL))||n.data&&Sw(i,kL)||n.attr&&LL.includes(i))&&(r[i]=e[i])}),r}function X$(e){return e&&be.isValidElement(e)&&e.type===be.Fragment}const NL=(e,t,n)=>be.isValidElement(e)?be.cloneElement(e,typeof n=="function"?n(e.props||{}):n):t;function Oo(e,t){return NL(e,e,t)}const Cw=e=>typeof e=="object"&&e!=null&&e.nodeType===1,$w=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",Uu=(e,t)=>{if(e.clientHeight{const i=(o=>{if(!o.ownerDocument||!o.ownerDocument.defaultView)return null;try{return o.ownerDocument.defaultView.frameElement}catch{return null}})(r);return!!i&&(i.clientHeightot||o>e&&l=t&&m>=n?o-e-r:l>t&&mn?l-t+i:0,DL=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},xw=(e,t)=>{var n,r,i,o;if(typeof document>"u")return[];const{scrollMode:l,block:m,inline:u,boundary:p,skipOverflowHiddenElements:s}=t,c=typeof p=="function"?p:I=>I!==p;if(!Cw(e))throw new TypeError("Invalid target");const d=document.scrollingElement||document.documentElement,h=[];let f=e;for(;Cw(f)&&c(f);){if(f=DL(f),f===d){h.push(f);break}f!=null&&f===document.body&&Uu(f)&&!Uu(document.documentElement)||f!=null&&Uu(f,s)&&h.push(f)}const v=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,y=(o=(i=window.visualViewport)==null?void 0:i.height)!=null?o:innerHeight,{scrollX:b,scrollY:w}=window,{height:x,width:E,top:_,right:$,bottom:O,left:N}=e.getBoundingClientRect(),{top:k,right:L,bottom:F,left:P}=(I=>{const D=window.getComputedStyle(I);return{top:parseFloat(D.scrollMarginTop)||0,right:parseFloat(D.scrollMarginRight)||0,bottom:parseFloat(D.scrollMarginBottom)||0,left:parseFloat(D.scrollMarginLeft)||0}})(e);let A=m==="start"||m==="nearest"?_-k:m==="end"?O+F:_+x/2-k+F,M=u==="center"?N+E/2-P+L:u==="end"?$+L:N-P;const R=[];for(let I=0;I=0&&N>=0&&O<=y&&$<=v&&(D===d&&!Uu(D)||_>=V&&O<=Y&&N>=U&&$<=H))return R;const K=getComputedStyle(D),G=parseInt(K.borderLeftWidth,10),q=parseInt(K.borderTopWidth,10),Z=parseInt(K.borderRightWidth,10),Q=parseInt(K.borderBottomWidth,10);let J=0,ie=0;const se="offsetWidth"in D?D.offsetWidth-D.clientWidth-G-Z:0,ae="offsetHeight"in D?D.offsetHeight-D.clientHeight-q-Q:0,ge="offsetWidth"in D?D.offsetWidth===0?0:B/D.offsetWidth:0,me="offsetHeight"in D?D.offsetHeight===0?0:j/D.offsetHeight:0;if(d===D)J=m==="start"?A:m==="end"?A-y:m==="nearest"?Gu(w,w+y,y,q,Q,w+A,w+A+x,x):A-y/2,ie=u==="start"?M:u==="center"?M-v/2:u==="end"?M-v:Gu(b,b+v,v,G,Z,b+M,b+M+E,E),J=Math.max(0,J+w),ie=Math.max(0,ie+b);else{J=m==="start"?A-V-q:m==="end"?A-Y+Q+ae:m==="nearest"?Gu(V,Y,j,q,Q+ae,A,A+x,x):A-(V+j/2)+ae/2,ie=u==="start"?M-U-G:u==="center"?M-(U+B/2)+se/2:u==="end"?M-H+Z+se:Gu(U,H,B,G,Z+se,M,M+E,E);const{scrollLeft:de,scrollTop:we}=D;J=me===0?0:Math.max(0,Math.min(we+J/me,D.scrollHeight-j/me+ae)),ie=ge===0?0:Math.max(0,Math.min(de+ie/ge,D.scrollWidth-B/ge+se)),A+=we-J,M+=de-ie}R.push({el:D,top:J,left:ie})}return R},FL=e=>e===!1?{block:"end",inline:"nearest"}:(t=>t===Object(t)&&Object.keys(t).length!==0)(e)?e:{block:"start",inline:"nearest"};function zL(e,t){if(!e.isConnected||!(i=>{let o=i;for(;o&&o.parentNode;){if(o.parentNode===document)return!0;o=o.parentNode instanceof ShadowRoot?o.parentNode.host:o.parentNode}return!1})(e))return;const n=(i=>{const o=window.getComputedStyle(i);return{top:parseFloat(o.scrollMarginTop)||0,right:parseFloat(o.scrollMarginRight)||0,bottom:parseFloat(o.scrollMarginBottom)||0,left:parseFloat(o.scrollMarginLeft)||0}})(e);if((i=>typeof i=="object"&&typeof i.behavior=="function")(t))return t.behavior(xw(e,t));const r=typeof t=="boolean"||t==null?void 0:t.behavior;for(const{el:i,top:o,left:l}of xw(e,FL(t))){const m=o-n.top+n.bottom,u=l-n.left+n.right;i.scroll({top:m,left:u,behavior:r})}}const eo=e=>{const[,,,,t]=Si();return t?`${e}-css-var`:""};var mt={BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,CAPS_LOCK:20,ESC:27,SPACE:32,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,N:78,P:80,META:91,WIN_KEY_RIGHT:92,CONTEXT_MENU:93,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,SEMICOLON:186,EQUALS:187,WIN_KEY:224},vv=C.forwardRef(function(e,t){var n=e.prefixCls,r=e.style,i=e.className,o=e.duration,l=o===void 0?4.5:o,m=e.showProgress,u=e.pauseOnHover,p=u===void 0?!0:u,s=e.eventKey,c=e.content,d=e.closable,h=e.closeIcon,f=h===void 0?"x":h,v=e.props,y=e.onClick,b=e.onNoticeClose,w=e.times,x=e.hovering,E=C.useState(!1),_=pe(E,2),$=_[0],O=_[1],N=C.useState(0),k=pe(N,2),L=k[0],F=k[1],P=C.useState(0),A=pe(P,2),M=A[0],R=A[1],I=x||$,D=l>0&&m,j=function(){b(s)},B=function(G){(G.key==="Enter"||G.code==="Enter"||G.keyCode===mt.ENTER)&&j()};C.useEffect(function(){if(!I&&l>0){var K=Date.now()-M,G=setTimeout(function(){j()},l*1e3-M);return function(){p&&clearTimeout(G),R(Date.now()-K)}}},[l,I,w]),C.useEffect(function(){if(!I&&D&&(p||M===0)){var K=performance.now(),G,q=function Z(){cancelAnimationFrame(G),G=requestAnimationFrame(function(Q){var J=Q+M-K,ie=Math.min(J/(l*1e3),1);F(ie*100),ie<1&&Z()})};return q(),function(){p&&cancelAnimationFrame(G)}}},[l,M,I,D,w]);var V=C.useMemo(function(){return wt(d)==="object"&&d!==null?d:d?{closeIcon:f}:{}},[d,f]),H=Wa(V,!0),Y=100-(!L||L<0?0:L>100?100:L),U="".concat(n,"-notice");return C.createElement("div",nt({},v,{ref:t,className:ve(U,i,ne({},"".concat(U,"-closable"),d)),style:r,onMouseEnter:function(G){var q;O(!0),v==null||(q=v.onMouseEnter)===null||q===void 0||q.call(v,G)},onMouseLeave:function(G){var q;O(!1),v==null||(q=v.onMouseLeave)===null||q===void 0||q.call(v,G)},onClick:y}),C.createElement("div",{className:"".concat(U,"-content")},c),d&&C.createElement("a",nt({tabIndex:0,className:"".concat(U,"-close"),onKeyDown:B,"aria-label":"Close"},H,{onClick:function(G){G.preventDefault(),G.stopPropagation(),j()}}),V.closeIcon),D&&C.createElement("progress",{className:"".concat(U,"-progress"),max:"100",value:Y},Y+"%"))}),q$=be.createContext({}),Q$=function(t){var n=t.children,r=t.classNames;return be.createElement(q$.Provider,{value:{classNames:r}},n)},Ew=8,_w=3,Mw=16,jL=function(t){var n={offset:Ew,threshold:_w,gap:Mw};if(t&&wt(t)==="object"){var r,i,o;n.offset=(r=t.offset)!==null&&r!==void 0?r:Ew,n.threshold=(i=t.threshold)!==null&&i!==void 0?i:_w,n.gap=(o=t.gap)!==null&&o!==void 0?o:Mw}return[!!t,n]},BL=["className","style","classNames","styles"],HL=function(t){var n=t.configList,r=t.placement,i=t.prefixCls,o=t.className,l=t.style,m=t.motion,u=t.onAllNoticeRemoved,p=t.onNoticeClose,s=t.stack,c=C.useContext(q$),d=c.classNames,h=C.useRef({}),f=C.useState(null),v=pe(f,2),y=v[0],b=v[1],w=C.useState([]),x=pe(w,2),E=x[0],_=x[1],$=n.map(function(I){return{config:I,key:String(I.key)}}),O=jL(s),N=pe(O,2),k=N[0],L=N[1],F=L.offset,P=L.threshold,A=L.gap,M=k&&(E.length>0||$.length<=P),R=typeof m=="function"?m(r):m;return C.useEffect(function(){k&&E.length>1&&_(function(I){return I.filter(function(D){return $.some(function(j){var B=j.key;return D===B})})})},[E,$,k]),C.useEffect(function(){var I;if(k&&h.current[(I=$[$.length-1])===null||I===void 0?void 0:I.key]){var D;b(h.current[(D=$[$.length-1])===null||D===void 0?void 0:D.key])}},[$,k]),be.createElement(z$,nt({key:r,className:ve(i,"".concat(i,"-").concat(r),d==null?void 0:d.list,o,ne(ne({},"".concat(i,"-stack"),!!k),"".concat(i,"-stack-expanded"),M)),style:l,keys:$,motionAppear:!0},R,{onAllRemoved:function(){u(r)}}),function(I,D){var j=I.config,B=I.className,V=I.style,H=I.index,Y=j,U=Y.key,K=Y.times,G=String(U),q=j,Z=q.className,Q=q.style,J=q.classNames,ie=q.styles,se=At(q,BL),ae=$.findIndex(function(ke){return ke.key===G}),ge={};if(k){var me=$.length-1-(ae>-1?ae:H-1),de=r==="top"||r==="bottom"?"-50%":"0";if(me>0){var we,Oe,xe;ge.height=M?(we=h.current[G])===null||we===void 0?void 0:we.offsetHeight:y==null?void 0:y.offsetHeight;for(var Pe=0,ze=0;ze-1?h.current[G]=Je:delete h.current[G]},prefixCls:i,classNames:J,styles:ie,className:ve(Z,d==null?void 0:d.notice),style:Q,times:K,key:U,eventKey:U,onNoticeClose:p,hovering:k&&E.length>0})))})},WL=C.forwardRef(function(e,t){var n=e.prefixCls,r=n===void 0?"rc-notification":n,i=e.container,o=e.motion,l=e.maxCount,m=e.className,u=e.style,p=e.onAllRemoved,s=e.stack,c=e.renderNotifications,d=C.useState([]),h=pe(d,2),f=h[0],v=h[1],y=function(k){var L,F=f.find(function(P){return P.key===k});F==null||(L=F.onClose)===null||L===void 0||L.call(F),v(function(P){return P.filter(function(A){return A.key!==k})})};C.useImperativeHandle(t,function(){return{open:function(k){v(function(L){var F=Ge(L),P=F.findIndex(function(R){return R.key===k.key}),A=oe({},k);if(P>=0){var M;A.times=(((M=L[P])===null||M===void 0?void 0:M.times)||0)+1,F[P]=A}else A.times=0,F.push(A);return l>0&&F.length>l&&(F=F.slice(-l)),F})},close:function(k){y(k)},destroy:function(){v([])}}});var b=C.useState({}),w=pe(b,2),x=w[0],E=w[1];C.useEffect(function(){var N={};f.forEach(function(k){var L=k.placement,F=L===void 0?"topRight":L;F&&(N[F]=N[F]||[],N[F].push(k))}),Object.keys(x).forEach(function(k){N[k]=N[k]||[]}),E(N)},[f]);var _=function(k){E(function(L){var F=oe({},L),P=F[k]||[];return P.length||delete F[k],F})},$=C.useRef(!1);if(C.useEffect(function(){Object.keys(x).length>0?$.current=!0:$.current&&(p==null||p(),$.current=!1)},[x]),!i)return null;var O=Object.keys(x);return da.createPortal(C.createElement(C.Fragment,null,O.map(function(N){var k=x[N],L=C.createElement(HL,{key:N,configList:k,placement:N,prefixCls:r,className:m==null?void 0:m(N),style:u==null?void 0:u(N),motion:o,onNoticeClose:y,onAllNoticeRemoved:_,stack:s});return c?c(L,{prefixCls:r,key:N}):L})),i)}),VL=["getContainer","motion","prefixCls","maxCount","className","style","onAllRemoved","stack","renderNotifications"],UL=function(){return document.body},Rw=0;function GL(){for(var e={},t=arguments.length,n=new Array(t),r=0;r0&&arguments[0]!==void 0?arguments[0]:{},t=e.getContainer,n=t===void 0?UL:t,r=e.motion,i=e.prefixCls,o=e.maxCount,l=e.className,m=e.style,u=e.onAllRemoved,p=e.stack,s=e.renderNotifications,c=At(e,VL),d=C.useState(),h=pe(d,2),f=h[0],v=h[1],y=C.useRef(),b=C.createElement(WL,{container:f,ref:y,prefixCls:i,motion:r,maxCount:o,className:l,style:m,onAllRemoved:u,stack:p,renderNotifications:s}),w=C.useState([]),x=pe(w,2),E=x[0],_=x[1],$=tr(function(N){var k=GL(c,N);(k.key===null||k.key===void 0)&&(k.key="rc-notification-".concat(Rw),Rw+=1),_(function(L){return[].concat(Ge(L),[{type:"open",config:k}])})}),O=C.useMemo(function(){return{open:$,close:function(k){_(function(L){return[].concat(Ge(L),[{type:"close",key:k}])})},destroy:function(){_(function(k){return[].concat(Ge(k),[{type:"destroy"}])})}}},[]);return C.useEffect(function(){v(n())}),C.useEffect(function(){if(y.current&&E.length){E.forEach(function(L){switch(L.type){case"open":y.current.open(L.config);break;case"close":y.current.close(L.key);break;case"destroy":y.current.destroy();break}});var N,k;_(function(L){return(N!==L||!k)&&(N=L,k=L.filter(function(F){return!E.includes(F)})),k})}},[E]),[O,b]}var J$={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z"}}]},name:"loading",theme:"outlined"},KL=function(t,n){return C.createElement(rr,nt({},t,{ref:n,icon:J$}))},Tc=C.forwardRef(KL);const ex=be.createContext(void 0),oa=100,YL=10,tx=oa*YL,nx={Modal:oa,Drawer:oa,Popover:oa,Popconfirm:oa,Tooltip:oa,Tour:oa,FloatButton:oa},XL={SelectLike:50,Dropdown:50,DatePicker:50,Menu:50,ImagePreview:1};function qL(e){return e in nx}const rx=(e,t)=>{const[,n]=Si(),r=be.useContext(ex),i=qL(e);let o;if(t!==void 0)o=[t,t];else{let l=r??0;i?l+=(r?0:n.zIndexPopupBase)+nx[e]:l+=XL[e],o=[r===void 0?t:l,l]}return o},QL=e=>{const{componentCls:t,iconCls:n,boxShadow:r,colorText:i,colorSuccess:o,colorError:l,colorWarning:m,colorInfo:u,fontSizeLG:p,motionEaseInOutCirc:s,motionDurationSlow:c,marginXS:d,paddingXS:h,borderRadiusLG:f,zIndexPopup:v,contentPadding:y,contentBg:b}=e,w=`${t}-notice`,x=new nn("MessageMoveIn",{"0%":{padding:0,transform:"translateY(-100%)",opacity:0},"100%":{padding:h,transform:"translateY(0)",opacity:1}}),E=new nn("MessageMoveOut",{"0%":{maxHeight:e.height,padding:h,opacity:1},"100%":{maxHeight:0,padding:0,opacity:0}}),_={padding:h,textAlign:"center",[`${t}-custom-content`]:{display:"flex",alignItems:"center"},[`${t}-custom-content > ${n}`]:{marginInlineEnd:d,fontSize:p},[`${w}-content`]:{display:"inline-block",padding:y,background:b,borderRadius:f,boxShadow:r,pointerEvents:"all"},[`${t}-success > ${n}`]:{color:o},[`${t}-error > ${n}`]:{color:l},[`${t}-warning > ${n}`]:{color:m},[`${t}-info > ${n}, + ${t}-loading > ${n}`]:{color:u}};return[{[t]:Object.assign(Object.assign({},ci(e)),{color:i,position:"fixed",top:d,width:"100%",pointerEvents:"none",zIndex:v,[`${t}-move-up`]:{animationFillMode:"forwards"},[` + ${t}-move-up-appear, + ${t}-move-up-enter + `]:{animationName:x,animationDuration:c,animationPlayState:"paused",animationTimingFunction:s},[` + ${t}-move-up-appear${t}-move-up-appear-active, + ${t}-move-up-enter${t}-move-up-enter-active + `]:{animationPlayState:"running"},[`${t}-move-up-leave`]:{animationName:E,animationDuration:c,animationPlayState:"paused",animationTimingFunction:s},[`${t}-move-up-leave${t}-move-up-leave-active`]:{animationPlayState:"running"},"&-rtl":{direction:"rtl",span:{direction:"rtl"}}})},{[t]:{[`${w}-wrapper`]:Object.assign({},_)}},{[`${t}-notice-pure-panel`]:Object.assign(Object.assign({},_),{padding:0,textAlign:"start"})}]},ZL=e=>({zIndexPopup:e.zIndexPopupBase+tx+10,contentBg:e.colorBgElevated,contentPadding:`${(e.controlHeightLG-e.fontSize*e.lineHeight)/2}px ${e.paddingSM}px`}),ix=gr("Message",e=>{const t=Sn(e,{height:150});return[QL(t)]},ZL);var JL=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);iC.createElement("div",{className:ve(`${e}-custom-content`,`${e}-${t}`)},n||e2[t],C.createElement("span",null,r)),t2=e=>{const{prefixCls:t,className:n,type:r,icon:i,content:o}=e,l=JL(e,["prefixCls","className","type","icon","content"]),{getPrefixCls:m}=C.useContext(zt),u=t||m("message"),p=eo(u),[s,c,d]=ix(u,p);return s(C.createElement(vv,Object.assign({},l,{prefixCls:u,className:ve(n,c,`${u}-notice-pure-panel`,d,p),eventKey:"pure",duration:null,content:C.createElement(ox,{prefixCls:u,type:r,icon:i},o)})))};function n2(e,t){return{motionName:t??`${e}-move-up`}}function yv(e){let t;const n=new Promise(i=>{t=e(()=>{i(!0)})}),r=()=>{t==null||t()};return r.then=(i,o)=>n.then(i,o),r.promise=n,r}var r2=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i{const n=eo(t),[r,i,o]=ix(t,n);return r(C.createElement(Q$,{classNames:{list:ve(i,o,n)}},e))},s2=(e,{prefixCls:t,key:n})=>C.createElement(a2,{prefixCls:t,key:n},e),l2=C.forwardRef((e,t)=>{const{top:n,prefixCls:r,getContainer:i,maxCount:o,duration:l=o2,rtl:m,transitionName:u,onAllRemoved:p}=e,{getPrefixCls:s,getPopupContainer:c,message:d,direction:h}=C.useContext(zt),f=r||s("message"),v=()=>({left:"50%",transform:"translateX(-50%)",top:n??i2}),y=()=>ve({[`${f}-rtl`]:m??h==="rtl"}),b=()=>n2(f,u),w=C.createElement("span",{className:`${f}-close-x`},C.createElement(tf,{className:`${f}-close-icon`})),[x,E]=Z$({prefixCls:f,style:v,className:y,motion:b,closable:!1,closeIcon:w,duration:l,getContainer:()=>(i==null?void 0:i())||(c==null?void 0:c())||document.body,maxCount:o,onAllRemoved:p,renderNotifications:s2});return C.useImperativeHandle(t,()=>Object.assign(Object.assign({},x),{prefixCls:f,message:d})),E});let Ow=0;function ax(e){const t=C.useRef(null);return _c(),[C.useMemo(()=>{const r=u=>{var p;(p=t.current)===null||p===void 0||p.close(u)},i=u=>{if(!t.current){const $=()=>{};return $.then=()=>{},$}const{open:p,prefixCls:s,message:c}=t.current,d=`${s}-notice`,{content:h,icon:f,type:v,key:y,className:b,style:w,onClose:x}=u,E=r2(u,["content","icon","type","key","className","style","onClose"]);let _=y;return _==null&&(Ow+=1,_=`antd-message-${Ow}`),yv($=>(p(Object.assign(Object.assign({},E),{key:_,content:C.createElement(ox,{prefixCls:s,type:v,icon:f},h),placement:"top",className:ve(v&&`${d}-${v}`,b,c==null?void 0:c.className),style:Object.assign(Object.assign({},c==null?void 0:c.style),w),onClose:()=>{x==null||x(),$()}})),()=>{r(_)}))},l={open:i,destroy:u=>{var p;u!==void 0?r(u):(p=t.current)===null||p===void 0||p.destroy()}};return["info","success","warning","error","loading"].forEach(u=>{const p=(s,c,d)=>{let h;s&&typeof s=="object"&&"content"in s?h=s:h={content:s};let f,v;typeof c=="function"?v=c:(f=c,v=d);const y=Object.assign(Object.assign({onClose:v,duration:f},h),{type:u});return i(y)};l[u]=p}),l},[]),C.createElement(l2,Object.assign({key:"message-holder"},e,{ref:t}))]}function c2(e){return ax(e)}function Qr(){Qr=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=typeof Symbol=="function"?Symbol:{},o=i.iterator||"@@iterator",l=i.asyncIterator||"@@asyncIterator",m=i.toStringTag||"@@toStringTag";function u(L,F,P,A){return Object.defineProperty(L,F,{value:P,enumerable:!A,configurable:!A,writable:!A})}try{u({},"")}catch{u=function(P,A,M){return P[A]=M}}function p(L,F,P,A){var M=F&&F.prototype instanceof d?F:d,R=Object.create(M.prototype);return u(R,"_invoke",function(I,D,j){var B=1;return function(V,H){if(B===3)throw Error("Generator is already running");if(B===4){if(V==="throw")throw H;return{value:e,done:!0}}for(j.method=V,j.arg=H;;){var Y=j.delegate;if(Y){var U=_(Y,j);if(U){if(U===c)continue;return U}}if(j.method==="next")j.sent=j._sent=j.arg;else if(j.method==="throw"){if(B===1)throw B=4,j.arg;j.dispatchException(j.arg)}else j.method==="return"&&j.abrupt("return",j.arg);B=3;var K=s(I,D,j);if(K.type==="normal"){if(B=j.done?4:2,K.arg===c)continue;return{value:K.arg,done:j.done}}K.type==="throw"&&(B=4,j.method="throw",j.arg=K.arg)}}}(L,P,new N(A||[])),!0),R}function s(L,F,P){try{return{type:"normal",arg:L.call(F,P)}}catch(A){return{type:"throw",arg:A}}}t.wrap=p;var c={};function d(){}function h(){}function f(){}var v={};u(v,o,function(){return this});var y=Object.getPrototypeOf,b=y&&y(y(k([])));b&&b!==n&&r.call(b,o)&&(v=b);var w=f.prototype=d.prototype=Object.create(v);function x(L){["next","throw","return"].forEach(function(F){u(L,F,function(P){return this._invoke(F,P)})})}function E(L,F){function P(M,R,I,D){var j=s(L[M],L,R);if(j.type!=="throw"){var B=j.arg,V=B.value;return V&&wt(V)=="object"&&r.call(V,"__await")?F.resolve(V.__await).then(function(H){P("next",H,I,D)},function(H){P("throw",H,I,D)}):F.resolve(V).then(function(H){B.value=H,I(B)},function(H){return P("throw",H,I,D)})}D(j.arg)}var A;u(this,"_invoke",function(M,R){function I(){return new F(function(D,j){P(M,R,D,j)})}return A=A?A.then(I,I):I()},!0)}function _(L,F){var P=F.method,A=L.i[P];if(A===e)return F.delegate=null,P==="throw"&&L.i.return&&(F.method="return",F.arg=e,_(L,F),F.method==="throw")||P!=="return"&&(F.method="throw",F.arg=new TypeError("The iterator does not provide a '"+P+"' method")),c;var M=s(A,L.i,F.arg);if(M.type==="throw")return F.method="throw",F.arg=M.arg,F.delegate=null,c;var R=M.arg;return R?R.done?(F[L.r]=R.value,F.next=L.n,F.method!=="return"&&(F.method="next",F.arg=e),F.delegate=null,c):R:(F.method="throw",F.arg=new TypeError("iterator result is not an object"),F.delegate=null,c)}function $(L){this.tryEntries.push(L)}function O(L){var F=L[4]||{};F.type="normal",F.arg=e,L[4]=F}function N(L){this.tryEntries=[[-1]],L.forEach($,this),this.reset(!0)}function k(L){if(L!=null){var F=L[o];if(F)return F.call(L);if(typeof L.next=="function")return L;if(!isNaN(L.length)){var P=-1,A=function M(){for(;++P=0;--M){var R=this.tryEntries[M],I=R[4],D=this.prev,j=R[1],B=R[2];if(R[0]===-1)return A("end"),!1;if(!j&&!B)throw Error("try statement without catch or finally");if(R[0]!=null&&R[0]<=D){if(D=0;--A){var M=this.tryEntries[A];if(M[0]>-1&&M[0]<=this.prev&&this.prev=0;--P){var A=this.tryEntries[P];if(A[2]===F)return this.complete(A[4],A[3]),O(A),c}},catch:function(F){for(var P=this.tryEntries.length-1;P>=0;--P){var A=this.tryEntries[P];if(A[0]===F){var M=A[4];if(M.type==="throw"){var R=M.arg;O(A)}return R}}throw Error("illegal catch attempt")},delegateYield:function(F,P,A){return this.delegate={i:k(F),r:P,n:A},this.method==="next"&&(this.arg=e),c}},t}function Aw(e,t,n,r,i,o,l){try{var m=e[o](l),u=m.value}catch(p){return void n(p)}m.done?t(u):Promise.resolve(u).then(r,i)}function Ya(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function l(u){Aw(o,r,i,l,m,"next",u)}function m(u){Aw(o,r,i,l,m,"throw",u)}l(void 0)})}}var Ic=oe({},qO),u2=Ic.version,Ep=Ic.render,d2=Ic.unmountComponentAtNode,nf;try{var f2=Number((u2||"").split(".")[0]);f2>=18&&(nf=Ic.createRoot)}catch{}function Tw(e){var t=Ic.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;t&&wt(t)==="object"&&(t.usingClientEntryPoint=e)}var Id="__rc_react_root__";function h2(e,t){Tw(!0);var n=t[Id]||nf(t);Tw(!1),n.render(e),t[Id]=n}function p2(e,t){Ep==null||Ep(e,t)}function g2(e,t){if(nf){h2(e,t);return}p2(e,t)}function m2(e){return im.apply(this,arguments)}function im(){return im=Ya(Qr().mark(function e(t){return Qr().wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.abrupt("return",Promise.resolve().then(function(){var i;(i=t[Id])===null||i===void 0||i.unmount(),delete t[Id]}));case 1:case"end":return r.stop()}},e)})),im.apply(this,arguments)}function v2(e){d2(e)}function y2(e){return om.apply(this,arguments)}function om(){return om=Ya(Qr().mark(function e(t){return Qr().wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if(nf===void 0){r.next=2;break}return r.abrupt("return",m2(t));case 2:v2(t);case 3:case"end":return r.stop()}},e)})),om.apply(this,arguments)}const b2=(e,t)=>(g2(e,t),()=>y2(t));let w2=b2;function bv(e){return w2}const _p=()=>({height:0,opacity:0}),Iw=e=>{const{scrollHeight:t}=e;return{height:t,opacity:1}},S2=e=>({height:e?e.offsetHeight:0}),Mp=(e,t)=>(t==null?void 0:t.deadline)===!0||t.propertyName==="height",am=(e=fc)=>({motionName:`${e}-motion-collapse`,onAppearStart:_p,onEnterStart:_p,onAppearActive:Iw,onEnterActive:Iw,onLeaveStart:S2,onLeaveActive:_p,onAppearEnd:Mp,onEnterEnd:Mp,onLeaveEnd:Mp,motionDeadline:500}),wv=(e,t,n)=>n!==void 0?n:`${e}-${t}`;function Er(e,t){var n=Object.assign({},e);return Array.isArray(t)&&t.forEach(function(r){delete n[r]}),n}const rf=function(e){if(!e)return!1;if(e instanceof Element){if(e.offsetParent)return!0;if(e.getBBox){var t=e.getBBox(),n=t.width,r=t.height;if(n||r)return!0}if(e.getBoundingClientRect){var i=e.getBoundingClientRect(),o=i.width,l=i.height;if(o||l)return!0}}return!1},C2=e=>{const{componentCls:t,colorPrimary:n}=e;return{[t]:{position:"absolute",background:"transparent",pointerEvents:"none",boxSizing:"border-box",color:`var(--wave-color, ${n})`,boxShadow:"0 0 0 0 currentcolor",opacity:.2,"&.wave-motion-appear":{transition:[`box-shadow 0.4s ${e.motionEaseOutCirc}`,`opacity 2s ${e.motionEaseOutCirc}`].join(","),"&-active":{boxShadow:"0 0 0 6px currentcolor",opacity:0},"&.wave-quick":{transition:[`box-shadow ${e.motionDurationSlow} ${e.motionEaseInOut}`,`opacity ${e.motionDurationSlow} ${e.motionEaseInOut}`].join(",")}}}}},$2=OI("Wave",e=>[C2(e)]),sx=`${fc}-wave-target`;function Rp(e){return e&&e!=="#fff"&&e!=="#ffffff"&&e!=="rgb(255, 255, 255)"&&e!=="rgba(255, 255, 255, 1)"&&!/rgba\((?:\d*, ){3}0\)/.test(e)&&e!=="transparent"}function x2(e){const{borderTopColor:t,borderColor:n,backgroundColor:r}=getComputedStyle(e);return Rp(t)?t:Rp(n)?n:Rp(r)?r:null}function Op(e){return Number.isNaN(e)?0:e}const E2=e=>{const{className:t,target:n,component:r,registerUnmount:i}=e,o=C.useRef(null),l=C.useRef(null);C.useEffect(()=>{l.current=i()},[]);const[m,u]=C.useState(null),[p,s]=C.useState([]),[c,d]=C.useState(0),[h,f]=C.useState(0),[v,y]=C.useState(0),[b,w]=C.useState(0),[x,E]=C.useState(!1),_={left:c,top:h,width:v,height:b,borderRadius:p.map(N=>`${N}px`).join(" ")};m&&(_["--wave-color"]=m);function $(){const N=getComputedStyle(n);u(x2(n));const k=N.position==="static",{borderLeftWidth:L,borderTopWidth:F}=N;d(k?n.offsetLeft:Op(-parseFloat(L))),f(k?n.offsetTop:Op(-parseFloat(F))),y(n.offsetWidth),w(n.offsetHeight);const{borderTopLeftRadius:P,borderTopRightRadius:A,borderBottomLeftRadius:M,borderBottomRightRadius:R}=N;s([P,A,R,M].map(I=>Op(parseFloat(I))))}if(C.useEffect(()=>{if(n){const N=gn(()=>{$(),E(!0)});let k;return typeof ResizeObserver<"u"&&(k=new ResizeObserver($),k.observe(n)),()=>{gn.cancel(N),k==null||k.disconnect()}}},[]),!x)return null;const O=(r==="Checkbox"||r==="Radio")&&(n==null?void 0:n.classList.contains(sx));return C.createElement(Lo,{visible:!0,motionAppear:!0,motionName:"wave-motion",motionDeadline:5e3,onAppearEnd:(N,k)=>{var L,F;if(k.deadline||k.propertyName==="opacity"){const P=(L=o.current)===null||L===void 0?void 0:L.parentElement;(F=l.current)===null||F===void 0||F.call(l).then(()=>{P==null||P.remove()})}return!1}},({className:N},k)=>C.createElement("div",{ref:wi(o,k),className:ve(t,N,{"wave-quick":O}),style:_}))},_2=(e,t)=>{var n;const{component:r}=t;if(r==="Checkbox"&&!(!((n=e.querySelector("input"))===null||n===void 0)&&n.checked))return;const i=document.createElement("div");i.style.position="absolute",i.style.left="0px",i.style.top="0px",e==null||e.insertBefore(i,e==null?void 0:e.firstChild);const o=bv();let l=null;function m(){return l}l=o(C.createElement(E2,Object.assign({},t,{target:e,registerUnmount:m})),i)},M2=(e,t,n)=>{const{wave:r}=C.useContext(zt),[,i,o]=Si(),l=tr(p=>{const s=e.current;if(r!=null&&r.disabled||!s)return;const c=s.querySelector(`.${sx}`)||s,{showEffect:d}=r||{};(d||_2)(c,{className:t,token:i,component:n,event:p,hashId:o})}),m=C.useRef(null);return p=>{gn.cancel(m.current),m.current=gn(()=>{l(p)})}},R2=e=>{const{children:t,disabled:n,component:r}=e,{getPrefixCls:i}=C.useContext(zt),o=C.useRef(null),l=i("wave"),[,m]=$2(l),u=M2(o,ve(l,m),r);if(be.useEffect(()=>{const s=o.current;if(!s||s.nodeType!==1||n)return;const c=d=>{!rf(d.target)||!s.getAttribute||s.getAttribute("disabled")||s.disabled||s.className.includes("disabled")||s.className.includes("-leave")||u(d)};return s.addEventListener("click",c,!0),()=>{s.removeEventListener("click",c,!0)}},[n]),!be.isValidElement(t))return t??null;const p=fa(t)?wi(Ka(t),o):o;return Oo(t,{ref:p})},to=e=>{const t=be.useContext(ja);return be.useMemo(()=>e?typeof e=="string"?e??t:typeof e=="function"?e(t):t:t,[e,t])},O2=e=>{const{componentCls:t}=e;return{[t]:{"&-block":{display:"flex",width:"100%"},"&-vertical":{flexDirection:"column"}}}},A2=e=>{const{componentCls:t,antCls:n}=e;return{[t]:{display:"inline-flex","&-rtl":{direction:"rtl"},"&-vertical":{flexDirection:"column"},"&-align":{flexDirection:"column","&-center":{alignItems:"center"},"&-start":{alignItems:"flex-start"},"&-end":{alignItems:"flex-end"},"&-baseline":{alignItems:"baseline"}},[`${t}-item:empty`]:{display:"none"},[`${t}-item > ${n}-badge-not-a-wrapper:only-child`]:{display:"block"}}}},T2=e=>{const{componentCls:t}=e;return{[t]:{"&-gap-row-small":{rowGap:e.spaceGapSmallSize},"&-gap-row-middle":{rowGap:e.spaceGapMiddleSize},"&-gap-row-large":{rowGap:e.spaceGapLargeSize},"&-gap-col-small":{columnGap:e.spaceGapSmallSize},"&-gap-col-middle":{columnGap:e.spaceGapMiddleSize},"&-gap-col-large":{columnGap:e.spaceGapLargeSize}}}},lx=gr("Space",e=>{const t=Sn(e,{spaceGapSmallSize:e.paddingXS,spaceGapMiddleSize:e.padding,spaceGapLargeSize:e.paddingLG});return[A2(t),T2(t),O2(t)]},()=>({}),{resetStyle:!1});var cx=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i{const n=C.useContext(of),r=C.useMemo(()=>{if(!n)return"";const{compactDirection:i,isFirstItem:o,isLastItem:l}=n,m=i==="vertical"?"-vertical-":"-";return ve(`${e}-compact${m}item`,{[`${e}-compact${m}first-item`]:o,[`${e}-compact${m}last-item`]:l,[`${e}-compact${m}item-rtl`]:t==="rtl"})},[e,t,n]);return{compactSize:n==null?void 0:n.compactSize,compactDirection:n==null?void 0:n.compactDirection,compactItemClassnames:r}},I2=e=>{const{children:t}=e;return C.createElement(of.Provider,{value:null},t)},L2=e=>{const{children:t}=e,n=cx(e,["children"]);return C.createElement(of.Provider,{value:C.useMemo(()=>n,[n])},t)},P2=e=>{const{getPrefixCls:t,direction:n}=C.useContext(zt),{size:r,direction:i,block:o,prefixCls:l,className:m,rootClassName:u,children:p}=e,s=cx(e,["size","direction","block","prefixCls","className","rootClassName","children"]),c=to(x=>r??x),d=t("space-compact",l),[h,f]=lx(d),v=ve(d,f,{[`${d}-rtl`]:n==="rtl",[`${d}-block`]:o,[`${d}-vertical`]:i==="vertical"},m,u),y=C.useContext(of),b=li(p),w=C.useMemo(()=>b.map((x,E)=>{const _=(x==null?void 0:x.key)||`${d}-item-${E}`;return C.createElement(L2,{key:_,compactSize:c,compactDirection:i,isFirstItem:E===0&&(!y||(y==null?void 0:y.isFirstItem)),isLastItem:E===b.length-1&&(!y||(y==null?void 0:y.isLastItem))},x)}),[r,b,y]);return b.length===0?null:h(C.createElement("div",Object.assign({className:v},s),w))};var k2=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i{const{getPrefixCls:t,direction:n}=C.useContext(zt),{prefixCls:r,size:i,className:o}=e,l=k2(e,["prefixCls","size","className"]),m=t("btn-group",r),[,,u]=Si(),p=C.useMemo(()=>{switch(i){case"large":return"lg";case"small":return"sm";default:return""}},[i]),s=ve(m,{[`${m}-${p}`]:p,[`${m}-rtl`]:n==="rtl"},o,u);return C.createElement(ux.Provider,{value:i},C.createElement("div",Object.assign({},l,{className:s})))},Lw=/^[\u4E00-\u9FA5]{2}$/,sm=Lw.test.bind(Lw);function Pw(e){return typeof e=="string"}function Ap(e){return e==="text"||e==="link"}function D2(e,t){if(e==null)return;const n=t?" ":"";return typeof e!="string"&&typeof e!="number"&&Pw(e.type)&&sm(e.props.children)?Oo(e,{children:e.props.children.split("").join(n)}):Pw(e)?sm(e)?be.createElement("span",null,e.split("").join(n)):be.createElement("span",null,e):X$(e)?be.createElement("span",null,e):e}function F2(e,t){let n=!1;const r=[];return be.Children.forEach(e,i=>{const o=typeof i,l=o==="string"||o==="number";if(n&&l){const m=r.length-1,u=r[m];r[m]=`${u}${i}`}else r.push(i);n=l}),be.Children.map(r,i=>D2(i,t))}["default","primary","danger"].concat(Ge(Ba));const lm=C.forwardRef((e,t)=>{const{className:n,style:r,children:i,prefixCls:o}=e,l=ve(`${o}-icon`,n);return be.createElement("span",{ref:t,className:l,style:r},i)}),kw=C.forwardRef((e,t)=>{const{prefixCls:n,className:r,style:i,iconClassName:o}=e,l=ve(`${n}-loading-icon`,r);return be.createElement(lm,{prefixCls:n,className:l,style:i,ref:t},be.createElement(Tc,{className:o}))}),Tp=()=>({width:0,opacity:0,transform:"scale(0)"}),Ip=e=>({width:e.scrollWidth,opacity:1,transform:"scale(1)"}),z2=e=>{const{prefixCls:t,loading:n,existIcon:r,className:i,style:o,mount:l}=e,m=!!n;return r?be.createElement(kw,{prefixCls:t,className:i,style:o}):be.createElement(Lo,{visible:m,motionName:`${t}-loading-icon-motion`,motionAppear:!l,motionEnter:!l,motionLeave:!l,removeOnLeave:!0,onAppearStart:Tp,onAppearActive:Ip,onEnterStart:Tp,onEnterActive:Ip,onLeaveStart:Ip,onLeaveActive:Tp},({className:u,style:p},s)=>{const c=Object.assign(Object.assign({},o),p);return be.createElement(kw,{prefixCls:t,className:ve(i,u),style:c,ref:s})})},Nw=(e,t)=>({[`> span, > ${e}`]:{"&:not(:last-child)":{[`&, & > ${e}`]:{"&:not(:disabled)":{borderInlineEndColor:t}}},"&:not(:first-child)":{[`&, & > ${e}`]:{"&:not(:disabled)":{borderInlineStartColor:t}}}}}),j2=e=>{const{componentCls:t,fontSize:n,lineWidth:r,groupBorderColor:i,colorErrorHover:o}=e;return{[`${t}-group`]:[{position:"relative",display:"inline-flex",[`> span, > ${t}`]:{"&:not(:last-child)":{[`&, & > ${t}`]:{borderStartEndRadius:0,borderEndEndRadius:0}},"&:not(:first-child)":{marginInlineStart:e.calc(r).mul(-1).equal(),[`&, & > ${t}`]:{borderStartStartRadius:0,borderEndStartRadius:0}}},[t]:{position:"relative",zIndex:1,"&:hover, &:focus, &:active":{zIndex:2},"&[disabled]":{zIndex:0}},[`${t}-icon-only`]:{fontSize:n}},Nw(`${t}-primary`,i),Nw(`${t}-danger`,o)]}},Cr=Math.round;function Lp(e,t){const n=e.replace(/^[^(]*\((.*)/,"$1").replace(/\).*/,"").match(/\d*\.?\d+%?/g)||[],r=n.map(i=>parseFloat(i));for(let i=0;i<3;i+=1)r[i]=t(r[i]||0,n[i]||"",i);return n[3]?r[3]=n[3].includes("%")?r[3]/100:r[3]:r[3]=1,r}const Dw=(e,t,n)=>n===0?e:e/100;function kl(e,t){const n=t||255;return e>n?n:e<0?0:e}let dx=class fx{constructor(t){ne(this,"isValid",!0),ne(this,"r",0),ne(this,"g",0),ne(this,"b",0),ne(this,"a",1),ne(this,"_h",void 0),ne(this,"_s",void 0),ne(this,"_l",void 0),ne(this,"_v",void 0),ne(this,"_max",void 0),ne(this,"_min",void 0),ne(this,"_brightness",void 0);function n(i){return i[0]in t&&i[1]in t&&i[2]in t}if(t)if(typeof t=="string"){let o=function(l){return i.startsWith(l)};var r=o;const i=t.trim();/^#?[A-F\d]{3,8}$/i.test(i)?this.fromHexString(i):o("rgb")?this.fromRgbString(i):o("hsl")?this.fromHslString(i):(o("hsv")||o("hsb"))&&this.fromHsvString(i)}else if(t instanceof fx)this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this._h=t._h,this._s=t._s,this._l=t._l,this._v=t._v;else if(n("rgb"))this.r=kl(t.r),this.g=kl(t.g),this.b=kl(t.b),this.a=typeof t.a=="number"?kl(t.a,1):1;else if(n("hsl"))this.fromHsl(t);else if(n("hsv"))this.fromHsv(t);else throw new Error("@ant-design/fast-color: unsupported input "+JSON.stringify(t))}setR(t){return this._sc("r",t)}setG(t){return this._sc("g",t)}setB(t){return this._sc("b",t)}setA(t){return this._sc("a",t,1)}setHue(t){const n=this.toHsv();return n.h=t,this._c(n)}getLuminance(){function t(o){const l=o/255;return l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4)}const n=t(this.r),r=t(this.g),i=t(this.b);return .2126*n+.7152*r+.0722*i}getHue(){if(typeof this._h>"u"){const t=this.getMax()-this.getMin();t===0?this._h=0:this._h=Cr(60*(this.r===this.getMax()?(this.g-this.b)/t+(this.g"u"){const t=this.getMax()-this.getMin();t===0?this._s=0:this._s=t/this.getMax()}return this._s}getLightness(){return typeof this._l>"u"&&(this._l=(this.getMax()+this.getMin())/510),this._l}getValue(){return typeof this._v>"u"&&(this._v=this.getMax()/255),this._v}getBrightness(){return typeof this._brightness>"u"&&(this._brightness=(this.r*299+this.g*587+this.b*114)/1e3),this._brightness}darken(t=10){const n=this.getHue(),r=this.getSaturation();let i=this.getLightness()-t/100;return i<0&&(i=0),this._c({h:n,s:r,l:i,a:this.a})}lighten(t=10){const n=this.getHue(),r=this.getSaturation();let i=this.getLightness()+t/100;return i>1&&(i=1),this._c({h:n,s:r,l:i,a:this.a})}mix(t,n=50){const r=this._c(t),i=n/100,o=m=>(r[m]-this[m])*i+this[m],l={r:Cr(o("r")),g:Cr(o("g")),b:Cr(o("b")),a:Cr(o("a")*100)/100};return this._c(l)}tint(t=10){return this.mix({r:255,g:255,b:255,a:1},t)}shade(t=10){return this.mix({r:0,g:0,b:0,a:1},t)}onBackground(t){const n=this._c(t),r=this.a+n.a*(1-this.a),i=o=>Cr((this[o]*this.a+n[o]*n.a*(1-this.a))/r);return this._c({r:i("r"),g:i("g"),b:i("b"),a:r})}isDark(){return this.getBrightness()<128}isLight(){return this.getBrightness()>=128}equals(t){return this.r===t.r&&this.g===t.g&&this.b===t.b&&this.a===t.a}clone(){return this._c(this)}toHexString(){let t="#";const n=(this.r||0).toString(16);t+=n.length===2?n:"0"+n;const r=(this.g||0).toString(16);t+=r.length===2?r:"0"+r;const i=(this.b||0).toString(16);if(t+=i.length===2?i:"0"+i,typeof this.a=="number"&&this.a>=0&&this.a<1){const o=Cr(this.a*255).toString(16);t+=o.length===2?o:"0"+o}return t}toHsl(){return{h:this.getHue(),s:this.getSaturation(),l:this.getLightness(),a:this.a}}toHslString(){const t=this.getHue(),n=Cr(this.getSaturation()*100),r=Cr(this.getLightness()*100);return this.a!==1?`hsla(${t},${n}%,${r}%,${this.a})`:`hsl(${t},${n}%,${r}%)`}toHsv(){return{h:this.getHue(),s:this.getSaturation(),v:this.getValue(),a:this.a}}toRgb(){return{r:this.r,g:this.g,b:this.b,a:this.a}}toRgbString(){return this.a!==1?`rgba(${this.r},${this.g},${this.b},${this.a})`:`rgb(${this.r},${this.g},${this.b})`}toString(){return this.toRgbString()}_sc(t,n,r){const i=this.clone();return i[t]=kl(n,r),i}_c(t){return new this.constructor(t)}getMax(){return typeof this._max>"u"&&(this._max=Math.max(this.r,this.g,this.b)),this._max}getMin(){return typeof this._min>"u"&&(this._min=Math.min(this.r,this.g,this.b)),this._min}fromHexString(t){const n=t.replace("#","");function r(i,o){return parseInt(n[i]+n[o||i],16)}n.length<6?(this.r=r(0),this.g=r(1),this.b=r(2),this.a=n[3]?r(3)/255:1):(this.r=r(0,1),this.g=r(2,3),this.b=r(4,5),this.a=n[6]?r(6,7)/255:1)}fromHsl({h:t,s:n,l:r,a:i}){if(this._h=t%360,this._s=n,this._l=r,this.a=typeof i=="number"?i:1,n<=0){const d=Cr(r*255);this.r=d,this.g=d,this.b=d}let o=0,l=0,m=0;const u=t/60,p=(1-Math.abs(2*r-1))*n,s=p*(1-Math.abs(u%2-1));u>=0&&u<1?(o=p,l=s):u>=1&&u<2?(o=s,l=p):u>=2&&u<3?(l=p,m=s):u>=3&&u<4?(l=s,m=p):u>=4&&u<5?(o=s,m=p):u>=5&&u<6&&(o=p,m=s);const c=r-p/2;this.r=Cr((o+c)*255),this.g=Cr((l+c)*255),this.b=Cr((m+c)*255)}fromHsv({h:t,s:n,v:r,a:i}){this._h=t%360,this._s=n,this._v=r,this.a=typeof i=="number"?i:1;const o=Cr(r*255);if(this.r=o,this.g=o,this.b=o,n<=0)return;const l=t/60,m=Math.floor(l),u=l-m,p=Cr(r*(1-n)*255),s=Cr(r*(1-n*u)*255),c=Cr(r*(1-n*(1-u))*255);switch(m){case 0:this.g=c,this.b=p;break;case 1:this.r=s,this.b=p;break;case 2:this.r=p,this.b=c;break;case 3:this.r=p,this.g=s;break;case 4:this.r=c,this.g=p;break;case 5:default:this.g=p,this.b=s;break}}fromHsvString(t){const n=Lp(t,Dw);this.fromHsv({h:n[0],s:n[1],v:n[2],a:n[3]})}fromHslString(t){const n=Lp(t,Dw);this.fromHsl({h:n[0],s:n[1],l:n[2],a:n[3]})}fromRgbString(t){const n=Lp(t,(r,i)=>i.includes("%")?Cr(r/100*255):r);this.r=n[0],this.g=n[1],this.b=n[2],this.a=n[3]}};var B2=["b"],H2=["v"],Pp=function(t){return Math.round(Number(t||0))},W2=function(t){if(t instanceof dx)return t;if(t&&wt(t)==="object"&&"h"in t&&"b"in t){var n=t,r=n.b,i=At(n,B2);return oe(oe({},i),{},{v:r})}return typeof t=="string"&&/hsb/.test(t)?t.replace(/hsb/,"hsv"):t},hc=function(e){To(n,e);var t=Io(n);function n(r){return cr(this,n),t.call(this,W2(r))}return ur(n,[{key:"toHsbString",value:function(){var i=this.toHsb(),o=Pp(i.s*100),l=Pp(i.b*100),m=Pp(i.h),u=i.a,p="hsb(".concat(m,", ").concat(o,"%, ").concat(l,"%)"),s="hsba(".concat(m,", ").concat(o,"%, ").concat(l,"%, ").concat(u.toFixed(u===0?0:2),")");return u===1?p:s}},{key:"toHsb",value:function(){var i=this.toHsv(),o=i.v,l=At(i,H2);return oe(oe({},l),{},{b:o,a:this.a})}}]),n}(dx),V2=function(t){return t instanceof hc?t:new hc(t)};V2("#1677ff");const U2=(e,t)=>(e==null?void 0:e.replace(/[^\w/]/g,"").slice(0,t?8:6))||"",G2=(e,t)=>e?U2(e,t):"";let K2=function(){function e(t){cr(this,e);var n;if(this.cleared=!1,t instanceof e){this.metaColor=t.metaColor.clone(),this.colors=(n=t.colors)===null||n===void 0?void 0:n.map(i=>({color:new e(i.color),percent:i.percent})),this.cleared=t.cleared;return}const r=Array.isArray(t);r&&t.length?(this.colors=t.map(({color:i,percent:o})=>({color:new e(i),percent:o})),this.metaColor=new hc(this.colors[0].color.metaColor)):this.metaColor=new hc(r?"":t),(!t||r&&!this.colors)&&(this.metaColor=this.metaColor.setA(0),this.cleared=!0)}return ur(e,[{key:"toHsb",value:function(){return this.metaColor.toHsb()}},{key:"toHsbString",value:function(){return this.metaColor.toHsbString()}},{key:"toHex",value:function(){return G2(this.toHexString(),this.metaColor.a<1)}},{key:"toHexString",value:function(){return this.metaColor.toHexString()}},{key:"toRgb",value:function(){return this.metaColor.toRgb()}},{key:"toRgbString",value:function(){return this.metaColor.toRgbString()}},{key:"isGradient",value:function(){return!!this.colors&&!this.cleared}},{key:"getColors",value:function(){return this.colors||[{color:this,percent:0}]}},{key:"toCssString",value:function(){const{colors:n}=this;return n?`linear-gradient(90deg, ${n.map(i=>`${i.color.toRgbString()} ${i.percent}%`).join(", ")})`:this.metaColor.toRgbString()}},{key:"equals",value:function(n){return!n||this.isGradient()!==n.isGradient()?!1:this.isGradient()?this.colors.length===n.colors.length&&this.colors.every((r,i)=>{const o=n.colors[i];return r.percent===o.percent&&r.color.equals(o.color)}):this.toHexString()===n.toHexString()}}])}();var Y2={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M765.7 486.8L314.9 134.7A7.97 7.97 0 00302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 000-50.4z"}}]},name:"right",theme:"outlined"},X2=function(t,n){return C.createElement(rr,nt({},t,{ref:n,icon:Y2}))},q2=C.forwardRef(X2),hx=be.forwardRef(function(e,t){var n=e.prefixCls,r=e.forceRender,i=e.className,o=e.style,l=e.children,m=e.isActive,u=e.role,p=e.classNames,s=e.styles,c=be.useState(m||r),d=pe(c,2),h=d[0],f=d[1];return be.useEffect(function(){(r||m)&&f(!0)},[r,m]),h?be.createElement("div",{ref:t,className:ve("".concat(n,"-content"),ne(ne({},"".concat(n,"-content-active"),m),"".concat(n,"-content-inactive"),!m),i),style:o,role:u},be.createElement("div",{className:ve("".concat(n,"-content-box"),p==null?void 0:p.body),style:s==null?void 0:s.body},l)):null});hx.displayName="PanelContent";var Q2=["showArrow","headerClass","isActive","onItemClick","forceRender","className","classNames","styles","prefixCls","collapsible","accordion","panelKey","extra","header","expandIcon","openMotion","destroyInactivePanel","children"],px=be.forwardRef(function(e,t){var n=e.showArrow,r=n===void 0?!0:n,i=e.headerClass,o=e.isActive,l=e.onItemClick,m=e.forceRender,u=e.className,p=e.classNames,s=p===void 0?{}:p,c=e.styles,d=c===void 0?{}:c,h=e.prefixCls,f=e.collapsible,v=e.accordion,y=e.panelKey,b=e.extra,w=e.header,x=e.expandIcon,E=e.openMotion,_=e.destroyInactivePanel,$=e.children,O=At(e,Q2),N=f==="disabled",k=b!=null&&typeof b!="boolean",L=ne(ne(ne({onClick:function(){l==null||l(y)},onKeyDown:function(D){(D.key==="Enter"||D.keyCode===mt.ENTER||D.which===mt.ENTER)&&(l==null||l(y))},role:v?"tab":"button"},"aria-expanded",o),"aria-disabled",N),"tabIndex",N?-1:0),F=typeof x=="function"?x(e):be.createElement("i",{className:"arrow"}),P=F&&be.createElement("div",nt({className:"".concat(h,"-expand-icon")},["header","icon"].includes(f)?L:{}),F),A=ve("".concat(h,"-item"),ne(ne({},"".concat(h,"-item-active"),o),"".concat(h,"-item-disabled"),N),u),M=ve(i,"".concat(h,"-header"),ne({},"".concat(h,"-collapsible-").concat(f),!!f),s.header),R=oe({className:M,style:d.header},["header","icon"].includes(f)?{}:L);return be.createElement("div",nt({},O,{ref:t,className:A}),be.createElement("div",R,r&&P,be.createElement("span",nt({className:"".concat(h,"-header-text")},f==="header"?L:{}),w),k&&be.createElement("div",{className:"".concat(h,"-extra")},b)),be.createElement(Lo,nt({visible:o,leavedClassName:"".concat(h,"-content-hidden")},E,{forceRender:m,removeOnLeave:_}),function(I,D){var j=I.className,B=I.style;return be.createElement(hx,{ref:D,prefixCls:h,className:j,classNames:s,style:B,styles:d,isActive:o,forceRender:m,role:v?"tabpanel":void 0},$)}))}),Z2=["children","label","key","collapsible","onItemClick","destroyInactivePanel"],J2=function(t,n){var r=n.prefixCls,i=n.accordion,o=n.collapsible,l=n.destroyInactivePanel,m=n.onItemClick,u=n.activeKey,p=n.openMotion,s=n.expandIcon;return t.map(function(c,d){var h=c.children,f=c.label,v=c.key,y=c.collapsible,b=c.onItemClick,w=c.destroyInactivePanel,x=At(c,Z2),E=String(v??d),_=y??o,$=w??l,O=function(L){_!=="disabled"&&(m(L),b==null||b(L))},N=!1;return i?N=u[0]===E:N=u.indexOf(E)>-1,be.createElement(px,nt({},x,{prefixCls:r,key:E,panelKey:E,isActive:N,accordion:i,openMotion:p,expandIcon:s,header:f,collapsible:_,onItemClick:O,destroyInactivePanel:$}),h)})},eP=function(t,n,r){if(!t)return null;var i=r.prefixCls,o=r.accordion,l=r.collapsible,m=r.destroyInactivePanel,u=r.onItemClick,p=r.activeKey,s=r.openMotion,c=r.expandIcon,d=t.key||String(n),h=t.props,f=h.header,v=h.headerClass,y=h.destroyInactivePanel,b=h.collapsible,w=h.onItemClick,x=!1;o?x=p[0]===d:x=p.indexOf(d)>-1;var E=b??l,_=function(N){E!=="disabled"&&(u(N),w==null||w(N))},$={key:d,panelKey:d,header:f,headerClass:v,isActive:x,prefixCls:i,destroyInactivePanel:y??m,openMotion:s,accordion:o,children:t.props.children,onItemClick:_,expandIcon:c,collapsible:E};return typeof t.type=="string"?t:(Object.keys($).forEach(function(O){typeof $[O]>"u"&&delete $[O]}),be.cloneElement(t,$))};function tP(e,t,n){return Array.isArray(e)?J2(e,n):li(t).map(function(r,i){return eP(r,i,n)})}function nP(e){var t=e;if(!Array.isArray(t)){var n=wt(t);t=n==="number"||n==="string"?[t]:[]}return t.map(function(r){return String(r)})}var rP=be.forwardRef(function(e,t){var n=e.prefixCls,r=n===void 0?"rc-collapse":n,i=e.destroyInactivePanel,o=i===void 0?!1:i,l=e.style,m=e.accordion,u=e.className,p=e.children,s=e.collapsible,c=e.openMotion,d=e.expandIcon,h=e.activeKey,f=e.defaultActiveKey,v=e.onChange,y=e.items,b=ve(r,u),w=Pr([],{value:h,onChange:function(k){return v==null?void 0:v(k)},defaultValue:f,postState:nP}),x=pe(w,2),E=x[0],_=x[1],$=function(k){return _(function(){if(m)return E[0]===k?[]:[k];var L=E.indexOf(k),F=L>-1;return F?E.filter(function(P){return P!==k}):[].concat(Ge(E),[k])})};Lr(!p,"[rc-collapse] `children` will be removed in next major version. Please use `items` instead.");var O=tP(y,p,{prefixCls:r,accordion:m,openMotion:c,expandIcon:d,collapsible:s,destroyInactivePanel:o,onItemClick:$,activeKey:E});return be.createElement("div",nt({ref:t,className:b,style:l,role:m?"tablist":void 0},Wa(e,{aria:!0,data:!0})),O)});const Sv=Object.assign(rP,{Panel:px});Sv.Panel;const iP=C.forwardRef((e,t)=>{const{getPrefixCls:n}=C.useContext(zt),{prefixCls:r,className:i,showArrow:o=!0}=e,l=n("collapse",r),m=ve({[`${l}-no-arrow`]:!o},i);return C.createElement(Sv.Panel,Object.assign({ref:t},e,{prefixCls:l,className:m}))}),gx=e=>({[e.componentCls]:{[`${e.antCls}-motion-collapse-legacy`]:{overflow:"hidden","&-active":{transition:`height ${e.motionDurationMid} ${e.motionEaseInOut}, + opacity ${e.motionDurationMid} ${e.motionEaseInOut} !important`}},[`${e.antCls}-motion-collapse`]:{overflow:"hidden",transition:`height ${e.motionDurationMid} ${e.motionEaseInOut}, + opacity ${e.motionDurationMid} ${e.motionEaseInOut} !important`}}}),oP=e=>({animationDuration:e,animationFillMode:"both"}),aP=e=>({animationDuration:e,animationFillMode:"both"}),Cv=(e,t,n,r,i=!1)=>{const o=i?"&":"";return{[` + ${o}${e}-enter, + ${o}${e}-appear + `]:Object.assign(Object.assign({},oP(r)),{animationPlayState:"paused"}),[`${o}${e}-leave`]:Object.assign(Object.assign({},aP(r)),{animationPlayState:"paused"}),[` + ${o}${e}-enter${e}-enter-active, + ${o}${e}-appear${e}-appear-active + `]:{animationName:t,animationPlayState:"running"},[`${o}${e}-leave${e}-leave-active`]:{animationName:n,animationPlayState:"running",pointerEvents:"none"}}},sP=new nn("antMoveDownIn",{"0%":{transform:"translate3d(0, 100%, 0)",transformOrigin:"0 0",opacity:0},"100%":{transform:"translate3d(0, 0, 0)",transformOrigin:"0 0",opacity:1}}),lP=new nn("antMoveDownOut",{"0%":{transform:"translate3d(0, 0, 0)",transformOrigin:"0 0",opacity:1},"100%":{transform:"translate3d(0, 100%, 0)",transformOrigin:"0 0",opacity:0}}),cP=new nn("antMoveLeftIn",{"0%":{transform:"translate3d(-100%, 0, 0)",transformOrigin:"0 0",opacity:0},"100%":{transform:"translate3d(0, 0, 0)",transformOrigin:"0 0",opacity:1}}),uP=new nn("antMoveLeftOut",{"0%":{transform:"translate3d(0, 0, 0)",transformOrigin:"0 0",opacity:1},"100%":{transform:"translate3d(-100%, 0, 0)",transformOrigin:"0 0",opacity:0}}),dP=new nn("antMoveRightIn",{"0%":{transform:"translate3d(100%, 0, 0)",transformOrigin:"0 0",opacity:0},"100%":{transform:"translate3d(0, 0, 0)",transformOrigin:"0 0",opacity:1}}),fP=new nn("antMoveRightOut",{"0%":{transform:"translate3d(0, 0, 0)",transformOrigin:"0 0",opacity:1},"100%":{transform:"translate3d(100%, 0, 0)",transformOrigin:"0 0",opacity:0}}),hP=new nn("antMoveUpIn",{"0%":{transform:"translate3d(0, -100%, 0)",transformOrigin:"0 0",opacity:0},"100%":{transform:"translate3d(0, 0, 0)",transformOrigin:"0 0",opacity:1}}),pP=new nn("antMoveUpOut",{"0%":{transform:"translate3d(0, 0, 0)",transformOrigin:"0 0",opacity:1},"100%":{transform:"translate3d(0, -100%, 0)",transformOrigin:"0 0",opacity:0}}),gP={"move-up":{inKeyframes:hP,outKeyframes:pP},"move-down":{inKeyframes:sP,outKeyframes:lP},"move-left":{inKeyframes:cP,outKeyframes:uP},"move-right":{inKeyframes:dP,outKeyframes:fP}},Fw=(e,t)=>{const{antCls:n}=e,r=`${n}-${t}`,{inKeyframes:i,outKeyframes:o}=gP[t];return[Cv(r,i,o,e.motionDurationMid),{[` + ${r}-enter, + ${r}-appear + `]:{opacity:0,animationTimingFunction:e.motionEaseOutCirc},[`${r}-leave`]:{animationTimingFunction:e.motionEaseInOutCirc}}]},mx=new nn("antSlideUpIn",{"0%":{transform:"scaleY(0.8)",transformOrigin:"0% 0%",opacity:0},"100%":{transform:"scaleY(1)",transformOrigin:"0% 0%",opacity:1}}),vx=new nn("antSlideUpOut",{"0%":{transform:"scaleY(1)",transformOrigin:"0% 0%",opacity:1},"100%":{transform:"scaleY(0.8)",transformOrigin:"0% 0%",opacity:0}}),yx=new nn("antSlideDownIn",{"0%":{transform:"scaleY(0.8)",transformOrigin:"100% 100%",opacity:0},"100%":{transform:"scaleY(1)",transformOrigin:"100% 100%",opacity:1}}),bx=new nn("antSlideDownOut",{"0%":{transform:"scaleY(1)",transformOrigin:"100% 100%",opacity:1},"100%":{transform:"scaleY(0.8)",transformOrigin:"100% 100%",opacity:0}}),mP=new nn("antSlideLeftIn",{"0%":{transform:"scaleX(0.8)",transformOrigin:"0% 0%",opacity:0},"100%":{transform:"scaleX(1)",transformOrigin:"0% 0%",opacity:1}}),vP=new nn("antSlideLeftOut",{"0%":{transform:"scaleX(1)",transformOrigin:"0% 0%",opacity:1},"100%":{transform:"scaleX(0.8)",transformOrigin:"0% 0%",opacity:0}}),yP=new nn("antSlideRightIn",{"0%":{transform:"scaleX(0.8)",transformOrigin:"100% 0%",opacity:0},"100%":{transform:"scaleX(1)",transformOrigin:"100% 0%",opacity:1}}),bP=new nn("antSlideRightOut",{"0%":{transform:"scaleX(1)",transformOrigin:"100% 0%",opacity:1},"100%":{transform:"scaleX(0.8)",transformOrigin:"100% 0%",opacity:0}}),wP={"slide-up":{inKeyframes:mx,outKeyframes:vx},"slide-down":{inKeyframes:yx,outKeyframes:bx},"slide-left":{inKeyframes:mP,outKeyframes:vP},"slide-right":{inKeyframes:yP,outKeyframes:bP}},Ld=(e,t)=>{const{antCls:n}=e,r=`${n}-${t}`,{inKeyframes:i,outKeyframes:o}=wP[t];return[Cv(r,i,o,e.motionDurationMid),{[` + ${r}-enter, + ${r}-appear + `]:{transform:"scale(0)",transformOrigin:"0% 0%",opacity:0,animationTimingFunction:e.motionEaseOutQuint,"&-prepare":{transform:"scale(1)"}},[`${r}-leave`]:{animationTimingFunction:e.motionEaseInQuint}}]},$v=new nn("antZoomIn",{"0%":{transform:"scale(0.2)",opacity:0},"100%":{transform:"scale(1)",opacity:1}}),SP=new nn("antZoomOut",{"0%":{transform:"scale(1)"},"100%":{transform:"scale(0.2)",opacity:0}}),zw=new nn("antZoomBigIn",{"0%":{transform:"scale(0.8)",opacity:0},"100%":{transform:"scale(1)",opacity:1}}),jw=new nn("antZoomBigOut",{"0%":{transform:"scale(1)"},"100%":{transform:"scale(0.8)",opacity:0}}),CP=new nn("antZoomUpIn",{"0%":{transform:"scale(0.8)",transformOrigin:"50% 0%",opacity:0},"100%":{transform:"scale(1)",transformOrigin:"50% 0%"}}),$P=new nn("antZoomUpOut",{"0%":{transform:"scale(1)",transformOrigin:"50% 0%"},"100%":{transform:"scale(0.8)",transformOrigin:"50% 0%",opacity:0}}),xP=new nn("antZoomLeftIn",{"0%":{transform:"scale(0.8)",transformOrigin:"0% 50%",opacity:0},"100%":{transform:"scale(1)",transformOrigin:"0% 50%"}}),EP=new nn("antZoomLeftOut",{"0%":{transform:"scale(1)",transformOrigin:"0% 50%"},"100%":{transform:"scale(0.8)",transformOrigin:"0% 50%",opacity:0}}),_P=new nn("antZoomRightIn",{"0%":{transform:"scale(0.8)",transformOrigin:"100% 50%",opacity:0},"100%":{transform:"scale(1)",transformOrigin:"100% 50%"}}),MP=new nn("antZoomRightOut",{"0%":{transform:"scale(1)",transformOrigin:"100% 50%"},"100%":{transform:"scale(0.8)",transformOrigin:"100% 50%",opacity:0}}),RP=new nn("antZoomDownIn",{"0%":{transform:"scale(0.8)",transformOrigin:"50% 100%",opacity:0},"100%":{transform:"scale(1)",transformOrigin:"50% 100%"}}),OP=new nn("antZoomDownOut",{"0%":{transform:"scale(1)",transformOrigin:"50% 100%"},"100%":{transform:"scale(0.8)",transformOrigin:"50% 100%",opacity:0}}),AP={zoom:{inKeyframes:$v,outKeyframes:SP},"zoom-big":{inKeyframes:zw,outKeyframes:jw},"zoom-big-fast":{inKeyframes:zw,outKeyframes:jw},"zoom-left":{inKeyframes:xP,outKeyframes:EP},"zoom-right":{inKeyframes:_P,outKeyframes:MP},"zoom-up":{inKeyframes:CP,outKeyframes:$P},"zoom-down":{inKeyframes:RP,outKeyframes:OP}},TP=(e,t)=>{const{antCls:n}=e,r=`${n}-${t}`,{inKeyframes:i,outKeyframes:o}=AP[t];return[Cv(r,i,o,e.motionDurationFast),{[` + ${r}-enter, + ${r}-appear + `]:{transform:"scale(0)",opacity:0,animationTimingFunction:e.motionEaseOutCirc,"&-prepare":{transform:"none"}},[`${r}-leave`]:{animationTimingFunction:e.motionEaseInOutCirc}}]},IP=e=>{const{componentCls:t,contentBg:n,padding:r,headerBg:i,headerPadding:o,collapseHeaderPaddingSM:l,collapseHeaderPaddingLG:m,collapsePanelBorderRadius:u,lineWidth:p,lineType:s,colorBorder:c,colorText:d,colorTextHeading:h,colorTextDisabled:f,fontSizeLG:v,lineHeight:y,lineHeightLG:b,marginSM:w,paddingSM:x,paddingLG:E,paddingXS:_,motionDurationSlow:$,fontSizeIcon:O,contentPadding:N,fontHeight:k,fontHeightLG:L}=e,F=`${$e(p)} ${s} ${c}`;return{[t]:Object.assign(Object.assign({},ci(e)),{backgroundColor:i,border:F,borderRadius:u,"&-rtl":{direction:"rtl"},[`& > ${t}-item`]:{borderBottom:F,"&:first-child":{[` + &, + & > ${t}-header`]:{borderRadius:`${$e(u)} ${$e(u)} 0 0`}},"&:last-child":{[` + &, + & > ${t}-header`]:{borderRadius:`0 0 ${$e(u)} ${$e(u)}`}},[`> ${t}-header`]:Object.assign(Object.assign({position:"relative",display:"flex",flexWrap:"nowrap",alignItems:"flex-start",padding:o,color:h,lineHeight:y,cursor:"pointer",transition:`all ${$}, visibility 0s`},Ha(e)),{[`> ${t}-header-text`]:{flex:"auto"},[`${t}-expand-icon`]:{height:k,display:"flex",alignItems:"center",paddingInlineEnd:w},[`${t}-arrow`]:Object.assign(Object.assign({},Rc()),{fontSize:O,transition:`transform ${$}`,svg:{transition:`transform ${$}`}}),[`${t}-header-text`]:{marginInlineEnd:"auto"}}),[`${t}-collapsible-header`]:{cursor:"default",[`${t}-header-text`]:{flex:"none",cursor:"pointer"}},[`${t}-collapsible-icon`]:{cursor:"unset",[`${t}-expand-icon`]:{cursor:"pointer"}}},[`${t}-content`]:{color:d,backgroundColor:n,borderTop:F,[`& > ${t}-content-box`]:{padding:N},"&-hidden":{display:"none"}},"&-small":{[`> ${t}-item`]:{[`> ${t}-header`]:{padding:l,paddingInlineStart:_,[`> ${t}-expand-icon`]:{marginInlineStart:e.calc(x).sub(_).equal()}},[`> ${t}-content > ${t}-content-box`]:{padding:x}}},"&-large":{[`> ${t}-item`]:{fontSize:v,lineHeight:b,[`> ${t}-header`]:{padding:m,paddingInlineStart:r,[`> ${t}-expand-icon`]:{height:L,marginInlineStart:e.calc(E).sub(r).equal()}},[`> ${t}-content > ${t}-content-box`]:{padding:E}}},[`${t}-item:last-child`]:{borderBottom:0,[`> ${t}-content`]:{borderRadius:`0 0 ${$e(u)} ${$e(u)}`}},[`& ${t}-item-disabled > ${t}-header`]:{"\n &,\n & > .arrow\n ":{color:f,cursor:"not-allowed"}},[`&${t}-icon-position-end`]:{[`& > ${t}-item`]:{[`> ${t}-header`]:{[`${t}-expand-icon`]:{order:1,paddingInlineEnd:0,paddingInlineStart:w}}}}})}},LP=e=>{const{componentCls:t}=e,n=`> ${t}-item > ${t}-header ${t}-arrow`;return{[`${t}-rtl`]:{[n]:{transform:"rotate(180deg)"}}}},PP=e=>{const{componentCls:t,headerBg:n,borderlessContentPadding:r,borderlessContentBg:i,colorBorder:o}=e;return{[`${t}-borderless`]:{backgroundColor:n,border:0,[`> ${t}-item`]:{borderBottom:`1px solid ${o}`},[` + > ${t}-item:last-child, + > ${t}-item:last-child ${t}-header + `]:{borderRadius:0},[`> ${t}-item:last-child`]:{borderBottom:0},[`> ${t}-item > ${t}-content`]:{backgroundColor:i,borderTop:0},[`> ${t}-item > ${t}-content > ${t}-content-box`]:{padding:r}}}},kP=e=>{const{componentCls:t,paddingSM:n}=e;return{[`${t}-ghost`]:{backgroundColor:"transparent",border:0,[`> ${t}-item`]:{borderBottom:0,[`> ${t}-content`]:{backgroundColor:"transparent",border:0,[`> ${t}-content-box`]:{paddingBlock:n}}}}}},NP=e=>({headerPadding:`${e.paddingSM}px ${e.padding}px`,headerBg:e.colorFillAlter,contentPadding:`${e.padding}px 16px`,contentBg:e.colorBgContainer,borderlessContentPadding:`${e.paddingXXS}px 16px ${e.padding}px`,borderlessContentBg:"transparent"}),DP=gr("Collapse",e=>{const t=Sn(e,{collapseHeaderPaddingSM:`${$e(e.paddingXS)} ${$e(e.paddingSM)}`,collapseHeaderPaddingLG:`${$e(e.padding)} ${$e(e.paddingLG)}`,collapsePanelBorderRadius:e.borderRadiusLG});return[IP(t),PP(t),kP(t),LP(t),gx(t)]},NP),FP=C.forwardRef((e,t)=>{const{getPrefixCls:n,direction:r,expandIcon:i,className:o,style:l}=Ji("collapse"),{prefixCls:m,className:u,rootClassName:p,style:s,bordered:c=!0,ghost:d,size:h,expandIconPosition:f="start",children:v,destroyInactivePanel:y,destroyOnHidden:b,expandIcon:w}=e,x=to(R=>{var I;return(I=h??R)!==null&&I!==void 0?I:"middle"}),E=n("collapse",m),_=n(),[$,O,N]=DP(E),k=C.useMemo(()=>f==="left"?"start":f==="right"?"end":f,[f]),L=w??i,F=C.useCallback((R={})=>{const I=typeof L=="function"?L(R):C.createElement(q2,{rotate:R.isActive?r==="rtl"?-90:90:void 0,"aria-label":R.isActive?"expanded":"collapsed"});return Oo(I,()=>{var D;return{className:ve((D=I==null?void 0:I.props)===null||D===void 0?void 0:D.className,`${E}-arrow`)}})},[L,E]),P=ve(`${E}-icon-position-${k}`,{[`${E}-borderless`]:!c,[`${E}-rtl`]:r==="rtl",[`${E}-ghost`]:!!d,[`${E}-${x}`]:x!=="middle"},o,u,p,O,N),A=Object.assign(Object.assign({},am(_)),{motionAppear:!1,leavedClassName:`${E}-content-hidden`}),M=C.useMemo(()=>v?li(v).map((R,I)=>{var D,j;const B=R.props;if(B!=null&&B.disabled){const V=(D=R.key)!==null&&D!==void 0?D:String(I),H=Object.assign(Object.assign({},Er(R.props,["disabled"])),{key:V,collapsible:(j=B.collapsible)!==null&&j!==void 0?j:"disabled"});return Oo(R,H)}return R}):null,[v]);return $(C.createElement(Sv,Object.assign({ref:t,openMotion:A},Er(e,["rootClassName"]),{expandIcon:F,prefixCls:E,className:P,style:Object.assign(Object.assign({},l),s),destroyInactivePanel:b??y}),M))}),wx=Object.assign(FP,{Panel:iP}),zP=(e,t)=>{const{r:n,g:r,b:i,a:o}=e.toRgb(),l=new hc(e.toRgbString()).onBackground(t).toHsv();return o<=.5?l.v>.5:n*.299+r*.587+i*.114>192},Sx=e=>{const{paddingInline:t,onlyIconSize:n}=e;return Sn(e,{buttonPaddingHorizontal:t,buttonPaddingVertical:0,buttonIconOnlyFontSize:n})},Cx=e=>{var t,n,r,i,o,l;const m=(t=e.contentFontSize)!==null&&t!==void 0?t:e.fontSize,u=(n=e.contentFontSizeSM)!==null&&n!==void 0?n:e.fontSize,p=(r=e.contentFontSizeLG)!==null&&r!==void 0?r:e.fontSizeLG,s=(i=e.contentLineHeight)!==null&&i!==void 0?i:fd(m),c=(o=e.contentLineHeightSM)!==null&&o!==void 0?o:fd(u),d=(l=e.contentLineHeightLG)!==null&&l!==void 0?l:fd(p),h=zP(new K2(e.colorBgSolid),"#fff")?"#000":"#fff",f=Ba.reduce((v,y)=>Object.assign(Object.assign({},v),{[`${y}ShadowColor`]:`0 ${$e(e.controlOutlineWidth)} 0 ${Wl(e[`${y}1`],e.colorBgContainer)}`}),{});return Object.assign(Object.assign({},f),{fontWeight:400,defaultShadow:`0 ${e.controlOutlineWidth}px 0 ${e.controlTmpOutline}`,primaryShadow:`0 ${e.controlOutlineWidth}px 0 ${e.controlOutline}`,dangerShadow:`0 ${e.controlOutlineWidth}px 0 ${e.colorErrorOutline}`,primaryColor:e.colorTextLightSolid,dangerColor:e.colorTextLightSolid,borderColorDisabled:e.colorBorder,defaultGhostColor:e.colorBgContainer,ghostBg:"transparent",defaultGhostBorderColor:e.colorBgContainer,paddingInline:e.paddingContentHorizontal-e.lineWidth,paddingInlineLG:e.paddingContentHorizontal-e.lineWidth,paddingInlineSM:8-e.lineWidth,onlyIconSize:"inherit",onlyIconSizeSM:"inherit",onlyIconSizeLG:"inherit",groupBorderColor:e.colorPrimaryHover,linkHoverBg:"transparent",textTextColor:e.colorText,textTextHoverColor:e.colorText,textTextActiveColor:e.colorText,textHoverBg:e.colorFillTertiary,defaultColor:e.colorText,defaultBg:e.colorBgContainer,defaultBorderColor:e.colorBorder,defaultBorderColorDisabled:e.colorBorder,defaultHoverBg:e.colorBgContainer,defaultHoverColor:e.colorPrimaryHover,defaultHoverBorderColor:e.colorPrimaryHover,defaultActiveBg:e.colorBgContainer,defaultActiveColor:e.colorPrimaryActive,defaultActiveBorderColor:e.colorPrimaryActive,solidTextColor:h,contentFontSize:m,contentFontSizeSM:u,contentFontSizeLG:p,contentLineHeight:s,contentLineHeightSM:c,contentLineHeightLG:d,paddingBlock:Math.max((e.controlHeight-m*s)/2-e.lineWidth,0),paddingBlockSM:Math.max((e.controlHeightSM-u*c)/2-e.lineWidth,0),paddingBlockLG:Math.max((e.controlHeightLG-p*d)/2-e.lineWidth,0)})},jP=e=>{const{componentCls:t,iconCls:n,fontWeight:r,opacityLoading:i,motionDurationSlow:o,motionEaseInOut:l,marginXS:m,calc:u}=e;return{[t]:{outline:"none",position:"relative",display:"inline-flex",gap:e.marginXS,alignItems:"center",justifyContent:"center",fontWeight:r,whiteSpace:"nowrap",textAlign:"center",backgroundImage:"none",background:"transparent",border:`${$e(e.lineWidth)} ${e.lineType} transparent`,cursor:"pointer",transition:`all ${e.motionDurationMid} ${e.motionEaseInOut}`,userSelect:"none",touchAction:"manipulation",color:e.colorText,"&:disabled > *":{pointerEvents:"none"},[`${t}-icon > svg`]:Rc(),"> a":{color:"currentColor"},"&:not(:disabled)":Ha(e),[`&${t}-two-chinese-chars::first-letter`]:{letterSpacing:"0.34em"},[`&${t}-two-chinese-chars > *:not(${n})`]:{marginInlineEnd:"-0.34em",letterSpacing:"0.34em"},[`&${t}-icon-only`]:{paddingInline:0,[`&${t}-compact-item`]:{flex:"none"},[`&${t}-round`]:{width:"auto"}},[`&${t}-loading`]:{opacity:i,cursor:"default"},[`${t}-loading-icon`]:{transition:["width","opacity","margin"].map(p=>`${p} ${o} ${l}`).join(",")},[`&:not(${t}-icon-end)`]:{[`${t}-loading-icon-motion`]:{"&-appear-start, &-enter-start":{marginInlineEnd:u(m).mul(-1).equal()},"&-appear-active, &-enter-active":{marginInlineEnd:0},"&-leave-start":{marginInlineEnd:0},"&-leave-active":{marginInlineEnd:u(m).mul(-1).equal()}}},"&-icon-end":{flexDirection:"row-reverse",[`${t}-loading-icon-motion`]:{"&-appear-start, &-enter-start":{marginInlineStart:u(m).mul(-1).equal()},"&-appear-active, &-enter-active":{marginInlineStart:0},"&-leave-start":{marginInlineStart:0},"&-leave-active":{marginInlineStart:u(m).mul(-1).equal()}}}}}},$x=(e,t,n)=>({[`&:not(:disabled):not(${e}-disabled)`]:{"&:hover":t,"&:active":n}}),BP=e=>({minWidth:e.controlHeight,paddingInlineStart:0,paddingInlineEnd:0,borderRadius:"50%"}),HP=e=>({borderRadius:e.controlHeight,paddingInlineStart:e.calc(e.controlHeight).div(2).equal(),paddingInlineEnd:e.calc(e.controlHeight).div(2).equal()}),WP=e=>({cursor:"not-allowed",borderColor:e.borderColorDisabled,color:e.colorTextDisabled,background:e.colorBgContainerDisabled,boxShadow:"none"}),af=(e,t,n,r,i,o,l,m)=>({[`&${e}-background-ghost`]:Object.assign(Object.assign({color:n||void 0,background:t,borderColor:r||void 0,boxShadow:"none"},$x(e,Object.assign({background:t},l),Object.assign({background:t},m))),{"&:disabled":{cursor:"not-allowed",color:i||void 0,borderColor:o||void 0}})}),VP=e=>({[`&:disabled, &${e.componentCls}-disabled`]:Object.assign({},WP(e))}),UP=e=>({[`&:disabled, &${e.componentCls}-disabled`]:{cursor:"not-allowed",color:e.colorTextDisabled}}),sf=(e,t,n,r)=>{const o=r&&["link","text"].includes(r)?UP:VP;return Object.assign(Object.assign({},o(e)),$x(e.componentCls,t,n))},lf=(e,t,n,r,i)=>({[`&${e.componentCls}-variant-solid`]:Object.assign({color:t,background:n},sf(e,r,i))}),cf=(e,t,n,r,i)=>({[`&${e.componentCls}-variant-outlined, &${e.componentCls}-variant-dashed`]:Object.assign({borderColor:t,background:n},sf(e,r,i))}),uf=e=>({[`&${e.componentCls}-variant-dashed`]:{borderStyle:"dashed"}}),df=(e,t,n,r)=>({[`&${e.componentCls}-variant-filled`]:Object.assign({boxShadow:"none",background:t},sf(e,n,r))}),go=(e,t,n,r,i)=>({[`&${e.componentCls}-variant-${n}`]:Object.assign({color:t,boxShadow:"none"},sf(e,r,i,n))}),GP=e=>{const{componentCls:t}=e;return Ba.reduce((n,r)=>{const i=e[`${r}6`],o=e[`${r}1`],l=e[`${r}5`],m=e[`${r}2`],u=e[`${r}3`],p=e[`${r}7`];return Object.assign(Object.assign({},n),{[`&${t}-color-${r}`]:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({color:i,boxShadow:e[`${r}ShadowColor`]},lf(e,e.colorTextLightSolid,i,{background:l},{background:p})),cf(e,i,e.colorBgContainer,{color:l,borderColor:l,background:e.colorBgContainer},{color:p,borderColor:p,background:e.colorBgContainer})),uf(e)),df(e,o,{background:m},{background:u})),go(e,i,"link",{color:l},{color:p})),go(e,i,"text",{color:l,background:o},{color:p,background:u}))})},{})},KP=e=>Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({color:e.defaultColor,boxShadow:e.defaultShadow},lf(e,e.solidTextColor,e.colorBgSolid,{color:e.solidTextColor,background:e.colorBgSolidHover},{color:e.solidTextColor,background:e.colorBgSolidActive})),uf(e)),df(e,e.colorFillTertiary,{background:e.colorFillSecondary},{background:e.colorFill})),af(e.componentCls,e.ghostBg,e.defaultGhostColor,e.defaultGhostBorderColor,e.colorTextDisabled,e.colorBorder)),go(e,e.textTextColor,"link",{color:e.colorLinkHover,background:e.linkHoverBg},{color:e.colorLinkActive})),YP=e=>Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({color:e.colorPrimary,boxShadow:e.primaryShadow},cf(e,e.colorPrimary,e.colorBgContainer,{color:e.colorPrimaryTextHover,borderColor:e.colorPrimaryHover,background:e.colorBgContainer},{color:e.colorPrimaryTextActive,borderColor:e.colorPrimaryActive,background:e.colorBgContainer})),uf(e)),df(e,e.colorPrimaryBg,{background:e.colorPrimaryBgHover},{background:e.colorPrimaryBorder})),go(e,e.colorPrimaryText,"text",{color:e.colorPrimaryTextHover,background:e.colorPrimaryBg},{color:e.colorPrimaryTextActive,background:e.colorPrimaryBorder})),go(e,e.colorPrimaryText,"link",{color:e.colorPrimaryTextHover,background:e.linkHoverBg},{color:e.colorPrimaryTextActive})),af(e.componentCls,e.ghostBg,e.colorPrimary,e.colorPrimary,e.colorTextDisabled,e.colorBorder,{color:e.colorPrimaryHover,borderColor:e.colorPrimaryHover},{color:e.colorPrimaryActive,borderColor:e.colorPrimaryActive})),XP=e=>Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({color:e.colorError,boxShadow:e.dangerShadow},lf(e,e.dangerColor,e.colorError,{background:e.colorErrorHover},{background:e.colorErrorActive})),cf(e,e.colorError,e.colorBgContainer,{color:e.colorErrorHover,borderColor:e.colorErrorBorderHover},{color:e.colorErrorActive,borderColor:e.colorErrorActive})),uf(e)),df(e,e.colorErrorBg,{background:e.colorErrorBgFilledHover},{background:e.colorErrorBgActive})),go(e,e.colorError,"text",{color:e.colorErrorHover,background:e.colorErrorBg},{color:e.colorErrorHover,background:e.colorErrorBgActive})),go(e,e.colorError,"link",{color:e.colorErrorHover},{color:e.colorErrorActive})),af(e.componentCls,e.ghostBg,e.colorError,e.colorError,e.colorTextDisabled,e.colorBorder,{color:e.colorErrorHover,borderColor:e.colorErrorHover},{color:e.colorErrorActive,borderColor:e.colorErrorActive})),qP=e=>Object.assign(Object.assign({},go(e,e.colorLink,"link",{color:e.colorLinkHover},{color:e.colorLinkActive})),af(e.componentCls,e.ghostBg,e.colorInfo,e.colorInfo,e.colorTextDisabled,e.colorBorder,{color:e.colorInfoHover,borderColor:e.colorInfoHover},{color:e.colorInfoActive,borderColor:e.colorInfoActive})),QP=e=>{const{componentCls:t}=e;return Object.assign({[`${t}-color-default`]:KP(e),[`${t}-color-primary`]:YP(e),[`${t}-color-dangerous`]:XP(e),[`${t}-color-link`]:qP(e)},GP(e))},ZP=e=>Object.assign(Object.assign(Object.assign(Object.assign({},cf(e,e.defaultBorderColor,e.defaultBg,{color:e.defaultHoverColor,borderColor:e.defaultHoverBorderColor,background:e.defaultHoverBg},{color:e.defaultActiveColor,borderColor:e.defaultActiveBorderColor,background:e.defaultActiveBg})),go(e,e.textTextColor,"text",{color:e.textTextHoverColor,background:e.textHoverBg},{color:e.textTextActiveColor,background:e.colorBgTextActive})),lf(e,e.primaryColor,e.colorPrimary,{background:e.colorPrimaryHover,color:e.primaryColor},{background:e.colorPrimaryActive,color:e.primaryColor})),go(e,e.colorLink,"link",{color:e.colorLinkHover,background:e.linkHoverBg},{color:e.colorLinkActive})),xv=(e,t="")=>{const{componentCls:n,controlHeight:r,fontSize:i,borderRadius:o,buttonPaddingHorizontal:l,iconCls:m,buttonPaddingVertical:u,buttonIconOnlyFontSize:p}=e;return[{[t]:{fontSize:i,height:r,padding:`${$e(u)} ${$e(l)}`,borderRadius:o,[`&${n}-icon-only`]:{width:r,[m]:{fontSize:p}}}},{[`${n}${n}-circle${t}`]:BP(e)},{[`${n}${n}-round${t}`]:HP(e)}]},JP=e=>{const t=Sn(e,{fontSize:e.contentFontSize});return xv(t,e.componentCls)},ek=e=>{const t=Sn(e,{controlHeight:e.controlHeightSM,fontSize:e.contentFontSizeSM,padding:e.paddingXS,buttonPaddingHorizontal:e.paddingInlineSM,buttonPaddingVertical:0,borderRadius:e.borderRadiusSM,buttonIconOnlyFontSize:e.onlyIconSizeSM});return xv(t,`${e.componentCls}-sm`)},tk=e=>{const t=Sn(e,{controlHeight:e.controlHeightLG,fontSize:e.contentFontSizeLG,buttonPaddingHorizontal:e.paddingInlineLG,buttonPaddingVertical:0,borderRadius:e.borderRadiusLG,buttonIconOnlyFontSize:e.onlyIconSizeLG});return xv(t,`${e.componentCls}-lg`)},nk=e=>{const{componentCls:t}=e;return{[t]:{[`&${t}-block`]:{width:"100%"}}}},rk=gr("Button",e=>{const t=Sx(e);return[jP(t),JP(t),ek(t),tk(t),nk(t),QP(t),ZP(t),j2(t)]},Cx,{unitless:{fontWeight:!0,contentLineHeight:!0,contentLineHeightSM:!0,contentLineHeightLG:!0}});function ik(e,t,n){const{focusElCls:r,focus:i,borderElCls:o}=n,l=o?"> *":"",m=["hover",i?"focus":null,"active"].filter(Boolean).map(u=>`&:${u} ${l}`).join(",");return{[`&-item:not(${t}-last-item)`]:{marginInlineEnd:e.calc(e.lineWidth).mul(-1).equal()},"&-item":Object.assign(Object.assign({[m]:{zIndex:2}},r?{[`&${r}`]:{zIndex:2}}:{}),{[`&[disabled] ${l}`]:{zIndex:0}})}}function ok(e,t,n){const{borderElCls:r}=n,i=r?`> ${r}`:"";return{[`&-item:not(${t}-first-item):not(${t}-last-item) ${i}`]:{borderRadius:0},[`&-item:not(${t}-last-item)${t}-first-item`]:{[`& ${i}, &${e}-sm ${i}, &${e}-lg ${i}`]:{borderStartEndRadius:0,borderEndEndRadius:0}},[`&-item:not(${t}-first-item)${t}-last-item`]:{[`& ${i}, &${e}-sm ${i}, &${e}-lg ${i}`]:{borderStartStartRadius:0,borderEndStartRadius:0}}}}function Ev(e,t={focus:!0}){const{componentCls:n}=e,r=`${n}-compact`;return{[r]:Object.assign(Object.assign({},ik(e,r,t)),ok(n,r,t))}}function ak(e,t){return{[`&-item:not(${t}-last-item)`]:{marginBottom:e.calc(e.lineWidth).mul(-1).equal()},"&-item":{"&:hover,&:focus,&:active":{zIndex:2},"&[disabled]":{zIndex:0}}}}function sk(e,t){return{[`&-item:not(${t}-first-item):not(${t}-last-item)`]:{borderRadius:0},[`&-item${t}-first-item:not(${t}-last-item)`]:{[`&, &${e}-sm, &${e}-lg`]:{borderEndEndRadius:0,borderEndStartRadius:0}},[`&-item${t}-last-item:not(${t}-first-item)`]:{[`&, &${e}-sm, &${e}-lg`]:{borderStartStartRadius:0,borderStartEndRadius:0}}}}function lk(e){const t=`${e.componentCls}-compact-vertical`;return{[t]:Object.assign(Object.assign({},ak(e,t)),sk(e.componentCls,t))}}const ck=e=>{const{componentCls:t,colorPrimaryHover:n,lineWidth:r,calc:i}=e,o=i(r).mul(-1).equal(),l=m=>{const u=`${t}-compact${m?"-vertical":""}-item${t}-primary:not([disabled])`;return{[`${u} + ${u}::before`]:{position:"absolute",top:m?o:0,insetInlineStart:m?0:o,backgroundColor:n,content:'""',width:m?"100%":r,height:m?r:"100%"}}};return Object.assign(Object.assign({},l()),l(!0))},uk=hv(["Button","compact"],e=>{const t=Sx(e);return[Ev(t),lk(t),ck(t)]},Cx);var dk=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i{var n,r;const{loading:i=!1,prefixCls:o,color:l,variant:m,type:u,danger:p=!1,shape:s="default",size:c,styles:d,disabled:h,className:f,rootClassName:v,children:y,icon:b,iconPosition:w="start",ghost:x=!1,block:E=!1,htmlType:_="button",classNames:$,style:O={},autoInsertSpace:N,autoFocus:k}=e,L=dk(e,["loading","prefixCls","color","variant","type","danger","shape","size","styles","disabled","className","rootClassName","children","icon","iconPosition","ghost","block","htmlType","classNames","style","autoInsertSpace","autoFocus"]),F=u||"default",{button:P}=be.useContext(zt),[A,M]=C.useMemo(()=>{if(l&&m)return[l,m];if(u||p){const te=hk[F]||[];return p?["danger",te[1]]:te}return P!=null&&P.color&&(P!=null&&P.variant)?[P.color,P.variant]:["default","outlined"]},[u,l,m,p,P==null?void 0:P.variant,P==null?void 0:P.color]),I=A==="danger"?"dangerous":A,{getPrefixCls:D,direction:j,autoInsertSpace:B,className:V,style:H,classNames:Y,styles:U}=Ji("button"),K=(n=N??B)!==null&&n!==void 0?n:!0,G=D("btn",o),[q,Z,Q]=rk(G),J=C.useContext(Ro),ie=h??J,se=C.useContext(ux),ae=C.useMemo(()=>fk(i),[i]),[ge,me]=C.useState(ae.loading),[de,we]=C.useState(!1),Oe=C.useRef(null),xe=Ga(t,Oe),Pe=C.Children.count(y)===1&&!b&&!Ap(M),ze=C.useRef(!0);be.useEffect(()=>(ze.current=!1,()=>{ze.current=!0}),[]),C.useEffect(()=>{let te=null;ae.delay>0?te=setTimeout(()=>{te=null,me(!0)},ae.delay):me(ae.loading);function fe(){te&&(clearTimeout(te),te=null)}return fe},[ae]),C.useEffect(()=>{if(!Oe.current||!K)return;const te=Oe.current.textContent||"";Pe&&sm(te)?de||we(!0):de&&we(!1)}),C.useEffect(()=>{k&&Oe.current&&Oe.current.focus()},[]);const Ie=be.useCallback(te=>{var fe;if(ge||ie){te.preventDefault();return}(fe=e.onClick)===null||fe===void 0||fe.call(e,("href"in e,te))},[e.onClick,ge,ie]),{compactSize:Ye,compactItemClassnames:Me}=Lc(G,j),ke={large:"lg",small:"sm",middle:void 0},Je=to(te=>{var fe,je;return(je=(fe=c??Ye)!==null&&fe!==void 0?fe:se)!==null&&je!==void 0?je:te}),ce=Je&&(r=ke[Je])!==null&&r!==void 0?r:"",Ee=ge?"loading":b,Re=Er(L,["navigate"]),Ae=ve(G,Z,Q,{[`${G}-${s}`]:s!=="default"&&s,[`${G}-${F}`]:F,[`${G}-dangerous`]:p,[`${G}-color-${I}`]:I,[`${G}-variant-${M}`]:M,[`${G}-${ce}`]:ce,[`${G}-icon-only`]:!y&&y!==0&&!!Ee,[`${G}-background-ghost`]:x&&!Ap(M),[`${G}-loading`]:ge,[`${G}-two-chinese-chars`]:de&&K&&!ge,[`${G}-block`]:E,[`${G}-rtl`]:j==="rtl",[`${G}-icon-end`]:w==="end"},Me,f,v,V),De=Object.assign(Object.assign({},H),O),He=ve($==null?void 0:$.icon,Y.icon),it=Object.assign(Object.assign({},(d==null?void 0:d.icon)||{}),U.icon||{}),Ne=b&&!ge?be.createElement(lm,{prefixCls:G,className:He,style:it},b):i&&typeof i=="object"&&i.icon?be.createElement(lm,{prefixCls:G,className:He,style:it},i.icon):be.createElement(z2,{existIcon:!!b,prefixCls:G,loading:ge,mount:ze.current}),Te=y||y===0?F2(y,Pe&&K):null;if(Re.href!==void 0)return q(be.createElement("a",Object.assign({},Re,{className:ve(Ae,{[`${G}-disabled`]:ie}),href:ie?void 0:Re.href,style:De,onClick:Ie,ref:xe,tabIndex:ie?-1:0}),Ne,Te));let We=be.createElement("button",Object.assign({},L,{type:_,className:Ae,style:De,onClick:Ie,disabled:ie,ref:xe}),Ne,Te,Me&&be.createElement(uk,{prefixCls:G}));return Ap(M)||(We=be.createElement(R2,{component:"Button",disabled:ge},We)),q(We)}),Pc=pk;Pc.Group=N2;Pc.__ANT_BUTTON=!0;var xx=C.createContext(null),Bw=[];function gk(e,t){var n=C.useState(function(){if(!qr())return null;var f=document.createElement("div");return f}),r=pe(n,1),i=r[0],o=C.useRef(!1),l=C.useContext(xx),m=C.useState(Bw),u=pe(m,2),p=u[0],s=u[1],c=l||(o.current?void 0:function(f){s(function(v){var y=[f].concat(Ge(v));return y})});function d(){i.parentElement||document.body.appendChild(i),o.current=!0}function h(){var f;(f=i.parentElement)===null||f===void 0||f.removeChild(i),o.current=!1}return fn(function(){return e?l?l(d):d():h(),h},[e]),fn(function(){p.length&&(p.forEach(function(f){return f()}),s(Bw))},[p]),[i,c]}function mk(e){var t="rc-scrollbar-measure-".concat(Math.random().toString(36).substring(7)),n=document.createElement("div");n.id=t;var r=n.style;r.position="absolute",r.left="0",r.top="0",r.width="100px",r.height="100px",r.overflow="scroll";var i,o;if(e){var l=getComputedStyle(e);r.scrollbarColor=l.scrollbarColor,r.scrollbarWidth=l.scrollbarWidth;var m=getComputedStyle(e,"::-webkit-scrollbar"),u=parseInt(m.width,10),p=parseInt(m.height,10);try{var s=u?"width: ".concat(m.width,";"):"",c=p?"height: ".concat(m.height,";"):"";Mo(` +#`.concat(t,`::-webkit-scrollbar { +`).concat(s,` +`).concat(c,` +}`),t)}catch(f){console.error(f),i=u,o=p}}document.body.appendChild(n);var d=e&&i&&!isNaN(i)?i:n.offsetWidth-n.clientWidth,h=e&&o&&!isNaN(o)?o:n.offsetHeight-n.clientHeight;return document.body.removeChild(n),sc(t),{width:d,height:h}}function vk(e){return typeof document>"u"||!e||!(e instanceof Element)?{width:0,height:0}:mk(e)}function yk(){return document.body.scrollHeight>(window.innerHeight||document.documentElement.clientHeight)&&window.innerWidth>document.body.offsetWidth}var bk="rc-util-locker-".concat(Date.now()),Hw=0;function wk(e){var t=!!e,n=C.useState(function(){return Hw+=1,"".concat(bk,"_").concat(Hw)}),r=pe(n,1),i=r[0];fn(function(){if(t){var o=vk(document.body).width,l=yk();Mo(` +html body { + overflow-y: hidden; + `.concat(l?"width: calc(100% - ".concat(o,"px);"):"",` +}`),i)}else sc(i);return function(){sc(i)}},[t,i])}var Sk=!1;function Ck(e){return Sk}var Ww=function(t){return t===!1?!1:!qr()||!t?null:typeof t=="string"?document.querySelector(t):typeof t=="function"?t():t},Ex=C.forwardRef(function(e,t){var n=e.open,r=e.autoLock,i=e.getContainer;e.debug;var o=e.autoDestroy,l=o===void 0?!0:o,m=e.children,u=C.useState(n),p=pe(u,2),s=p[0],c=p[1],d=s||n;C.useEffect(function(){(l||n)&&c(n)},[n,l]);var h=C.useState(function(){return Ww(i)}),f=pe(h,2),v=f[0],y=f[1];C.useEffect(function(){var F=Ww(i);y(F??null)});var b=gk(d&&!v),w=pe(b,2),x=w[0],E=w[1],_=v??x;wk(r&&n&&qr()&&(_===x||_===document.body));var $=null;if(m&&fa(m)&&t){var O=m;$=O.ref}var N=Ga($,t);if(!d||!qr()||v===void 0)return null;var k=_===!1||Ck(),L=m;return t&&(L=C.cloneElement(m,{ref:N})),C.createElement(xx.Provider,{value:E},k?L:da.createPortal(L,_))});function $k(){var e=oe({},Wd);return e.useId}var Vw=0,Uw=$k();const _x=Uw?function(t){var n=Uw();return t||n}:function(t){var n=C.useState("ssr-id"),r=pe(n,2),i=r[0],o=r[1];return C.useEffect(function(){var l=Vw;Vw+=1,o("rc_unique_".concat(l))},[]),t||i};var La="RC_FORM_INTERNAL_HOOKS",xn=function(){Lr(!1,"Can not find FormContext. Please make sure you wrap Field under Form.")},Va=C.createContext({getFieldValue:xn,getFieldsValue:xn,getFieldError:xn,getFieldWarning:xn,getFieldsError:xn,isFieldsTouched:xn,isFieldTouched:xn,isFieldValidating:xn,isFieldsValidating:xn,resetFields:xn,setFields:xn,setFieldValue:xn,setFieldsValue:xn,validateFields:xn,submit:xn,getInternalHooks:function(){return xn(),{dispatch:xn,initEntityValue:xn,registerField:xn,useSubscribe:xn,setInitialValues:xn,destroyForm:xn,setCallbacks:xn,registerWatch:xn,getFields:xn,setValidateMessages:xn,setPreserve:xn,getInitialValue:xn}}}),pc=C.createContext(null);function cm(e){return e==null?[]:Array.isArray(e)?e:[e]}function xk(e){return e&&!!e._init}function um(){return{default:"Validation error on field %s",required:"%s is required",enum:"%s must be one of %s",whitespace:"%s cannot be empty",date:{format:"%s date %s is invalid for format %s",parse:"%s date could not be parsed, %s is invalid ",invalid:"%s date %s is invalid"},types:{string:"%s is not a %s",method:"%s is not a %s (function)",array:"%s is not an %s",object:"%s is not an %s",number:"%s is not a %s",date:"%s is not a %s",boolean:"%s is not a %s",integer:"%s is not an %s",float:"%s is not a %s",regexp:"%s is not a valid %s",email:"%s is not a valid %s",url:"%s is not a valid %s",hex:"%s is not a valid %s"},string:{len:"%s must be exactly %s characters",min:"%s must be at least %s characters",max:"%s cannot be longer than %s characters",range:"%s must be between %s and %s characters"},number:{len:"%s must equal %s",min:"%s cannot be less than %s",max:"%s cannot be greater than %s",range:"%s must be between %s and %s"},array:{len:"%s must be exactly %s in length",min:"%s cannot be less than %s in length",max:"%s cannot be greater than %s in length",range:"%s must be between %s and %s in length"},pattern:{mismatch:"%s value %s does not match pattern %s"},clone:function(){var t=JSON.parse(JSON.stringify(this));return t.clone=this.clone,t}}}var dm=um();function Ek(e){try{return Function.toString.call(e).indexOf("[native code]")!==-1}catch{return typeof e=="function"}}function _k(e,t,n){if(nv())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,t);var i=new(e.bind.apply(e,r));return n&&ic(i,n.prototype),i}function fm(e){var t=typeof Map=="function"?new Map:void 0;return fm=function(r){if(r===null||!Ek(r))return r;if(typeof r!="function")throw new TypeError("Super expression must either be null or a function");if(t!==void 0){if(t.has(r))return t.get(r);t.set(r,i)}function i(){return _k(r,arguments,oc(this).constructor)}return i.prototype=Object.create(r.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),ic(i,r)},fm(e)}var Mk=/%[sdj%]/g,Rk=function(){};function hm(e){if(!e||!e.length)return null;var t={};return e.forEach(function(n){var r=n.field;t[r]=t[r]||[],t[r].push(n)}),t}function yi(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r=o)return m;switch(m){case"%s":return String(n[i++]);case"%d":return Number(n[i++]);case"%j":try{return JSON.stringify(n[i++])}catch{return"[Circular]"}break;default:return m}});return l}return e}function Ok(e){return e==="string"||e==="url"||e==="hex"||e==="email"||e==="date"||e==="pattern"}function pr(e,t){return!!(e==null||t==="array"&&Array.isArray(e)&&!e.length||Ok(t)&&typeof e=="string"&&!e)}function Ak(e,t,n){var r=[],i=0,o=e.length;function l(m){r.push.apply(r,Ge(m||[])),i++,i===o&&n(r)}e.forEach(function(m){t(m,l)})}function Gw(e,t,n){var r=0,i=e.length;function o(l){if(l&&l.length){n(l);return}var m=r;r=r+1,mt.max?i.push(yi(o.messages[c].max,t.fullField,t.max)):m&&u&&(st.max)&&i.push(yi(o.messages[c].range,t.fullField,t.min,t.max))},Mx=function(t,n,r,i,o,l){t.required&&(!r.hasOwnProperty(t.field)||pr(n,l||t.type))&&i.push(yi(o.messages.required,t.fullField))},Ku;const Fk=function(){if(Ku)return Ku;var e="[a-fA-F\\d:]",t=function($){return $&&$.includeBoundaries?"(?:(?<=\\s|^)(?=".concat(e,")|(?<=").concat(e,")(?=\\s|$))"):""},n="(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}",r="[a-fA-F\\d]{1,4}",i=["(?:".concat(r,":){7}(?:").concat(r,"|:)"),"(?:".concat(r,":){6}(?:").concat(n,"|:").concat(r,"|:)"),"(?:".concat(r,":){5}(?::").concat(n,"|(?::").concat(r,"){1,2}|:)"),"(?:".concat(r,":){4}(?:(?::").concat(r,"){0,1}:").concat(n,"|(?::").concat(r,"){1,3}|:)"),"(?:".concat(r,":){3}(?:(?::").concat(r,"){0,2}:").concat(n,"|(?::").concat(r,"){1,4}|:)"),"(?:".concat(r,":){2}(?:(?::").concat(r,"){0,3}:").concat(n,"|(?::").concat(r,"){1,5}|:)"),"(?:".concat(r,":){1}(?:(?::").concat(r,"){0,4}:").concat(n,"|(?::").concat(r,"){1,6}|:)"),"(?::(?:(?::".concat(r,"){0,5}:").concat(n,"|(?::").concat(r,"){1,7}|:))")],o="(?:%[0-9a-zA-Z]{1,})?",l="(?:".concat(i.join("|"),")").concat(o),m=new RegExp("(?:^".concat(n,"$)|(?:^").concat(l,"$)")),u=new RegExp("^".concat(n,"$")),p=new RegExp("^".concat(l,"$")),s=function($){return $&&$.exact?m:new RegExp("(?:".concat(t($)).concat(n).concat(t($),")|(?:").concat(t($)).concat(l).concat(t($),")"),"g")};s.v4=function(_){return _&&_.exact?u:new RegExp("".concat(t(_)).concat(n).concat(t(_)),"g")},s.v6=function(_){return _&&_.exact?p:new RegExp("".concat(t(_)).concat(l).concat(t(_)),"g")};var c="(?:(?:[a-z]+:)?//)",d="(?:\\S+(?::\\S*)?@)?",h=s.v4().source,f=s.v6().source,v="(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)",y="(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*",b="(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))",w="(?::\\d{2,5})?",x='(?:[/?#][^\\s"]*)?',E="(?:".concat(c,"|www\\.)").concat(d,"(?:localhost|").concat(h,"|").concat(f,"|").concat(v).concat(y).concat(b,")").concat(w).concat(x);return Ku=new RegExp("(?:^".concat(E,"$)"),"i"),Ku};var qw={email:/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+\.)+[a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}))$/,hex:/^#?([a-f0-9]{6}|[a-f0-9]{3})$/i},Vl={integer:function(t){return Vl.number(t)&&parseInt(t,10)===t},float:function(t){return Vl.number(t)&&!Vl.integer(t)},array:function(t){return Array.isArray(t)},regexp:function(t){if(t instanceof RegExp)return!0;try{return!!new RegExp(t)}catch{return!1}},date:function(t){return typeof t.getTime=="function"&&typeof t.getMonth=="function"&&typeof t.getYear=="function"&&!isNaN(t.getTime())},number:function(t){return isNaN(t)?!1:typeof t=="number"},object:function(t){return wt(t)==="object"&&!Vl.array(t)},method:function(t){return typeof t=="function"},email:function(t){return typeof t=="string"&&t.length<=320&&!!t.match(qw.email)},url:function(t){return typeof t=="string"&&t.length<=2048&&!!t.match(Fk())},hex:function(t){return typeof t=="string"&&!!t.match(qw.hex)}},zk=function(t,n,r,i,o){if(t.required&&n===void 0){Mx(t,n,r,i,o);return}var l=["integer","float","array","regexp","object","method","email","number","date","url","hex"],m=t.type;l.indexOf(m)>-1?Vl[m](n)||i.push(yi(o.messages.types[m],t.fullField,t.type)):m&&wt(n)!==t.type&&i.push(yi(o.messages.types[m],t.fullField,t.type))},jk=function(t,n,r,i,o){(/^\s+$/.test(n)||n==="")&&i.push(yi(o.messages.whitespace,t.fullField))};const tn={required:Mx,whitespace:jk,type:zk,range:Dk,enum:kk,pattern:Nk};var Bk=function(t,n,r,i,o){var l=[],m=t.required||!t.required&&i.hasOwnProperty(t.field);if(m){if(pr(n)&&!t.required)return r();tn.required(t,n,i,l,o)}r(l)},Hk=function(t,n,r,i,o){var l=[],m=t.required||!t.required&&i.hasOwnProperty(t.field);if(m){if(n==null&&!t.required)return r();tn.required(t,n,i,l,o,"array"),n!=null&&(tn.type(t,n,i,l,o),tn.range(t,n,i,l,o))}r(l)},Wk=function(t,n,r,i,o){var l=[],m=t.required||!t.required&&i.hasOwnProperty(t.field);if(m){if(pr(n)&&!t.required)return r();tn.required(t,n,i,l,o),n!==void 0&&tn.type(t,n,i,l,o)}r(l)},Vk=function(t,n,r,i,o){var l=[],m=t.required||!t.required&&i.hasOwnProperty(t.field);if(m){if(pr(n,"date")&&!t.required)return r();if(tn.required(t,n,i,l,o),!pr(n,"date")){var u;n instanceof Date?u=n:u=new Date(n),tn.type(t,u,i,l,o),u&&tn.range(t,u.getTime(),i,l,o)}}r(l)},Uk="enum",Gk=function(t,n,r,i,o){var l=[],m=t.required||!t.required&&i.hasOwnProperty(t.field);if(m){if(pr(n)&&!t.required)return r();tn.required(t,n,i,l,o),n!==void 0&&tn[Uk](t,n,i,l,o)}r(l)},Kk=function(t,n,r,i,o){var l=[],m=t.required||!t.required&&i.hasOwnProperty(t.field);if(m){if(pr(n)&&!t.required)return r();tn.required(t,n,i,l,o),n!==void 0&&(tn.type(t,n,i,l,o),tn.range(t,n,i,l,o))}r(l)},Yk=function(t,n,r,i,o){var l=[],m=t.required||!t.required&&i.hasOwnProperty(t.field);if(m){if(pr(n)&&!t.required)return r();tn.required(t,n,i,l,o),n!==void 0&&(tn.type(t,n,i,l,o),tn.range(t,n,i,l,o))}r(l)},Xk=function(t,n,r,i,o){var l=[],m=t.required||!t.required&&i.hasOwnProperty(t.field);if(m){if(pr(n)&&!t.required)return r();tn.required(t,n,i,l,o),n!==void 0&&tn.type(t,n,i,l,o)}r(l)},qk=function(t,n,r,i,o){var l=[],m=t.required||!t.required&&i.hasOwnProperty(t.field);if(m){if(n===""&&(n=void 0),pr(n)&&!t.required)return r();tn.required(t,n,i,l,o),n!==void 0&&(tn.type(t,n,i,l,o),tn.range(t,n,i,l,o))}r(l)},Qk=function(t,n,r,i,o){var l=[],m=t.required||!t.required&&i.hasOwnProperty(t.field);if(m){if(pr(n)&&!t.required)return r();tn.required(t,n,i,l,o),n!==void 0&&tn.type(t,n,i,l,o)}r(l)},Zk=function(t,n,r,i,o){var l=[],m=t.required||!t.required&&i.hasOwnProperty(t.field);if(m){if(pr(n,"string")&&!t.required)return r();tn.required(t,n,i,l,o),pr(n,"string")||tn.pattern(t,n,i,l,o)}r(l)},Jk=function(t,n,r,i,o){var l=[],m=t.required||!t.required&&i.hasOwnProperty(t.field);if(m){if(pr(n)&&!t.required)return r();tn.required(t,n,i,l,o),pr(n)||tn.type(t,n,i,l,o)}r(l)},eN=function(t,n,r,i,o){var l=[],m=Array.isArray(n)?"array":wt(n);tn.required(t,n,i,l,o,m),r(l)},tN=function(t,n,r,i,o){var l=[],m=t.required||!t.required&&i.hasOwnProperty(t.field);if(m){if(pr(n,"string")&&!t.required)return r();tn.required(t,n,i,l,o,"string"),pr(n,"string")||(tn.type(t,n,i,l,o),tn.range(t,n,i,l,o),tn.pattern(t,n,i,l,o),t.whitespace===!0&&tn.whitespace(t,n,i,l,o))}r(l)},kp=function(t,n,r,i,o){var l=t.type,m=[],u=t.required||!t.required&&i.hasOwnProperty(t.field);if(u){if(pr(n,l)&&!t.required)return r();tn.required(t,n,i,m,o,l),pr(n,l)||tn.type(t,n,i,m,o)}r(m)};const ql={string:tN,method:Xk,number:qk,boolean:Wk,regexp:Jk,integer:Yk,float:Kk,array:Hk,object:Qk,enum:Gk,pattern:Zk,date:Vk,url:kp,hex:kp,email:kp,required:eN,any:Bk};var kc=function(){function e(t){cr(this,e),ne(this,"rules",null),ne(this,"_messages",dm),this.define(t)}return ur(e,[{key:"define",value:function(n){var r=this;if(!n)throw new Error("Cannot configure a schema with no rules");if(wt(n)!=="object"||Array.isArray(n))throw new Error("Rules must be an object");this.rules={},Object.keys(n).forEach(function(i){var o=n[i];r.rules[i]=Array.isArray(o)?o:[o]})}},{key:"messages",value:function(n){return n&&(this._messages=Xw(um(),n)),this._messages}},{key:"validate",value:function(n){var r=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:function(){},l=n,m=i,u=o;if(typeof m=="function"&&(u=m,m={}),!this.rules||Object.keys(this.rules).length===0)return u&&u(null,l),Promise.resolve(l);function p(f){var v=[],y={};function b(x){if(Array.isArray(x)){var E;v=(E=v).concat.apply(E,Ge(x))}else v.push(x)}for(var w=0;w0&&arguments[0]!==void 0?arguments[0]:[],N=Array.isArray(O)?O:[O];!m.suppressWarning&&N.length&&e.warning("async-validator:",N),N.length&&y.message!==void 0&&(N=[].concat(y.message));var k=N.map(Yw(y,l));if(m.first&&k.length)return h[y.field]=1,v(k);if(!b)v(k);else{if(y.required&&!f.value)return y.message!==void 0?k=[].concat(y.message).map(Yw(y,l)):m.error&&(k=[m.error(y,yi(m.messages.required,y.field))]),v(k);var L={};y.defaultField&&Object.keys(f.value).map(function(A){L[A]=y.defaultField}),L=oe(oe({},L),f.rule.fields);var F={};Object.keys(L).forEach(function(A){var M=L[A],R=Array.isArray(M)?M:[M];F[A]=R.map(w.bind(null,A))});var P=new e(F);P.messages(m.messages),f.rule.options&&(f.rule.options.messages=m.messages,f.rule.options.error=m.error),P.validate(f.value,f.rule.options||m,function(A){var M=[];k&&k.length&&M.push.apply(M,Ge(k)),A&&A.length&&M.push.apply(M,Ge(A)),v(M.length?M:null)})}}var E;if(y.asyncValidator)E=y.asyncValidator(y,f.value,x,f.source,m);else if(y.validator){try{E=y.validator(y,f.value,x,f.source,m)}catch(O){var _,$;(_=($=console).error)===null||_===void 0||_.call($,O),m.suppressValidatorError||setTimeout(function(){throw O},0),x(O.message)}E===!0?x():E===!1?x(typeof y.message=="function"?y.message(y.fullField||y.field):y.message||"".concat(y.fullField||y.field," fails")):E instanceof Array?x(E):E instanceof Error&&x(E.message)}E&&E.then&&E.then(function(){return x()},function(O){return x(O)})},function(f){p(f)},l)}},{key:"getType",value:function(n){if(n.type===void 0&&n.pattern instanceof RegExp&&(n.type="pattern"),typeof n.validator!="function"&&n.type&&!ql.hasOwnProperty(n.type))throw new Error(yi("Unknown rule type %s",n.type));return n.type||"string"}},{key:"getValidationMethod",value:function(n){if(typeof n.validator=="function")return n.validator;var r=Object.keys(n),i=r.indexOf("message");return i!==-1&&r.splice(i,1),r.length===1&&r[0]==="required"?ql.required:ql[this.getType(n)]||void 0}}]),e}();ne(kc,"register",function(t,n){if(typeof n!="function")throw new Error("Cannot register a validator by type, validator is not a function");ql[t]=n});ne(kc,"warning",Rk);ne(kc,"messages",dm);ne(kc,"validators",ql);var gi="'${name}' is not a valid ${type}",Rx={default:"Validation error on field '${name}'",required:"'${name}' is required",enum:"'${name}' must be one of [${enum}]",whitespace:"'${name}' cannot be empty",date:{format:"'${name}' is invalid for format date",parse:"'${name}' could not be parsed as date",invalid:"'${name}' is invalid date"},types:{string:gi,method:gi,array:gi,object:gi,number:gi,date:gi,boolean:gi,integer:gi,float:gi,regexp:gi,email:gi,url:gi,hex:gi},string:{len:"'${name}' must be exactly ${len} characters",min:"'${name}' must be at least ${min} characters",max:"'${name}' cannot be longer than ${max} characters",range:"'${name}' must be between ${min} and ${max} characters"},number:{len:"'${name}' must equal ${len}",min:"'${name}' cannot be less than ${min}",max:"'${name}' cannot be greater than ${max}",range:"'${name}' must be between ${min} and ${max}"},array:{len:"'${name}' must be exactly ${len} in length",min:"'${name}' cannot be less than ${min} in length",max:"'${name}' cannot be greater than ${max} in length",range:"'${name}' must be between ${min} and ${max} in length"},pattern:{mismatch:"'${name}' does not match pattern ${pattern}"}},Qw=kc;function nN(e,t){return e.replace(/\\?\$\{\w+\}/g,function(n){if(n.startsWith("\\"))return n.slice(1);var r=n.slice(2,-1);return t[r]})}var Zw="CODE_LOGIC_ERROR";function pm(e,t,n,r,i){return gm.apply(this,arguments)}function gm(){return gm=Ya(Qr().mark(function e(t,n,r,i,o){var l,m,u,p,s,c,d,h,f;return Qr().wrap(function(y){for(;;)switch(y.prev=y.next){case 0:return l=oe({},r),delete l.ruleIndex,Qw.warning=function(){},l.validator&&(m=l.validator,l.validator=function(){try{return m.apply(void 0,arguments)}catch(b){return console.error(b),Promise.reject(Zw)}}),u=null,l&&l.type==="array"&&l.defaultField&&(u=l.defaultField,delete l.defaultField),p=new Qw(ne({},t,[l])),s=Ts(Rx,i.validateMessages),p.messages(s),c=[],y.prev=10,y.next=13,Promise.resolve(p.validate(ne({},t,n),oe({},i)));case 13:y.next=18;break;case 15:y.prev=15,y.t0=y.catch(10),y.t0.errors&&(c=y.t0.errors.map(function(b,w){var x=b.message,E=x===Zw?s.default:x;return C.isValidElement(E)?C.cloneElement(E,{key:"error_".concat(w)}):E}));case 18:if(!(!c.length&&u)){y.next=23;break}return y.next=21,Promise.all(n.map(function(b,w){return pm("".concat(t,".").concat(w),b,u,i,o)}));case 21:return d=y.sent,y.abrupt("return",d.reduce(function(b,w){return[].concat(Ge(b),Ge(w))},[]));case 23:return h=oe(oe({},r),{},{name:t,enum:(r.enum||[]).join(", ")},o),f=c.map(function(b){return typeof b=="string"?nN(b,h):b}),y.abrupt("return",f);case 26:case"end":return y.stop()}},e,null,[[10,15]])})),gm.apply(this,arguments)}function rN(e,t,n,r,i,o){var l=e.join("."),m=n.map(function(s,c){var d=s.validator,h=oe(oe({},s),{},{ruleIndex:c});return d&&(h.validator=function(f,v,y){var b=!1,w=function(){for(var _=arguments.length,$=new Array(_),O=0;O<_;O++)$[O]=arguments[O];Promise.resolve().then(function(){Lr(!b,"Your validator function has already return a promise. `callback` will be ignored."),b||y.apply(void 0,$)})},x=d(f,v,w);b=x&&typeof x.then=="function"&&typeof x.catch=="function",Lr(b,"`callback` is deprecated. Please return a promise instead."),b&&x.then(function(){y()}).catch(function(E){y(E||" ")})}),h}).sort(function(s,c){var d=s.warningOnly,h=s.ruleIndex,f=c.warningOnly,v=c.ruleIndex;return!!d==!!f?h-v:d?1:-1}),u;if(i===!0)u=new Promise(function(){var s=Ya(Qr().mark(function c(d,h){var f,v,y;return Qr().wrap(function(w){for(;;)switch(w.prev=w.next){case 0:f=0;case 1:if(!(f2&&arguments[2]!==void 0?arguments[2]:!1;return e&&e.some(function(r){return Ox(t,r,n)})}function Ox(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return!e||!t||!n&&e.length!==t.length?!1:t.every(function(r,i){return e[i]===r})}function aN(e,t){if(e===t)return!0;if(!e&&t||e&&!t||!e||!t||wt(e)!=="object"||wt(t)!=="object")return!1;var n=Object.keys(e),r=Object.keys(t),i=new Set([].concat(n,r));return Ge(i).every(function(o){var l=e[o],m=t[o];return typeof l=="function"&&typeof m=="function"?!0:l===m})}function sN(e){var t=arguments.length<=1?void 0:arguments[1];return t&&t.target&&wt(t.target)==="object"&&e in t.target?t.target[e]:t}function eS(e,t,n){var r=e.length;if(t<0||t>=r||n<0||n>=r)return e;var i=e[t],o=t-n;return o>0?[].concat(Ge(e.slice(0,n)),[i],Ge(e.slice(n,t)),Ge(e.slice(t+1,r))):o<0?[].concat(Ge(e.slice(0,t)),Ge(e.slice(t+1,n+1)),[i],Ge(e.slice(n+1,r))):e}var lN=["name"],Ai=[];function Np(e,t,n,r,i,o){return typeof e=="function"?e(t,n,"source"in o?{source:o.source}:{}):r!==i}var _v=function(e){To(n,e);var t=Io(n);function n(r){var i;if(cr(this,n),i=t.call(this,r),ne(Ut(i),"state",{resetCount:0}),ne(Ut(i),"cancelRegisterFunc",null),ne(Ut(i),"mounted",!1),ne(Ut(i),"touched",!1),ne(Ut(i),"dirty",!1),ne(Ut(i),"validatePromise",void 0),ne(Ut(i),"prevValidating",void 0),ne(Ut(i),"errors",Ai),ne(Ut(i),"warnings",Ai),ne(Ut(i),"cancelRegister",function(){var u=i.props,p=u.preserve,s=u.isListField,c=u.name;i.cancelRegisterFunc&&i.cancelRegisterFunc(s,p,er(c)),i.cancelRegisterFunc=null}),ne(Ut(i),"getNamePath",function(){var u=i.props,p=u.name,s=u.fieldContext,c=s.prefixName,d=c===void 0?[]:c;return p!==void 0?[].concat(Ge(d),Ge(p)):[]}),ne(Ut(i),"getRules",function(){var u=i.props,p=u.rules,s=p===void 0?[]:p,c=u.fieldContext;return s.map(function(d){return typeof d=="function"?d(c):d})}),ne(Ut(i),"refresh",function(){i.mounted&&i.setState(function(u){var p=u.resetCount;return{resetCount:p+1}})}),ne(Ut(i),"metaCache",null),ne(Ut(i),"triggerMetaEvent",function(u){var p=i.props.onMetaChange;if(p){var s=oe(oe({},i.getMeta()),{},{destroy:u});lc(i.metaCache,s)||p(s),i.metaCache=s}else i.metaCache=null}),ne(Ut(i),"onStoreChange",function(u,p,s){var c=i.props,d=c.shouldUpdate,h=c.dependencies,f=h===void 0?[]:h,v=c.onReset,y=s.store,b=i.getNamePath(),w=i.getValue(u),x=i.getValue(y),E=p&&Ns(p,b);switch(s.type==="valueUpdate"&&s.source==="external"&&!lc(w,x)&&(i.touched=!0,i.dirty=!0,i.validatePromise=null,i.errors=Ai,i.warnings=Ai,i.triggerMetaEvent()),s.type){case"reset":if(!p||E){i.touched=!1,i.dirty=!1,i.validatePromise=void 0,i.errors=Ai,i.warnings=Ai,i.triggerMetaEvent(),v==null||v(),i.refresh();return}break;case"remove":{if(d&&Np(d,u,y,w,x,s)){i.reRender();return}break}case"setField":{var _=s.data;if(E){"touched"in _&&(i.touched=_.touched),"validating"in _&&!("originRCField"in _)&&(i.validatePromise=_.validating?Promise.resolve([]):null),"errors"in _&&(i.errors=_.errors||Ai),"warnings"in _&&(i.warnings=_.warnings||Ai),i.dirty=!0,i.triggerMetaEvent(),i.reRender();return}else if("value"in _&&Ns(p,b,!0)){i.reRender();return}if(d&&!b.length&&Np(d,u,y,w,x,s)){i.reRender();return}break}case"dependenciesUpdate":{var $=f.map(er);if($.some(function(O){return Ns(s.relatedFields,O)})){i.reRender();return}break}default:if(E||(!f.length||b.length||d)&&Np(d,u,y,w,x,s)){i.reRender();return}break}d===!0&&i.reRender()}),ne(Ut(i),"validateRules",function(u){var p=i.getNamePath(),s=i.getValue(),c=u||{},d=c.triggerName,h=c.validateOnly,f=h===void 0?!1:h,v=Promise.resolve().then(Ya(Qr().mark(function y(){var b,w,x,E,_,$,O;return Qr().wrap(function(k){for(;;)switch(k.prev=k.next){case 0:if(i.mounted){k.next=2;break}return k.abrupt("return",[]);case 2:if(b=i.props,w=b.validateFirst,x=w===void 0?!1:w,E=b.messageVariables,_=b.validateDebounce,$=i.getRules(),d&&($=$.filter(function(L){return L}).filter(function(L){var F=L.validateTrigger;if(!F)return!0;var P=cm(F);return P.includes(d)})),!(_&&d)){k.next=10;break}return k.next=8,new Promise(function(L){setTimeout(L,_)});case 8:if(i.validatePromise===v){k.next=10;break}return k.abrupt("return",[]);case 10:return O=rN(p,s,$,u,x,E),O.catch(function(L){return L}).then(function(){var L=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Ai;if(i.validatePromise===v){var F;i.validatePromise=null;var P=[],A=[];(F=L.forEach)===null||F===void 0||F.call(L,function(M){var R=M.rule.warningOnly,I=M.errors,D=I===void 0?Ai:I;R?A.push.apply(A,Ge(D)):P.push.apply(P,Ge(D))}),i.errors=P,i.warnings=A,i.triggerMetaEvent(),i.reRender()}}),k.abrupt("return",O);case 13:case"end":return k.stop()}},y)})));return f||(i.validatePromise=v,i.dirty=!0,i.errors=Ai,i.warnings=Ai,i.triggerMetaEvent(),i.reRender()),v}),ne(Ut(i),"isFieldValidating",function(){return!!i.validatePromise}),ne(Ut(i),"isFieldTouched",function(){return i.touched}),ne(Ut(i),"isFieldDirty",function(){if(i.dirty||i.props.initialValue!==void 0)return!0;var u=i.props.fieldContext,p=u.getInternalHooks(La),s=p.getInitialValue;return s(i.getNamePath())!==void 0}),ne(Ut(i),"getErrors",function(){return i.errors}),ne(Ut(i),"getWarnings",function(){return i.warnings}),ne(Ut(i),"isListField",function(){return i.props.isListField}),ne(Ut(i),"isList",function(){return i.props.isList}),ne(Ut(i),"isPreserve",function(){return i.props.preserve}),ne(Ut(i),"getMeta",function(){i.prevValidating=i.isFieldValidating();var u={touched:i.isFieldTouched(),validating:i.prevValidating,errors:i.errors,warnings:i.warnings,name:i.getNamePath(),validated:i.validatePromise===null};return u}),ne(Ut(i),"getOnlyChild",function(u){if(typeof u=="function"){var p=i.getMeta();return oe(oe({},i.getOnlyChild(u(i.getControlled(),p,i.props.fieldContext))),{},{isFunction:!0})}var s=li(u);return s.length!==1||!C.isValidElement(s[0])?{child:s,isFunction:!1}:{child:s[0],isFunction:!1}}),ne(Ut(i),"getValue",function(u){var p=i.props.fieldContext.getFieldsValue,s=i.getNamePath();return Pi(u||p(!0),s)}),ne(Ut(i),"getControlled",function(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},p=i.props,s=p.name,c=p.trigger,d=p.validateTrigger,h=p.getValueFromEvent,f=p.normalize,v=p.valuePropName,y=p.getValueProps,b=p.fieldContext,w=d!==void 0?d:b.validateTrigger,x=i.getNamePath(),E=b.getInternalHooks,_=b.getFieldsValue,$=E(La),O=$.dispatch,N=i.getValue(),k=y||function(M){return ne({},v,M)},L=u[c],F=s!==void 0?k(N):{},P=oe(oe({},u),F);P[c]=function(){i.touched=!0,i.dirty=!0,i.triggerMetaEvent();for(var M,R=arguments.length,I=new Array(R),D=0;D=0&&L<=F.length?(s.keys=[].concat(Ge(s.keys.slice(0,L)),[s.id],Ge(s.keys.slice(L))),x([].concat(Ge(F.slice(0,L)),[k],Ge(F.slice(L))))):(s.keys=[].concat(Ge(s.keys),[s.id]),x([].concat(Ge(F),[k]))),s.id+=1},remove:function(k){var L=_(),F=new Set(Array.isArray(k)?k:[k]);F.size<=0||(s.keys=s.keys.filter(function(P,A){return!F.has(A)}),x(L.filter(function(P,A){return!F.has(A)})))},move:function(k,L){if(k!==L){var F=_();k<0||k>=F.length||L<0||L>=F.length||(s.keys=eS(s.keys,k,L),x(eS(F,k,L)))}}},O=w||[];return Array.isArray(O)||(O=[]),r(O.map(function(N,k){var L=s.keys[k];return L===void 0&&(s.keys[k]=s.id,L=s.keys[k],s.id+=1),{name:k,key:L,isListField:!0}}),$,y)})))}function cN(e){var t=!1,n=e.length,r=[];return e.length?new Promise(function(i,o){e.forEach(function(l,m){l.catch(function(u){return t=!0,u}).then(function(u){n-=1,r[m]=u,!(n>0)&&(t&&o(r),i(r))})})}):Promise.resolve([])}var Tx="__@field_split__";function Dp(e){return e.map(function(t){return"".concat(wt(t),":").concat(t)}).join(Tx)}var ws=function(){function e(){cr(this,e),ne(this,"kvs",new Map)}return ur(e,[{key:"set",value:function(n,r){this.kvs.set(Dp(n),r)}},{key:"get",value:function(n){return this.kvs.get(Dp(n))}},{key:"update",value:function(n,r){var i=this.get(n),o=r(i);o?this.set(n,o):this.delete(n)}},{key:"delete",value:function(n){this.kvs.delete(Dp(n))}},{key:"map",value:function(n){return Ge(this.kvs.entries()).map(function(r){var i=pe(r,2),o=i[0],l=i[1],m=o.split(Tx);return n({key:m.map(function(u){var p=u.match(/^([^:]*):(.*)$/),s=pe(p,3),c=s[1],d=s[2];return c==="number"?Number(d):d}),value:l})})}},{key:"toJSON",value:function(){var n={};return this.map(function(r){var i=r.key,o=r.value;return n[i.join(".")]=o,null}),n}}]),e}(),uN=["name"],dN=ur(function e(t){var n=this;cr(this,e),ne(this,"formHooked",!1),ne(this,"forceRootUpdate",void 0),ne(this,"subscribable",!0),ne(this,"store",{}),ne(this,"fieldEntities",[]),ne(this,"initialValues",{}),ne(this,"callbacks",{}),ne(this,"validateMessages",null),ne(this,"preserve",null),ne(this,"lastValidatePromise",null),ne(this,"getForm",function(){return{getFieldValue:n.getFieldValue,getFieldsValue:n.getFieldsValue,getFieldError:n.getFieldError,getFieldWarning:n.getFieldWarning,getFieldsError:n.getFieldsError,isFieldsTouched:n.isFieldsTouched,isFieldTouched:n.isFieldTouched,isFieldValidating:n.isFieldValidating,isFieldsValidating:n.isFieldsValidating,resetFields:n.resetFields,setFields:n.setFields,setFieldValue:n.setFieldValue,setFieldsValue:n.setFieldsValue,validateFields:n.validateFields,submit:n.submit,_init:!0,getInternalHooks:n.getInternalHooks}}),ne(this,"getInternalHooks",function(r){return r===La?(n.formHooked=!0,{dispatch:n.dispatch,initEntityValue:n.initEntityValue,registerField:n.registerField,useSubscribe:n.useSubscribe,setInitialValues:n.setInitialValues,destroyForm:n.destroyForm,setCallbacks:n.setCallbacks,setValidateMessages:n.setValidateMessages,getFields:n.getFields,setPreserve:n.setPreserve,getInitialValue:n.getInitialValue,registerWatch:n.registerWatch}):(Lr(!1,"`getInternalHooks` is internal usage. Should not call directly."),null)}),ne(this,"useSubscribe",function(r){n.subscribable=r}),ne(this,"prevWithoutPreserves",null),ne(this,"setInitialValues",function(r,i){if(n.initialValues=r||{},i){var o,l=Ts(r,n.store);(o=n.prevWithoutPreserves)===null||o===void 0||o.map(function(m){var u=m.key;l=Li(l,u,Pi(r,u))}),n.prevWithoutPreserves=null,n.updateStore(l)}}),ne(this,"destroyForm",function(r){if(r)n.updateStore({});else{var i=new ws;n.getFieldEntities(!0).forEach(function(o){n.isMergedPreserve(o.isPreserve())||i.set(o.getNamePath(),!0)}),n.prevWithoutPreserves=i}}),ne(this,"getInitialValue",function(r){var i=Pi(n.initialValues,r);return r.length?Ts(i):i}),ne(this,"setCallbacks",function(r){n.callbacks=r}),ne(this,"setValidateMessages",function(r){n.validateMessages=r}),ne(this,"setPreserve",function(r){n.preserve=r}),ne(this,"watchList",[]),ne(this,"registerWatch",function(r){return n.watchList.push(r),function(){n.watchList=n.watchList.filter(function(i){return i!==r})}}),ne(this,"notifyWatch",function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];if(n.watchList.length){var i=n.getFieldsValue(),o=n.getFieldsValue(!0);n.watchList.forEach(function(l){l(i,o,r)})}}),ne(this,"timeoutId",null),ne(this,"warningUnhooked",function(){}),ne(this,"updateStore",function(r){n.store=r}),ne(this,"getFieldEntities",function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;return r?n.fieldEntities.filter(function(i){return i.getNamePath().length}):n.fieldEntities}),ne(this,"getFieldsMap",function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,i=new ws;return n.getFieldEntities(r).forEach(function(o){var l=o.getNamePath();i.set(l,o)}),i}),ne(this,"getFieldEntitiesForNamePathList",function(r){if(!r)return n.getFieldEntities(!0);var i=n.getFieldsMap(!0);return r.map(function(o){var l=er(o);return i.get(l)||{INVALIDATE_NAME_PATH:er(o)}})}),ne(this,"getFieldsValue",function(r,i){n.warningUnhooked();var o,l,m;if(r===!0||Array.isArray(r)?(o=r,l=i):r&&wt(r)==="object"&&(m=r.strict,l=r.filter),o===!0&&!l)return n.store;var u=n.getFieldEntitiesForNamePathList(Array.isArray(o)?o:null),p=[];return u.forEach(function(s){var c,d,h="INVALIDATE_NAME_PATH"in s?s.INVALIDATE_NAME_PATH:s.getNamePath();if(m){var f,v;if((f=(v=s).isList)!==null&&f!==void 0&&f.call(v))return}else if(!o&&(c=(d=s).isListField)!==null&&c!==void 0&&c.call(d))return;if(!l)p.push(h);else{var y="getMeta"in s?s.getMeta():null;l(y)&&p.push(h)}}),Jw(n.store,p.map(er))}),ne(this,"getFieldValue",function(r){n.warningUnhooked();var i=er(r);return Pi(n.store,i)}),ne(this,"getFieldsError",function(r){n.warningUnhooked();var i=n.getFieldEntitiesForNamePathList(r);return i.map(function(o,l){return o&&!("INVALIDATE_NAME_PATH"in o)?{name:o.getNamePath(),errors:o.getErrors(),warnings:o.getWarnings()}:{name:er(r[l]),errors:[],warnings:[]}})}),ne(this,"getFieldError",function(r){n.warningUnhooked();var i=er(r),o=n.getFieldsError([i])[0];return o.errors}),ne(this,"getFieldWarning",function(r){n.warningUnhooked();var i=er(r),o=n.getFieldsError([i])[0];return o.warnings}),ne(this,"isFieldsTouched",function(){n.warningUnhooked();for(var r=arguments.length,i=new Array(r),o=0;o0&&arguments[0]!==void 0?arguments[0]:{},i=new ws,o=n.getFieldEntities(!0);o.forEach(function(u){var p=u.props.initialValue,s=u.getNamePath();if(p!==void 0){var c=i.get(s)||new Set;c.add({entity:u,value:p}),i.set(s,c)}});var l=function(p){p.forEach(function(s){var c=s.props.initialValue;if(c!==void 0){var d=s.getNamePath(),h=n.getInitialValue(d);if(h!==void 0)Lr(!1,"Form already set 'initialValues' with path '".concat(d.join("."),"'. Field can not overwrite it."));else{var f=i.get(d);if(f&&f.size>1)Lr(!1,"Multiple Field with path '".concat(d.join("."),"' set 'initialValue'. Can not decide which one to pick."));else if(f){var v=n.getFieldValue(d),y=s.isListField();!y&&(!r.skipExist||v===void 0)&&n.updateStore(Li(n.store,d,Ge(f)[0].value))}}}})},m;r.entities?m=r.entities:r.namePathList?(m=[],r.namePathList.forEach(function(u){var p=i.get(u);if(p){var s;(s=m).push.apply(s,Ge(Ge(p).map(function(c){return c.entity})))}})):m=o,l(m)}),ne(this,"resetFields",function(r){n.warningUnhooked();var i=n.store;if(!r){n.updateStore(Ts(n.initialValues)),n.resetWithFieldInitialValue(),n.notifyObservers(i,null,{type:"reset"}),n.notifyWatch();return}var o=r.map(er);o.forEach(function(l){var m=n.getInitialValue(l);n.updateStore(Li(n.store,l,m))}),n.resetWithFieldInitialValue({namePathList:o}),n.notifyObservers(i,o,{type:"reset"}),n.notifyWatch(o)}),ne(this,"setFields",function(r){n.warningUnhooked();var i=n.store,o=[];r.forEach(function(l){var m=l.name,u=At(l,uN),p=er(m);o.push(p),"value"in u&&n.updateStore(Li(n.store,p,u.value)),n.notifyObservers(i,[p],{type:"setField",data:l})}),n.notifyWatch(o)}),ne(this,"getFields",function(){var r=n.getFieldEntities(!0),i=r.map(function(o){var l=o.getNamePath(),m=o.getMeta(),u=oe(oe({},m),{},{name:l,value:n.getFieldValue(l)});return Object.defineProperty(u,"originRCField",{value:!0}),u});return i}),ne(this,"initEntityValue",function(r){var i=r.props.initialValue;if(i!==void 0){var o=r.getNamePath(),l=Pi(n.store,o);l===void 0&&n.updateStore(Li(n.store,o,i))}}),ne(this,"isMergedPreserve",function(r){var i=r!==void 0?r:n.preserve;return i??!0}),ne(this,"registerField",function(r){n.fieldEntities.push(r);var i=r.getNamePath();if(n.notifyWatch([i]),r.props.initialValue!==void 0){var o=n.store;n.resetWithFieldInitialValue({entities:[r],skipExist:!0}),n.notifyObservers(o,[r.getNamePath()],{type:"valueUpdate",source:"internal"})}return function(l,m){var u=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];if(n.fieldEntities=n.fieldEntities.filter(function(c){return c!==r}),!n.isMergedPreserve(m)&&(!l||u.length>1)){var p=l?void 0:n.getInitialValue(i);if(i.length&&n.getFieldValue(i)!==p&&n.fieldEntities.every(function(c){return!Ox(c.getNamePath(),i)})){var s=n.store;n.updateStore(Li(s,i,p,!0)),n.notifyObservers(s,[i],{type:"remove"}),n.triggerDependenciesUpdate(s,i)}}n.notifyWatch([i])}}),ne(this,"dispatch",function(r){switch(r.type){case"updateValue":{var i=r.namePath,o=r.value;n.updateValue(i,o);break}case"validateField":{var l=r.namePath,m=r.triggerName;n.validateFields([l],{triggerName:m});break}}}),ne(this,"notifyObservers",function(r,i,o){if(n.subscribable){var l=oe(oe({},o),{},{store:n.getFieldsValue(!0)});n.getFieldEntities().forEach(function(m){var u=m.onStoreChange;u(r,i,l)})}else n.forceRootUpdate()}),ne(this,"triggerDependenciesUpdate",function(r,i){var o=n.getDependencyChildrenFields(i);return o.length&&n.validateFields(o),n.notifyObservers(r,o,{type:"dependenciesUpdate",relatedFields:[i].concat(Ge(o))}),o}),ne(this,"updateValue",function(r,i){var o=er(r),l=n.store;n.updateStore(Li(n.store,o,i)),n.notifyObservers(l,[o],{type:"valueUpdate",source:"internal"}),n.notifyWatch([o]);var m=n.triggerDependenciesUpdate(l,o),u=n.callbacks.onValuesChange;if(u){var p=Jw(n.store,[o]);u(p,n.getFieldsValue())}n.triggerOnFieldsChange([o].concat(Ge(m)))}),ne(this,"setFieldsValue",function(r){n.warningUnhooked();var i=n.store;if(r){var o=Ts(n.store,r);n.updateStore(o)}n.notifyObservers(i,null,{type:"valueUpdate",source:"external"}),n.notifyWatch()}),ne(this,"setFieldValue",function(r,i){n.setFields([{name:r,value:i,errors:[],warnings:[]}])}),ne(this,"getDependencyChildrenFields",function(r){var i=new Set,o=[],l=new ws;n.getFieldEntities().forEach(function(u){var p=u.props.dependencies;(p||[]).forEach(function(s){var c=er(s);l.update(c,function(){var d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:new Set;return d.add(u),d})})});var m=function u(p){var s=l.get(p)||new Set;s.forEach(function(c){if(!i.has(c)){i.add(c);var d=c.getNamePath();c.isFieldDirty()&&d.length&&(o.push(d),u(d))}})};return m(r),o}),ne(this,"triggerOnFieldsChange",function(r,i){var o=n.callbacks.onFieldsChange;if(o){var l=n.getFields();if(i){var m=new ws;i.forEach(function(p){var s=p.name,c=p.errors;m.set(s,c)}),l.forEach(function(p){p.errors=m.get(p.name)||p.errors})}var u=l.filter(function(p){var s=p.name;return Ns(r,s)});u.length&&o(u,l)}}),ne(this,"validateFields",function(r,i){n.warningUnhooked();var o,l;Array.isArray(r)||typeof r=="string"||typeof i=="string"?(o=r,l=i):l=r;var m=!!o,u=m?o.map(er):[],p=[],s=String(Date.now()),c=new Set,d=l||{},h=d.recursive,f=d.dirty;n.getFieldEntities(!0).forEach(function(w){if(m||u.push(w.getNamePath()),!(!w.props.rules||!w.props.rules.length)&&!(f&&!w.isFieldDirty())){var x=w.getNamePath();if(c.add(x.join(s)),!m||Ns(u,x,h)){var E=w.validateRules(oe({validateMessages:oe(oe({},Rx),n.validateMessages)},l));p.push(E.then(function(){return{name:x,errors:[],warnings:[]}}).catch(function(_){var $,O=[],N=[];return($=_.forEach)===null||$===void 0||$.call(_,function(k){var L=k.rule.warningOnly,F=k.errors;L?N.push.apply(N,Ge(F)):O.push.apply(O,Ge(F))}),O.length?Promise.reject({name:x,errors:O,warnings:N}):{name:x,errors:O,warnings:N}}))}}});var v=cN(p);n.lastValidatePromise=v,v.catch(function(w){return w}).then(function(w){var x=w.map(function(E){var _=E.name;return _});n.notifyObservers(n.store,x,{type:"validateFinish"}),n.triggerOnFieldsChange(x,w)});var y=v.then(function(){return n.lastValidatePromise===v?Promise.resolve(n.getFieldsValue(u)):Promise.reject([])}).catch(function(w){var x=w.filter(function(E){return E&&E.errors.length});return Promise.reject({values:n.getFieldsValue(u),errorFields:x,outOfDate:n.lastValidatePromise!==v})});y.catch(function(w){return w});var b=u.filter(function(w){return c.has(w.join(s))});return n.triggerOnFieldsChange(b),y}),ne(this,"submit",function(){n.warningUnhooked(),n.validateFields().then(function(r){var i=n.callbacks.onFinish;if(i)try{i(r)}catch(o){console.error(o)}}).catch(function(r){var i=n.callbacks.onFinishFailed;i&&i(r)})}),this.forceRootUpdate=t});function Rv(e){var t=C.useRef(),n=C.useState({}),r=pe(n,2),i=r[1];if(!t.current)if(e)t.current=e;else{var o=function(){i({})},l=new dN(o);t.current=l.getForm()}return[t.current]}var ym=C.createContext({triggerFormChange:function(){},triggerFormFinish:function(){},registerForm:function(){},unregisterForm:function(){}}),Ix=function(t){var n=t.validateMessages,r=t.onFormChange,i=t.onFormFinish,o=t.children,l=C.useContext(ym),m=C.useRef({});return C.createElement(ym.Provider,{value:oe(oe({},l),{},{validateMessages:oe(oe({},l.validateMessages),n),triggerFormChange:function(p,s){r&&r(p,{changedFields:s,forms:m.current}),l.triggerFormChange(p,s)},triggerFormFinish:function(p,s){i&&i(p,{values:s,forms:m.current}),l.triggerFormFinish(p,s)},registerForm:function(p,s){p&&(m.current=oe(oe({},m.current),{},ne({},p,s))),l.registerForm(p,s)},unregisterForm:function(p){var s=oe({},m.current);delete s[p],m.current=s,l.unregisterForm(p)}})},o)},fN=["name","initialValues","fields","form","preserve","children","component","validateMessages","validateTrigger","onValuesChange","onFieldsChange","onFinish","onFinishFailed","clearOnDestroy"],hN=function(t,n){var r=t.name,i=t.initialValues,o=t.fields,l=t.form,m=t.preserve,u=t.children,p=t.component,s=p===void 0?"form":p,c=t.validateMessages,d=t.validateTrigger,h=d===void 0?"onChange":d,f=t.onValuesChange,v=t.onFieldsChange,y=t.onFinish,b=t.onFinishFailed,w=t.clearOnDestroy,x=At(t,fN),E=C.useRef(null),_=C.useContext(ym),$=Rv(l),O=pe($,1),N=O[0],k=N.getInternalHooks(La),L=k.useSubscribe,F=k.setInitialValues,P=k.setCallbacks,A=k.setValidateMessages,M=k.setPreserve,R=k.destroyForm;C.useImperativeHandle(n,function(){return oe(oe({},N),{},{nativeElement:E.current})}),C.useEffect(function(){return _.registerForm(r,N),function(){_.unregisterForm(r)}},[_,N,r]),A(oe(oe({},_.validateMessages),c)),P({onValuesChange:f,onFieldsChange:function(K){if(_.triggerFormChange(r,K),v){for(var G=arguments.length,q=new Array(G>1?G-1:0),Z=1;Z{}}),Px=C.createContext(null),kx=e=>{const t=Er(e,["prefixCls"]);return C.createElement(Ix,Object.assign({},t))},Ov=C.createContext({prefixCls:""}),bi=C.createContext({}),gN=({children:e,status:t,override:n})=>{const r=C.useContext(bi),i=C.useMemo(()=>{const o=Object.assign({},r);return n&&delete o.isFormItemInput,t&&(delete o.status,delete o.hasFeedback,delete o.feedbackIcon),o},[t,n,r]);return C.createElement(bi.Provider,{value:i},e)},Nx=C.createContext(void 0),bm=e=>{const{space:t,form:n,children:r}=e;if(r==null)return null;let i=r;return n&&(i=be.createElement(gN,{override:!0,status:!0},i)),t&&(i=be.createElement(I2,null,i)),i};var mN=function(t){if(qr()&&window.document.documentElement){var n=Array.isArray(t)?t:[t],r=window.document.documentElement;return n.some(function(i){return i in r.style})}return!1};function nS(e,t){return mN(e)}const ff=e=>{const{prefixCls:t,className:n,style:r,size:i,shape:o}=e,l=ve({[`${t}-lg`]:i==="large",[`${t}-sm`]:i==="small"}),m=ve({[`${t}-circle`]:o==="circle",[`${t}-square`]:o==="square",[`${t}-round`]:o==="round"}),u=C.useMemo(()=>typeof i=="number"?{width:i,height:i,lineHeight:`${i}px`}:{},[i]);return C.createElement("span",{className:ve(t,l,m,n),style:Object.assign(Object.assign({},u),r)})},vN=new nn("ant-skeleton-loading",{"0%":{backgroundPosition:"100% 50%"},"100%":{backgroundPosition:"0 50%"}}),hf=e=>({height:e,lineHeight:$e(e)}),Ds=e=>Object.assign({width:e},hf(e)),yN=e=>({background:e.skeletonLoadingBackground,backgroundSize:"400% 100%",animationName:vN,animationDuration:e.skeletonLoadingMotionDuration,animationTimingFunction:"ease",animationIterationCount:"infinite"}),Fp=(e,t)=>Object.assign({width:t(e).mul(5).equal(),minWidth:t(e).mul(5).equal()},hf(e)),bN=e=>{const{skeletonAvatarCls:t,gradientFromColor:n,controlHeight:r,controlHeightLG:i,controlHeightSM:o}=e;return{[t]:Object.assign({display:"inline-block",verticalAlign:"top",background:n},Ds(r)),[`${t}${t}-circle`]:{borderRadius:"50%"},[`${t}${t}-lg`]:Object.assign({},Ds(i)),[`${t}${t}-sm`]:Object.assign({},Ds(o))}},wN=e=>{const{controlHeight:t,borderRadiusSM:n,skeletonInputCls:r,controlHeightLG:i,controlHeightSM:o,gradientFromColor:l,calc:m}=e;return{[r]:Object.assign({display:"inline-block",verticalAlign:"top",background:l,borderRadius:n},Fp(t,m)),[`${r}-lg`]:Object.assign({},Fp(i,m)),[`${r}-sm`]:Object.assign({},Fp(o,m))}},rS=e=>Object.assign({width:e},hf(e)),SN=e=>{const{skeletonImageCls:t,imageSizeBase:n,gradientFromColor:r,borderRadiusSM:i,calc:o}=e;return{[t]:Object.assign(Object.assign({display:"inline-flex",alignItems:"center",justifyContent:"center",verticalAlign:"middle",background:r,borderRadius:i},rS(o(n).mul(2).equal())),{[`${t}-path`]:{fill:"#bfbfbf"},[`${t}-svg`]:Object.assign(Object.assign({},rS(n)),{maxWidth:o(n).mul(4).equal(),maxHeight:o(n).mul(4).equal()}),[`${t}-svg${t}-svg-circle`]:{borderRadius:"50%"}}),[`${t}${t}-circle`]:{borderRadius:"50%"}}},zp=(e,t,n)=>{const{skeletonButtonCls:r}=e;return{[`${n}${r}-circle`]:{width:t,minWidth:t,borderRadius:"50%"},[`${n}${r}-round`]:{borderRadius:t}}},jp=(e,t)=>Object.assign({width:t(e).mul(2).equal(),minWidth:t(e).mul(2).equal()},hf(e)),CN=e=>{const{borderRadiusSM:t,skeletonButtonCls:n,controlHeight:r,controlHeightLG:i,controlHeightSM:o,gradientFromColor:l,calc:m}=e;return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({[n]:Object.assign({display:"inline-block",verticalAlign:"top",background:l,borderRadius:t,width:m(r).mul(2).equal(),minWidth:m(r).mul(2).equal()},jp(r,m))},zp(e,r,n)),{[`${n}-lg`]:Object.assign({},jp(i,m))}),zp(e,i,`${n}-lg`)),{[`${n}-sm`]:Object.assign({},jp(o,m))}),zp(e,o,`${n}-sm`))},$N=e=>{const{componentCls:t,skeletonAvatarCls:n,skeletonTitleCls:r,skeletonParagraphCls:i,skeletonButtonCls:o,skeletonInputCls:l,skeletonImageCls:m,controlHeight:u,controlHeightLG:p,controlHeightSM:s,gradientFromColor:c,padding:d,marginSM:h,borderRadius:f,titleHeight:v,blockRadius:y,paragraphLiHeight:b,controlHeightXS:w,paragraphMarginTop:x}=e;return{[t]:{display:"table",width:"100%",[`${t}-header`]:{display:"table-cell",paddingInlineEnd:d,verticalAlign:"top",[n]:Object.assign({display:"inline-block",verticalAlign:"top",background:c},Ds(u)),[`${n}-circle`]:{borderRadius:"50%"},[`${n}-lg`]:Object.assign({},Ds(p)),[`${n}-sm`]:Object.assign({},Ds(s))},[`${t}-content`]:{display:"table-cell",width:"100%",verticalAlign:"top",[r]:{width:"100%",height:v,background:c,borderRadius:y,[`+ ${i}`]:{marginBlockStart:s}},[i]:{padding:0,"> li":{width:"100%",height:b,listStyle:"none",background:c,borderRadius:y,"+ li":{marginBlockStart:w}}},[`${i}> li:last-child:not(:first-child):not(:nth-child(2))`]:{width:"61%"}},[`&-round ${t}-content`]:{[`${r}, ${i} > li`]:{borderRadius:f}}},[`${t}-with-avatar ${t}-content`]:{[r]:{marginBlockStart:h,[`+ ${i}`]:{marginBlockStart:x}}},[`${t}${t}-element`]:Object.assign(Object.assign(Object.assign(Object.assign({display:"inline-block",width:"auto"},CN(e)),bN(e)),wN(e)),SN(e)),[`${t}${t}-block`]:{width:"100%",[o]:{width:"100%"},[l]:{width:"100%"}},[`${t}${t}-active`]:{[` + ${r}, + ${i} > li, + ${n}, + ${o}, + ${l}, + ${m} + `]:Object.assign({},yN(e))}}},xN=e=>{const{colorFillContent:t,colorFill:n}=e,r=t,i=n;return{color:r,colorGradientEnd:i,gradientFromColor:r,gradientToColor:i,titleHeight:e.controlHeight/2,blockRadius:e.borderRadiusSM,paragraphMarginTop:e.marginLG+e.marginXXS,paragraphLiHeight:e.controlHeight/2}},el=gr("Skeleton",e=>{const{componentCls:t,calc:n}=e,r=Sn(e,{skeletonAvatarCls:`${t}-avatar`,skeletonTitleCls:`${t}-title`,skeletonParagraphCls:`${t}-paragraph`,skeletonButtonCls:`${t}-button`,skeletonInputCls:`${t}-input`,skeletonImageCls:`${t}-image`,imageSizeBase:n(e.controlHeight).mul(1.5).equal(),borderRadius:100,skeletonLoadingBackground:`linear-gradient(90deg, ${e.gradientFromColor} 25%, ${e.gradientToColor} 37%, ${e.gradientFromColor} 63%)`,skeletonLoadingMotionDuration:"1.4s"});return[$N(r)]},xN,{deprecatedTokens:[["color","gradientFromColor"],["colorGradientEnd","gradientToColor"]]}),EN=e=>{const{prefixCls:t,className:n,rootClassName:r,active:i,shape:o="circle",size:l="default"}=e,{getPrefixCls:m}=C.useContext(zt),u=m("skeleton",t),[p,s,c]=el(u),d=Er(e,["prefixCls","className"]),h=ve(u,`${u}-element`,{[`${u}-active`]:i},n,r,s,c);return p(C.createElement("div",{className:h},C.createElement(ff,Object.assign({prefixCls:`${u}-avatar`,shape:o,size:l},d))))},_N=e=>{const{prefixCls:t,className:n,rootClassName:r,active:i,block:o=!1,size:l="default"}=e,{getPrefixCls:m}=C.useContext(zt),u=m("skeleton",t),[p,s,c]=el(u),d=Er(e,["prefixCls"]),h=ve(u,`${u}-element`,{[`${u}-active`]:i,[`${u}-block`]:o},n,r,s,c);return p(C.createElement("div",{className:h},C.createElement(ff,Object.assign({prefixCls:`${u}-button`,size:l},d))))},MN="M365.714286 329.142857q0 45.714286-32.036571 77.677714t-77.677714 32.036571-77.677714-32.036571-32.036571-77.677714 32.036571-77.677714 77.677714-32.036571 77.677714 32.036571 32.036571 77.677714zM950.857143 548.571429l0 256-804.571429 0 0-109.714286 182.857143-182.857143 91.428571 91.428571 292.571429-292.571429zM1005.714286 146.285714l-914.285714 0q-7.460571 0-12.873143 5.412571t-5.412571 12.873143l0 694.857143q0 7.460571 5.412571 12.873143t12.873143 5.412571l914.285714 0q7.460571 0 12.873143-5.412571t5.412571-12.873143l0-694.857143q0-7.460571-5.412571-12.873143t-12.873143-5.412571zM1097.142857 164.571429l0 694.857143q0 37.741714-26.843429 64.585143t-64.585143 26.843429l-914.285714 0q-37.741714 0-64.585143-26.843429t-26.843429-64.585143l0-694.857143q0-37.741714 26.843429-64.585143t64.585143-26.843429l914.285714 0q37.741714 0 64.585143 26.843429t26.843429 64.585143z",RN=e=>{const{prefixCls:t,className:n,rootClassName:r,style:i,active:o}=e,{getPrefixCls:l}=C.useContext(zt),m=l("skeleton",t),[u,p,s]=el(m),c=ve(m,`${m}-element`,{[`${m}-active`]:o},n,r,p,s);return u(C.createElement("div",{className:c},C.createElement("div",{className:ve(`${m}-image`,n),style:i},C.createElement("svg",{viewBox:"0 0 1098 1024",xmlns:"http://www.w3.org/2000/svg",className:`${m}-image-svg`},C.createElement("title",null,"Image placeholder"),C.createElement("path",{d:MN,className:`${m}-image-path`})))))},ON=e=>{const{prefixCls:t,className:n,rootClassName:r,active:i,block:o,size:l="default"}=e,{getPrefixCls:m}=C.useContext(zt),u=m("skeleton",t),[p,s,c]=el(u),d=Er(e,["prefixCls"]),h=ve(u,`${u}-element`,{[`${u}-active`]:i,[`${u}-block`]:o},n,r,s,c);return p(C.createElement("div",{className:h},C.createElement(ff,Object.assign({prefixCls:`${u}-input`,size:l},d))))},AN=e=>{const{prefixCls:t,className:n,rootClassName:r,style:i,active:o,children:l}=e,{getPrefixCls:m}=C.useContext(zt),u=m("skeleton",t),[p,s,c]=el(u),d=ve(u,`${u}-element`,{[`${u}-active`]:o},s,n,r,c);return p(C.createElement("div",{className:d},C.createElement("div",{className:ve(`${u}-image`,n),style:i},l)))},TN=(e,t)=>{const{width:n,rows:r=2}=t;if(Array.isArray(n))return n[e];if(r-1===e)return n},IN=e=>{const{prefixCls:t,className:n,style:r,rows:i=0}=e,o=Array.from({length:i}).map((l,m)=>C.createElement("li",{key:m,style:{width:TN(m,e)}}));return C.createElement("ul",{className:ve(t,n),style:r},o)},LN=({prefixCls:e,className:t,width:n,style:r})=>C.createElement("h3",{className:ve(e,t),style:Object.assign({width:n},r)});function Bp(e){return e&&typeof e=="object"?e:{}}function PN(e,t){return e&&!t?{size:"large",shape:"square"}:{size:"large",shape:"circle"}}function kN(e,t){return!e&&t?{width:"38%"}:e&&t?{width:"50%"}:{}}function NN(e,t){const n={};return(!e||!t)&&(n.width="61%"),!e&&t?n.rows=3:n.rows=2,n}const tl=e=>{const{prefixCls:t,loading:n,className:r,rootClassName:i,style:o,children:l,avatar:m=!1,title:u=!0,paragraph:p=!0,active:s,round:c}=e,{getPrefixCls:d,direction:h,className:f,style:v}=Ji("skeleton"),y=d("skeleton",t),[b,w,x]=el(y);if(n||!("loading"in e)){const E=!!m,_=!!u,$=!!p;let O;if(E){const L=Object.assign(Object.assign({prefixCls:`${y}-avatar`},PN(_,$)),Bp(m));O=C.createElement("div",{className:`${y}-header`},C.createElement(ff,Object.assign({},L)))}let N;if(_||$){let L;if(_){const P=Object.assign(Object.assign({prefixCls:`${y}-title`},kN(E,$)),Bp(u));L=C.createElement(LN,Object.assign({},P))}let F;if($){const P=Object.assign(Object.assign({prefixCls:`${y}-paragraph`},NN(E,_)),Bp(p));F=C.createElement(IN,Object.assign({},P))}N=C.createElement("div",{className:`${y}-content`},L,F)}const k=ve(y,{[`${y}-with-avatar`]:E,[`${y}-active`]:s,[`${y}-rtl`]:h==="rtl",[`${y}-round`]:c},f,r,i,w,x);return b(C.createElement("div",{className:k,style:Object.assign(Object.assign({},v),o)},O,N))}return l??null};tl.Button=_N;tl.Avatar=EN;tl.Input=ON;tl.Image=RN;tl.Node=AN;const DN=e=>{const{componentCls:t}=e;return{[t]:{display:"flex",flexFlow:"row wrap",minWidth:0,"&::before, &::after":{display:"flex"},"&-no-wrap":{flexWrap:"nowrap"},"&-start":{justifyContent:"flex-start"},"&-center":{justifyContent:"center"},"&-end":{justifyContent:"flex-end"},"&-space-between":{justifyContent:"space-between"},"&-space-around":{justifyContent:"space-around"},"&-space-evenly":{justifyContent:"space-evenly"},"&-top":{alignItems:"flex-start"},"&-middle":{alignItems:"center"},"&-bottom":{alignItems:"flex-end"}}}},FN=e=>{const{componentCls:t}=e;return{[t]:{position:"relative",maxWidth:"100%",minHeight:1}}},zN=(e,t)=>{const{prefixCls:n,componentCls:r,gridColumns:i}=e,o={};for(let l=i;l>=0;l--)l===0?(o[`${r}${t}-${l}`]={display:"none"},o[`${r}-push-${l}`]={insetInlineStart:"auto"},o[`${r}-pull-${l}`]={insetInlineEnd:"auto"},o[`${r}${t}-push-${l}`]={insetInlineStart:"auto"},o[`${r}${t}-pull-${l}`]={insetInlineEnd:"auto"},o[`${r}${t}-offset-${l}`]={marginInlineStart:0},o[`${r}${t}-order-${l}`]={order:0}):(o[`${r}${t}-${l}`]=[{"--ant-display":"block",display:"block"},{display:"var(--ant-display)",flex:`0 0 ${l/i*100}%`,maxWidth:`${l/i*100}%`}],o[`${r}${t}-push-${l}`]={insetInlineStart:`${l/i*100}%`},o[`${r}${t}-pull-${l}`]={insetInlineEnd:`${l/i*100}%`},o[`${r}${t}-offset-${l}`]={marginInlineStart:`${l/i*100}%`},o[`${r}${t}-order-${l}`]={order:l});return o[`${r}${t}-flex`]={flex:`var(--${n}${t}-flex)`},o},wm=(e,t)=>zN(e,t),jN=(e,t,n)=>({[`@media (min-width: ${$e(t)})`]:Object.assign({},wm(e,n))}),BN=()=>({}),HN=()=>({}),WN=gr("Grid",DN,BN),VN=e=>({xs:e.screenXSMin,sm:e.screenSMMin,md:e.screenMDMin,lg:e.screenLGMin,xl:e.screenXLMin,xxl:e.screenXXLMin}),UN=gr("Grid",e=>{const t=Sn(e,{gridColumns:24}),n=VN(t);return delete n.xs,[FN(t),wm(t,""),wm(t,"-xs"),Object.keys(n).map(r=>jN(t,n[r],`-${r}`)).reduce((r,i)=>Object.assign(Object.assign({},r),i),{})]},HN),GN=e=>{const{componentCls:t,notificationMarginEdge:n,animationMaxHeight:r}=e,i=`${t}-notice`,o=new nn("antNotificationFadeIn",{"0%":{transform:"translate3d(100%, 0, 0)",opacity:0},"100%":{transform:"translate3d(0, 0, 0)",opacity:1}}),l=new nn("antNotificationTopFadeIn",{"0%":{top:-r,opacity:0},"100%":{top:0,opacity:1}}),m=new nn("antNotificationBottomFadeIn",{"0%":{bottom:e.calc(r).mul(-1).equal(),opacity:0},"100%":{bottom:0,opacity:1}}),u=new nn("antNotificationLeftFadeIn",{"0%":{transform:"translate3d(-100%, 0, 0)",opacity:0},"100%":{transform:"translate3d(0, 0, 0)",opacity:1}});return{[t]:{[`&${t}-top, &${t}-bottom`]:{marginInline:0,[i]:{marginInline:"auto auto"}},[`&${t}-top`]:{[`${t}-fade-enter${t}-fade-enter-active, ${t}-fade-appear${t}-fade-appear-active`]:{animationName:l}},[`&${t}-bottom`]:{[`${t}-fade-enter${t}-fade-enter-active, ${t}-fade-appear${t}-fade-appear-active`]:{animationName:m}},[`&${t}-topRight, &${t}-bottomRight`]:{[`${t}-fade-enter${t}-fade-enter-active, ${t}-fade-appear${t}-fade-appear-active`]:{animationName:o}},[`&${t}-topLeft, &${t}-bottomLeft`]:{marginRight:{value:0,_skip_check_:!0},marginLeft:{value:n,_skip_check_:!0},[i]:{marginInlineEnd:"auto",marginInlineStart:0},[`${t}-fade-enter${t}-fade-enter-active, ${t}-fade-appear${t}-fade-appear-active`]:{animationName:u}}}}},KN=["top","topLeft","topRight","bottom","bottomLeft","bottomRight"],YN={topLeft:"left",topRight:"right",bottomLeft:"left",bottomRight:"right",top:"left",bottom:"left"},XN=(e,t)=>{const{componentCls:n}=e;return{[`${n}-${t}`]:{[`&${n}-stack > ${n}-notice-wrapper`]:{[t.startsWith("top")?"top":"bottom"]:0,[YN[t]]:{value:0,_skip_check_:!0}}}}},qN=e=>{const t={};for(let n=1;n ${e.componentCls}-notice`]:{opacity:0,transition:`opacity ${e.motionDurationMid}`}};return Object.assign({[`&:not(:nth-last-child(-n+${e.notificationStackLayer}))`]:{opacity:0,overflow:"hidden",color:"transparent",pointerEvents:"none"}},t)},QN=e=>{const t={};for(let n=1;n{const{componentCls:t}=e;return Object.assign({[`${t}-stack`]:{[`& > ${t}-notice-wrapper`]:Object.assign({transition:`transform ${e.motionDurationSlow}, backdrop-filter 0s`,willChange:"transform, opacity",position:"absolute"},qN(e))},[`${t}-stack:not(${t}-stack-expanded)`]:{[`& > ${t}-notice-wrapper`]:Object.assign({},QN(e))},[`${t}-stack${t}-stack-expanded`]:{[`& > ${t}-notice-wrapper`]:{"&:not(:nth-last-child(-n + 1))":{opacity:1,overflow:"unset",color:"inherit",pointerEvents:"auto",[`& > ${e.componentCls}-notice`]:{opacity:1}},"&:after":{content:'""',position:"absolute",height:e.margin,width:"100%",insetInline:0,bottom:e.calc(e.margin).mul(-1).equal(),background:"transparent",pointerEvents:"auto"}}}},KN.map(n=>XN(e,n)).reduce((n,r)=>Object.assign(Object.assign({},n),r),{}))},Dx=e=>{const{iconCls:t,componentCls:n,boxShadow:r,fontSizeLG:i,notificationMarginBottom:o,borderRadiusLG:l,colorSuccess:m,colorInfo:u,colorWarning:p,colorError:s,colorTextHeading:c,notificationBg:d,notificationPadding:h,notificationMarginEdge:f,notificationProgressBg:v,notificationProgressHeight:y,fontSize:b,lineHeight:w,width:x,notificationIconSize:E,colorText:_}=e,$=`${n}-notice`;return{position:"relative",marginBottom:o,marginInlineStart:"auto",background:d,borderRadius:l,boxShadow:r,[$]:{padding:h,width:x,maxWidth:`calc(100vw - ${$e(e.calc(f).mul(2).equal())})`,overflow:"hidden",lineHeight:w,wordWrap:"break-word"},[`${$}-message`]:{marginBottom:e.marginXS,color:c,fontSize:i,lineHeight:e.lineHeightLG},[`${$}-description`]:{fontSize:b,color:_},[`${$}-closable ${$}-message`]:{paddingInlineEnd:e.paddingLG},[`${$}-with-icon ${$}-message`]:{marginBottom:e.marginXS,marginInlineStart:e.calc(e.marginSM).add(E).equal(),fontSize:i},[`${$}-with-icon ${$}-description`]:{marginInlineStart:e.calc(e.marginSM).add(E).equal(),fontSize:b},[`${$}-icon`]:{position:"absolute",fontSize:E,lineHeight:1,[`&-success${t}`]:{color:m},[`&-info${t}`]:{color:u},[`&-warning${t}`]:{color:p},[`&-error${t}`]:{color:s}},[`${$}-close`]:Object.assign({position:"absolute",top:e.notificationPaddingVertical,insetInlineEnd:e.notificationPaddingHorizontal,color:e.colorIcon,outline:"none",width:e.notificationCloseButtonSize,height:e.notificationCloseButtonSize,borderRadius:e.borderRadiusSM,transition:`background-color ${e.motionDurationMid}, color ${e.motionDurationMid}`,display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none","&:hover":{color:e.colorIconHover,backgroundColor:e.colorBgTextHover},"&:active":{backgroundColor:e.colorBgTextActive}},Ha(e)),[`${$}-progress`]:{position:"absolute",display:"block",appearance:"none",inlineSize:`calc(100% - ${$e(l)} * 2)`,left:{_skip_check_:!0,value:l},right:{_skip_check_:!0,value:l},bottom:0,blockSize:y,border:0,"&, &::-webkit-progress-bar":{borderRadius:l,backgroundColor:"rgba(0, 0, 0, 0.04)"},"&::-moz-progress-bar":{background:v},"&::-webkit-progress-value":{borderRadius:l,background:v}},[`${$}-actions`]:{float:"right",marginTop:e.marginSM}}},JN=e=>{const{componentCls:t,notificationMarginBottom:n,notificationMarginEdge:r,motionDurationMid:i,motionEaseInOut:o}=e,l=`${t}-notice`,m=new nn("antNotificationFadeOut",{"0%":{maxHeight:e.animationMaxHeight,marginBottom:n},"100%":{maxHeight:0,marginBottom:0,paddingTop:0,paddingBottom:0,opacity:0}});return[{[t]:Object.assign(Object.assign({},ci(e)),{position:"fixed",zIndex:e.zIndexPopup,marginRight:{value:r,_skip_check_:!0},[`${t}-hook-holder`]:{position:"relative"},[`${t}-fade-appear-prepare`]:{opacity:"0 !important"},[`${t}-fade-enter, ${t}-fade-appear`]:{animationDuration:e.motionDurationMid,animationTimingFunction:o,animationFillMode:"both",opacity:0,animationPlayState:"paused"},[`${t}-fade-leave`]:{animationTimingFunction:o,animationFillMode:"both",animationDuration:i,animationPlayState:"paused"},[`${t}-fade-enter${t}-fade-enter-active, ${t}-fade-appear${t}-fade-appear-active`]:{animationPlayState:"running"},[`${t}-fade-leave${t}-fade-leave-active`]:{animationName:m,animationPlayState:"running"},"&-rtl":{direction:"rtl",[`${l}-actions`]:{float:"left"}}})},{[t]:{[`${l}-wrapper`]:Object.assign({},Dx(e))}}]},Fx=e=>({zIndexPopup:e.zIndexPopupBase+tx+50,width:384}),zx=e=>{const t=e.paddingMD,n=e.paddingLG;return Sn(e,{notificationBg:e.colorBgElevated,notificationPaddingVertical:t,notificationPaddingHorizontal:n,notificationIconSize:e.calc(e.fontSizeLG).mul(e.lineHeightLG).equal(),notificationCloseButtonSize:e.calc(e.controlHeightLG).mul(.55).equal(),notificationMarginBottom:e.margin,notificationPadding:`${$e(e.paddingMD)} ${$e(e.paddingContentHorizontalLG)}`,notificationMarginEdge:e.marginLG,animationMaxHeight:150,notificationStackLayer:3,notificationProgressHeight:2,notificationProgressBg:`linear-gradient(90deg, ${e.colorPrimaryBorderHover}, ${e.colorPrimary})`})},jx=gr("Notification",e=>{const t=zx(e);return[JN(t),GN(t),ZN(t)]},Fx),eD=hv(["Notification","PurePanel"],e=>{const t=`${e.componentCls}-notice`,n=zx(e);return{[`${t}-pure-panel`]:Object.assign(Object.assign({},Dx(n)),{width:n.width,maxWidth:`calc(100vw - ${$e(e.calc(n.notificationMarginEdge).mul(2).equal())})`,margin:0})}},Fx);var tD=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i{const{prefixCls:t,icon:n,type:r,message:i,description:o,actions:l,role:m="alert"}=e;let u=null;return n?u=C.createElement("span",{className:`${t}-icon`},n):r&&(u=C.createElement(nD[r]||null,{className:ve(`${t}-icon`,`${t}-icon-${r}`)})),C.createElement("div",{className:ve({[`${t}-with-icon`]:u}),role:m},u,C.createElement("div",{className:`${t}-message`},i),C.createElement("div",{className:`${t}-description`},o),l&&C.createElement("div",{className:`${t}-actions`},l))},rD=e=>{const{prefixCls:t,className:n,icon:r,type:i,message:o,description:l,btn:m,actions:u,closable:p=!0,closeIcon:s,className:c}=e,d=tD(e,["prefixCls","className","icon","type","message","description","btn","actions","closable","closeIcon","className"]),{getPrefixCls:h}=C.useContext(zt),f=u??m,v=t||h("notification"),y=`${v}-notice`,b=eo(v),[w,x,E]=jx(v,b);return w(C.createElement("div",{className:ve(`${y}-pure-panel`,x,n,E,b)},C.createElement(eD,{prefixCls:v}),C.createElement(vv,Object.assign({},d,{prefixCls:v,eventKey:"pure",duration:null,closable:p,className:ve({notificationClassName:c}),closeIcon:Av(v,s),content:C.createElement(Bx,{prefixCls:y,icon:r,type:i,message:o,description:l,actions:f})}))))};function iD(e,t,n){let r;switch(e){case"top":r={left:"50%",transform:"translateX(-50%)",right:"auto",top:t,bottom:"auto"};break;case"topLeft":r={left:0,top:t,bottom:"auto"};break;case"topRight":r={right:0,top:t,bottom:"auto"};break;case"bottom":r={left:"50%",transform:"translateX(-50%)",right:"auto",top:"auto",bottom:n};break;case"bottomLeft":r={left:0,top:"auto",bottom:n};break;default:r={right:0,top:"auto",bottom:n};break}return r}function oD(e){return{motionName:`${e}-fade`}}function aD(e,t,n){return typeof e<"u"?e:typeof(t==null?void 0:t.closeIcon)<"u"?t.closeIcon:n==null?void 0:n.closeIcon}var sD=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i{const n=eo(t),[r,i,o]=jx(t,n);return r(be.createElement(Q$,{classNames:{list:ve(i,o,n)}},e))},dD=(e,{prefixCls:t,key:n})=>be.createElement(uD,{prefixCls:t,key:n},e),fD=be.forwardRef((e,t)=>{const{top:n,bottom:r,prefixCls:i,getContainer:o,maxCount:l,rtl:m,onAllRemoved:u,stack:p,duration:s,pauseOnHover:c=!0,showProgress:d}=e,{getPrefixCls:h,getPopupContainer:f,notification:v,direction:y}=C.useContext(zt),[,b]=Si(),w=i||h("notification"),x=N=>iD(N,n??iS,r??iS),E=()=>ve({[`${w}-rtl`]:m??y==="rtl"}),_=()=>oD(w),[$,O]=Z$({prefixCls:w,style:x,className:E,motion:_,closable:!0,closeIcon:Av(w),duration:s??lD,getContainer:()=>(o==null?void 0:o())||(f==null?void 0:f())||document.body,maxCount:l,pauseOnHover:c,showProgress:d,onAllRemoved:u,renderNotifications:dD,stack:p===!1?!1:{threshold:typeof p=="object"?p==null?void 0:p.threshold:void 0,offset:8,gap:b.margin}});return be.useImperativeHandle(t,()=>Object.assign(Object.assign({},$),{prefixCls:w,notification:v})),O});function Hx(e){const t=be.useRef(null);return _c(),[be.useMemo(()=>{const r=m=>{var u;if(!t.current)return;const{open:p,prefixCls:s,notification:c}=t.current,d=`${s}-notice`,{message:h,description:f,icon:v,type:y,btn:b,actions:w,className:x,style:E,role:_="alert",closeIcon:$,closable:O}=m,N=sD(m,["message","description","icon","type","btn","actions","className","style","role","closeIcon","closable"]),k=w??b,L=Av(d,aD($,e,c));return p(Object.assign(Object.assign({placement:(u=e==null?void 0:e.placement)!==null&&u!==void 0?u:cD},N),{content:be.createElement(Bx,{prefixCls:d,icon:v,type:y,message:h,description:f,actions:k,role:_}),className:ve(y&&`${d}-${y}`,x,c==null?void 0:c.className),style:Object.assign(Object.assign({},c==null?void 0:c.style),E),closeIcon:L,closable:O??!!L}))},o={open:r,destroy:m=>{var u,p;m!==void 0?(u=t.current)===null||u===void 0||u.close(m):(p=t.current)===null||p===void 0||p.destroy()}};return["success","info","warning","error"].forEach(m=>{o[m]=u=>r(Object.assign(Object.assign({},u),{type:m}))}),o},[]),be.createElement(fD,Object.assign({key:"notification-holder"},e,{ref:t}))]}function hD(e){return Hx(e)}const Wx=be.createContext({});function pD(e){return t=>C.createElement(ha,{theme:{token:{motion:!1,zIndexPopupBase:0}}},C.createElement(e,Object.assign({},t)))}const gD=(e,t,n,r,i)=>pD(l=>{const{prefixCls:m,style:u}=l,p=C.useRef(null),[s,c]=C.useState(0),[d,h]=C.useState(0),[f,v]=Pr(!1,{value:l.open}),{getPrefixCls:y}=C.useContext(zt),b=y("select",m);C.useEffect(()=>{if(v(!0),typeof ResizeObserver<"u"){const E=new ResizeObserver($=>{const O=$[0].target;c(O.offsetHeight+8),h(O.offsetWidth)}),_=setInterval(()=>{var $;const O=`.${b}-dropdown`,N=($=p.current)===null||$===void 0?void 0:$.querySelector(O);N&&(clearInterval(_),E.observe(N))},10);return()=>{clearInterval(_),E.disconnect()}}},[]);let w=Object.assign(Object.assign({},l),{style:Object.assign(Object.assign({},u),{margin:0}),open:f,visible:f,getPopupContainer:()=>p.current});Object.assign(w,{[t]:{overflow:{adjustX:!1,adjustY:!1}}});const x={paddingBottom:s,position:"relative",minWidth:d};return C.createElement("div",{ref:p,style:x},C.createElement(e,Object.assign({},w)))}),Tv=function(){if(typeof navigator>"u"||typeof window>"u")return!1;var e=navigator.userAgent||navigator.vendor||window.opera;return/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(e==null?void 0:e.substr(0,4))};var pf=function(t){var n=t.className,r=t.customizeIcon,i=t.customizeIconProps,o=t.children,l=t.onMouseDown,m=t.onClick,u=typeof r=="function"?r(i):r;return C.createElement("span",{className:n,onMouseDown:function(s){s.preventDefault(),l==null||l(s)},style:{userSelect:"none",WebkitUserSelect:"none"},unselectable:"on",onClick:m,"aria-hidden":!0},u!==void 0?u:C.createElement("span",{className:ve(n.split(/\s+/).map(function(p){return"".concat(p,"-icon")}))},o))},mD=function(t,n,r,i,o){var l=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!1,m=arguments.length>6?arguments[6]:void 0,u=arguments.length>7?arguments[7]:void 0,p=be.useMemo(function(){if(wt(i)==="object")return i.clearIcon;if(o)return o},[i,o]),s=be.useMemo(function(){return!!(!l&&i&&(r.length||m)&&!(u==="combobox"&&m===""))},[i,l,r.length,m,u]);return{allowClear:s,clearIcon:be.createElement(pf,{className:"".concat(t,"-clear"),onMouseDown:n,customizeIcon:p},"×")}},Vx=C.createContext(null);function vD(){return C.useContext(Vx)}function yD(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:10,t=C.useState(!1),n=pe(t,2),r=n[0],i=n[1],o=C.useRef(null),l=function(){window.clearTimeout(o.current)};C.useEffect(function(){return l},[]);var m=function(p,s){l(),o.current=window.setTimeout(function(){i(p),s&&s()},e)};return[r,m,l]}function Ux(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:250,t=C.useRef(null),n=C.useRef(null);C.useEffect(function(){return function(){window.clearTimeout(n.current)}},[]);function r(i){(i||t.current===null)&&(t.current=i),window.clearTimeout(n.current),n.current=window.setTimeout(function(){t.current=null},e)}return[function(){return t.current},r]}function bD(e,t,n,r){var i=C.useRef(null);i.current={open:t,triggerOpen:n,customizedTrigger:r},C.useEffect(function(){function o(l){var m;if(!((m=i.current)!==null&&m!==void 0&&m.customizedTrigger)){var u=l.target;u.shadowRoot&&l.composed&&(u=l.composedPath()[0]||u),i.current.open&&e().filter(function(p){return p}).every(function(p){return!p.contains(u)&&p!==u})&&i.current.triggerOpen(!1)}}return window.addEventListener("mousedown",o),function(){return window.removeEventListener("mousedown",o)}},[])}function wD(e){return e&&![mt.ESC,mt.SHIFT,mt.BACKSPACE,mt.TAB,mt.WIN_KEY,mt.ALT,mt.META,mt.WIN_KEY_RIGHT,mt.CTRL,mt.SEMICOLON,mt.EQUALS,mt.CAPS_LOCK,mt.CONTEXT_MENU,mt.F1,mt.F2,mt.F3,mt.F4,mt.F5,mt.F6,mt.F7,mt.F8,mt.F9,mt.F10,mt.F11,mt.F12].includes(e)}var SD=["prefixCls","invalidate","item","renderItem","responsive","responsiveDisabled","registerSize","itemKey","className","style","children","display","order","component"],Ss=void 0;function CD(e,t){var n=e.prefixCls,r=e.invalidate,i=e.item,o=e.renderItem,l=e.responsive,m=e.responsiveDisabled,u=e.registerSize,p=e.itemKey,s=e.className,c=e.style,d=e.children,h=e.display,f=e.order,v=e.component,y=v===void 0?"div":v,b=At(e,SD),w=l&&!h;function x(N){u(p,N)}C.useEffect(function(){return function(){x(null)}},[]);var E=o&&i!==Ss?o(i,{index:f}):d,_;r||(_={opacity:w?0:1,height:w?0:Ss,overflowY:w?"hidden":Ss,order:l?f:Ss,pointerEvents:w?"none":Ss,position:w?"absolute":Ss});var $={};w&&($["aria-hidden"]=!0);var O=C.createElement(y,nt({className:ve(!r&&n,s),style:oe(oe({},_),c)},$,b,{ref:t}),E);return l&&(O=C.createElement(ki,{onResize:function(k){var L=k.offsetWidth;x(L)},disabled:m},O)),O}var Ql=C.forwardRef(CD);Ql.displayName="Item";function $D(e){if(typeof MessageChannel>"u")gn(e);else{var t=new MessageChannel;t.port1.onmessage=function(){return e()},t.port2.postMessage(void 0)}}function xD(){var e=C.useRef(null),t=function(r){e.current||(e.current=[],$D(function(){da.unstable_batchedUpdates(function(){e.current.forEach(function(i){i()}),e.current=null})})),e.current.push(r)};return t}function Nl(e,t){var n=C.useState(t),r=pe(n,2),i=r[0],o=r[1],l=tr(function(m){e(function(){o(m)})});return[i,l]}var Pd=be.createContext(null),ED=["component"],_D=["className"],MD=["className"],RD=function(t,n){var r=C.useContext(Pd);if(!r){var i=t.component,o=i===void 0?"div":i,l=At(t,ED);return C.createElement(o,nt({},l,{ref:n}))}var m=r.className,u=At(r,_D),p=t.className,s=At(t,MD);return C.createElement(Pd.Provider,{value:null},C.createElement(Ql,nt({ref:n,className:ve(m,p)},u,s)))},Gx=C.forwardRef(RD);Gx.displayName="RawItem";var OD=["prefixCls","data","renderItem","renderRawItem","itemKey","itemWidth","ssr","style","className","maxCount","renderRest","renderRawRest","suffix","component","itemComponent","onVisibleChange"],Kx="responsive",Yx="invalidate";function AD(e){return"+ ".concat(e.length," ...")}function TD(e,t){var n=e.prefixCls,r=n===void 0?"rc-overflow":n,i=e.data,o=i===void 0?[]:i,l=e.renderItem,m=e.renderRawItem,u=e.itemKey,p=e.itemWidth,s=p===void 0?10:p,c=e.ssr,d=e.style,h=e.className,f=e.maxCount,v=e.renderRest,y=e.renderRawRest,b=e.suffix,w=e.component,x=w===void 0?"div":w,E=e.itemComponent,_=e.onVisibleChange,$=At(e,OD),O=c==="full",N=xD(),k=Nl(N,null),L=pe(k,2),F=L[0],P=L[1],A=F||0,M=Nl(N,new Map),R=pe(M,2),I=R[0],D=R[1],j=Nl(N,0),B=pe(j,2),V=B[0],H=B[1],Y=Nl(N,0),U=pe(Y,2),K=U[0],G=U[1],q=Nl(N,0),Z=pe(q,2),Q=Z[0],J=Z[1],ie=C.useState(null),se=pe(ie,2),ae=se[0],ge=se[1],me=C.useState(null),de=pe(me,2),we=de[0],Oe=de[1],xe=C.useMemo(function(){return we===null&&O?Number.MAX_SAFE_INTEGER:we||0},[we,F]),Pe=C.useState(!1),ze=pe(Pe,2),Ie=ze[0],Ye=ze[1],Me="".concat(r,"-item"),ke=Math.max(V,K),Je=f===Kx,ce=o.length&&Je,Ee=f===Yx,Re=ce||typeof f=="number"&&o.length>f,Ae=C.useMemo(function(){var dt=o;return ce?F===null&&O?dt=o:dt=o.slice(0,Math.min(o.length,A/s)):typeof f=="number"&&(dt=o.slice(0,f)),dt},[o,s,F,f,ce]),De=C.useMemo(function(){return ce?o.slice(xe+1):o.slice(Ae.length)},[o,Ae,ce,xe]),He=C.useCallback(function(dt,et){var Ke;return typeof u=="function"?u(dt):(Ke=u&&(dt==null?void 0:dt[u]))!==null&&Ke!==void 0?Ke:et},[u]),it=C.useCallback(l||function(dt){return dt},[l]);function Ne(dt,et,Ke){we===dt&&(et===void 0||et===ae)||(Oe(dt),Ke||(Ye(dtA){Ne(_t-1,dt-Tt-Q+K);break}}b&&je(0)+Q>A&&ge(null)}},[A,I,K,Q,He,Ae]);var ct=Ie&&!!De.length,Jt={};ae!==null&&ce&&(Jt={position:"absolute",left:ae,top:0});var kt={prefixCls:Me,responsive:ce,component:E,invalidate:Ee},rn=m?function(dt,et){var Ke=He(dt,et);return C.createElement(Pd.Provider,{key:Ke,value:oe(oe({},kt),{},{order:et,item:dt,itemKey:Ke,registerSize:We,display:et<=xe})},m(dt,et))}:function(dt,et){var Ke=He(dt,et);return C.createElement(Ql,nt({},kt,{order:et,key:Ke,item:dt,renderItem:it,itemKey:Ke,registerSize:We,display:et<=xe}))},Qt={order:ct?xe:Number.MAX_SAFE_INTEGER,className:"".concat(Me,"-rest"),registerSize:te,display:ct},Lt=v||AD,Nt=y?C.createElement(Pd.Provider,{value:oe(oe({},kt),Qt)},y(De)):C.createElement(Ql,nt({},kt,Qt),typeof Lt=="function"?Lt(De):Lt),Et=C.createElement(x,nt({className:ve(!Ee&&r,h),style:d,ref:t},$),Ae.map(rn),Re?Nt:null,b&&C.createElement(Ql,nt({},kt,{responsive:Je,responsiveDisabled:!ce,order:xe,className:"".concat(Me,"-suffix"),registerSize:fe,display:!0,style:Jt}),b));return Je?C.createElement(ki,{onResize:Te,disabled:!ce},Et):Et}var po=C.forwardRef(TD);po.displayName="Overflow";po.Item=Gx;po.RESPONSIVE=Kx;po.INVALIDATE=Yx;function ID(e,t,n){var r=oe(oe({},e),t);return Object.keys(t).forEach(function(i){var o=t[i];typeof o=="function"&&(r[i]=function(){for(var l,m=arguments.length,u=new Array(m),p=0;px&&(ze="".concat(Ie.slice(0,x),"..."))}var Ye=function(ke){ke&&ke.stopPropagation(),N(de)};return typeof $=="function"?J(xe,ze,we,Pe,Ye):Q(de,ze,we,Pe,Ye)},se=function(de){if(!i.length)return null;var we=typeof _=="function"?_(de):_;return typeof $=="function"?J(void 0,we,!1,!1,void 0,!0):Q({title:we},we,!1)},ae=C.createElement("div",{className:"".concat(G,"-search"),style:{width:B},onFocus:function(){K(!0)},onBlur:function(){K(!1)}},C.createElement(Xx,{ref:u,open:o,prefixCls:r,id:n,inputElement:null,disabled:s,autoFocus:h,autoComplete:f,editable:Z,activeDescendantId:v,value:q,onKeyDown:F,onMouseDown:P,onChange:k,onPaste:L,onCompositionStart:A,onCompositionEnd:M,onBlur:R,tabIndex:y,attrs:Wa(t,!0)}),C.createElement("span",{ref:I,className:"".concat(G,"-search-mirror"),"aria-hidden":!0},q," ")),ge=C.createElement(po,{prefixCls:"".concat(G,"-overflow"),data:i,renderItem:ie,renderRest:se,suffix:ae,itemKey:jD,maxCount:w});return C.createElement("span",{className:"".concat(G,"-wrap")},ge,!i.length&&!q&&C.createElement("span",{className:"".concat(G,"-placeholder")},p))},HD=function(t){var n=t.inputElement,r=t.prefixCls,i=t.id,o=t.inputRef,l=t.disabled,m=t.autoFocus,u=t.autoComplete,p=t.activeDescendantId,s=t.mode,c=t.open,d=t.values,h=t.placeholder,f=t.tabIndex,v=t.showSearch,y=t.searchValue,b=t.activeValue,w=t.maxLength,x=t.onInputKeyDown,E=t.onInputMouseDown,_=t.onInputChange,$=t.onInputPaste,O=t.onInputCompositionStart,N=t.onInputCompositionEnd,k=t.onInputBlur,L=t.title,F=C.useState(!1),P=pe(F,2),A=P[0],M=P[1],R=s==="combobox",I=R||v,D=d[0],j=y||"";R&&b&&!A&&(j=b),C.useEffect(function(){R&&M(!1)},[R,b]);var B=s!=="combobox"&&!c&&!v?!1:!!j,V=L===void 0?Qx(D):L,H=C.useMemo(function(){return D?null:C.createElement("span",{className:"".concat(r,"-selection-placeholder"),style:B?{visibility:"hidden"}:void 0},h)},[D,B,h,r]);return C.createElement("span",{className:"".concat(r,"-selection-wrap")},C.createElement("span",{className:"".concat(r,"-selection-search")},C.createElement(Xx,{ref:o,prefixCls:r,id:i,open:c,inputElement:n,disabled:l,autoFocus:m,autoComplete:u,editable:I,activeDescendantId:p,value:j,onKeyDown:x,onMouseDown:E,onChange:function(U){M(!0),_(U)},onPaste:$,onCompositionStart:O,onCompositionEnd:N,onBlur:k,tabIndex:f,attrs:Wa(t,!0),maxLength:R?w:void 0})),!R&&D?C.createElement("span",{className:"".concat(r,"-selection-item"),title:V,style:B?{visibility:"hidden"}:void 0},D.label):null,H)},WD=function(t,n){var r=C.useRef(null),i=C.useRef(!1),o=t.prefixCls,l=t.open,m=t.mode,u=t.showSearch,p=t.tokenWithEnter,s=t.disabled,c=t.prefix,d=t.autoClearSearchValue,h=t.onSearch,f=t.onSearchSubmit,v=t.onToggleOpen,y=t.onInputKeyDown,b=t.onInputBlur,w=t.domRef;C.useImperativeHandle(n,function(){return{focus:function(V){r.current.focus(V)},blur:function(){r.current.blur()}}});var x=Ux(0),E=pe(x,2),_=E[0],$=E[1],O=function(V){var H=V.which,Y=r.current instanceof HTMLTextAreaElement;!Y&&l&&(H===mt.UP||H===mt.DOWN)&&V.preventDefault(),y&&y(V),H===mt.ENTER&&m==="tags"&&!i.current&&!l&&(f==null||f(V.target.value)),!(Y&&!l&&~[mt.UP,mt.DOWN,mt.LEFT,mt.RIGHT].indexOf(H))&&wD(H)&&v(!0)},N=function(){$(!0)},k=C.useRef(null),L=function(V){h(V,!0,i.current)!==!1&&v(!0)},F=function(){i.current=!0},P=function(V){i.current=!1,m!=="combobox"&&L(V.target.value)},A=function(V){var H=V.target.value;if(p&&k.current&&/[\r\n]/.test(k.current)){var Y=k.current.replace(/[\r\n]+$/,"").replace(/\r\n/g," ").replace(/[\r\n]/g," ");H=H.replace(Y,k.current)}k.current=null,L(H)},M=function(V){var H=V.clipboardData,Y=H==null?void 0:H.getData("text");k.current=Y||""},R=function(V){var H=V.target;if(H!==r.current){var Y=document.body.style.msTouchAction!==void 0;Y?setTimeout(function(){r.current.focus()}):r.current.focus()}},I=function(V){var H=_();V.target!==r.current&&!H&&!(m==="combobox"&&s)&&V.preventDefault(),(m!=="combobox"&&(!u||!H)||!l)&&(l&&d!==!1&&h("",!0,!1),v())},D={inputRef:r,onInputKeyDown:O,onInputMouseDown:N,onInputChange:A,onInputPaste:M,onInputCompositionStart:F,onInputCompositionEnd:P,onInputBlur:b},j=m==="multiple"||m==="tags"?C.createElement(BD,nt({},t,D)):C.createElement(HD,nt({},t,D));return C.createElement("div",{ref:w,className:"".concat(o,"-selector"),onClick:R,onMouseDown:I},c&&C.createElement("div",{className:"".concat(o,"-prefix")},c),j)},VD=C.forwardRef(WD);function UD(e){var t=e.prefixCls,n=e.align,r=e.arrow,i=e.arrowPos,o=r||{},l=o.className,m=o.content,u=i.x,p=u===void 0?0:u,s=i.y,c=s===void 0?0:s,d=C.useRef();if(!n||!n.points)return null;var h={position:"absolute"};if(n.autoArrow!==!1){var f=n.points[0],v=n.points[1],y=f[0],b=f[1],w=v[0],x=v[1];y===w||!["t","b"].includes(y)?h.top=c:y==="t"?h.top=0:h.bottom=0,b===x||!["l","r"].includes(b)?h.left=p:b==="l"?h.left=0:h.right=0}return C.createElement("div",{ref:d,className:ve("".concat(t,"-arrow"),l),style:h},m)}function GD(e){var t=e.prefixCls,n=e.open,r=e.zIndex,i=e.mask,o=e.motion;return i?C.createElement(Lo,nt({},o,{motionAppear:!0,visible:n,removeOnLeave:!0}),function(l){var m=l.className;return C.createElement("div",{style:{zIndex:r},className:ve("".concat(t,"-mask"),m)})}):null}var KD=C.memo(function(e){var t=e.children;return t},function(e,t){return t.cache}),YD=C.forwardRef(function(e,t){var n=e.popup,r=e.className,i=e.prefixCls,o=e.style,l=e.target,m=e.onVisibleChanged,u=e.open,p=e.keepDom,s=e.fresh,c=e.onClick,d=e.mask,h=e.arrow,f=e.arrowPos,v=e.align,y=e.motion,b=e.maskMotion,w=e.forceRender,x=e.getPopupContainer,E=e.autoDestroy,_=e.portal,$=e.zIndex,O=e.onMouseEnter,N=e.onMouseLeave,k=e.onPointerEnter,L=e.onPointerDownCapture,F=e.ready,P=e.offsetX,A=e.offsetY,M=e.offsetR,R=e.offsetB,I=e.onAlign,D=e.onPrepare,j=e.stretch,B=e.targetWidth,V=e.targetHeight,H=typeof n=="function"?n():n,Y=u||p,U=(x==null?void 0:x.length)>0,K=C.useState(!x||!U),G=pe(K,2),q=G[0],Z=G[1];if(fn(function(){!q&&U&&l&&Z(!0)},[q,U,l]),!q)return null;var Q="auto",J={left:"-1000vw",top:"-1000vh",right:Q,bottom:Q};if(F||!u){var ie,se=v.points,ae=v.dynamicInset||((ie=v._experimental)===null||ie===void 0?void 0:ie.dynamicInset),ge=ae&&se[0][1]==="r",me=ae&&se[0][0]==="b";ge?(J.right=M,J.left=Q):(J.left=P,J.right=Q),me?(J.bottom=R,J.top=Q):(J.top=A,J.bottom=Q)}var de={};return j&&(j.includes("height")&&V?de.height=V:j.includes("minHeight")&&V&&(de.minHeight=V),j.includes("width")&&B?de.width=B:j.includes("minWidth")&&B&&(de.minWidth=B)),u||(de.pointerEvents="none"),C.createElement(_,{open:w||Y,getContainer:x&&function(){return x(l)},autoDestroy:E},C.createElement(GD,{prefixCls:i,open:u,zIndex:$,mask:d,motion:b}),C.createElement(ki,{onResize:I,disabled:!u},function(we){return C.createElement(Lo,nt({motionAppear:!0,motionEnter:!0,motionLeave:!0,removeOnLeave:!1,forceRender:w,leavedClassName:"".concat(i,"-hidden")},y,{onAppearPrepare:D,onEnterPrepare:D,visible:u,onVisibleChanged:function(xe){var Pe;y==null||(Pe=y.onVisibleChanged)===null||Pe===void 0||Pe.call(y,xe),m(xe)}}),function(Oe,xe){var Pe=Oe.className,ze=Oe.style,Ie=ve(i,Pe,r);return C.createElement("div",{ref:wi(we,t,xe),className:Ie,style:oe(oe(oe(oe({"--arrow-x":"".concat(f.x||0,"px"),"--arrow-y":"".concat(f.y||0,"px")},J),de),ze),{},{boxSizing:"border-box",zIndex:$},o),onMouseEnter:O,onMouseLeave:N,onPointerEnter:k,onClick:c,onPointerDownCapture:L},h&&C.createElement(UD,{prefixCls:i,arrow:h,arrowPos:f,align:v}),C.createElement(KD,{cache:!u&&!s},H))})}))}),XD=C.forwardRef(function(e,t){var n=e.children,r=e.getTriggerDOMNode,i=fa(n),o=C.useCallback(function(m){tv(t,r?r(m):m)},[r]),l=Ga(o,Ka(n));return i?C.cloneElement(n,{ref:l}):n}),sS=C.createContext(null);function lS(e){return e?Array.isArray(e)?e:[e]:[]}function qD(e,t,n,r){return C.useMemo(function(){var i=lS(n??t),o=lS(r??t),l=new Set(i),m=new Set(o);return e&&(l.has("hover")&&(l.delete("hover"),l.add("click")),m.has("hover")&&(m.delete("hover"),m.add("click"))),[l,m]},[e,t,n,r])}function QD(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=arguments.length>2?arguments[2]:void 0;return n?e[0]===t[0]:e[0]===t[0]&&e[1]===t[1]}function ZD(e,t,n,r){for(var i=n.points,o=Object.keys(e),l=0;l1&&arguments[1]!==void 0?arguments[1]:1;return Number.isNaN(e)?t:e}function Dl(e){return gc(parseFloat(e),0)}function uS(e,t){var n=oe({},e);return(t||[]).forEach(function(r){if(!(r instanceof HTMLBodyElement||r instanceof HTMLHtmlElement)){var i=Nc(r).getComputedStyle(r),o=i.overflow,l=i.overflowClipMargin,m=i.borderTopWidth,u=i.borderBottomWidth,p=i.borderLeftWidth,s=i.borderRightWidth,c=r.getBoundingClientRect(),d=r.offsetHeight,h=r.clientHeight,f=r.offsetWidth,v=r.clientWidth,y=Dl(m),b=Dl(u),w=Dl(p),x=Dl(s),E=gc(Math.round(c.width/f*1e3)/1e3),_=gc(Math.round(c.height/d*1e3)/1e3),$=(f-v-w-x)*E,O=(d-h-y-b)*_,N=y*_,k=b*_,L=w*E,F=x*E,P=0,A=0;if(o==="clip"){var M=Dl(l);P=M*E,A=M*_}var R=c.x+L-P,I=c.y+N-A,D=R+c.width+2*P-L-F-$,j=I+c.height+2*A-N-k-O;n.left=Math.max(n.left,R),n.top=Math.max(n.top,I),n.right=Math.min(n.right,D),n.bottom=Math.min(n.bottom,j)}}),n}function dS(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n="".concat(t),r=n.match(/^(.*)\%$/);return r?e*(parseFloat(r[1])/100):parseFloat(n)}function fS(e,t){var n=t||[],r=pe(n,2),i=r[0],o=r[1];return[dS(e.width,i),dS(e.height,o)]}function hS(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return[e[0],e[1]]}function Cs(e,t){var n=t[0],r=t[1],i,o;return n==="t"?o=e.y:n==="b"?o=e.y+e.height:o=e.y+e.height/2,r==="l"?i=e.x:r==="r"?i=e.x+e.width:i=e.x+e.width/2,{x:i,y:o}}function Jo(e,t){var n={t:"b",b:"t",l:"r",r:"l"};return e.map(function(r,i){return i===t?n[r]||"c":r}).join("")}function JD(e,t,n,r,i,o,l){var m=C.useState({ready:!1,offsetX:0,offsetY:0,offsetR:0,offsetB:0,arrowX:0,arrowY:0,scaleX:1,scaleY:1,align:i[r]||{}}),u=pe(m,2),p=u[0],s=u[1],c=C.useRef(0),d=C.useMemo(function(){return t?Sm(t):[]},[t]),h=C.useRef({}),f=function(){h.current={}};e||f();var v=tr(function(){if(t&&n&&e){let Kn=function(Hn,or){var Zr=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ke,Vr=K.x+Hn,Ur=K.y+or,mo=Vr+ge,pt=Ur+ae,xt=Math.max(Vr,Zr.left),bn=Math.max(Ur,Zr.top),_n=Math.min(mo,Zr.right),sn=Math.min(pt,Zr.bottom);return Math.max(0,(_n-xt)*(sn-bn))},Or=function(){Ht=K.y+Ke,yn=Ht+ae,Cn=K.x+et,Rn=Cn+ge};var ga=Kn,ko=Or,w,x,E,_,$=t,O=$.ownerDocument,N=Nc($),k=N.getComputedStyle($),L=k.width,F=k.height,P=k.position,A=$.style.left,M=$.style.top,R=$.style.right,I=$.style.bottom,D=$.style.overflow,j=oe(oe({},i[r]),o),B=O.createElement("div");(w=$.parentElement)===null||w===void 0||w.appendChild(B),B.style.left="".concat($.offsetLeft,"px"),B.style.top="".concat($.offsetTop,"px"),B.style.position=P,B.style.height="".concat($.offsetHeight,"px"),B.style.width="".concat($.offsetWidth,"px"),$.style.left="0",$.style.top="0",$.style.right="auto",$.style.bottom="auto",$.style.overflow="hidden";var V;if(Array.isArray(n))V={x:n[0],y:n[1],width:0,height:0};else{var H,Y,U=n.getBoundingClientRect();U.x=(H=U.x)!==null&&H!==void 0?H:U.left,U.y=(Y=U.y)!==null&&Y!==void 0?Y:U.top,V={x:U.x,y:U.y,width:U.width,height:U.height}}var K=$.getBoundingClientRect();K.x=(x=K.x)!==null&&x!==void 0?x:K.left,K.y=(E=K.y)!==null&&E!==void 0?E:K.top;var G=O.documentElement,q=G.clientWidth,Z=G.clientHeight,Q=G.scrollWidth,J=G.scrollHeight,ie=G.scrollTop,se=G.scrollLeft,ae=K.height,ge=K.width,me=V.height,de=V.width,we={left:0,top:0,right:q,bottom:Z},Oe={left:-se,top:-ie,right:Q-se,bottom:J-ie},xe=j.htmlRegion,Pe="visible",ze="visibleFirst";xe!=="scroll"&&xe!==ze&&(xe=Pe);var Ie=xe===ze,Ye=uS(Oe,d),Me=uS(we,d),ke=xe===Pe?Me:Ye,Je=Ie?Me:ke;$.style.left="auto",$.style.top="auto",$.style.right="0",$.style.bottom="0";var ce=$.getBoundingClientRect();$.style.left=A,$.style.top=M,$.style.right=R,$.style.bottom=I,$.style.overflow=D,(_=$.parentElement)===null||_===void 0||_.removeChild(B);var Ee=gc(Math.round(ge/parseFloat(L)*1e3)/1e3),Re=gc(Math.round(ae/parseFloat(F)*1e3)/1e3);if(Ee===0||Re===0||rc(n)&&!rf(n))return;var Ae=j.offset,De=j.targetOffset,He=fS(K,Ae),it=pe(He,2),Ne=it[0],Te=it[1],We=fS(V,De),te=pe(We,2),fe=te[0],je=te[1];V.x-=fe,V.y-=je;var ct=j.points||[],Jt=pe(ct,2),kt=Jt[0],rn=Jt[1],Qt=hS(rn),Lt=hS(kt),Nt=Cs(V,Qt),Et=Cs(K,Lt),dt=oe({},j),et=Nt.x-Et.x+Ne,Ke=Nt.y-Et.y+Te,_t=Kn(et,Ke),Tt=Kn(et,Ke,Me),tt=Cs(V,["t","l"]),Ze=Cs(K,["t","l"]),at=Cs(V,["b","r"]),ot=Cs(K,["b","r"]),rt=j.overflow||{},vt=rt.adjustX,on=rt.adjustY,Bt=rt.shiftX,Gt=rt.shiftY,Dt=function(or){return typeof or=="boolean"?or:or>=0},Ht,yn,Cn,Rn;Or();var cn=Dt(on),Kt=Lt[0]===Qt[0];if(cn&&Lt[0]==="t"&&(yn>Je.bottom||h.current.bt)){var Xe=Ke;Kt?Xe-=ae-me:Xe=tt.y-ot.y-Te;var ut=Kn(et,Xe),st=Kn(et,Xe,Me);ut>_t||ut===_t&&(!Ie||st>=Tt)?(h.current.bt=!0,Ke=Xe,Te=-Te,dt.points=[Jo(Lt,0),Jo(Qt,0)]):h.current.bt=!1}if(cn&&Lt[0]==="b"&&(Ht_t||Ct===_t&&(!Ie||Ft>=Tt)?(h.current.tb=!0,Ke=Le,Te=-Te,dt.points=[Jo(Lt,0),Jo(Qt,0)]):h.current.tb=!1}var en=Dt(vt),hn=Lt[1]===Qt[1];if(en&&Lt[1]==="l"&&(Rn>Je.right||h.current.rl)){var Dn=et;hn?Dn-=ge-de:Dn=tt.x-ot.x-Ne;var Yt=Kn(Dn,Ke),$n=Kn(Dn,Ke,Me);Yt>_t||Yt===_t&&(!Ie||$n>=Tt)?(h.current.rl=!0,et=Dn,Ne=-Ne,dt.points=[Jo(Lt,1),Jo(Qt,1)]):h.current.rl=!1}if(en&&Lt[1]==="r"&&(Cn_t||Wr===_t&&(!Ie||Fn>=Tt)?(h.current.lr=!0,et=ln,Ne=-Ne,dt.points=[Jo(Lt,1),Jo(Qt,1)]):h.current.lr=!1}Or();var Gn=Bt===!0?0:Bt;typeof Gn=="number"&&(CnMe.right&&(et-=Rn-Me.right-Ne,V.x>Me.right-Gn&&(et+=V.x-Me.right+Gn)));var qn=Gt===!0?0:Gt;typeof qn=="number"&&(HtMe.bottom&&(Ke-=yn-Me.bottom-Te,V.y>Me.bottom-qn&&(Ke+=V.y-Me.bottom+qn)));var _r=K.x+et,Mr=_r+ge,Ln=K.y+Ke,Rr=Ln+ae,Vt=V.x,ft=Vt+de,lt=V.y,Xt=lt+me,Zt=Math.max(_r,Vt),an=Math.min(Mr,ft),un=(Zt+an)/2,dr=un-_r,zn=Math.max(Ln,lt),Ot=Math.min(Rr,Xt),On=(zn+Ot)/2,ir=On-Ln;l==null||l(t,dt);var mr=ce.right-K.x-(et+K.width),En=ce.bottom-K.y-(Ke+K.height);Ee===1&&(et=Math.round(et),mr=Math.round(mr)),Re===1&&(Ke=Math.round(Ke),En=Math.round(En));var Po={ready:!0,offsetX:et/Ee,offsetY:Ke/Re,offsetR:mr/Ee,offsetB:En/Re,arrowX:dr/Ee,arrowY:ir/Re,scaleX:Ee,scaleY:Re,align:dt};s(Po)}}),y=function(){c.current+=1;var x=c.current;Promise.resolve().then(function(){c.current===x&&v()})},b=function(){s(function(x){return oe(oe({},x),{},{ready:!1})})};return fn(b,[r]),fn(function(){e||b()},[e]),[p.ready,p.offsetX,p.offsetY,p.offsetR,p.offsetB,p.arrowX,p.arrowY,p.scaleX,p.scaleY,p.align,y]}function eF(e,t,n,r,i){fn(function(){if(e&&t&&n){let d=function(){r(),i()};var c=d,o=t,l=n,m=Sm(o),u=Sm(l),p=Nc(l),s=new Set([p].concat(Ge(m),Ge(u)));return s.forEach(function(h){h.addEventListener("scroll",d,{passive:!0})}),p.addEventListener("resize",d,{passive:!0}),r(),function(){s.forEach(function(h){h.removeEventListener("scroll",d),p.removeEventListener("resize",d)})}}},[e,t,n])}function tF(e,t,n,r,i,o,l,m){var u=C.useRef(e);u.current=e;var p=C.useRef(!1);C.useEffect(function(){if(t&&r&&(!i||o)){var c=function(){p.current=!1},d=function(y){var b;u.current&&!l(((b=y.composedPath)===null||b===void 0||(b=b.call(y))===null||b===void 0?void 0:b[0])||y.target)&&!p.current&&m(!1)},h=Nc(r);h.addEventListener("pointerdown",c,!0),h.addEventListener("mousedown",d,!0),h.addEventListener("contextmenu",d,!0);var f=Td(n);return f&&(f.addEventListener("mousedown",d,!0),f.addEventListener("contextmenu",d,!0)),function(){h.removeEventListener("pointerdown",c,!0),h.removeEventListener("mousedown",d,!0),h.removeEventListener("contextmenu",d,!0),f&&(f.removeEventListener("mousedown",d,!0),f.removeEventListener("contextmenu",d,!0))}}},[t,n,r,i,o]);function s(){p.current=!0}return s}var nF=["prefixCls","children","action","showAction","hideAction","popupVisible","defaultPopupVisible","onPopupVisibleChange","afterPopupVisibleChange","mouseEnterDelay","mouseLeaveDelay","focusDelay","blurDelay","mask","maskClosable","getPopupContainer","forceRender","autoDestroy","destroyPopupOnHide","popup","popupClassName","popupStyle","popupPlacement","builtinPlacements","popupAlign","zIndex","stretch","getPopupClassNameFromAlign","fresh","alignPoint","onPopupClick","onPopupAlign","arrow","popupMotion","maskMotion","popupTransitionName","popupAnimation","maskTransitionName","maskAnimation","className","getTriggerDOMNode"];function rF(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Ex,t=C.forwardRef(function(n,r){var i=n.prefixCls,o=i===void 0?"rc-trigger-popup":i,l=n.children,m=n.action,u=m===void 0?"hover":m,p=n.showAction,s=n.hideAction,c=n.popupVisible,d=n.defaultPopupVisible,h=n.onPopupVisibleChange,f=n.afterPopupVisibleChange,v=n.mouseEnterDelay,y=n.mouseLeaveDelay,b=y===void 0?.1:y,w=n.focusDelay,x=n.blurDelay,E=n.mask,_=n.maskClosable,$=_===void 0?!0:_,O=n.getPopupContainer,N=n.forceRender,k=n.autoDestroy,L=n.destroyPopupOnHide,F=n.popup,P=n.popupClassName,A=n.popupStyle,M=n.popupPlacement,R=n.builtinPlacements,I=R===void 0?{}:R,D=n.popupAlign,j=n.zIndex,B=n.stretch,V=n.getPopupClassNameFromAlign,H=n.fresh,Y=n.alignPoint,U=n.onPopupClick,K=n.onPopupAlign,G=n.arrow,q=n.popupMotion,Z=n.maskMotion,Q=n.popupTransitionName,J=n.popupAnimation,ie=n.maskTransitionName,se=n.maskAnimation,ae=n.className,ge=n.getTriggerDOMNode,me=At(n,nF),de=k||L||!1,we=C.useState(!1),Oe=pe(we,2),xe=Oe[0],Pe=Oe[1];fn(function(){Pe(Tv())},[]);var ze=C.useRef({}),Ie=C.useContext(sS),Ye=C.useMemo(function(){return{registerSubPopup:function(xt,bn){ze.current[xt]=bn,Ie==null||Ie.registerSubPopup(xt,bn)}}},[Ie]),Me=_x(),ke=C.useState(null),Je=pe(ke,2),ce=Je[0],Ee=Je[1],Re=C.useRef(null),Ae=tr(function(pt){Re.current=pt,rc(pt)&&ce!==pt&&Ee(pt),Ie==null||Ie.registerSubPopup(Me,pt)}),De=C.useState(null),He=pe(De,2),it=He[0],Ne=He[1],Te=C.useRef(null),We=tr(function(pt){rc(pt)&&it!==pt&&(Ne(pt),Te.current=pt)}),te=C.Children.only(l),fe=(te==null?void 0:te.props)||{},je={},ct=tr(function(pt){var xt,bn,_n=it;return(_n==null?void 0:_n.contains(pt))||((xt=Td(_n))===null||xt===void 0?void 0:xt.host)===pt||pt===_n||(ce==null?void 0:ce.contains(pt))||((bn=Td(ce))===null||bn===void 0?void 0:bn.host)===pt||pt===ce||Object.values(ze.current).some(function(sn){return(sn==null?void 0:sn.contains(pt))||pt===sn})}),Jt=cS(o,q,J,Q),kt=cS(o,Z,se,ie),rn=C.useState(d||!1),Qt=pe(rn,2),Lt=Qt[0],Nt=Qt[1],Et=c??Lt,dt=tr(function(pt){c===void 0&&Nt(pt)});fn(function(){Nt(c||!1)},[c]);var et=C.useRef(Et);et.current=Et;var Ke=C.useRef([]);Ke.current=[];var _t=tr(function(pt){var xt;dt(pt),((xt=Ke.current[Ke.current.length-1])!==null&&xt!==void 0?xt:Et)!==pt&&(Ke.current.push(pt),h==null||h(pt))}),Tt=C.useRef(),tt=function(){clearTimeout(Tt.current)},Ze=function(xt){var bn=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;tt(),bn===0?_t(xt):Tt.current=setTimeout(function(){_t(xt)},bn*1e3)};C.useEffect(function(){return tt},[]);var at=C.useState(!1),ot=pe(at,2),rt=ot[0],vt=ot[1];fn(function(pt){(!pt||Et)&&vt(!0)},[Et]);var on=C.useState(null),Bt=pe(on,2),Gt=Bt[0],Dt=Bt[1],Ht=C.useState(null),yn=pe(Ht,2),Cn=yn[0],Rn=yn[1],cn=function(xt){Rn([xt.clientX,xt.clientY])},Kt=JD(Et,ce,Y&&Cn!==null?Cn:it,M,I,D,K),Xe=pe(Kt,11),ut=Xe[0],st=Xe[1],Le=Xe[2],Ct=Xe[3],Ft=Xe[4],en=Xe[5],hn=Xe[6],Dn=Xe[7],Yt=Xe[8],$n=Xe[9],ln=Xe[10],Wr=qD(xe,u,p,s),Fn=pe(Wr,2),Gn=Fn[0],qn=Fn[1],_r=Gn.has("click"),Mr=qn.has("click")||qn.has("contextMenu"),Ln=tr(function(){rt||ln()}),Rr=function(){et.current&&Y&&Mr&&Ze(!1)};eF(Et,it,ce,Ln,Rr),fn(function(){Ln()},[Cn,M]),fn(function(){Et&&!(I!=null&&I[M])&&Ln()},[JSON.stringify(D)]);var Vt=C.useMemo(function(){var pt=ZD(I,o,$n,Y);return ve(pt,V==null?void 0:V($n))},[$n,V,I,o,Y]);C.useImperativeHandle(r,function(){return{nativeElement:Te.current,popupElement:Re.current,forceAlign:Ln}});var ft=C.useState(0),lt=pe(ft,2),Xt=lt[0],Zt=lt[1],an=C.useState(0),un=pe(an,2),dr=un[0],zn=un[1],Ot=function(){if(B&&it){var xt=it.getBoundingClientRect();Zt(xt.width),zn(xt.height)}},On=function(){Ot(),Ln()},ir=function(xt){vt(!1),ln(),f==null||f(xt)},mr=function(){return new Promise(function(xt){Ot(),Dt(function(){return xt})})};fn(function(){Gt&&(ln(),Gt(),Dt(null))},[Gt]);function En(pt,xt,bn,_n){je[pt]=function(sn){var ro;_n==null||_n(sn),Ze(xt,bn);for(var ma=arguments.length,io=new Array(ma>1?ma-1:0),Ci=1;Ci1?bn-1:0),sn=1;sn1?bn-1:0),sn=1;sn1&&arguments[1]!==void 0?arguments[1]:{},n=t.fieldNames,r=t.childrenAsData,i=[],o=Zx(n,!1),l=o.label,m=o.value,u=o.options,p=o.groupLabel;function s(c,d){Array.isArray(c)&&c.forEach(function(h){if(d||!(u in h)){var f=h[m];i.push({key:pS(h,i.length),groupOption:d,data:h,label:h[l],value:f})}else{var v=h[p];v===void 0&&r&&(v=h.label),i.push({key:pS(h,i.length),group:!0,data:h,label:v}),s(h[u],!0)}})}return s(e,!1),i}function $m(e){var t=oe({},e);return"props"in t||Object.defineProperty(t,"props",{get:function(){return Lr(!1,"Return type is option instead of Option instance. Please read value directly instead of reading from `props`."),t}}),t}var cF=function(t,n,r){if(!n||!n.length)return null;var i=!1,o=function m(u,p){var s=u$(p),c=s[0],d=s.slice(1);if(!c)return[u];var h=u.split(c);return i=i||h.length>1,h.reduce(function(f,v){return[].concat(Ge(f),Ge(m(v,d)))},[]).filter(Boolean)},l=o(t,n);return i?typeof r<"u"?l.slice(0,r):l:null},Iv=C.createContext(null);function uF(e){var t=e.visible,n=e.values;if(!t)return null;var r=50;return C.createElement("span",{"aria-live":"polite",style:{width:0,height:0,position:"absolute",overflow:"hidden",opacity:0}},"".concat(n.slice(0,r).map(function(i){var o=i.label,l=i.value;return["number","string"].includes(wt(o))?o:l}).join(", ")),n.length>r?", ...":null)}var dF=["id","prefixCls","className","showSearch","tagRender","direction","omitDomProps","displayValues","onDisplayValuesChange","emptyOptions","notFoundContent","onClear","mode","disabled","loading","getInputElement","getRawInputElement","open","defaultOpen","onDropdownVisibleChange","activeValue","onActiveValueChange","activeDescendantId","searchValue","autoClearSearchValue","onSearch","onSearchSplit","tokenSeparators","allowClear","prefix","suffixIcon","clearIcon","OptionList","animation","transitionName","dropdownStyle","dropdownClassName","dropdownMatchSelectWidth","dropdownRender","dropdownAlign","placement","builtinPlacements","getPopupContainer","showAction","onFocus","onBlur","onKeyUp","onKeyDown","onMouseDown"],fF=["value","onChange","removeIcon","placeholder","autoFocus","maxTagCount","maxTagTextLength","maxTagPlaceholder","choiceTransitionName","onInputKeyDown","onPopupScroll","tabIndex"],xm=function(t){return t==="tags"||t==="multiple"},hF=C.forwardRef(function(e,t){var n,r=e.id,i=e.prefixCls,o=e.className,l=e.showSearch,m=e.tagRender,u=e.direction,p=e.omitDomProps,s=e.displayValues,c=e.onDisplayValuesChange,d=e.emptyOptions,h=e.notFoundContent,f=h===void 0?"Not Found":h,v=e.onClear,y=e.mode,b=e.disabled,w=e.loading,x=e.getInputElement,E=e.getRawInputElement,_=e.open,$=e.defaultOpen,O=e.onDropdownVisibleChange,N=e.activeValue,k=e.onActiveValueChange,L=e.activeDescendantId,F=e.searchValue,P=e.autoClearSearchValue,A=e.onSearch,M=e.onSearchSplit,R=e.tokenSeparators,I=e.allowClear,D=e.prefix,j=e.suffixIcon,B=e.clearIcon,V=e.OptionList,H=e.animation,Y=e.transitionName,U=e.dropdownStyle,K=e.dropdownClassName,G=e.dropdownMatchSelectWidth,q=e.dropdownRender,Z=e.dropdownAlign,Q=e.placement,J=e.builtinPlacements,ie=e.getPopupContainer,se=e.showAction,ae=se===void 0?[]:se,ge=e.onFocus,me=e.onBlur,de=e.onKeyUp,we=e.onKeyDown,Oe=e.onMouseDown,xe=At(e,dF),Pe=xm(y),ze=(l!==void 0?l:Pe)||y==="combobox",Ie=oe({},xe);fF.forEach(function(ft){delete Ie[ft]}),p==null||p.forEach(function(ft){delete Ie[ft]});var Ye=C.useState(!1),Me=pe(Ye,2),ke=Me[0],Je=Me[1];C.useEffect(function(){Je(Tv())},[]);var ce=C.useRef(null),Ee=C.useRef(null),Re=C.useRef(null),Ae=C.useRef(null),De=C.useRef(null),He=C.useRef(!1),it=yD(),Ne=pe(it,3),Te=Ne[0],We=Ne[1],te=Ne[2];C.useImperativeHandle(t,function(){var ft,lt;return{focus:(ft=Ae.current)===null||ft===void 0?void 0:ft.focus,blur:(lt=Ae.current)===null||lt===void 0?void 0:lt.blur,scrollTo:function(Zt){var an;return(an=De.current)===null||an===void 0?void 0:an.scrollTo(Zt)},nativeElement:ce.current||Ee.current}});var fe=C.useMemo(function(){var ft;if(y!=="combobox")return F;var lt=(ft=s[0])===null||ft===void 0?void 0:ft.value;return typeof lt=="string"||typeof lt=="number"?String(lt):""},[F,y,s]),je=y==="combobox"&&typeof x=="function"&&x()||null,ct=typeof E=="function"&&E(),Jt=Ga(Ee,ct==null||(n=ct.props)===null||n===void 0?void 0:n.ref),kt=C.useState(!1),rn=pe(kt,2),Qt=rn[0],Lt=rn[1];fn(function(){Lt(!0)},[]);var Nt=Pr(!1,{defaultValue:$,value:_}),Et=pe(Nt,2),dt=Et[0],et=Et[1],Ke=Qt?dt:!1,_t=!f&&d;(b||_t&&Ke&&y==="combobox")&&(Ke=!1);var Tt=_t?!1:Ke,tt=C.useCallback(function(ft){var lt=ft!==void 0?ft:!Ke;b||(et(lt),Ke!==lt&&(O==null||O(lt)))},[b,Ke,et,O]),Ze=C.useMemo(function(){return(R||[]).some(function(ft){return[` +`,`\r +`].includes(ft)})},[R]),at=C.useContext(Iv)||{},ot=at.maxCount,rt=at.rawValues,vt=function(lt,Xt,Zt){if(!(Pe&&Cm(ot)&&(rt==null?void 0:rt.size)>=ot)){var an=!0,un=lt;k==null||k(null);var dr=cF(lt,R,Cm(ot)?ot-rt.size:void 0),zn=Zt?null:dr;return y!=="combobox"&&zn&&(un="",M==null||M(zn),tt(!1),an=!1),A&&fe!==un&&A(un,{source:Xt?"typing":"effect"}),an}},on=function(lt){!lt||!lt.trim()||A(lt,{source:"submit"})};C.useEffect(function(){!Ke&&!Pe&&y!=="combobox"&&vt("",!1,!1)},[Ke]),C.useEffect(function(){dt&&b&&et(!1),b&&!He.current&&We(!1)},[b]);var Bt=Ux(),Gt=pe(Bt,2),Dt=Gt[0],Ht=Gt[1],yn=C.useRef(!1),Cn=function(lt){var Xt=Dt(),Zt=lt.key,an=Zt==="Enter";if(an&&(y!=="combobox"&<.preventDefault(),Ke||tt(!0)),Ht(!!fe),Zt==="Backspace"&&!Xt&&Pe&&!fe&&s.length){for(var un=Ge(s),dr=null,zn=un.length-1;zn>=0;zn-=1){var Ot=un[zn];if(!Ot.disabled){un.splice(zn,1),dr=Ot;break}}dr&&c(un,{type:"remove",values:[dr]})}for(var On=arguments.length,ir=new Array(On>1?On-1:0),mr=1;mr1?Xt-1:0),an=1;an1?dr-1:0),Ot=1;Ot"u"?"undefined":wt(navigator))==="object"&&/Firefox/i.test(navigator.userAgent);const eE=function(e,t,n,r){var i=C.useRef(!1),o=C.useRef(null);function l(){clearTimeout(o.current),i.current=!0,o.current=setTimeout(function(){i.current=!1},50)}var m=C.useRef({top:e,bottom:t,left:n,right:r});return m.current.top=e,m.current.bottom=t,m.current.left=n,m.current.right=r,function(u,p){var s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,c=u?p<0&&m.current.left||p>0&&m.current.right:p<0&&m.current.top||p>0&&m.current.bottom;return s&&c?(clearTimeout(o.current),i.current=!1):(!c||i.current)&&l(),!i.current&&c}};function yF(e,t,n,r,i,o,l){var m=C.useRef(0),u=C.useRef(null),p=C.useRef(null),s=C.useRef(!1),c=eE(t,n,r,i);function d(w,x){if(gn.cancel(u.current),!c(!1,x)){var E=w;if(!E._virtualHandled)E._virtualHandled=!0;else return;m.current+=x,p.current=x,gS||E.preventDefault(),u.current=gn(function(){var _=s.current?10:1;l(m.current*_,!1),m.current=0})}}function h(w,x){l(x,!0),gS||w.preventDefault()}var f=C.useRef(null),v=C.useRef(null);function y(w){if(e){gn.cancel(v.current),v.current=gn(function(){f.current=null},2);var x=w.deltaX,E=w.deltaY,_=w.shiftKey,$=x,O=E;(f.current==="sx"||!f.current&&_&&E&&!x)&&($=E,O=0,f.current="sx");var N=Math.abs($),k=Math.abs(O);f.current===null&&(f.current=o&&N>k?"x":"y"),f.current==="y"?d(w,O):h(w,$)}}function b(w){e&&(s.current=w.detail===p.current)}return[y,b]}function bF(e,t,n,r){var i=C.useMemo(function(){return[new Map,[]]},[e,n.id,r]),o=pe(i,2),l=o[0],m=o[1],u=function(s){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:s,d=l.get(s),h=l.get(c);if(d===void 0||h===void 0)for(var f=e.length,v=m.length;v0&&arguments[0]!==void 0?arguments[0]:!1;s();var f=function(){var b=!1;m.current.forEach(function(w,x){if(w&&w.offsetParent){var E=w.offsetHeight,_=getComputedStyle(w),$=_.marginTop,O=_.marginBottom,N=mS($),k=mS(O),L=E+N+k;u.current.get(x)!==L&&(u.current.set(x,L),b=!0)}}),b&&l(function(w){return w+1})};if(h)f();else{p.current+=1;var v=p.current;Promise.resolve().then(function(){v===p.current&&f()})}}function d(h,f){var v=e(h);m.current.get(v),f?(m.current.set(v,f),c()):m.current.delete(v)}return C.useEffect(function(){return s},[]),[d,c,u.current,o]}var vS=14/15;function CF(e,t,n){var r=C.useRef(!1),i=C.useRef(0),o=C.useRef(0),l=C.useRef(null),m=C.useRef(null),u,p=function(h){if(r.current){var f=Math.ceil(h.touches[0].pageX),v=Math.ceil(h.touches[0].pageY),y=i.current-f,b=o.current-v,w=Math.abs(y)>Math.abs(b);w?i.current=f:o.current=v;var x=n(w,w?y:b,!1,h);x&&h.preventDefault(),clearInterval(m.current),x&&(m.current=setInterval(function(){w?y*=vS:b*=vS;var E=Math.floor(w?y:b);(!n(w,E,!0)||Math.abs(E)<=.1)&&clearInterval(m.current)},16))}},s=function(){r.current=!1,u()},c=function(h){u(),h.touches.length===1&&!r.current&&(r.current=!0,i.current=Math.ceil(h.touches[0].pageX),o.current=Math.ceil(h.touches[0].pageY),l.current=h.target,l.current.addEventListener("touchmove",p,{passive:!1}),l.current.addEventListener("touchend",s,{passive:!0}))};u=function(){l.current&&(l.current.removeEventListener("touchmove",p),l.current.removeEventListener("touchend",s))},fn(function(){return e&&t.current.addEventListener("touchstart",c,{passive:!0}),function(){var d;(d=t.current)===null||d===void 0||d.removeEventListener("touchstart",c),u(),clearInterval(m.current)}},[e])}function yS(e){return Math.floor(Math.pow(e,.5))}function Em(e,t){var n="touches"in e?e.touches[0]:e;return n[t?"pageX":"pageY"]-window[t?"scrollX":"scrollY"]}function $F(e,t,n){C.useEffect(function(){var r=t.current;if(e&&r){var i=!1,o,l,m=function(){gn.cancel(o)},u=function d(){m(),o=gn(function(){n(l),d()})},p=function(h){if(!(h.target.draggable||h.button!==0)){var f=h;f._virtualHandled||(f._virtualHandled=!0,i=!0)}},s=function(){i=!1,m()},c=function(h){if(i){var f=Em(h,!1),v=r.getBoundingClientRect(),y=v.top,b=v.bottom;if(f<=y){var w=y-f;l=-yS(w),u()}else if(f>=b){var x=f-b;l=yS(x),u()}else m()}};return r.addEventListener("mousedown",p),r.ownerDocument.addEventListener("mouseup",s),r.ownerDocument.addEventListener("mousemove",c),function(){r.removeEventListener("mousedown",p),r.ownerDocument.removeEventListener("mouseup",s),r.ownerDocument.removeEventListener("mousemove",c),m()}}},[e])}var xF=10;function EF(e,t,n,r,i,o,l,m){var u=C.useRef(),p=C.useState(null),s=pe(p,2),c=s[0],d=s[1];return fn(function(){if(c&&c.times=0;M-=1){var R=i(t[M]),I=n.get(R);if(I===void 0){w=!0;break}if(A-=I,A<=0)break}switch(_){case"top":E=O-y;break;case"bottom":E=N-b+y;break;default:{var D=e.current.scrollTop,j=D+b;Oj&&(x="bottom")}}E!==null&&l(E),E!==c.lastTop&&(w=!0)}w&&d(oe(oe({},c),{},{times:c.times+1,targetAlign:x,lastTop:E}))}},[c,e.current]),function(h){if(h==null){m();return}if(gn.cancel(u.current),typeof h=="number")l(h);else if(h&&wt(h)==="object"){var f,v=h.align;"index"in h?f=h.index:f=t.findIndex(function(w){return i(w)===h.key});var y=h.offset,b=y===void 0?0:y;d({times:0,index:f,offset:b,originAlign:v})}}}var bS=C.forwardRef(function(e,t){var n=e.prefixCls,r=e.rtl,i=e.scrollOffset,o=e.scrollRange,l=e.onStartMove,m=e.onStopMove,u=e.onScroll,p=e.horizontal,s=e.spinSize,c=e.containerSize,d=e.style,h=e.thumbStyle,f=e.showScrollBar,v=C.useState(!1),y=pe(v,2),b=y[0],w=y[1],x=C.useState(null),E=pe(x,2),_=E[0],$=E[1],O=C.useState(null),N=pe(O,2),k=N[0],L=N[1],F=!r,P=C.useRef(),A=C.useRef(),M=C.useState(f),R=pe(M,2),I=R[0],D=R[1],j=C.useRef(),B=function(){f===!0||f===!1||(clearTimeout(j.current),D(!0),j.current=setTimeout(function(){D(!1)},3e3))},V=o-c||0,H=c-s||0,Y=C.useMemo(function(){if(i===0||V===0)return 0;var se=i/V;return se*H},[i,V,H]),U=function(ae){ae.stopPropagation(),ae.preventDefault()},K=C.useRef({top:Y,dragging:b,pageY:_,startTop:k});K.current={top:Y,dragging:b,pageY:_,startTop:k};var G=function(ae){w(!0),$(Em(ae,p)),L(K.current.top),l(),ae.stopPropagation(),ae.preventDefault()};C.useEffect(function(){var se=function(de){de.preventDefault()},ae=P.current,ge=A.current;return ae.addEventListener("touchstart",se,{passive:!1}),ge.addEventListener("touchstart",G,{passive:!1}),function(){ae.removeEventListener("touchstart",se),ge.removeEventListener("touchstart",G)}},[]);var q=C.useRef();q.current=V;var Z=C.useRef();Z.current=H,C.useEffect(function(){if(b){var se,ae=function(de){var we=K.current,Oe=we.dragging,xe=we.pageY,Pe=we.startTop;gn.cancel(se);var ze=P.current.getBoundingClientRect(),Ie=c/(p?ze.width:ze.height);if(Oe){var Ye=(Em(de,p)-xe)*Ie,Me=Pe;!F&&p?Me-=Ye:Me+=Ye;var ke=q.current,Je=Z.current,ce=Je?Me/Je:0,Ee=Math.ceil(ce*ke);Ee=Math.max(Ee,0),Ee=Math.min(Ee,ke),se=gn(function(){u(Ee,p)})}},ge=function(){w(!1),m()};return window.addEventListener("mousemove",ae,{passive:!0}),window.addEventListener("touchmove",ae,{passive:!0}),window.addEventListener("mouseup",ge,{passive:!0}),window.addEventListener("touchend",ge,{passive:!0}),function(){window.removeEventListener("mousemove",ae),window.removeEventListener("touchmove",ae),window.removeEventListener("mouseup",ge),window.removeEventListener("touchend",ge),gn.cancel(se)}}},[b]),C.useEffect(function(){return B(),function(){clearTimeout(j.current)}},[i]),C.useImperativeHandle(t,function(){return{delayHidden:B}});var Q="".concat(n,"-scrollbar"),J={position:"absolute",visibility:I?null:"hidden"},ie={position:"absolute",background:"rgba(0, 0, 0, 0.5)",borderRadius:99,cursor:"pointer",userSelect:"none"};return p?(J.height=8,J.left=0,J.right=0,J.bottom=0,ie.height="100%",ie.width=s,F?ie.left=Y:ie.right=Y):(J.width=8,J.top=0,J.bottom=0,F?J.right=0:J.left=0,ie.width="100%",ie.height=s,ie.top=Y),C.createElement("div",{ref:P,className:ve(Q,ne(ne(ne({},"".concat(Q,"-horizontal"),p),"".concat(Q,"-vertical"),!p),"".concat(Q,"-visible"),I)),style:oe(oe({},J),d),onMouseDown:U,onMouseMove:B},C.createElement("div",{ref:A,className:ve("".concat(Q,"-thumb"),ne({},"".concat(Q,"-thumb-moving"),b)),style:oe(oe({},ie),h),onMouseDown:G}))}),_F=20;function wS(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=e/t*e;return isNaN(n)&&(n=0),n=Math.max(n,_F),Math.floor(n)}var MF=["prefixCls","className","height","itemHeight","fullHeight","style","data","children","itemKey","virtual","direction","scrollWidth","component","onScroll","onVirtualScroll","onVisibleChange","innerProps","extraRender","styles","showScrollBar"],RF=[],OF={overflowY:"auto",overflowAnchor:"none"};function AF(e,t){var n=e.prefixCls,r=n===void 0?"rc-virtual-list":n,i=e.className,o=e.height,l=e.itemHeight,m=e.fullHeight,u=m===void 0?!0:m,p=e.style,s=e.data,c=e.children,d=e.itemKey,h=e.virtual,f=e.direction,v=e.scrollWidth,y=e.component,b=y===void 0?"div":y,w=e.onScroll,x=e.onVirtualScroll,E=e.onVisibleChange,_=e.innerProps,$=e.extraRender,O=e.styles,N=e.showScrollBar,k=N===void 0?"optional":N,L=At(e,MF),F=C.useCallback(function(Xe){return typeof d=="function"?d(Xe):Xe==null?void 0:Xe[d]},[d]),P=SF(F),A=pe(P,4),M=A[0],R=A[1],I=A[2],D=A[3],j=!!(h!==!1&&o&&l),B=C.useMemo(function(){return Object.values(I.maps).reduce(function(Xe,ut){return Xe+ut},0)},[I.id,I.maps]),V=j&&s&&(Math.max(l*s.length,B)>o||!!v),H=f==="rtl",Y=ve(r,ne({},"".concat(r,"-rtl"),H),i),U=s||RF,K=C.useRef(),G=C.useRef(),q=C.useRef(),Z=C.useState(0),Q=pe(Z,2),J=Q[0],ie=Q[1],se=C.useState(0),ae=pe(se,2),ge=ae[0],me=ae[1],de=C.useState(!1),we=pe(de,2),Oe=we[0],xe=we[1],Pe=function(){xe(!0)},ze=function(){xe(!1)},Ie={getKey:F};function Ye(Xe){ie(function(ut){var st;typeof Xe=="function"?st=Xe(ut):st=Xe;var Le=Lt(st);return K.current.scrollTop=Le,Le})}var Me=C.useRef({start:0,end:U.length}),ke=C.useRef(),Je=vF(U,F),ce=pe(Je,1),Ee=ce[0];ke.current=Ee;var Re=C.useMemo(function(){if(!j)return{scrollHeight:void 0,start:0,end:U.length-1,offset:void 0};if(!V){var Xe;return{scrollHeight:((Xe=G.current)===null||Xe===void 0?void 0:Xe.offsetHeight)||0,start:0,end:U.length-1,offset:void 0}}for(var ut=0,st,Le,Ct,Ft=U.length,en=0;en=J&&st===void 0&&(st=en,Le=ut),$n>J+o&&Ct===void 0&&(Ct=en),ut=$n}return st===void 0&&(st=0,Le=0,Ct=Math.ceil(o/l)),Ct===void 0&&(Ct=U.length-1),Ct=Math.min(Ct+1,U.length-1),{scrollHeight:ut,start:st,end:Ct,offset:Le}},[V,j,J,U,D,o]),Ae=Re.scrollHeight,De=Re.start,He=Re.end,it=Re.offset;Me.current.start=De,Me.current.end=He,C.useLayoutEffect(function(){var Xe=I.getRecord();if(Xe.size===1){var ut=Array.from(Xe.keys())[0],st=Xe.get(ut),Le=U[De];if(Le&&st===void 0){var Ct=F(Le);if(Ct===ut){var Ft=I.get(ut),en=Ft-l;Ye(function(hn){return hn+en})}}}I.resetRecord()},[Ae]);var Ne=C.useState({width:0,height:o}),Te=pe(Ne,2),We=Te[0],te=Te[1],fe=function(ut){te({width:ut.offsetWidth,height:ut.offsetHeight})},je=C.useRef(),ct=C.useRef(),Jt=C.useMemo(function(){return wS(We.width,v)},[We.width,v]),kt=C.useMemo(function(){return wS(We.height,Ae)},[We.height,Ae]),rn=Ae-o,Qt=C.useRef(rn);Qt.current=rn;function Lt(Xe){var ut=Xe;return Number.isNaN(Qt.current)||(ut=Math.min(ut,Qt.current)),ut=Math.max(ut,0),ut}var Nt=J<=0,Et=J>=rn,dt=ge<=0,et=ge>=v,Ke=eE(Nt,Et,dt,et),_t=function(){return{x:H?-ge:ge,y:J}},Tt=C.useRef(_t()),tt=tr(function(Xe){if(x){var ut=oe(oe({},_t()),Xe);(Tt.current.x!==ut.x||Tt.current.y!==ut.y)&&(x(ut),Tt.current=ut)}});function Ze(Xe,ut){var st=Xe;ut?(da.flushSync(function(){me(st)}),tt()):Ye(st)}function at(Xe){var ut=Xe.currentTarget.scrollTop;ut!==J&&Ye(ut),w==null||w(Xe),tt()}var ot=function(ut){var st=ut,Le=v?v-We.width:0;return st=Math.max(st,0),st=Math.min(st,Le),st},rt=tr(function(Xe,ut){ut?(da.flushSync(function(){me(function(st){var Le=st+(H?-Xe:Xe);return ot(Le)})}),tt()):Ye(function(st){var Le=st+Xe;return Le})}),vt=yF(j,Nt,Et,dt,et,!!v,rt),on=pe(vt,2),Bt=on[0],Gt=on[1];CF(j,K,function(Xe,ut,st,Le){var Ct=Le;return Ke(Xe,ut,st)?!1:!Ct||!Ct._virtualHandled?(Ct&&(Ct._virtualHandled=!0),Bt({preventDefault:function(){},deltaX:Xe?ut:0,deltaY:Xe?0:ut}),!0):!1}),$F(V,K,function(Xe){Ye(function(ut){return ut+Xe})}),fn(function(){function Xe(st){var Le=Nt&&st.detail<0,Ct=Et&&st.detail>0;j&&!Le&&!Ct&&st.preventDefault()}var ut=K.current;return ut.addEventListener("wheel",Bt,{passive:!1}),ut.addEventListener("DOMMouseScroll",Gt,{passive:!0}),ut.addEventListener("MozMousePixelScroll",Xe,{passive:!1}),function(){ut.removeEventListener("wheel",Bt),ut.removeEventListener("DOMMouseScroll",Gt),ut.removeEventListener("MozMousePixelScroll",Xe)}},[j,Nt,Et]),fn(function(){if(v){var Xe=ot(ge);me(Xe),tt({x:Xe})}},[We.width,v]);var Dt=function(){var ut,st;(ut=je.current)===null||ut===void 0||ut.delayHidden(),(st=ct.current)===null||st===void 0||st.delayHidden()},Ht=EF(K,U,I,l,F,function(){return R(!0)},Ye,Dt);C.useImperativeHandle(t,function(){return{nativeElement:q.current,getScrollInfo:_t,scrollTo:function(ut){function st(Le){return Le&&wt(Le)==="object"&&("left"in Le||"top"in Le)}st(ut)?(ut.left!==void 0&&me(ot(ut.left)),Ht(ut.top)):Ht(ut)}}}),fn(function(){if(E){var Xe=U.slice(De,He+1);E(Xe,U)}},[De,He,U]);var yn=bF(U,F,I,l),Cn=$==null?void 0:$({start:De,end:He,virtual:V,offsetX:ge,offsetY:it,rtl:H,getSize:yn}),Rn=gF(U,De,He,v,ge,M,c,Ie),cn=null;o&&(cn=oe(ne({},u?"height":"maxHeight",o),OF),j&&(cn.overflowY="hidden",v&&(cn.overflowX="hidden"),Oe&&(cn.pointerEvents="none")));var Kt={};return H&&(Kt.dir="rtl"),C.createElement("div",nt({ref:q,style:oe(oe({},p),{},{position:"relative"}),className:Y},Kt,L),C.createElement(ki,{onResize:fe},C.createElement(b,{className:"".concat(r,"-holder"),style:cn,ref:K,onScroll:at,onMouseEnter:Dt},C.createElement(Jx,{prefixCls:r,height:Ae,offsetX:ge,offsetY:it,scrollWidth:v,onInnerResize:R,ref:G,innerProps:_,rtl:H,extra:Cn},Rn))),V&&Ae>o&&C.createElement(bS,{ref:je,prefixCls:r,scrollOffset:J,scrollRange:Ae,rtl:H,onScroll:Ze,onStartMove:Pe,onStopMove:ze,spinSize:kt,containerSize:We.height,style:O==null?void 0:O.verticalScrollBar,thumbStyle:O==null?void 0:O.verticalScrollBarThumb,showScrollBar:k}),V&&v>We.width&&C.createElement(bS,{ref:ct,prefixCls:r,scrollOffset:ge,scrollRange:v,rtl:H,onScroll:Ze,onStartMove:Pe,onStopMove:ze,spinSize:Jt,containerSize:We.width,horizontal:!0,style:O==null?void 0:O.horizontalScrollBar,thumbStyle:O==null?void 0:O.horizontalScrollBarThumb,showScrollBar:k}))}var tE=C.forwardRef(AF);tE.displayName="List";function TF(){return/(mac\sos|macintosh)/i.test(navigator.appVersion)}var IF=["disabled","title","children","style","className"];function SS(e){return typeof e=="string"||typeof e=="number"}var LF=function(t,n){var r=vD(),i=r.prefixCls,o=r.id,l=r.open,m=r.multiple,u=r.mode,p=r.searchValue,s=r.toggleOpen,c=r.notFoundContent,d=r.onPopupScroll,h=C.useContext(Iv),f=h.maxCount,v=h.flattenOptions,y=h.onActiveValue,b=h.defaultActiveFirstOption,w=h.onSelect,x=h.menuItemSelectedIcon,E=h.rawValues,_=h.fieldNames,$=h.virtual,O=h.direction,N=h.listHeight,k=h.listItemHeight,L=h.optionRender,F="".concat(i,"-item"),P=xc(function(){return v},[l,v],function(se,ae){return ae[0]&&se[1]!==ae[1]}),A=C.useRef(null),M=C.useMemo(function(){return m&&Cm(f)&&(E==null?void 0:E.size)>=f},[m,f,E==null?void 0:E.size]),R=function(ae){ae.preventDefault()},I=function(ae){var ge;(ge=A.current)===null||ge===void 0||ge.scrollTo(typeof ae=="number"?{index:ae}:ae)},D=C.useCallback(function(se){return u==="combobox"?!1:E.has(se)},[u,Ge(E).toString(),E.size]),j=function(ae){for(var ge=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,me=P.length,de=0;de1&&arguments[1]!==void 0?arguments[1]:!1;Y(ae);var me={source:ge?"keyboard":"mouse"},de=P[ae];if(!de){y(null,-1,me);return}y(de.value,ae,me)};C.useEffect(function(){U(b!==!1?j(0):-1)},[P.length,p]);var K=C.useCallback(function(se){return u==="combobox"?String(se).toLowerCase()===p.toLowerCase():E.has(se)},[u,p,Ge(E).toString(),E.size]);C.useEffect(function(){var se=setTimeout(function(){if(!m&&l&&E.size===1){var ge=Array.from(E)[0],me=P.findIndex(function(de){var we=de.data;return p?String(we.value).startsWith(p):we.value===ge});me!==-1&&(U(me),I(me))}});if(l){var ae;(ae=A.current)===null||ae===void 0||ae.scrollTo(void 0)}return function(){return clearTimeout(se)}},[l,p]);var G=function(ae){ae!==void 0&&w(ae,{selected:!E.has(ae)}),m||s(!1)};if(C.useImperativeHandle(n,function(){return{onKeyDown:function(ae){var ge=ae.which,me=ae.ctrlKey;switch(ge){case mt.N:case mt.P:case mt.UP:case mt.DOWN:{var de=0;if(ge===mt.UP?de=-1:ge===mt.DOWN?de=1:TF()&&me&&(ge===mt.N?de=1:ge===mt.P&&(de=-1)),de!==0){var we=j(H+de,de);I(we),U(we,!0)}break}case mt.TAB:case mt.ENTER:{var Oe,xe=P[H];xe&&!(xe!=null&&(Oe=xe.data)!==null&&Oe!==void 0&&Oe.disabled)&&!M?G(xe.value):G(void 0),l&&ae.preventDefault();break}case mt.ESC:s(!1),l&&ae.stopPropagation()}},onKeyUp:function(){},scrollTo:function(ae){I(ae)}}}),P.length===0)return C.createElement("div",{role:"listbox",id:"".concat(o,"_list"),className:"".concat(F,"-empty"),onMouseDown:R},c);var q=Object.keys(_).map(function(se){return _[se]}),Z=function(ae){return ae.label};function Q(se,ae){var ge=se.group;return{role:ge?"presentation":"option",id:"".concat(o,"_list_").concat(ae)}}var J=function(ae){var ge=P[ae];if(!ge)return null;var me=ge.data||{},de=me.value,we=ge.group,Oe=Wa(me,!0),xe=Z(ge);return ge?C.createElement("div",nt({"aria-label":typeof xe=="string"&&!we?xe:null},Oe,{key:ae},Q(ge,ae),{"aria-selected":K(de)}),de):null},ie={role:"listbox",id:"".concat(o,"_list")};return C.createElement(C.Fragment,null,$&&C.createElement("div",nt({},ie,{style:{height:0,width:0,overflow:"hidden"}}),J(H-1),J(H),J(H+1)),C.createElement(tE,{itemKey:"key",ref:A,data:P,height:N,itemHeight:k,fullHeight:!1,onMouseDown:R,onScroll:d,virtual:$,direction:O,innerProps:$?null:ie},function(se,ae){var ge=se.group,me=se.groupOption,de=se.data,we=se.label,Oe=se.value,xe=de.key;if(ge){var Pe,ze=(Pe=de.title)!==null&&Pe!==void 0?Pe:SS(we)?we.toString():void 0;return C.createElement("div",{className:ve(F,"".concat(F,"-group"),de.className),title:ze},we!==void 0?we:xe)}var Ie=de.disabled,Ye=de.title;de.children;var Me=de.style,ke=de.className,Je=At(de,IF),ce=Er(Je,q),Ee=D(Oe),Re=Ie||!Ee&&M,Ae="".concat(F,"-option"),De=ve(F,Ae,ke,ne(ne(ne(ne({},"".concat(Ae,"-grouped"),me),"".concat(Ae,"-active"),H===ae&&!Re),"".concat(Ae,"-disabled"),Re),"".concat(Ae,"-selected"),Ee)),He=Z(se),it=!x||typeof x=="function"||Ee,Ne=typeof He=="number"?He:He||Oe,Te=SS(Ne)?Ne.toString():void 0;return Ye!==void 0&&(Te=Ye),C.createElement("div",nt({},Wa(ce),$?{}:Q(se,ae),{"aria-selected":K(Oe),className:De,title:Te,onMouseMove:function(){H===ae||Re||U(ae)},onClick:function(){Re||G(Oe)},style:Me}),C.createElement("div",{className:"".concat(Ae,"-content")},typeof L=="function"?L(se,{index:ae}):Ne),C.isValidElement(x)||Ee,it&&C.createElement(pf,{className:"".concat(F,"-option-state"),customizeIcon:x,customizeIconProps:{value:Oe,disabled:Re,isSelected:Ee}},Ee?"✓":null))}))},PF=C.forwardRef(LF);const kF=function(e,t){var n=C.useRef({values:new Map,options:new Map}),r=C.useMemo(function(){var o=n.current,l=o.values,m=o.options,u=e.map(function(c){if(c.label===void 0){var d;return oe(oe({},c),{},{label:(d=l.get(c.value))===null||d===void 0?void 0:d.label})}return c}),p=new Map,s=new Map;return u.forEach(function(c){p.set(c.value,c),s.set(c.value,t.get(c.value)||m.get(c.value))}),n.current.values=p,n.current.options=s,u},[e,t]),i=C.useCallback(function(o){return t.get(o)||n.current.options.get(o)},[t]);return[r,i]};function Hp(e,t){return qx(e).join("").toUpperCase().includes(t)}const NF=function(e,t,n,r,i){return C.useMemo(function(){if(!n||r===!1)return e;var o=t.options,l=t.label,m=t.value,u=[],p=typeof r=="function",s=n.toUpperCase(),c=p?r:function(h,f){return i?Hp(f[i],s):f[o]?Hp(f[l!=="children"?l:"label"],s):Hp(f[m],s)},d=p?function(h){return $m(h)}:function(h){return h};return e.forEach(function(h){if(h[o]){var f=c(n,d(h));if(f)u.push(h);else{var v=h[o].filter(function(y){return c(n,d(y))});v.length&&u.push(oe(oe({},h),{},ne({},o,v)))}return}c(n,d(h))&&u.push(h)}),u},[e,r,i,n,t])};var CS=0,DF=qr();function FF(){var e;return DF?(e=CS,CS+=1):e="TEST_OR_SSR",e}function zF(e){var t=C.useState(),n=pe(t,2),r=n[0],i=n[1];return C.useEffect(function(){i("rc_select_".concat(FF()))},[]),e||r}var jF=["children","value"],BF=["children"];function HF(e){var t=e,n=t.key,r=t.props,i=r.children,o=r.value,l=At(r,jF);return oe({key:n,value:o!==void 0?o:n,children:i},l)}function nE(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return li(e).map(function(n,r){if(!C.isValidElement(n)||!n.type)return null;var i=n,o=i.type.isSelectOptGroup,l=i.key,m=i.props,u=m.children,p=At(m,BF);return t||!o?HF(n):oe(oe({key:"__RC_SELECT_GRP__".concat(l===null?r:l,"__"),label:l},p),{},{options:nE(u)})}).filter(function(n){return n})}var WF=function(t,n,r,i,o){return C.useMemo(function(){var l=t,m=!t;m&&(l=nE(n));var u=new Map,p=new Map,s=function(h,f,v){v&&typeof v=="string"&&h.set(f[v],f)},c=function d(h){for(var f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,v=0;v0?tt(ot.options):ot.options}):ot})},Ne=C.useMemo(function(){return w?it(He):He},[He,w,ie]),Te=C.useMemo(function(){return lF(Ne,{fieldNames:Z,childrenAsData:G})},[Ne,Z,G]),We=function(Ze){var at=we(Ze);if(ze(at),V&&(at.length!==ke.length||at.some(function(vt,on){var Bt;return((Bt=ke[on])===null||Bt===void 0?void 0:Bt.value)!==(vt==null?void 0:vt.value)}))){var ot=B?at:at.map(function(vt){return vt.value}),rt=at.map(function(vt){return $m(Je(vt.value))});V(K?ot:ot[0],K?rt:rt[0])}},te=C.useState(null),fe=pe(te,2),je=fe[0],ct=fe[1],Jt=C.useState(0),kt=pe(Jt,2),rn=kt[0],Qt=kt[1],Lt=N!==void 0?N:r!=="combobox",Nt=C.useCallback(function(tt,Ze){var at=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},ot=at.source,rt=ot===void 0?"keyboard":ot;Qt(Ze),l&&r==="combobox"&&tt!==null&&rt==="keyboard"&&ct(String(tt))},[l,r]),Et=function(Ze,at,ot){var rt=function(){var cn,Kt=Je(Ze);return[B?{label:Kt==null?void 0:Kt[Z.label],value:Ze,key:(cn=Kt==null?void 0:Kt.key)!==null&&cn!==void 0?cn:Ze}:Ze,$m(Kt)]};if(at&&h){var vt=rt(),on=pe(vt,2),Bt=on[0],Gt=on[1];h(Bt,Gt)}else if(!at&&f&&ot!=="clear"){var Dt=rt(),Ht=pe(Dt,2),yn=Ht[0],Cn=Ht[1];f(yn,Cn)}},dt=$S(function(tt,Ze){var at,ot=K?Ze.selected:!0;ot?at=K?[].concat(Ge(ke),[tt]):[tt]:at=ke.filter(function(rt){return rt.value!==tt}),We(at),Et(tt,ot),r==="combobox"?ct(""):(!xm||d)&&(se(""),ct(""))}),et=function(Ze,at){We(Ze);var ot=at.type,rt=at.values;(ot==="remove"||ot==="clear")&&rt.forEach(function(vt){Et(vt.value,!1,ot)})},Ke=function(Ze,at){if(se(Ze),ct(null),at.source==="submit"){var ot=(Ze||"").trim();if(ot){var rt=Array.from(new Set([].concat(Ge(Ee),[ot])));We(rt),Et(ot,!0),se("")}return}at.source!=="blur"&&(r==="combobox"&&We(Ze),s==null||s(Ze))},_t=function(Ze){var at=Ze;r!=="tags"&&(at=Ze.map(function(rt){var vt=me.get(rt);return vt==null?void 0:vt.value}).filter(function(rt){return rt!==void 0}));var ot=Array.from(new Set([].concat(Ge(Ee),Ge(at))));We(ot),ot.forEach(function(rt){Et(rt,!0)})},Tt=C.useMemo(function(){var tt=L!==!1&&y!==!1;return oe(oe({},ae),{},{flattenOptions:Te,onActiveValue:Nt,defaultActiveFirstOption:Lt,onSelect:dt,menuItemSelectedIcon:k,rawValues:Ee,fieldNames:Z,virtual:tt,direction:F,listHeight:A,listItemHeight:R,childrenAsData:G,maxCount:H,optionRender:$})},[H,ae,Te,Nt,Lt,dt,k,Ee,Z,L,y,F,A,R,G,$]);return C.createElement(Iv.Provider,{value:Tt},C.createElement(hF,nt({},Y,{id:U,prefixCls:o,ref:t,omitDomProps:UF,mode:r,displayValues:ce,onDisplayValuesChange:et,direction:F,searchValue:ie,onSearch:Ke,autoClearSearchValue:d,onSearchSplit:_t,dropdownMatchSelectWidth:y,OptionList:PF,emptyOptions:!Te.length,activeValue:je,activeDescendantId:"".concat(U,"_list_").concat(rn)})))}),kv=KF;kv.Option=Pv;kv.OptGroup=Lv;function kd(e,t,n){return ve({[`${e}-status-success`]:t==="success",[`${e}-status-warning`]:t==="warning",[`${e}-status-error`]:t==="error",[`${e}-status-validating`]:t==="validating",[`${e}-has-feedback`]:n})}const mf=(e,t)=>t||e,YF=()=>{const[,e]=Si(),[t]=Mc("Empty"),r=new Un(e.colorBgBase).toHsl().l<.5?{opacity:.65}:{};return C.createElement("svg",{style:r,width:"184",height:"152",viewBox:"0 0 184 152",xmlns:"http://www.w3.org/2000/svg"},C.createElement("title",null,(t==null?void 0:t.description)||"Empty"),C.createElement("g",{fill:"none",fillRule:"evenodd"},C.createElement("g",{transform:"translate(24 31.67)"},C.createElement("ellipse",{fillOpacity:".8",fill:"#F5F5F7",cx:"67.797",cy:"106.89",rx:"67.797",ry:"12.668"}),C.createElement("path",{d:"M122.034 69.674L98.109 40.229c-1.148-1.386-2.826-2.225-4.593-2.225h-51.44c-1.766 0-3.444.839-4.592 2.225L13.56 69.674v15.383h108.475V69.674z",fill:"#AEB8C2"}),C.createElement("path",{d:"M101.537 86.214L80.63 61.102c-1.001-1.207-2.507-1.867-4.048-1.867H31.724c-1.54 0-3.047.66-4.048 1.867L6.769 86.214v13.792h94.768V86.214z",fill:"url(#linearGradient-1)",transform:"translate(13.56)"}),C.createElement("path",{d:"M33.83 0h67.933a4 4 0 0 1 4 4v93.344a4 4 0 0 1-4 4H33.83a4 4 0 0 1-4-4V4a4 4 0 0 1 4-4z",fill:"#F5F5F7"}),C.createElement("path",{d:"M42.678 9.953h50.237a2 2 0 0 1 2 2V36.91a2 2 0 0 1-2 2H42.678a2 2 0 0 1-2-2V11.953a2 2 0 0 1 2-2zM42.94 49.767h49.713a2.262 2.262 0 1 1 0 4.524H42.94a2.262 2.262 0 0 1 0-4.524zM42.94 61.53h49.713a2.262 2.262 0 1 1 0 4.525H42.94a2.262 2.262 0 0 1 0-4.525zM121.813 105.032c-.775 3.071-3.497 5.36-6.735 5.36H20.515c-3.238 0-5.96-2.29-6.734-5.36a7.309 7.309 0 0 1-.222-1.79V69.675h26.318c2.907 0 5.25 2.448 5.25 5.42v.04c0 2.971 2.37 5.37 5.277 5.37h34.785c2.907 0 5.277-2.421 5.277-5.393V75.1c0-2.972 2.343-5.426 5.25-5.426h26.318v33.569c0 .617-.077 1.216-.221 1.789z",fill:"#DCE0E6"})),C.createElement("path",{d:"M149.121 33.292l-6.83 2.65a1 1 0 0 1-1.317-1.23l1.937-6.207c-2.589-2.944-4.109-6.534-4.109-10.408C138.802 8.102 148.92 0 161.402 0 173.881 0 184 8.102 184 18.097c0 9.995-10.118 18.097-22.599 18.097-4.528 0-8.744-1.066-12.28-2.902z",fill:"#DCE0E6"}),C.createElement("g",{transform:"translate(149.65 15.383)",fill:"#FFF"},C.createElement("ellipse",{cx:"20.654",cy:"3.167",rx:"2.849",ry:"2.815"}),C.createElement("path",{d:"M5.698 5.63H0L2.898.704zM9.259.704h4.985V5.63H9.259z"}))))},XF=()=>{const[,e]=Si(),[t]=Mc("Empty"),{colorFill:n,colorFillTertiary:r,colorFillQuaternary:i,colorBgContainer:o}=e,{borderColor:l,shadowColor:m,contentColor:u}=C.useMemo(()=>({borderColor:new Un(n).onBackground(o).toHexString(),shadowColor:new Un(r).onBackground(o).toHexString(),contentColor:new Un(i).onBackground(o).toHexString()}),[n,r,i,o]);return C.createElement("svg",{width:"64",height:"41",viewBox:"0 0 64 41",xmlns:"http://www.w3.org/2000/svg"},C.createElement("title",null,(t==null?void 0:t.description)||"Empty"),C.createElement("g",{transform:"translate(0 1)",fill:"none",fillRule:"evenodd"},C.createElement("ellipse",{fill:m,cx:"32",cy:"33",rx:"32",ry:"7"}),C.createElement("g",{fillRule:"nonzero",stroke:l},C.createElement("path",{d:"M55 12.76L44.854 1.258C44.367.474 43.656 0 42.907 0H21.093c-.749 0-1.46.474-1.947 1.257L9 12.761V22h46v-9.24z"}),C.createElement("path",{d:"M41.613 15.931c0-1.605.994-2.93 2.227-2.931H55v18.137C55 33.26 53.68 35 52.05 35h-40.1C10.32 35 9 33.259 9 31.137V13h11.16c1.233 0 2.227 1.323 2.227 2.928v.022c0 1.605 1.005 2.901 2.237 2.901h14.752c1.232 0 2.237-1.308 2.237-2.913v-.007z",fill:u}))))},qF=e=>{const{componentCls:t,margin:n,marginXS:r,marginXL:i,fontSize:o,lineHeight:l}=e;return{[t]:{marginInline:r,fontSize:o,lineHeight:l,textAlign:"center",[`${t}-image`]:{height:e.emptyImgHeight,marginBottom:r,opacity:e.opacityImage,img:{height:"100%"},svg:{maxWidth:"100%",height:"100%",margin:"auto"}},[`${t}-description`]:{color:e.colorTextDescription},[`${t}-footer`]:{marginTop:n},"&-normal":{marginBlock:i,color:e.colorTextDescription,[`${t}-description`]:{color:e.colorTextDescription},[`${t}-image`]:{height:e.emptyImgHeightMD}},"&-small":{marginBlock:r,color:e.colorTextDescription,[`${t}-image`]:{height:e.emptyImgHeightSM}}}}},QF=gr("Empty",e=>{const{componentCls:t,controlHeightLG:n,calc:r}=e,i=Sn(e,{emptyImgCls:`${t}-img`,emptyImgHeight:r(n).mul(2.5).equal(),emptyImgHeightMD:n,emptyImgHeightSM:r(n).mul(.875).equal()});return[qF(i)]});var ZF=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i{const{className:t,rootClassName:n,prefixCls:r,image:i=rE,description:o,children:l,imageStyle:m,style:u,classNames:p,styles:s}=e,c=ZF(e,["className","rootClassName","prefixCls","image","description","children","imageStyle","style","classNames","styles"]),{getPrefixCls:d,direction:h,className:f,style:v,classNames:y,styles:b}=Ji("empty"),w=d("empty",r),[x,E,_]=QF(w),[$]=Mc("Empty"),O=typeof o<"u"?o:$==null?void 0:$.description,N=typeof O=="string"?O:"empty";let k=null;return typeof i=="string"?k=C.createElement("img",{alt:N,src:i}):k=i,x(C.createElement("div",Object.assign({className:ve(E,_,w,f,{[`${w}-normal`]:i===iE,[`${w}-rtl`]:h==="rtl"},t,n,y.root,p==null?void 0:p.root),style:Object.assign(Object.assign(Object.assign(Object.assign({},b.root),v),s==null?void 0:s.root),u)},c),C.createElement("div",{className:ve(`${w}-image`,y.image,p==null?void 0:p.image),style:Object.assign(Object.assign(Object.assign({},m),b.image),s==null?void 0:s.image)},k),O&&C.createElement("div",{className:ve(`${w}-description`,y.description,p==null?void 0:p.description),style:Object.assign(Object.assign({},b.description),s==null?void 0:s.description)},O),l&&C.createElement("div",{className:ve(`${w}-footer`,y.footer,p==null?void 0:p.footer),style:Object.assign(Object.assign({},b.footer),s==null?void 0:s.footer)},l)))};aa.PRESENTED_IMAGE_DEFAULT=rE;aa.PRESENTED_IMAGE_SIMPLE=iE;const JF=e=>{const{componentName:t}=e,{getPrefixCls:n}=C.useContext(zt),r=n("empty");switch(t){case"Table":case"List":return be.createElement(aa,{image:aa.PRESENTED_IMAGE_SIMPLE});case"Select":case"TreeSelect":case"Cascader":case"Transfer":case"Mentions":return be.createElement(aa,{image:aa.PRESENTED_IMAGE_SIMPLE,className:`${r}-small`});case"Table.filter":return null;default:return be.createElement(aa,null)}},vf=(e,t,n=void 0)=>{var r,i;const{variant:o,[e]:l}=C.useContext(zt),m=C.useContext(Nx),u=l==null?void 0:l.variant;let p;typeof t<"u"?p=t:n===!1?p="borderless":p=(i=(r=m??u)!==null&&r!==void 0?r:o)!==null&&i!==void 0?i:"outlined";const s=iI.includes(p);return[p,s]},e4=e=>{const n={overflow:{adjustX:!0,adjustY:!0,shiftY:!0},htmlRegion:e==="scroll"?"scroll":"visible",dynamicInset:!0};return{bottomLeft:Object.assign(Object.assign({},n),{points:["tl","bl"],offset:[0,4]}),bottomRight:Object.assign(Object.assign({},n),{points:["tr","br"],offset:[0,4]}),topLeft:Object.assign(Object.assign({},n),{points:["bl","tl"],offset:[0,-4]}),topRight:Object.assign(Object.assign({},n),{points:["br","tr"],offset:[0,-4]})}};function t4(e,t){return e||e4(t)}const xS=e=>{const{optionHeight:t,optionFontSize:n,optionLineHeight:r,optionPadding:i}=e;return{position:"relative",display:"block",minHeight:t,padding:i,color:e.colorText,fontWeight:"normal",fontSize:n,lineHeight:r,boxSizing:"border-box"}},n4=e=>{const{antCls:t,componentCls:n}=e,r=`${n}-item`,i=`&${t}-slide-up-enter${t}-slide-up-enter-active`,o=`&${t}-slide-up-appear${t}-slide-up-appear-active`,l=`&${t}-slide-up-leave${t}-slide-up-leave-active`,m=`${n}-dropdown-placement-`,u=`${r}-option-selected`;return[{[`${n}-dropdown`]:Object.assign(Object.assign({},ci(e)),{position:"absolute",top:-9999,zIndex:e.zIndexPopup,boxSizing:"border-box",padding:e.paddingXXS,overflow:"hidden",fontSize:e.fontSize,fontVariant:"initial",backgroundColor:e.colorBgElevated,borderRadius:e.borderRadiusLG,outline:"none",boxShadow:e.boxShadowSecondary,[` + ${i}${m}bottomLeft, + ${o}${m}bottomLeft + `]:{animationName:mx},[` + ${i}${m}topLeft, + ${o}${m}topLeft, + ${i}${m}topRight, + ${o}${m}topRight + `]:{animationName:yx},[`${l}${m}bottomLeft`]:{animationName:vx},[` + ${l}${m}topLeft, + ${l}${m}topRight + `]:{animationName:bx},"&-hidden":{display:"none"},[r]:Object.assign(Object.assign({},xS(e)),{cursor:"pointer",transition:`background ${e.motionDurationSlow} ease`,borderRadius:e.borderRadiusSM,"&-group":{color:e.colorTextDescription,fontSize:e.fontSizeSM,cursor:"default"},"&-option":{display:"flex","&-content":Object.assign({flex:"auto"},Ys),"&-state":{flex:"none",display:"flex",alignItems:"center"},[`&-active:not(${r}-option-disabled)`]:{backgroundColor:e.optionActiveBg},[`&-selected:not(${r}-option-disabled)`]:{color:e.optionSelectedColor,fontWeight:e.optionSelectedFontWeight,backgroundColor:e.optionSelectedBg,[`${r}-option-state`]:{color:e.colorPrimary}},"&-disabled":{[`&${r}-option-selected`]:{backgroundColor:e.colorBgContainerDisabled},color:e.colorTextDisabled,cursor:"not-allowed"},"&-grouped":{paddingInlineStart:e.calc(e.controlPaddingHorizontal).mul(2).equal()}},"&-empty":Object.assign(Object.assign({},xS(e)),{color:e.colorTextDisabled})}),[`${u}:has(+ ${u})`]:{borderEndStartRadius:0,borderEndEndRadius:0,[`& + ${u}`]:{borderStartStartRadius:0,borderStartEndRadius:0}},"&-rtl":{direction:"rtl"}})},Ld(e,"slide-up"),Ld(e,"slide-down"),Fw(e,"move-up"),Fw(e,"move-down")]},r4=e=>{const{multipleSelectItemHeight:t,paddingXXS:n,lineWidth:r,INTERNAL_FIXED_ITEM_MARGIN:i}=e,o=e.max(e.calc(n).sub(r).equal(),0),l=e.max(e.calc(o).sub(i).equal(),0);return{basePadding:o,containerPadding:l,itemHeight:$e(t),itemLineHeight:$e(e.calc(t).sub(e.calc(e.lineWidth).mul(2)).equal())}},i4=e=>{const{multipleSelectItemHeight:t,selectHeight:n,lineWidth:r}=e;return e.calc(n).sub(t).div(2).sub(r).equal()},o4=e=>{const{componentCls:t,iconCls:n,borderRadiusSM:r,motionDurationSlow:i,paddingXS:o,multipleItemColorDisabled:l,multipleItemBorderColorDisabled:m,colorIcon:u,colorIconHover:p,INTERNAL_FIXED_ITEM_MARGIN:s}=e;return{[`${t}-selection-overflow`]:{position:"relative",display:"flex",flex:"auto",flexWrap:"wrap",maxWidth:"100%","&-item":{flex:"none",alignSelf:"center",maxWidth:"100%",display:"inline-flex"},[`${t}-selection-item`]:{display:"flex",alignSelf:"center",flex:"none",boxSizing:"border-box",maxWidth:"100%",marginBlock:s,borderRadius:r,cursor:"default",transition:`font-size ${i}, line-height ${i}, height ${i}`,marginInlineEnd:e.calc(s).mul(2).equal(),paddingInlineStart:o,paddingInlineEnd:e.calc(o).div(2).equal(),[`${t}-disabled&`]:{color:l,borderColor:m,cursor:"not-allowed"},"&-content":{display:"inline-block",marginInlineEnd:e.calc(o).div(2).equal(),overflow:"hidden",whiteSpace:"pre",textOverflow:"ellipsis"},"&-remove":Object.assign(Object.assign({},Rc()),{display:"inline-flex",alignItems:"center",color:u,fontWeight:"bold",fontSize:10,lineHeight:"inherit",cursor:"pointer",[`> ${n}`]:{verticalAlign:"-0.2em"},"&:hover":{color:p}})}}}},a4=(e,t)=>{const{componentCls:n,INTERNAL_FIXED_ITEM_MARGIN:r}=e,i=`${n}-selection-overflow`,o=e.multipleSelectItemHeight,l=i4(e),m=t?`${n}-${t}`:"",u=r4(e);return{[`${n}-multiple${m}`]:Object.assign(Object.assign({},o4(e)),{[`${n}-selector`]:{display:"flex",alignItems:"center",width:"100%",height:"100%",paddingInline:u.basePadding,paddingBlock:u.containerPadding,borderRadius:e.borderRadius,[`${n}-disabled&`]:{background:e.multipleSelectorBgDisabled,cursor:"not-allowed"},"&:after":{display:"inline-block",width:0,margin:`${$e(r)} 0`,lineHeight:$e(o),visibility:"hidden",content:'"\\a0"'}},[`${n}-selection-item`]:{height:u.itemHeight,lineHeight:$e(u.itemLineHeight)},[`${n}-selection-wrap`]:{alignSelf:"flex-start","&:after":{lineHeight:$e(o),marginBlock:r}},[`${n}-prefix`]:{marginInlineStart:e.calc(e.inputPaddingHorizontalBase).sub(u.basePadding).equal()},[`${i}-item + ${i}-item, + ${n}-prefix + ${n}-selection-wrap + `]:{[`${n}-selection-search`]:{marginInlineStart:0},[`${n}-selection-placeholder`]:{insetInlineStart:0}},[`${i}-item-suffix`]:{minHeight:u.itemHeight,marginBlock:r},[`${n}-selection-search`]:{display:"inline-flex",position:"relative",maxWidth:"100%",marginInlineStart:e.calc(e.inputPaddingHorizontalBase).sub(l).equal(),"\n &-input,\n &-mirror\n ":{height:o,fontFamily:e.fontFamily,lineHeight:$e(o),transition:`all ${e.motionDurationSlow}`},"&-input":{width:"100%",minWidth:4.1},"&-mirror":{position:"absolute",top:0,insetInlineStart:0,insetInlineEnd:"auto",zIndex:999,whiteSpace:"pre",visibility:"hidden"}},[`${n}-selection-placeholder`]:{position:"absolute",top:"50%",insetInlineStart:e.calc(e.inputPaddingHorizontalBase).sub(u.basePadding).equal(),insetInlineEnd:e.inputPaddingHorizontalBase,transform:"translateY(-50%)",transition:`all ${e.motionDurationSlow}`}})}};function Wp(e,t){const{componentCls:n}=e,r=t?`${n}-${t}`:"",i={[`${n}-multiple${r}`]:{fontSize:e.fontSize,[`${n}-selector`]:{[`${n}-show-search&`]:{cursor:"text"}},[` + &${n}-show-arrow ${n}-selector, + &${n}-allow-clear ${n}-selector + `]:{paddingInlineEnd:e.calc(e.fontSizeIcon).add(e.controlPaddingHorizontal).equal()}}};return[a4(e,t),i]}const s4=e=>{const{componentCls:t}=e,n=Sn(e,{selectHeight:e.controlHeightSM,multipleSelectItemHeight:e.multipleItemHeightSM,borderRadius:e.borderRadiusSM,borderRadiusSM:e.borderRadiusXS}),r=Sn(e,{fontSize:e.fontSizeLG,selectHeight:e.controlHeightLG,multipleSelectItemHeight:e.multipleItemHeightLG,borderRadius:e.borderRadiusLG,borderRadiusSM:e.borderRadius});return[Wp(e),Wp(n,"sm"),{[`${t}-multiple${t}-sm`]:{[`${t}-selection-placeholder`]:{insetInline:e.calc(e.controlPaddingHorizontalSM).sub(e.lineWidth).equal()},[`${t}-selection-search`]:{marginInlineStart:2}}},Wp(r,"lg")]};function Vp(e,t){const{componentCls:n,inputPaddingHorizontalBase:r,borderRadius:i}=e,o=e.calc(e.controlHeight).sub(e.calc(e.lineWidth).mul(2)).equal(),l=t?`${n}-${t}`:"";return{[`${n}-single${l}`]:{fontSize:e.fontSize,height:e.controlHeight,[`${n}-selector`]:Object.assign(Object.assign({},ci(e,!0)),{display:"flex",borderRadius:i,flex:"1 1 auto",[`${n}-selection-wrap:after`]:{lineHeight:$e(o)},[`${n}-selection-search`]:{position:"absolute",inset:0,width:"100%","&-input":{width:"100%",WebkitAppearance:"textfield"}},[` + ${n}-selection-item, + ${n}-selection-placeholder + `]:{display:"block",padding:0,lineHeight:$e(o),transition:`all ${e.motionDurationSlow}, visibility 0s`,alignSelf:"center"},[`${n}-selection-placeholder`]:{transition:"none",pointerEvents:"none"},[["&:after",`${n}-selection-item:empty:after`,`${n}-selection-placeholder:empty:after`].join(",")]:{display:"inline-block",width:0,visibility:"hidden",content:'"\\a0"'}}),[` + &${n}-show-arrow ${n}-selection-item, + &${n}-show-arrow ${n}-selection-search, + &${n}-show-arrow ${n}-selection-placeholder + `]:{paddingInlineEnd:e.showArrowPaddingInlineEnd},[`&${n}-open ${n}-selection-item`]:{color:e.colorTextPlaceholder},[`&:not(${n}-customize-input)`]:{[`${n}-selector`]:{width:"100%",height:"100%",alignItems:"center",padding:`0 ${$e(r)}`,[`${n}-selection-search-input`]:{height:o,fontSize:e.fontSize},"&:after":{lineHeight:$e(o)}}},[`&${n}-customize-input`]:{[`${n}-selector`]:{"&:after":{display:"none"},[`${n}-selection-search`]:{position:"static",width:"100%"},[`${n}-selection-placeholder`]:{position:"absolute",insetInlineStart:0,insetInlineEnd:0,padding:`0 ${$e(r)}`,"&:after":{display:"none"}}}}}}}function l4(e){const{componentCls:t}=e,n=e.calc(e.controlPaddingHorizontalSM).sub(e.lineWidth).equal();return[Vp(e),Vp(Sn(e,{controlHeight:e.controlHeightSM,borderRadius:e.borderRadiusSM}),"sm"),{[`${t}-single${t}-sm`]:{[`&:not(${t}-customize-input)`]:{[`${t}-selector`]:{padding:`0 ${$e(n)}`},[`&${t}-show-arrow ${t}-selection-search`]:{insetInlineEnd:e.calc(n).add(e.calc(e.fontSize).mul(1.5)).equal()},[` + &${t}-show-arrow ${t}-selection-item, + &${t}-show-arrow ${t}-selection-placeholder + `]:{paddingInlineEnd:e.calc(e.fontSize).mul(1.5).equal()}}}},Vp(Sn(e,{controlHeight:e.singleItemHeightLG,fontSize:e.fontSizeLG,borderRadius:e.borderRadiusLG}),"lg")]}const c4=e=>{const{fontSize:t,lineHeight:n,lineWidth:r,controlHeight:i,controlHeightSM:o,controlHeightLG:l,paddingXXS:m,controlPaddingHorizontal:u,zIndexPopupBase:p,colorText:s,fontWeightStrong:c,controlItemBgActive:d,controlItemBgHover:h,colorBgContainer:f,colorFillSecondary:v,colorBgContainerDisabled:y,colorTextDisabled:b,colorPrimaryHover:w,colorPrimary:x,controlOutline:E}=e,_=m*2,$=r*2,O=Math.min(i-_,i-$),N=Math.min(o-_,o-$),k=Math.min(l-_,l-$);return{INTERNAL_FIXED_ITEM_MARGIN:Math.floor(m/2),zIndexPopup:p+50,optionSelectedColor:s,optionSelectedFontWeight:c,optionSelectedBg:d,optionActiveBg:h,optionPadding:`${(i-t*n)/2}px ${u}px`,optionFontSize:t,optionLineHeight:n,optionHeight:i,selectorBg:f,clearBg:f,singleItemHeightLG:l,multipleItemBg:v,multipleItemBorderColor:"transparent",multipleItemHeight:O,multipleItemHeightSM:N,multipleItemHeightLG:k,multipleSelectorBgDisabled:y,multipleItemColorDisabled:b,multipleItemBorderColorDisabled:"transparent",showArrowPaddingInlineEnd:Math.ceil(e.fontSize*1.25),hoverBorderColor:w,activeBorderColor:x,activeOutlineColor:E,selectAffixPadding:m}},oE=(e,t)=>{const{componentCls:n,antCls:r,controlOutlineWidth:i}=e;return{[`&:not(${n}-customize-input) ${n}-selector`]:{border:`${$e(e.lineWidth)} ${e.lineType} ${t.borderColor}`,background:e.selectorBg},[`&:not(${n}-disabled):not(${n}-customize-input):not(${r}-pagination-size-changer)`]:{[`&:hover ${n}-selector`]:{borderColor:t.hoverBorderHover},[`${n}-focused& ${n}-selector`]:{borderColor:t.activeBorderColor,boxShadow:`0 0 0 ${$e(i)} ${t.activeOutlineColor}`,outline:0},[`${n}-prefix`]:{color:t.color}}}},ES=(e,t)=>({[`&${e.componentCls}-status-${t.status}`]:Object.assign({},oE(e,t))}),u4=e=>({"&-outlined":Object.assign(Object.assign(Object.assign(Object.assign({},oE(e,{borderColor:e.colorBorder,hoverBorderHover:e.hoverBorderColor,activeBorderColor:e.activeBorderColor,activeOutlineColor:e.activeOutlineColor,color:e.colorText})),ES(e,{status:"error",borderColor:e.colorError,hoverBorderHover:e.colorErrorHover,activeBorderColor:e.colorError,activeOutlineColor:e.colorErrorOutline,color:e.colorError})),ES(e,{status:"warning",borderColor:e.colorWarning,hoverBorderHover:e.colorWarningHover,activeBorderColor:e.colorWarning,activeOutlineColor:e.colorWarningOutline,color:e.colorWarning})),{[`&${e.componentCls}-disabled`]:{[`&:not(${e.componentCls}-customize-input) ${e.componentCls}-selector`]:{background:e.colorBgContainerDisabled,color:e.colorTextDisabled}},[`&${e.componentCls}-multiple ${e.componentCls}-selection-item`]:{background:e.multipleItemBg,border:`${$e(e.lineWidth)} ${e.lineType} ${e.multipleItemBorderColor}`}})}),aE=(e,t)=>{const{componentCls:n,antCls:r}=e;return{[`&:not(${n}-customize-input) ${n}-selector`]:{background:t.bg,border:`${$e(e.lineWidth)} ${e.lineType} transparent`,color:t.color},[`&:not(${n}-disabled):not(${n}-customize-input):not(${r}-pagination-size-changer)`]:{[`&:hover ${n}-selector`]:{background:t.hoverBg},[`${n}-focused& ${n}-selector`]:{background:e.selectorBg,borderColor:t.activeBorderColor,outline:0}}}},_S=(e,t)=>({[`&${e.componentCls}-status-${t.status}`]:Object.assign({},aE(e,t))}),d4=e=>({"&-filled":Object.assign(Object.assign(Object.assign(Object.assign({},aE(e,{bg:e.colorFillTertiary,hoverBg:e.colorFillSecondary,activeBorderColor:e.activeBorderColor,color:e.colorText})),_S(e,{status:"error",bg:e.colorErrorBg,hoverBg:e.colorErrorBgHover,activeBorderColor:e.colorError,color:e.colorError})),_S(e,{status:"warning",bg:e.colorWarningBg,hoverBg:e.colorWarningBgHover,activeBorderColor:e.colorWarning,color:e.colorWarning})),{[`&${e.componentCls}-disabled`]:{[`&:not(${e.componentCls}-customize-input) ${e.componentCls}-selector`]:{borderColor:e.colorBorder,background:e.colorBgContainerDisabled,color:e.colorTextDisabled}},[`&${e.componentCls}-multiple ${e.componentCls}-selection-item`]:{background:e.colorBgContainer,border:`${$e(e.lineWidth)} ${e.lineType} ${e.colorSplit}`}})}),f4=e=>({"&-borderless":{[`${e.componentCls}-selector`]:{background:"transparent",border:`${$e(e.lineWidth)} ${e.lineType} transparent`},[`&${e.componentCls}-disabled`]:{[`&:not(${e.componentCls}-customize-input) ${e.componentCls}-selector`]:{color:e.colorTextDisabled}},[`&${e.componentCls}-multiple ${e.componentCls}-selection-item`]:{background:e.multipleItemBg,border:`${$e(e.lineWidth)} ${e.lineType} ${e.multipleItemBorderColor}`},[`&${e.componentCls}-status-error`]:{[`${e.componentCls}-prefix, ${e.componentCls}-selection-item`]:{color:e.colorError}},[`&${e.componentCls}-status-warning`]:{[`${e.componentCls}-prefix, ${e.componentCls}-selection-item`]:{color:e.colorWarning}}}}),sE=(e,t)=>{const{componentCls:n,antCls:r}=e;return{[`&:not(${n}-customize-input) ${n}-selector`]:{borderWidth:`0 0 ${$e(e.lineWidth)} 0`,borderStyle:`none none ${e.lineType} none`,borderColor:t.borderColor,background:e.selectorBg,borderRadius:0},[`&:not(${n}-disabled):not(${n}-customize-input):not(${r}-pagination-size-changer)`]:{[`&:hover ${n}-selector`]:{borderColor:t.hoverBorderHover},[`${n}-focused& ${n}-selector`]:{borderColor:t.activeBorderColor,outline:0},[`${n}-prefix`]:{color:t.color}}}},MS=(e,t)=>({[`&${e.componentCls}-status-${t.status}`]:Object.assign({},sE(e,t))}),h4=e=>({"&-underlined":Object.assign(Object.assign(Object.assign(Object.assign({},sE(e,{borderColor:e.colorBorder,hoverBorderHover:e.hoverBorderColor,activeBorderColor:e.activeBorderColor,activeOutlineColor:e.activeOutlineColor,color:e.colorText})),MS(e,{status:"error",borderColor:e.colorError,hoverBorderHover:e.colorErrorHover,activeBorderColor:e.colorError,activeOutlineColor:e.colorErrorOutline,color:e.colorError})),MS(e,{status:"warning",borderColor:e.colorWarning,hoverBorderHover:e.colorWarningHover,activeBorderColor:e.colorWarning,activeOutlineColor:e.colorWarningOutline,color:e.colorWarning})),{[`&${e.componentCls}-disabled`]:{[`&:not(${e.componentCls}-customize-input) ${e.componentCls}-selector`]:{color:e.colorTextDisabled}},[`&${e.componentCls}-multiple ${e.componentCls}-selection-item`]:{background:e.multipleItemBg,border:`${$e(e.lineWidth)} ${e.lineType} ${e.multipleItemBorderColor}`}})}),p4=e=>({[e.componentCls]:Object.assign(Object.assign(Object.assign(Object.assign({},u4(e)),d4(e)),f4(e)),h4(e))}),g4=e=>{const{componentCls:t}=e;return{position:"relative",transition:`all ${e.motionDurationMid} ${e.motionEaseInOut}`,input:{cursor:"pointer"},[`${t}-show-search&`]:{cursor:"text",input:{cursor:"auto",color:"inherit",height:"100%"}},[`${t}-disabled&`]:{cursor:"not-allowed",input:{cursor:"not-allowed"}}}},m4=e=>{const{componentCls:t}=e;return{[`${t}-selection-search-input`]:{margin:0,padding:0,background:"transparent",border:"none",outline:"none",appearance:"none",fontFamily:"inherit","&::-webkit-search-cancel-button":{display:"none",appearance:"none"}}}},v4=e=>{const{antCls:t,componentCls:n,inputPaddingHorizontalBase:r,iconCls:i}=e,o={[`${n}-clear`]:{opacity:1,background:e.colorBgBase,borderRadius:"50%"}};return{[n]:Object.assign(Object.assign({},ci(e)),{position:"relative",display:"inline-flex",cursor:"pointer",[`&:not(${n}-customize-input) ${n}-selector`]:Object.assign(Object.assign({},g4(e)),m4(e)),[`${n}-selection-item`]:Object.assign(Object.assign({flex:1,fontWeight:"normal",position:"relative",userSelect:"none"},Ys),{[`> ${t}-typography`]:{display:"inline"}}),[`${n}-selection-placeholder`]:Object.assign(Object.assign({},Ys),{flex:1,color:e.colorTextPlaceholder,pointerEvents:"none"}),[`${n}-arrow`]:Object.assign(Object.assign({},Rc()),{position:"absolute",top:"50%",insetInlineStart:"auto",insetInlineEnd:r,height:e.fontSizeIcon,marginTop:e.calc(e.fontSizeIcon).mul(-1).div(2).equal(),color:e.colorTextQuaternary,fontSize:e.fontSizeIcon,lineHeight:1,textAlign:"center",pointerEvents:"none",display:"flex",alignItems:"center",transition:`opacity ${e.motionDurationSlow} ease`,[i]:{verticalAlign:"top",transition:`transform ${e.motionDurationSlow}`,"> svg":{verticalAlign:"top"},[`&:not(${n}-suffix)`]:{pointerEvents:"auto"}},[`${n}-disabled &`]:{cursor:"not-allowed"},"> *:not(:last-child)":{marginInlineEnd:8}}),[`${n}-selection-wrap`]:{display:"flex",width:"100%",position:"relative",minWidth:0,"&:after":{content:'"\\a0"',width:0,overflow:"hidden"}},[`${n}-prefix`]:{flex:"none",marginInlineEnd:e.selectAffixPadding},[`${n}-clear`]:{position:"absolute",top:"50%",insetInlineStart:"auto",insetInlineEnd:r,zIndex:1,display:"inline-block",width:e.fontSizeIcon,height:e.fontSizeIcon,marginTop:e.calc(e.fontSizeIcon).mul(-1).div(2).equal(),color:e.colorTextQuaternary,fontSize:e.fontSizeIcon,fontStyle:"normal",lineHeight:1,textAlign:"center",textTransform:"none",cursor:"pointer",opacity:0,transition:`color ${e.motionDurationMid} ease, opacity ${e.motionDurationSlow} ease`,textRendering:"auto","&:before":{display:"block"},"&:hover":{color:e.colorIcon}},"@media(hover:none)":o,"&:hover":o}),[`${n}-status`]:{"&-error, &-warning, &-success, &-validating":{[`&${n}-has-feedback`]:{[`${n}-clear`]:{insetInlineEnd:e.calc(r).add(e.fontSize).add(e.paddingXS).equal()}}}}}},y4=e=>{const{componentCls:t}=e;return[{[t]:{[`&${t}-in-form-item`]:{width:"100%"}}},v4(e),l4(e),s4(e),n4(e),{[`${t}-rtl`]:{direction:"rtl"}},Ev(e,{borderElCls:`${t}-selector`,focusElCls:`${t}-focused`})]},b4=gr("Select",(e,{rootPrefixCls:t})=>{const n=Sn(e,{rootPrefixCls:t,inputPaddingHorizontalBase:e.calc(e.paddingSM).sub(1).equal(),multipleSelectItemHeight:e.multipleItemHeight,selectHeight:e.controlHeight});return[y4(n),p4(n)]},c4,{unitless:{optionLineHeight:!0,optionSelectedFontWeight:!0}});var w4={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474a32 32 0 00-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1.4-12.8-6.3-12.8z"}}]},name:"check",theme:"outlined"},S4=function(t,n){return C.createElement(rr,nt({},t,{ref:n,icon:w4}))},lE=C.forwardRef(S4),C4={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"}}]},name:"down",theme:"outlined"},$4=function(t,n){return C.createElement(rr,nt({},t,{ref:n,icon:C4}))},x4=C.forwardRef($4),E4={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M909.6 854.5L649.9 594.8C690.2 542.7 712 479 712 412c0-80.2-31.3-155.4-87.9-212.1-56.6-56.7-132-87.9-212.1-87.9s-155.5 31.3-212.1 87.9C143.2 256.5 112 331.8 112 412c0 80.1 31.3 155.5 87.9 212.1C256.5 680.8 331.8 712 412 712c67 0 130.6-21.8 182.7-62l259.7 259.6a8.2 8.2 0 0011.6 0l43.6-43.5a8.2 8.2 0 000-11.6zM570.4 570.4C528 612.7 471.8 636 412 636s-116-23.3-158.4-65.6C211.3 528 188 471.8 188 412s23.3-116.1 65.6-158.4C296 211.3 352.2 188 412 188s116.1 23.2 158.4 65.6S636 352.2 636 412s-23.3 116.1-65.6 158.4z"}}]},name:"search",theme:"outlined"},_4=function(t,n){return C.createElement(rr,nt({},t,{ref:n,icon:E4}))},cE=C.forwardRef(_4);function M4({suffixIcon:e,clearIcon:t,menuItemSelectedIcon:n,removeIcon:r,loading:i,multiple:o,hasFeedback:l,prefixCls:m,showSuffixIcon:u,feedbackIcon:p,showArrow:s,componentName:c}){const d=t??C.createElement(Ac,null),h=b=>e===null&&!l&&!s?null:C.createElement(C.Fragment,null,u!==!1&&b,l&&p);let f=null;if(e!==void 0)f=h(e);else if(i)f=h(C.createElement(Tc,{spin:!0}));else{const b=`${m}-suffix`;f=({open:w,showSearch:x})=>h(w&&x?C.createElement(cE,{className:b}):C.createElement(x4,{className:b}))}let v=null;n!==void 0?v=n:o?v=C.createElement(lE,null):v=null;let y=null;return r!==void 0?y=r:y=C.createElement(tf,null),{clearIcon:d,suffixIcon:f,itemIcon:v,removeIcon:y}}function R4(e,t){return t!==void 0?t:e!==null}var O4=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i{var n,r,i,o,l;const{prefixCls:m,bordered:u,className:p,rootClassName:s,getPopupContainer:c,popupClassName:d,dropdownClassName:h,listHeight:f=256,placement:v,listItemHeight:y,size:b,disabled:w,notFoundContent:x,status:E,builtinPlacements:_,dropdownMatchSelectWidth:$,popupMatchSelectWidth:O,direction:N,style:k,allowClear:L,variant:F,dropdownStyle:P,transitionName:A,tagRender:M,maxCount:R,prefix:I,dropdownRender:D,popupRender:j,onDropdownVisibleChange:B,onOpenChange:V,styles:H,classNames:Y}=e,U=O4(e,["prefixCls","bordered","className","rootClassName","getPopupContainer","popupClassName","dropdownClassName","listHeight","placement","listItemHeight","size","disabled","notFoundContent","status","builtinPlacements","dropdownMatchSelectWidth","popupMatchSelectWidth","direction","style","allowClear","variant","dropdownStyle","transitionName","tagRender","maxCount","prefix","dropdownRender","popupRender","onDropdownVisibleChange","onOpenChange","styles","classNames"]),{getPopupContainer:K,getPrefixCls:G,renderEmpty:q,direction:Z,virtual:Q,popupMatchSelectWidth:J,popupOverflow:ie}=C.useContext(zt),{showSearch:se,style:ae,styles:ge,className:me,classNames:de}=Ji("select"),[,we]=Si(),Oe=y??(we==null?void 0:we.controlHeight),xe=G("select",m),Pe=G(),ze=N??Z,{compactSize:Ie,compactItemClassnames:Ye}=Lc(xe,ze),[Me,ke]=vf("select",F,u),Je=eo(xe),[ce,Ee,Re]=b4(xe,Je),Ae=C.useMemo(()=>{const{mode:ot}=e;if(ot!=="combobox")return ot===uE?"combobox":ot},[e.mode]),De=Ae==="multiple"||Ae==="tags",He=R4(e.suffixIcon,e.showArrow),it=(n=O??$)!==null&&n!==void 0?n:J,Ne=((r=H==null?void 0:H.popup)===null||r===void 0?void 0:r.root)||((i=ge.popup)===null||i===void 0?void 0:i.root)||P,Te=j||D,We=V||B,{status:te,hasFeedback:fe,isFormItemInput:je,feedbackIcon:ct}=C.useContext(bi),Jt=mf(te,E);let kt;x!==void 0?kt=x:Ae==="combobox"?kt=null:kt=(q==null?void 0:q("Select"))||C.createElement(JF,{componentName:"Select"});const{suffixIcon:rn,itemIcon:Qt,removeIcon:Lt,clearIcon:Nt}=M4(Object.assign(Object.assign({},U),{multiple:De,hasFeedback:fe,feedbackIcon:ct,showSuffixIcon:He,prefixCls:xe,componentName:"Select"})),Et=L===!0?{clearIcon:Nt}:L,dt=Er(U,["suffixIcon","itemIcon"]),et=ve(((o=Y==null?void 0:Y.popup)===null||o===void 0?void 0:o.root)||((l=de==null?void 0:de.popup)===null||l===void 0?void 0:l.root)||d||h,{[`${xe}-dropdown-${ze}`]:ze==="rtl"},s,de.root,Y==null?void 0:Y.root,Re,Je,Ee),Ke=to(ot=>{var rt;return(rt=b??Ie)!==null&&rt!==void 0?rt:ot}),_t=C.useContext(Ro),Tt=w??_t,tt=ve({[`${xe}-lg`]:Ke==="large",[`${xe}-sm`]:Ke==="small",[`${xe}-rtl`]:ze==="rtl",[`${xe}-${Me}`]:ke,[`${xe}-in-form-item`]:je},kd(xe,Jt,fe),Ye,me,p,de.root,Y==null?void 0:Y.root,s,Re,Je,Ee),Ze=C.useMemo(()=>v!==void 0?v:ze==="rtl"?"bottomRight":"bottomLeft",[v,ze]),[at]=rx("SelectLike",Ne==null?void 0:Ne.zIndex);return ce(C.createElement(kv,Object.assign({ref:t,virtual:Q,showSearch:se},dt,{style:Object.assign(Object.assign(Object.assign(Object.assign({},ge.root),H==null?void 0:H.root),ae),k),dropdownMatchSelectWidth:it,transitionName:wv(Pe,"slide-up",A),builtinPlacements:t4(_,ie),listHeight:f,listItemHeight:Oe,mode:Ae,prefixCls:xe,placement:Ze,direction:ze,prefix:I,suffixIcon:rn,menuItemSelectedIcon:Qt,removeIcon:Lt,allowClear:Et,notFoundContent:kt,className:tt,getPopupContainer:c||K,dropdownClassName:et,disabled:Tt,dropdownStyle:Object.assign(Object.assign({},Ne),{zIndex:at}),maxCount:De?R:void 0,tagRender:De?M:void 0,dropdownRender:Te,onDropdownVisibleChange:We})))},Xa=C.forwardRef(A4),T4=gD(Xa,"dropdownAlign");Xa.SECRET_COMBOBOX_MODE_DO_NOT_USE=uE;Xa.Option=Pv;Xa.OptGroup=Lv;Xa._InternalPanelDoNotUseOrYouWillBeFired=T4;const I4=(e,t)=>{typeof(e==null?void 0:e.addEventListener)<"u"?e.addEventListener("change",t):typeof(e==null?void 0:e.addListener)<"u"&&e.addListener(t)},L4=(e,t)=>{typeof(e==null?void 0:e.removeEventListener)<"u"?e.removeEventListener("change",t):typeof(e==null?void 0:e.removeListener)<"u"&&e.removeListener(t)},mc=["xxl","xl","lg","md","sm","xs"],P4=e=>({xs:`(max-width: ${e.screenXSMax}px)`,sm:`(min-width: ${e.screenSM}px)`,md:`(min-width: ${e.screenMD}px)`,lg:`(min-width: ${e.screenLG}px)`,xl:`(min-width: ${e.screenXL}px)`,xxl:`(min-width: ${e.screenXXL}px)`}),k4=e=>{const t=e,n=[].concat(mc).reverse();return n.forEach((r,i)=>{const o=r.toUpperCase(),l=`screen${o}Min`,m=`screen${o}`;if(!(t[l]<=t[m]))throw new Error(`${l}<=${m} fails : !(${t[l]}<=${t[m]})`);if(i{const[,e]=Si(),t=P4(k4(e));return be.useMemo(()=>{const n=new Map;let r=-1,i={};return{responsiveMap:t,matchHandlers:{},dispatch(o){return i=o,n.forEach(l=>l(i)),n.size>=1},subscribe(o){return n.size||this.register(),r+=1,n.set(r,o),o(i),r},unsubscribe(o){n.delete(o),n.size||this.unregister()},register(){Object.entries(t).forEach(([o,l])=>{const m=({matches:p})=>{this.dispatch(Object.assign(Object.assign({},i),{[o]:p}))},u=window.matchMedia(l);I4(u,m),this.matchHandlers[l]={mql:u,listener:m},m(u)})},unregister(){Object.values(t).forEach(o=>{const l=this.matchHandlers[o];L4(l==null?void 0:l.mql,l==null?void 0:l.listener)}),n.clear()}}},[e])};function D4(){const[,e]=C.useReducer(t=>t+1,0);return e}function F4(e=!0,t={}){const n=C.useRef(t),r=D4(),i=N4();return fn(()=>{const o=i.subscribe(l=>{n.current=l,e&&r()});return()=>i.unsubscribe(o)},[]),n.current}function dE(e){var t=e.children,n=e.prefixCls,r=e.id,i=e.overlayInnerStyle,o=e.bodyClassName,l=e.className,m=e.style;return C.createElement("div",{className:ve("".concat(n,"-content"),l),style:m},C.createElement("div",{className:ve("".concat(n,"-inner"),o),id:r,role:"tooltip",style:i},typeof t=="function"?t():t))}var $s={shiftX:64,adjustY:1},xs={adjustX:1,shiftY:!0},Ti=[0,0],z4={left:{points:["cr","cl"],overflow:xs,offset:[-4,0],targetOffset:Ti},right:{points:["cl","cr"],overflow:xs,offset:[4,0],targetOffset:Ti},top:{points:["bc","tc"],overflow:$s,offset:[0,-4],targetOffset:Ti},bottom:{points:["tc","bc"],overflow:$s,offset:[0,4],targetOffset:Ti},topLeft:{points:["bl","tl"],overflow:$s,offset:[0,-4],targetOffset:Ti},leftTop:{points:["tr","tl"],overflow:xs,offset:[-4,0],targetOffset:Ti},topRight:{points:["br","tr"],overflow:$s,offset:[0,-4],targetOffset:Ti},rightTop:{points:["tl","tr"],overflow:xs,offset:[4,0],targetOffset:Ti},bottomRight:{points:["tr","br"],overflow:$s,offset:[0,4],targetOffset:Ti},rightBottom:{points:["bl","br"],overflow:xs,offset:[4,0],targetOffset:Ti},bottomLeft:{points:["tl","bl"],overflow:$s,offset:[0,4],targetOffset:Ti},leftBottom:{points:["br","bl"],overflow:xs,offset:[-4,0],targetOffset:Ti}},j4=["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","motion","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle","arrowContent","overlay","id","showArrow","classNames","styles"],B4=function(t,n){var r=t.overlayClassName,i=t.trigger,o=i===void 0?["hover"]:i,l=t.mouseEnterDelay,m=l===void 0?0:l,u=t.mouseLeaveDelay,p=u===void 0?.1:u,s=t.overlayStyle,c=t.prefixCls,d=c===void 0?"rc-tooltip":c,h=t.children,f=t.onVisibleChange,v=t.afterVisibleChange,y=t.transitionName,b=t.animation,w=t.motion,x=t.placement,E=x===void 0?"right":x,_=t.align,$=_===void 0?{}:_,O=t.destroyTooltipOnHide,N=O===void 0?!1:O,k=t.defaultVisible,L=t.getTooltipContainer,F=t.overlayInnerStyle;t.arrowContent;var P=t.overlay,A=t.id,M=t.showArrow,R=M===void 0?!0:M,I=t.classNames,D=t.styles,j=At(t,j4),B=_x(A),V=C.useRef(null);C.useImperativeHandle(n,function(){return V.current});var H=oe({},j);"visible"in t&&(H.popupVisible=t.visible);var Y=function(){return C.createElement(dE,{key:"content",prefixCls:d,id:B,bodyClassName:I==null?void 0:I.body,overlayInnerStyle:oe(oe({},F),D==null?void 0:D.body)},P)},U=function(){var G=C.Children.only(h),q=(G==null?void 0:G.props)||{},Z=oe(oe({},q),{},{"aria-describedby":P?B:null});return C.cloneElement(h,Z)};return C.createElement(gf,nt({popupClassName:ve(r,I==null?void 0:I.root),prefixCls:d,popup:Y,action:o,builtinPlacements:z4,popupPlacement:E,ref:V,popupAlign:$,getPopupContainer:L,onPopupVisibleChange:f,afterPopupVisibleChange:v,popupTransitionName:y,popupAnimation:b,popupMotion:w,defaultPopupVisible:k,autoDestroy:N,mouseLeaveDelay:p,popupStyle:oe(oe({},s),D==null?void 0:D.root),mouseEnterDelay:m,arrow:R},H),U())};const H4=C.forwardRef(B4);function W4(e){const{sizePopupArrow:t,borderRadiusXS:n,borderRadiusOuter:r}=e,i=t/2,o=0,l=i,m=r*1/Math.sqrt(2),u=i-r*(1-1/Math.sqrt(2)),p=i-n*(1/Math.sqrt(2)),s=r*(Math.sqrt(2)-1)+n*(1/Math.sqrt(2)),c=2*i-p,d=s,h=2*i-m,f=u,v=2*i-o,y=l,b=i*Math.sqrt(2)+r*(Math.sqrt(2)-2),w=r*(Math.sqrt(2)-1),x=`polygon(${w}px 100%, 50% ${w}px, ${2*i-w}px 100%, ${w}px 100%)`,E=`path('M ${o} ${l} A ${r} ${r} 0 0 0 ${m} ${u} L ${p} ${s} A ${n} ${n} 0 0 1 ${c} ${d} L ${h} ${f} A ${r} ${r} 0 0 0 ${v} ${y} Z')`;return{arrowShadowWidth:b,arrowPath:E,arrowPolygon:x}}const V4=(e,t,n)=>{const{sizePopupArrow:r,arrowPolygon:i,arrowPath:o,arrowShadowWidth:l,borderRadiusXS:m,calc:u}=e;return{pointerEvents:"none",width:r,height:r,overflow:"hidden","&::before":{position:"absolute",bottom:0,insetInlineStart:0,width:r,height:u(r).div(2).equal(),background:t,clipPath:{_multi_value_:!0,value:[i,o]},content:'""'},"&::after":{content:'""',position:"absolute",width:l,height:l,bottom:0,insetInline:0,margin:"auto",borderRadius:{_skip_check_:!0,value:`0 0 ${$e(m)} 0`},transform:"translateY(50%) rotate(-135deg)",boxShadow:n,zIndex:0,background:"transparent"}}},fE=8;function hE(e){const{contentRadius:t,limitVerticalRadius:n}=e,r=t>12?t+2:12;return{arrowOffsetHorizontal:r,arrowOffsetVertical:n?fE:r}}function Yu(e,t){return e?t:{}}function U4(e,t,n){const{componentCls:r,boxShadowPopoverArrow:i,arrowOffsetVertical:o,arrowOffsetHorizontal:l}=e,{arrowDistance:m=0,arrowPlacement:u={left:!0,right:!0,top:!0,bottom:!0}}={};return{[r]:Object.assign(Object.assign(Object.assign(Object.assign({[`${r}-arrow`]:[Object.assign(Object.assign({position:"absolute",zIndex:1,display:"block"},V4(e,t,i)),{"&:before":{background:t}})]},Yu(!!u.top,{[[`&-placement-top > ${r}-arrow`,`&-placement-topLeft > ${r}-arrow`,`&-placement-topRight > ${r}-arrow`].join(",")]:{bottom:m,transform:"translateY(100%) rotate(180deg)"},[`&-placement-top > ${r}-arrow`]:{left:{_skip_check_:!0,value:"50%"},transform:"translateX(-50%) translateY(100%) rotate(180deg)"},"&-placement-topLeft":{"--arrow-offset-horizontal":l,[`> ${r}-arrow`]:{left:{_skip_check_:!0,value:l}}},"&-placement-topRight":{"--arrow-offset-horizontal":`calc(100% - ${$e(l)})`,[`> ${r}-arrow`]:{right:{_skip_check_:!0,value:l}}}})),Yu(!!u.bottom,{[[`&-placement-bottom > ${r}-arrow`,`&-placement-bottomLeft > ${r}-arrow`,`&-placement-bottomRight > ${r}-arrow`].join(",")]:{top:m,transform:"translateY(-100%)"},[`&-placement-bottom > ${r}-arrow`]:{left:{_skip_check_:!0,value:"50%"},transform:"translateX(-50%) translateY(-100%)"},"&-placement-bottomLeft":{"--arrow-offset-horizontal":l,[`> ${r}-arrow`]:{left:{_skip_check_:!0,value:l}}},"&-placement-bottomRight":{"--arrow-offset-horizontal":`calc(100% - ${$e(l)})`,[`> ${r}-arrow`]:{right:{_skip_check_:!0,value:l}}}})),Yu(!!u.left,{[[`&-placement-left > ${r}-arrow`,`&-placement-leftTop > ${r}-arrow`,`&-placement-leftBottom > ${r}-arrow`].join(",")]:{right:{_skip_check_:!0,value:m},transform:"translateX(100%) rotate(90deg)"},[`&-placement-left > ${r}-arrow`]:{top:{_skip_check_:!0,value:"50%"},transform:"translateY(-50%) translateX(100%) rotate(90deg)"},[`&-placement-leftTop > ${r}-arrow`]:{top:o},[`&-placement-leftBottom > ${r}-arrow`]:{bottom:o}})),Yu(!!u.right,{[[`&-placement-right > ${r}-arrow`,`&-placement-rightTop > ${r}-arrow`,`&-placement-rightBottom > ${r}-arrow`].join(",")]:{left:{_skip_check_:!0,value:m},transform:"translateX(-100%) rotate(-90deg)"},[`&-placement-right > ${r}-arrow`]:{top:{_skip_check_:!0,value:"50%"},transform:"translateY(-50%) translateX(-100%) rotate(-90deg)"},[`&-placement-rightTop > ${r}-arrow`]:{top:o},[`&-placement-rightBottom > ${r}-arrow`]:{bottom:o}}))}}function G4(e,t,n,r){if(r===!1)return{adjustX:!1,adjustY:!1};const i=r&&typeof r=="object"?r:{},o={};switch(e){case"top":case"bottom":o.shiftX=t.arrowOffsetHorizontal*2+n,o.shiftY=!0,o.adjustY=!0;break;case"left":case"right":o.shiftY=t.arrowOffsetVertical*2+n,o.shiftX=!0,o.adjustX=!0;break}const l=Object.assign(Object.assign({},o),i);return l.shiftX||(l.adjustX=!0),l.shiftY||(l.adjustY=!0),l}const RS={left:{points:["cr","cl"]},right:{points:["cl","cr"]},top:{points:["bc","tc"]},bottom:{points:["tc","bc"]},topLeft:{points:["bl","tl"]},leftTop:{points:["tr","tl"]},topRight:{points:["br","tr"]},rightTop:{points:["tl","tr"]},bottomRight:{points:["tr","br"]},rightBottom:{points:["bl","br"]},bottomLeft:{points:["tl","bl"]},leftBottom:{points:["br","bl"]}},K4={topLeft:{points:["bl","tc"]},leftTop:{points:["tr","cl"]},topRight:{points:["br","tc"]},rightTop:{points:["tl","cr"]},bottomRight:{points:["tr","bc"]},rightBottom:{points:["bl","cr"]},bottomLeft:{points:["tl","bc"]},leftBottom:{points:["br","cl"]}},Y4=new Set(["topLeft","topRight","bottomLeft","bottomRight","leftTop","leftBottom","rightTop","rightBottom"]);function X4(e){const{arrowWidth:t,autoAdjustOverflow:n,arrowPointAtCenter:r,offset:i,borderRadius:o}=e,l=t/2,m={};return Object.keys(RS).forEach(u=>{const p=r&&K4[u]||RS[u],s=Object.assign(Object.assign({},p),{offset:[0,0],dynamicInset:!0});switch(m[u]=s,Y4.has(u)&&(s.autoArrow=!1),u){case"top":case"topLeft":case"topRight":s.offset[1]=-l-i;break;case"bottom":case"bottomLeft":case"bottomRight":s.offset[1]=l+i;break;case"left":case"leftTop":case"leftBottom":s.offset[0]=-l-i;break;case"right":case"rightTop":case"rightBottom":s.offset[0]=l+i;break}const c=hE({contentRadius:o,limitVerticalRadius:!0});if(r)switch(u){case"topLeft":case"bottomLeft":s.offset[0]=-c.arrowOffsetHorizontal-l;break;case"topRight":case"bottomRight":s.offset[0]=c.arrowOffsetHorizontal+l;break;case"leftTop":case"rightTop":s.offset[1]=-c.arrowOffsetHorizontal*2+l;break;case"leftBottom":case"rightBottom":s.offset[1]=c.arrowOffsetHorizontal*2-l;break}s.overflow=G4(u,c,t,n),s.htmlRegion="visibleFirst"}),m}const q4=e=>{const{calc:t,componentCls:n,tooltipMaxWidth:r,tooltipColor:i,tooltipBg:o,tooltipBorderRadius:l,zIndexPopup:m,controlHeight:u,boxShadowSecondary:p,paddingSM:s,paddingXS:c,arrowOffsetHorizontal:d,sizePopupArrow:h}=e,f=t(l).add(h).add(d).equal(),v=t(l).mul(2).add(h).equal();return[{[n]:Object.assign(Object.assign(Object.assign(Object.assign({},ci(e)),{position:"absolute",zIndex:m,display:"block",width:"max-content",maxWidth:r,visibility:"visible","--valid-offset-x":"var(--arrow-offset-horizontal, var(--arrow-x))",transformOrigin:["var(--valid-offset-x, 50%)","var(--arrow-y, 50%)"].join(" "),"&-hidden":{display:"none"},"--antd-arrow-background-color":o,[`${n}-inner`]:{minWidth:v,minHeight:u,padding:`${$e(e.calc(s).div(2).equal())} ${$e(c)}`,color:i,textAlign:"start",textDecoration:"none",wordWrap:"break-word",backgroundColor:o,borderRadius:l,boxShadow:p,boxSizing:"border-box"},[["&-placement-topLeft","&-placement-topRight","&-placement-bottomLeft","&-placement-bottomRight"].join(",")]:{minWidth:f},[["&-placement-left","&-placement-leftTop","&-placement-leftBottom","&-placement-right","&-placement-rightTop","&-placement-rightBottom"].join(",")]:{[`${n}-inner`]:{borderRadius:e.min(l,fE)}},[`${n}-content`]:{position:"relative"}}),AI(e,(y,{darkColor:b})=>({[`&${n}-${y}`]:{[`${n}-inner`]:{backgroundColor:b},[`${n}-arrow`]:{"--antd-arrow-background-color":b}}}))),{"&-rtl":{direction:"rtl"}})},U4(e,"var(--antd-arrow-background-color)"),{[`${n}-pure`]:{position:"relative",maxWidth:"none",margin:e.sizePopupArrow}}]},Q4=e=>Object.assign(Object.assign({zIndexPopup:e.zIndexPopupBase+70},hE({contentRadius:e.borderRadius,limitVerticalRadius:!0})),W4(Sn(e,{borderRadiusOuter:Math.min(e.borderRadiusOuter,4)}))),pE=(e,t=!0)=>gr("Tooltip",r=>{const{borderRadius:i,colorTextLightSolid:o,colorBgSpotlight:l}=r,m=Sn(r,{tooltipMaxWidth:250,tooltipColor:o,tooltipBorderRadius:i,tooltipBg:l});return[q4(m),TP(r,"zoom-big-fast")]},Q4,{resetStyle:!1,injectStyle:t})(e),Z4=Ba.map(e=>`${e}-inverse`);function J4(e,t=!0){return t?[].concat(Ge(Z4),Ge(Ba)).includes(e):Ba.includes(e)}function gE(e,t){const n=J4(t),r=ve({[`${e}-${t}`]:t&&n}),i={},o={};return t&&!n&&(i.background=t,o["--antd-arrow-background-color"]=t),{className:r,overlayStyle:i,arrowStyle:o}}const ez=e=>{const{prefixCls:t,className:n,placement:r="top",title:i,color:o,overlayInnerStyle:l}=e,{getPrefixCls:m}=C.useContext(zt),u=m("tooltip",t),[p,s,c]=pE(u),d=gE(u,o),h=d.arrowStyle,f=Object.assign(Object.assign({},l),d.overlayStyle),v=ve(s,c,u,`${u}-pure`,`${u}-placement-${r}`,n,d.className);return p(C.createElement("div",{className:v,style:h},C.createElement("div",{className:`${u}-arrow`}),C.createElement(dE,Object.assign({},e,{className:s,prefixCls:u,overlayInnerStyle:f}),i)))};var tz=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i{var n,r;const{prefixCls:i,openClassName:o,getTooltipContainer:l,color:m,overlayInnerStyle:u,children:p,afterOpenChange:s,afterVisibleChange:c,destroyTooltipOnHide:d,destroyOnHidden:h,arrow:f=!0,title:v,overlay:y,builtinPlacements:b,arrowPointAtCenter:w=!1,autoAdjustOverflow:x=!0,motion:E,getPopupContainer:_,placement:$="top",mouseEnterDelay:O=.1,mouseLeaveDelay:N=.1,overlayStyle:k,rootClassName:L,overlayClassName:F,styles:P,classNames:A}=e,M=tz(e,["prefixCls","openClassName","getTooltipContainer","color","overlayInnerStyle","children","afterOpenChange","afterVisibleChange","destroyTooltipOnHide","destroyOnHidden","arrow","title","overlay","builtinPlacements","arrowPointAtCenter","autoAdjustOverflow","motion","getPopupContainer","placement","mouseEnterDelay","mouseLeaveDelay","overlayStyle","rootClassName","overlayClassName","styles","classNames"]),R=!!f,[,I]=Si(),{getPopupContainer:D,getPrefixCls:j,direction:B,className:V,style:H,classNames:Y,styles:U}=Ji("tooltip"),K=_c(),G=C.useRef(null),q=()=>{var He;(He=G.current)===null||He===void 0||He.forceAlign()};C.useImperativeHandle(t,()=>{var He,it;return{forceAlign:q,forcePopupAlign:()=>{K.deprecated(!1,"forcePopupAlign","forceAlign"),q()},nativeElement:(He=G.current)===null||He===void 0?void 0:He.nativeElement,popupElement:(it=G.current)===null||it===void 0?void 0:it.popupElement}});const[Z,Q]=Pr(!1,{value:(n=e.open)!==null&&n!==void 0?n:e.visible,defaultValue:(r=e.defaultOpen)!==null&&r!==void 0?r:e.defaultVisible}),J=!v&&!y&&v!==0,ie=He=>{var it,Ne;Q(J?!1:He),J||((it=e.onOpenChange)===null||it===void 0||it.call(e,He),(Ne=e.onVisibleChange)===null||Ne===void 0||Ne.call(e,He))},se=C.useMemo(()=>{var He,it;let Ne=w;return typeof f=="object"&&(Ne=(it=(He=f.pointAtCenter)!==null&&He!==void 0?He:f.arrowPointAtCenter)!==null&&it!==void 0?it:w),b||X4({arrowPointAtCenter:Ne,autoAdjustOverflow:x,arrowWidth:R?I.sizePopupArrow:0,borderRadius:I.borderRadius,offset:I.marginXXS})},[w,f,b,I]),ae=C.useMemo(()=>v===0?v:y||v||"",[y,v]),ge=C.createElement(bm,{space:!0},typeof ae=="function"?ae():ae),me=j("tooltip",i),de=j(),we=e["data-popover-inject"];let Oe=Z;!("open"in e)&&!("visible"in e)&&J&&(Oe=!1);const xe=C.isValidElement(p)&&!X$(p)?p:C.createElement("span",null,p),Pe=xe.props,ze=!Pe.className||typeof Pe.className=="string"?ve(Pe.className,o||`${me}-open`):Pe.className,[Ie,Ye,Me]=pE(me,!we),ke=gE(me,m),Je=ke.arrowStyle,ce=ve(F,{[`${me}-rtl`]:B==="rtl"},ke.className,L,Ye,Me,V,Y.root,A==null?void 0:A.root),Ee=ve(Y.body,A==null?void 0:A.body),[Re,Ae]=rx("Tooltip",M.zIndex),De=C.createElement(H4,Object.assign({},M,{zIndex:Re,showArrow:R,placement:$,mouseEnterDelay:O,mouseLeaveDelay:N,prefixCls:me,classNames:{root:ce,body:Ee},styles:{root:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},Je),U.root),H),k),P==null?void 0:P.root),body:Object.assign(Object.assign(Object.assign(Object.assign({},U.body),u),P==null?void 0:P.body),ke.overlayStyle)},getTooltipContainer:_||l||D,ref:G,builtinPlacements:se,overlay:ge,visible:Oe,onVisibleChange:ie,afterVisibleChange:s??c,arrowContent:C.createElement("span",{className:`${me}-arrow-content`}),motion:{motionName:wv(de,"zoom-big-fast",e.transitionName),motionDeadline:1e3},destroyTooltipOnHide:h??!!d}),Oe?Oo(xe,{className:ze}):xe);return Ie(C.createElement(ex.Provider,{value:Ae},De))}),nl=nz;nl._InternalPanelDoNotUseOrYouWillBeFired=ez;var rz=mt.ESC,iz=mt.TAB;function oz(e){var t=e.visible,n=e.triggerRef,r=e.onVisibleChange,i=e.autoFocus,o=e.overlayRef,l=C.useRef(!1),m=function(){if(t){var c,d;(c=n.current)===null||c===void 0||(d=c.focus)===null||d===void 0||d.call(c),r==null||r(!1)}},u=function(){var c;return(c=o.current)!==null&&c!==void 0&&c.focus?(o.current.focus(),l.current=!0,!0):!1},p=function(c){switch(c.keyCode){case rz:m();break;case iz:{var d=!1;l.current||(d=u()),d?c.preventDefault():m();break}}};C.useEffect(function(){return t?(window.addEventListener("keydown",p),i&&gn(u,3),function(){window.removeEventListener("keydown",p),l.current=!1}):function(){l.current=!1}},[t])}var az=C.forwardRef(function(e,t){var n=e.overlay,r=e.arrow,i=e.prefixCls,o=C.useMemo(function(){var m;return typeof n=="function"?m=n():m=n,m},[n]),l=wi(t,Ka(o));return be.createElement(be.Fragment,null,r&&be.createElement("div",{className:"".concat(i,"-arrow")}),be.cloneElement(o,{ref:fa(o)?l:void 0}))}),Es={adjustX:1,adjustY:1},_s=[0,0],sz={topLeft:{points:["bl","tl"],overflow:Es,offset:[0,-4],targetOffset:_s},top:{points:["bc","tc"],overflow:Es,offset:[0,-4],targetOffset:_s},topRight:{points:["br","tr"],overflow:Es,offset:[0,-4],targetOffset:_s},bottomLeft:{points:["tl","bl"],overflow:Es,offset:[0,4],targetOffset:_s},bottom:{points:["tc","bc"],overflow:Es,offset:[0,4],targetOffset:_s},bottomRight:{points:["tr","br"],overflow:Es,offset:[0,4],targetOffset:_s}},lz=["arrow","prefixCls","transitionName","animation","align","placement","placements","getPopupContainer","showAction","hideAction","overlayClassName","overlayStyle","visible","trigger","autoFocus","overlay","children","onVisibleChange"];function cz(e,t){var n,r=e.arrow,i=r===void 0?!1:r,o=e.prefixCls,l=o===void 0?"rc-dropdown":o,m=e.transitionName,u=e.animation,p=e.align,s=e.placement,c=s===void 0?"bottomLeft":s,d=e.placements,h=d===void 0?sz:d,f=e.getPopupContainer,v=e.showAction,y=e.hideAction,b=e.overlayClassName,w=e.overlayStyle,x=e.visible,E=e.trigger,_=E===void 0?["hover"]:E,$=e.autoFocus,O=e.overlay,N=e.children,k=e.onVisibleChange,L=At(e,lz),F=be.useState(),P=pe(F,2),A=P[0],M=P[1],R="visible"in e?x:A,I=be.useRef(null),D=be.useRef(null),j=be.useRef(null);be.useImperativeHandle(t,function(){return I.current});var B=function(Q){M(Q),k==null||k(Q)};oz({visible:R,triggerRef:j,onVisibleChange:B,autoFocus:$,overlayRef:D});var V=function(Q){var J=e.onOverlayClick;M(!1),J&&J(Q)},H=function(){return be.createElement(az,{ref:D,overlay:O,prefixCls:l,arrow:i})},Y=function(){return typeof O=="function"?H:H()},U=function(){var Q=e.minOverlayWidthMatchTrigger,J=e.alignPoint;return"minOverlayWidthMatchTrigger"in e?Q:!J},K=function(){var Q=e.openClassName;return Q!==void 0?Q:"".concat(l,"-open")},G=be.cloneElement(N,{className:ve((n=N.props)===null||n===void 0?void 0:n.className,R&&K()),ref:fa(N)?wi(j,Ka(N)):void 0}),q=y;return!q&&_.indexOf("contextMenu")!==-1&&(q=["click"]),be.createElement(gf,nt({builtinPlacements:h},L,{prefixCls:l,ref:I,popupClassName:ve(b,ne({},"".concat(l,"-show-arrow"),i)),popupStyle:w,action:_,showAction:v,hideAction:q,popupPlacement:c,popupAlign:p,popupTransitionName:m,popupAnimation:u,popupVisible:R,stretch:U()?"minWidth":"",popup:Y(),onPopupVisibleChange:B,onPopupClick:V,getPopupContainer:f}),G)}const uz=be.forwardRef(cz);var mE=C.createContext(null);function vE(e,t){return e===void 0?null:"".concat(e,"-").concat(t)}function yE(e){var t=C.useContext(mE);return vE(t,e)}var dz=["children","locked"],Zi=C.createContext(null);function fz(e,t){var n=oe({},e);return Object.keys(t).forEach(function(r){var i=t[r];i!==void 0&&(n[r]=i)}),n}function vc(e){var t=e.children,n=e.locked,r=At(e,dz),i=C.useContext(Zi),o=xc(function(){return fz(i,r)},[i,r],function(l,m){return!n&&(l[0]!==m[0]||!lc(l[1],m[1],!0))});return C.createElement(Zi.Provider,{value:o},t)}var hz=[],bE=C.createContext(null);function yf(){return C.useContext(bE)}var wE=C.createContext(hz);function Dc(e){var t=C.useContext(wE);return C.useMemo(function(){return e!==void 0?[].concat(Ge(t),[e]):t},[t,e])}var SE=C.createContext(null),Nv=C.createContext({});function OS(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(rf(e)){var n=e.nodeName.toLowerCase(),r=["input","select","textarea","button"].includes(n)||e.isContentEditable||n==="a"&&!!e.getAttribute("href"),i=e.getAttribute("tabindex"),o=Number(i),l=null;return i&&!Number.isNaN(o)?l=o:r&&l===null&&(l=0),r&&e.disabled&&(l=null),l!==null&&(l>=0||t&&l<0)}return!1}function pz(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=Ge(e.querySelectorAll("*")).filter(function(r){return OS(r,t)});return OS(e,t)&&n.unshift(e),n}var _m=mt.LEFT,Mm=mt.RIGHT,Rm=mt.UP,pd=mt.DOWN,gd=mt.ENTER,CE=mt.ESC,Fl=mt.HOME,zl=mt.END,AS=[Rm,pd,_m,Mm];function gz(e,t,n,r){var i,o="prev",l="next",m="children",u="parent";if(e==="inline"&&r===gd)return{inlineTrigger:!0};var p=ne(ne({},Rm,o),pd,l),s=ne(ne(ne(ne({},_m,n?l:o),Mm,n?o:l),pd,m),gd,m),c=ne(ne(ne(ne(ne(ne({},Rm,o),pd,l),gd,m),CE,u),_m,n?m:u),Mm,n?u:m),d={inline:p,horizontal:s,vertical:c,inlineSub:p,horizontalSub:c,verticalSub:c},h=(i=d["".concat(e).concat(t?"":"Sub")])===null||i===void 0?void 0:i[r];switch(h){case o:return{offset:-1,sibling:!0};case l:return{offset:1,sibling:!0};case u:return{offset:-1,sibling:!1};case m:return{offset:1,sibling:!1};default:return null}}function mz(e){for(var t=e;t;){if(t.getAttribute("data-menu-list"))return t;t=t.parentElement}return null}function vz(e,t){for(var n=e||document.activeElement;n;){if(t.has(n))return n;n=n.parentElement}return null}function Dv(e,t){var n=pz(e,!0);return n.filter(function(r){return t.has(r)})}function TS(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:1;if(!e)return null;var i=Dv(e,t),o=i.length,l=i.findIndex(function(m){return n===m});return r<0?l===-1?l=o-1:l-=1:r>0&&(l+=1),l=(l+o)%o,i[l]}var Om=function(t,n){var r=new Set,i=new Map,o=new Map;return t.forEach(function(l){var m=document.querySelector("[data-menu-id='".concat(vE(n,l),"']"));m&&(r.add(m),o.set(m,l),i.set(l,m))}),{elements:r,key2element:i,element2key:o}};function yz(e,t,n,r,i,o,l,m,u,p){var s=C.useRef(),c=C.useRef();c.current=t;var d=function(){gn.cancel(s.current)};return C.useEffect(function(){return function(){d()}},[]),function(h){var f=h.which;if([].concat(AS,[gd,CE,Fl,zl]).includes(f)){var v=o(),y=Om(v,r),b=y,w=b.elements,x=b.key2element,E=b.element2key,_=x.get(t),$=vz(_,w),O=E.get($),N=gz(e,l(O,!0).length===1,n,f);if(!N&&f!==Fl&&f!==zl)return;(AS.includes(f)||[Fl,zl].includes(f))&&h.preventDefault();var k=function(D){if(D){var j=D,B=D.querySelector("a");B!=null&&B.getAttribute("href")&&(j=B);var V=E.get(D);m(V),d(),s.current=gn(function(){c.current===V&&j.focus()})}};if([Fl,zl].includes(f)||N.sibling||!$){var L;!$||e==="inline"?L=i.current:L=mz($);var F,P=Dv(L,w);f===Fl?F=P[0]:f===zl?F=P[P.length-1]:F=TS(L,w,$,N.offset),k(F)}else if(N.inlineTrigger)u(O);else if(N.offset>0)u(O,!0),d(),s.current=gn(function(){y=Om(v,r);var I=$.getAttribute("aria-controls"),D=document.getElementById(I),j=TS(D,y.elements);k(j)},5);else if(N.offset<0){var A=l(O,!0),M=A[A.length-2],R=x.get(M);u(M,!1),k(R)}}p==null||p(h)}}function bz(e){Promise.resolve().then(e)}var Fv="__RC_UTIL_PATH_SPLIT__",IS=function(t){return t.join(Fv)},wz=function(t){return t.split(Fv)},Am="rc-menu-more";function Sz(){var e=C.useState({}),t=pe(e,2),n=t[1],r=C.useRef(new Map),i=C.useRef(new Map),o=C.useState([]),l=pe(o,2),m=l[0],u=l[1],p=C.useRef(0),s=C.useRef(!1),c=function(){s.current||n({})},d=C.useCallback(function(x,E){var _=IS(E);i.current.set(_,x),r.current.set(x,_),p.current+=1;var $=p.current;bz(function(){$===p.current&&c()})},[]),h=C.useCallback(function(x,E){var _=IS(E);i.current.delete(_),r.current.delete(x)},[]),f=C.useCallback(function(x){u(x)},[]),v=C.useCallback(function(x,E){var _=r.current.get(x)||"",$=wz(_);return E&&m.includes($[0])&&$.unshift(Am),$},[m]),y=C.useCallback(function(x,E){return x.filter(function(_){return _!==void 0}).some(function(_){var $=v(_,!0);return $.includes(E)})},[v]),b=function(){var E=Ge(r.current.keys());return m.length&&E.push(Am),E},w=C.useCallback(function(x){var E="".concat(r.current.get(x)).concat(Fv),_=new Set;return Ge(i.current.keys()).forEach(function($){$.startsWith(E)&&_.add(i.current.get($))}),_},[]);return C.useEffect(function(){return function(){s.current=!0}},[]),{registerPath:d,unregisterPath:h,refreshOverflowKeys:f,isSubPathKey:y,getKeyPath:v,getKeys:b,getSubPathKeys:w}}function Ul(e){var t=C.useRef(e);t.current=e;var n=C.useCallback(function(){for(var r,i=arguments.length,o=new Array(i),l=0;l1&&(w.motionAppear=!1);var x=w.onVisibleChanged;return w.onVisibleChanged=function(E){return!d.current&&!E&&y(!0),x==null?void 0:x(E)},v?null:C.createElement(vc,{mode:o,locked:!d.current},C.createElement(Lo,nt({visible:b},w,{forceRender:u,removeOnLeave:!1,leavedClassName:"".concat(m,"-hidden")}),function(E){var _=E.className,$=E.style;return C.createElement(zv,{id:t,className:_,style:$},i)}))}var Fz=["style","className","title","eventKey","warnKey","disabled","internalPopupClose","children","itemIcon","expandIcon","popupClassName","popupOffset","popupStyle","onClick","onMouseEnter","onMouseLeave","onTitleClick","onTitleMouseEnter","onTitleMouseLeave"],zz=["active"],jz=C.forwardRef(function(e,t){var n=e.style,r=e.className,i=e.title,o=e.eventKey;e.warnKey;var l=e.disabled,m=e.internalPopupClose,u=e.children,p=e.itemIcon,s=e.expandIcon,c=e.popupClassName,d=e.popupOffset,h=e.popupStyle,f=e.onClick,v=e.onMouseEnter,y=e.onMouseLeave,b=e.onTitleClick,w=e.onTitleMouseEnter,x=e.onTitleMouseLeave,E=At(e,Fz),_=yE(o),$=C.useContext(Zi),O=$.prefixCls,N=$.mode,k=$.openKeys,L=$.disabled,F=$.overflowDisabled,P=$.activeKey,A=$.selectedKeys,M=$.itemIcon,R=$.expandIcon,I=$.onItemClick,D=$.onOpenChange,j=$.onActive,B=C.useContext(Nv),V=B._internalRenderSubMenuItem,H=C.useContext(SE),Y=H.isSubPathKey,U=Dc(),K="".concat(O,"-submenu"),G=L||l,q=C.useRef(),Z=C.useRef(),Q=p??M,J=s??R,ie=k.includes(o),se=!F&&ie,ae=Y(A,o),ge=$E(o,G,w,x),me=ge.active,de=At(ge,zz),we=C.useState(!1),Oe=pe(we,2),xe=Oe[0],Pe=Oe[1],ze=function(te){G||Pe(te)},Ie=function(te){ze(!0),v==null||v({key:o,domEvent:te})},Ye=function(te){ze(!1),y==null||y({key:o,domEvent:te})},Me=C.useMemo(function(){return me||(N!=="inline"?xe||Y([P],o):!1)},[N,me,P,xe,o,Y]),ke=xE(U.length),Je=function(te){G||(b==null||b({key:o,domEvent:te}),N==="inline"&&D(o,!ie))},ce=Ul(function(We){f==null||f(Nd(We)),I(We)}),Ee=function(te){N!=="inline"&&D(o,te)},Re=function(){j(o)},Ae=_&&"".concat(_,"-popup"),De=C.useMemo(function(){return C.createElement(EE,{icon:N!=="horizontal"?J:void 0,props:oe(oe({},e),{},{isOpen:se,isSubMenu:!0})},C.createElement("i",{className:"".concat(K,"-arrow")}))},[N,J,e,se,K]),He=C.createElement("div",nt({role:"menuitem",style:ke,className:"".concat(K,"-title"),tabIndex:G?null:-1,ref:q,title:typeof i=="string"?i:null,"data-menu-id":F&&_?null:_,"aria-expanded":se,"aria-haspopup":!0,"aria-controls":Ae,"aria-disabled":G,onClick:Je,onFocus:Re},de),i,De),it=C.useRef(N);if(N!=="inline"&&U.length>1?it.current="vertical":it.current=N,!F){var Ne=it.current;He=C.createElement(Nz,{mode:Ne,prefixCls:K,visible:!m&&se&&N!=="inline",popupClassName:c,popupOffset:d,popupStyle:h,popup:C.createElement(vc,{mode:Ne==="horizontal"?"vertical":Ne},C.createElement(zv,{id:Ae,ref:Z},u)),disabled:G,onVisibleChange:Ee},He)}var Te=C.createElement(po.Item,nt({ref:t,role:"none"},E,{component:"li",style:n,className:ve(K,"".concat(K,"-").concat(N),r,ne(ne(ne(ne({},"".concat(K,"-open"),se),"".concat(K,"-active"),Me),"".concat(K,"-selected"),ae),"".concat(K,"-disabled"),G)),onMouseEnter:Ie,onMouseLeave:Ye}),He,!F&&C.createElement(Dz,{id:Ae,open:se,keyPath:U},u));return V&&(Te=V(Te,e,{selected:ae,active:Me,open:se,disabled:G})),C.createElement(vc,{onItemClick:ce,mode:N==="horizontal"?"vertical":N,itemIcon:Q,expandIcon:J},Te)}),Bv=C.forwardRef(function(e,t){var n=e.eventKey,r=e.children,i=Dc(n),o=jv(r,i),l=yf();C.useEffect(function(){if(l)return l.registerPath(n,i),function(){l.unregisterPath(n,i)}},[i]);var m;return l?m=o:m=C.createElement(jz,nt({ref:t},e),o),C.createElement(wE.Provider,{value:i},m)});function ME(e){var t=e.className,n=e.style,r=C.useContext(Zi),i=r.prefixCls,o=yf();return o?null:C.createElement("li",{role:"separator",className:ve("".concat(i,"-item-divider"),t),style:n})}var Bz=["className","title","eventKey","children"],Hz=C.forwardRef(function(e,t){var n=e.className,r=e.title;e.eventKey;var i=e.children,o=At(e,Bz),l=C.useContext(Zi),m=l.prefixCls,u="".concat(m,"-item-group");return C.createElement("li",nt({ref:t,role:"presentation"},o,{onClick:function(s){return s.stopPropagation()},className:ve(u,n)}),C.createElement("div",{role:"presentation",className:"".concat(u,"-title"),title:typeof r=="string"?r:void 0},r),C.createElement("ul",{role:"group",className:"".concat(u,"-list")},i))}),RE=C.forwardRef(function(e,t){var n=e.eventKey,r=e.children,i=Dc(n),o=jv(r,i),l=yf();return l?o:C.createElement(Hz,nt({ref:t},Er(e,["warnKey"])),o)}),Wz=["label","children","key","type","extra"];function Tm(e,t,n){var r=t.item,i=t.group,o=t.submenu,l=t.divider;return(e||[]).map(function(m,u){if(m&&wt(m)==="object"){var p=m,s=p.label,c=p.children,d=p.key,h=p.type,f=p.extra,v=At(p,Wz),y=d??"tmp-".concat(u);return c||h==="group"?h==="group"?C.createElement(i,nt({key:y},v,{title:s}),Tm(c,t,n)):C.createElement(o,nt({key:y},v,{title:s}),Tm(c,t,n)):h==="divider"?C.createElement(l,nt({key:y},v)):C.createElement(r,nt({key:y},v,{extra:f}),s,(!!f||f===0)&&C.createElement("span",{className:"".concat(n,"-item-extra")},f))}return null}).filter(function(m){return m})}function PS(e,t,n,r,i){var o=e,l=oe({divider:ME,item:bf,group:RE,submenu:Bv},r);return t&&(o=Tm(t,l,i)),jv(o,n)}var Vz=["prefixCls","rootClassName","style","className","tabIndex","items","children","direction","id","mode","inlineCollapsed","disabled","disabledOverflow","subMenuOpenDelay","subMenuCloseDelay","forceSubMenuRender","defaultOpenKeys","openKeys","activeKey","defaultActiveFirst","selectable","multiple","defaultSelectedKeys","selectedKeys","onSelect","onDeselect","inlineIndent","motion","defaultMotions","triggerSubMenuAction","builtinPlacements","itemIcon","expandIcon","overflowedIndicator","overflowedIndicatorPopupClassName","getPopupContainer","onClick","onOpenChange","onKeyDown","openAnimation","openTransitionName","_internalRenderMenuItem","_internalRenderSubMenuItem","_internalComponents"],Oa=[],Uz=C.forwardRef(function(e,t){var n,r=e,i=r.prefixCls,o=i===void 0?"rc-menu":i,l=r.rootClassName,m=r.style,u=r.className,p=r.tabIndex,s=p===void 0?0:p,c=r.items,d=r.children,h=r.direction,f=r.id,v=r.mode,y=v===void 0?"vertical":v,b=r.inlineCollapsed,w=r.disabled,x=r.disabledOverflow,E=r.subMenuOpenDelay,_=E===void 0?.1:E,$=r.subMenuCloseDelay,O=$===void 0?.1:$,N=r.forceSubMenuRender,k=r.defaultOpenKeys,L=r.openKeys,F=r.activeKey,P=r.defaultActiveFirst,A=r.selectable,M=A===void 0?!0:A,R=r.multiple,I=R===void 0?!1:R,D=r.defaultSelectedKeys,j=r.selectedKeys,B=r.onSelect,V=r.onDeselect,H=r.inlineIndent,Y=H===void 0?24:H,U=r.motion,K=r.defaultMotions,G=r.triggerSubMenuAction,q=G===void 0?"hover":G,Z=r.builtinPlacements,Q=r.itemIcon,J=r.expandIcon,ie=r.overflowedIndicator,se=ie===void 0?"...":ie,ae=r.overflowedIndicatorPopupClassName,ge=r.getPopupContainer,me=r.onClick,de=r.onOpenChange,we=r.onKeyDown;r.openAnimation,r.openTransitionName;var Oe=r._internalRenderMenuItem,xe=r._internalRenderSubMenuItem,Pe=r._internalComponents,ze=At(r,Vz),Ie=C.useMemo(function(){return[PS(d,c,Oa,Pe,o),PS(d,c,Oa,{},o)]},[d,c,Pe]),Ye=pe(Ie,2),Me=Ye[0],ke=Ye[1],Je=C.useState(!1),ce=pe(Je,2),Ee=ce[0],Re=ce[1],Ae=C.useRef(),De=$z(f),He=h==="rtl",it=Pr(k,{value:L,postState:function(ft){return ft||Oa}}),Ne=pe(it,2),Te=Ne[0],We=Ne[1],te=function(ft){var lt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;function Xt(){We(ft),de==null||de(ft)}lt?da.flushSync(Xt):Xt()},fe=C.useState(Te),je=pe(fe,2),ct=je[0],Jt=je[1],kt=C.useRef(!1),rn=C.useMemo(function(){return(y==="inline"||y==="vertical")&&b?["vertical",b]:[y,!1]},[y,b]),Qt=pe(rn,2),Lt=Qt[0],Nt=Qt[1],Et=Lt==="inline",dt=C.useState(Lt),et=pe(dt,2),Ke=et[0],_t=et[1],Tt=C.useState(Nt),tt=pe(Tt,2),Ze=tt[0],at=tt[1];C.useEffect(function(){_t(Lt),at(Nt),kt.current&&(Et?We(ct):te(Oa))},[Lt,Nt]);var ot=C.useState(0),rt=pe(ot,2),vt=rt[0],on=rt[1],Bt=vt>=Me.length-1||Ke!=="horizontal"||x;C.useEffect(function(){Et&&Jt(Te)},[Te]),C.useEffect(function(){return kt.current=!0,function(){kt.current=!1}},[]);var Gt=Sz(),Dt=Gt.registerPath,Ht=Gt.unregisterPath,yn=Gt.refreshOverflowKeys,Cn=Gt.isSubPathKey,Rn=Gt.getKeyPath,cn=Gt.getKeys,Kt=Gt.getSubPathKeys,Xe=C.useMemo(function(){return{registerPath:Dt,unregisterPath:Ht}},[Dt,Ht]),ut=C.useMemo(function(){return{isSubPathKey:Cn}},[Cn]);C.useEffect(function(){yn(Bt?Oa:Me.slice(vt+1).map(function(Vt){return Vt.key}))},[vt,Bt]);var st=Pr(F||P&&((n=Me[0])===null||n===void 0?void 0:n.key),{value:F}),Le=pe(st,2),Ct=Le[0],Ft=Le[1],en=Ul(function(Vt){Ft(Vt)}),hn=Ul(function(){Ft(void 0)});C.useImperativeHandle(t,function(){return{list:Ae.current,focus:function(ft){var lt,Xt=cn(),Zt=Om(Xt,De),an=Zt.elements,un=Zt.key2element,dr=Zt.element2key,zn=Dv(Ae.current,an),Ot=Ct??(zn[0]?dr.get(zn[0]):(lt=Me.find(function(mr){return!mr.props.disabled}))===null||lt===void 0?void 0:lt.key),On=un.get(Ot);if(Ot&&On){var ir;On==null||(ir=On.focus)===null||ir===void 0||ir.call(On,ft)}}}});var Dn=Pr(D||[],{value:j,postState:function(ft){return Array.isArray(ft)?ft:ft==null?Oa:[ft]}}),Yt=pe(Dn,2),$n=Yt[0],ln=Yt[1],Wr=function(ft){if(M){var lt=ft.key,Xt=$n.includes(lt),Zt;I?Xt?Zt=$n.filter(function(un){return un!==lt}):Zt=[].concat(Ge($n),[lt]):Zt=[lt],ln(Zt);var an=oe(oe({},ft),{},{selectedKeys:Zt});Xt?V==null||V(an):B==null||B(an)}!I&&Te.length&&Ke!=="inline"&&te(Oa)},Fn=Ul(function(Vt){me==null||me(Nd(Vt)),Wr(Vt)}),Gn=Ul(function(Vt,ft){var lt=Te.filter(function(Zt){return Zt!==Vt});if(ft)lt.push(Vt);else if(Ke!=="inline"){var Xt=Kt(Vt);lt=lt.filter(function(Zt){return!Xt.has(Zt)})}lc(Te,lt,!0)||te(lt,!0)}),qn=function(ft,lt){var Xt=lt??!Te.includes(ft);Gn(ft,Xt)},_r=yz(Ke,Ct,He,De,Ae,cn,Rn,Ft,qn,we);C.useEffect(function(){Re(!0)},[]);var Mr=C.useMemo(function(){return{_internalRenderMenuItem:Oe,_internalRenderSubMenuItem:xe}},[Oe,xe]),Ln=Ke!=="horizontal"||x?Me:Me.map(function(Vt,ft){return C.createElement(vc,{key:Vt.key,overflowDisabled:ft>vt},Vt)}),Rr=C.createElement(po,nt({id:f,ref:Ae,prefixCls:"".concat(o,"-overflow"),component:"ul",itemComponent:bf,className:ve(o,"".concat(o,"-root"),"".concat(o,"-").concat(Ke),u,ne(ne({},"".concat(o,"-inline-collapsed"),Ze),"".concat(o,"-rtl"),He),l),dir:h,style:m,role:"menu",tabIndex:s,data:Ln,renderRawItem:function(ft){return ft},renderRawRest:function(ft){var lt=ft.length,Xt=lt?Me.slice(-lt):null;return C.createElement(Bv,{eventKey:Am,title:se,disabled:Bt,internalPopupClose:lt===0,popupClassName:ae},Xt)},maxCount:Ke!=="horizontal"||x?po.INVALIDATE:po.RESPONSIVE,ssr:"full","data-menu-list":!0,onVisibleChange:function(ft){on(ft)},onKeyDown:_r},ze));return C.createElement(Nv.Provider,{value:Mr},C.createElement(mE.Provider,{value:De},C.createElement(vc,{prefixCls:o,rootClassName:l,mode:Ke,openKeys:Te,rtl:He,disabled:w,motion:Ee?U:null,defaultMotions:Ee?K:null,activeKey:Ct,onActive:en,onInactive:hn,selectedKeys:$n,inlineIndent:Y,subMenuOpenDelay:_,subMenuCloseDelay:O,forceSubMenuRender:N,builtinPlacements:Z,triggerSubMenuAction:q,getPopupContainer:ge,itemIcon:Q,expandIcon:J,onItemClick:Fn,onOpenChange:Gn},C.createElement(SE.Provider,{value:ut},Rr),C.createElement("div",{style:{display:"none"},"aria-hidden":!0},C.createElement(bE.Provider,{value:Xe},ke)))))}),Fc=Uz;Fc.Item=bf;Fc.SubMenu=Bv;Fc.ItemGroup=RE;Fc.Divider=ME;var Gz={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M176 511a56 56 0 10112 0 56 56 0 10-112 0zm280 0a56 56 0 10112 0 56 56 0 10-112 0zm280 0a56 56 0 10112 0 56 56 0 10-112 0z"}}]},name:"ellipsis",theme:"outlined"},Kz=function(t,n){return C.createElement(rr,nt({},t,{ref:n,icon:Gz}))},Yz=C.forwardRef(Kz);function wf(e){return Sn(e,{inputAffixPadding:e.paddingXXS})}const Sf=e=>{const{controlHeight:t,fontSize:n,lineHeight:r,lineWidth:i,controlHeightSM:o,controlHeightLG:l,fontSizeLG:m,lineHeightLG:u,paddingSM:p,controlPaddingHorizontalSM:s,controlPaddingHorizontal:c,colorFillAlter:d,colorPrimaryHover:h,colorPrimary:f,controlOutlineWidth:v,controlOutline:y,colorErrorOutline:b,colorWarningOutline:w,colorBgContainer:x,inputFontSize:E,inputFontSizeLG:_,inputFontSizeSM:$}=e,O=E||n,N=$||O,k=_||m,L=Math.round((t-O*r)/2*10)/10-i,F=Math.round((o-N*r)/2*10)/10-i,P=Math.ceil((l-k*u)/2*10)/10-i;return{paddingBlock:Math.max(L,0),paddingBlockSM:Math.max(F,0),paddingBlockLG:Math.max(P,0),paddingInline:p-i,paddingInlineSM:s-i,paddingInlineLG:c-i,addonBg:d,activeBorderColor:f,hoverBorderColor:h,activeShadow:`0 0 0 ${v}px ${y}`,errorActiveShadow:`0 0 0 ${v}px ${b}`,warningActiveShadow:`0 0 0 ${v}px ${w}`,hoverBg:x,activeBg:x,inputFontSize:O,inputFontSizeLG:k,inputFontSizeSM:N}},Xz=e=>({borderColor:e.hoverBorderColor,backgroundColor:e.hoverBg}),Hv=e=>({color:e.colorTextDisabled,backgroundColor:e.colorBgContainerDisabled,borderColor:e.colorBorder,boxShadow:"none",cursor:"not-allowed",opacity:1,"input[disabled], textarea[disabled]":{cursor:"not-allowed"},"&:hover:not([disabled])":Object.assign({},Xz(Sn(e,{hoverBorderColor:e.colorBorder,hoverBg:e.colorBgContainerDisabled})))}),OE=(e,t)=>({background:e.colorBgContainer,borderWidth:e.lineWidth,borderStyle:e.lineType,borderColor:t.borderColor,"&:hover":{borderColor:t.hoverBorderColor,backgroundColor:e.hoverBg},"&:focus, &:focus-within":{borderColor:t.activeBorderColor,boxShadow:t.activeShadow,outline:0,backgroundColor:e.activeBg}}),kS=(e,t)=>({[`&${e.componentCls}-status-${t.status}:not(${e.componentCls}-disabled)`]:Object.assign(Object.assign({},OE(e,t)),{[`${e.componentCls}-prefix, ${e.componentCls}-suffix`]:{color:t.affixColor}}),[`&${e.componentCls}-status-${t.status}${e.componentCls}-disabled`]:{borderColor:t.borderColor}}),qz=(e,t)=>({"&-outlined":Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},OE(e,{borderColor:e.colorBorder,hoverBorderColor:e.hoverBorderColor,activeBorderColor:e.activeBorderColor,activeShadow:e.activeShadow})),{[`&${e.componentCls}-disabled, &[disabled]`]:Object.assign({},Hv(e))}),kS(e,{status:"error",borderColor:e.colorError,hoverBorderColor:e.colorErrorBorderHover,activeBorderColor:e.colorError,activeShadow:e.errorActiveShadow,affixColor:e.colorError})),kS(e,{status:"warning",borderColor:e.colorWarning,hoverBorderColor:e.colorWarningBorderHover,activeBorderColor:e.colorWarning,activeShadow:e.warningActiveShadow,affixColor:e.colorWarning})),t)}),NS=(e,t)=>({[`&${e.componentCls}-group-wrapper-status-${t.status}`]:{[`${e.componentCls}-group-addon`]:{borderColor:t.addonBorderColor,color:t.addonColor}}}),Qz=e=>({"&-outlined":Object.assign(Object.assign(Object.assign({[`${e.componentCls}-group`]:{"&-addon":{background:e.addonBg,border:`${$e(e.lineWidth)} ${e.lineType} ${e.colorBorder}`},"&-addon:first-child":{borderInlineEnd:0},"&-addon:last-child":{borderInlineStart:0}}},NS(e,{status:"error",addonBorderColor:e.colorError,addonColor:e.colorErrorText})),NS(e,{status:"warning",addonBorderColor:e.colorWarning,addonColor:e.colorWarningText})),{[`&${e.componentCls}-group-wrapper-disabled`]:{[`${e.componentCls}-group-addon`]:Object.assign({},Hv(e))}})}),Zz=(e,t)=>{const{componentCls:n}=e;return{"&-borderless":Object.assign({background:"transparent",border:"none","&:focus, &:focus-within":{outline:"none"},[`&${n}-disabled, &[disabled]`]:{color:e.colorTextDisabled,cursor:"not-allowed"},[`&${n}-status-error`]:{"&, & input, & textarea":{color:e.colorError}},[`&${n}-status-warning`]:{"&, & input, & textarea":{color:e.colorWarning}}},t)}},AE=(e,t)=>{var n;return{background:t.bg,borderWidth:e.lineWidth,borderStyle:e.lineType,borderColor:"transparent","input&, & input, textarea&, & textarea":{color:(n=t==null?void 0:t.inputColor)!==null&&n!==void 0?n:"unset"},"&:hover":{background:t.hoverBg},"&:focus, &:focus-within":{outline:0,borderColor:t.activeBorderColor,backgroundColor:e.activeBg}}},DS=(e,t)=>({[`&${e.componentCls}-status-${t.status}:not(${e.componentCls}-disabled)`]:Object.assign(Object.assign({},AE(e,t)),{[`${e.componentCls}-prefix, ${e.componentCls}-suffix`]:{color:t.affixColor}})}),Jz=(e,t)=>({"&-filled":Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},AE(e,{bg:e.colorFillTertiary,hoverBg:e.colorFillSecondary,activeBorderColor:e.activeBorderColor})),{[`&${e.componentCls}-disabled, &[disabled]`]:Object.assign({},Hv(e))}),DS(e,{status:"error",bg:e.colorErrorBg,hoverBg:e.colorErrorBgHover,activeBorderColor:e.colorError,inputColor:e.colorErrorText,affixColor:e.colorError})),DS(e,{status:"warning",bg:e.colorWarningBg,hoverBg:e.colorWarningBgHover,activeBorderColor:e.colorWarning,inputColor:e.colorWarningText,affixColor:e.colorWarning})),t)}),FS=(e,t)=>({[`&${e.componentCls}-group-wrapper-status-${t.status}`]:{[`${e.componentCls}-group-addon`]:{background:t.addonBg,color:t.addonColor}}}),ej=e=>({"&-filled":Object.assign(Object.assign(Object.assign({[`${e.componentCls}-group-addon`]:{background:e.colorFillTertiary,"&:last-child":{position:"static"}}},FS(e,{status:"error",addonBg:e.colorErrorBg,addonColor:e.colorErrorText})),FS(e,{status:"warning",addonBg:e.colorWarningBg,addonColor:e.colorWarningText})),{[`&${e.componentCls}-group-wrapper-disabled`]:{[`${e.componentCls}-group`]:{"&-addon":{background:e.colorFillTertiary,color:e.colorTextDisabled},"&-addon:first-child":{borderInlineStart:`${$e(e.lineWidth)} ${e.lineType} ${e.colorBorder}`,borderTop:`${$e(e.lineWidth)} ${e.lineType} ${e.colorBorder}`,borderBottom:`${$e(e.lineWidth)} ${e.lineType} ${e.colorBorder}`},"&-addon:last-child":{borderInlineEnd:`${$e(e.lineWidth)} ${e.lineType} ${e.colorBorder}`,borderTop:`${$e(e.lineWidth)} ${e.lineType} ${e.colorBorder}`,borderBottom:`${$e(e.lineWidth)} ${e.lineType} ${e.colorBorder}`}}}})}),TE=(e,t)=>({background:e.colorBgContainer,borderWidth:`${$e(e.lineWidth)} 0`,borderStyle:`${e.lineType} none`,borderColor:`transparent transparent ${t.borderColor} transparent`,borderRadius:0,"&:hover":{borderColor:`transparent transparent ${t.borderColor} transparent`,backgroundColor:e.hoverBg},"&:focus, &:focus-within":{borderColor:`transparent transparent ${t.borderColor} transparent`,outline:0,backgroundColor:e.activeBg}}),zS=(e,t)=>({[`&${e.componentCls}-status-${t.status}:not(${e.componentCls}-disabled)`]:Object.assign(Object.assign({},TE(e,t)),{[`${e.componentCls}-prefix, ${e.componentCls}-suffix`]:{color:t.affixColor}}),[`&${e.componentCls}-status-${t.status}${e.componentCls}-disabled`]:{borderColor:`transparent transparent ${t.borderColor} transparent`}}),tj=(e,t)=>({"&-underlined":Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},TE(e,{borderColor:e.colorBorder,hoverBorderColor:e.hoverBorderColor,activeBorderColor:e.activeBorderColor,activeShadow:e.activeShadow})),{[`&${e.componentCls}-disabled, &[disabled]`]:{color:e.colorTextDisabled,boxShadow:"none",cursor:"not-allowed","&:hover":{borderColor:`transparent transparent ${e.colorBorder} transparent`}},"input[disabled], textarea[disabled]":{cursor:"not-allowed"}}),zS(e,{status:"error",borderColor:e.colorError,hoverBorderColor:e.colorErrorBorderHover,activeBorderColor:e.colorError,activeShadow:e.errorActiveShadow,affixColor:e.colorError})),zS(e,{status:"warning",borderColor:e.colorWarning,hoverBorderColor:e.colorWarningBorderHover,activeBorderColor:e.colorWarning,activeShadow:e.warningActiveShadow,affixColor:e.colorWarning})),t)}),nj=e=>({"&::-moz-placeholder":{opacity:1},"&::placeholder":{color:e,userSelect:"none"},"&:placeholder-shown":{textOverflow:"ellipsis"}}),IE=e=>{const{paddingBlockLG:t,lineHeightLG:n,borderRadiusLG:r,paddingInlineLG:i}=e;return{padding:`${$e(t)} ${$e(i)}`,fontSize:e.inputFontSizeLG,lineHeight:n,borderRadius:r}},LE=e=>({padding:`${$e(e.paddingBlockSM)} ${$e(e.paddingInlineSM)}`,fontSize:e.inputFontSizeSM,borderRadius:e.borderRadiusSM}),PE=e=>Object.assign(Object.assign({position:"relative",display:"inline-block",width:"100%",minWidth:0,padding:`${$e(e.paddingBlock)} ${$e(e.paddingInline)}`,color:e.colorText,fontSize:e.inputFontSize,lineHeight:e.lineHeight,borderRadius:e.borderRadius,transition:`all ${e.motionDurationMid}`},nj(e.colorTextPlaceholder)),{"&-lg":Object.assign({},IE(e)),"&-sm":Object.assign({},LE(e)),"&-rtl, &-textarea-rtl":{direction:"rtl"}}),rj=e=>{const{componentCls:t,antCls:n}=e;return{position:"relative",display:"table",width:"100%",borderCollapse:"separate",borderSpacing:0,"&[class*='col-']":{paddingInlineEnd:e.paddingXS,"&:last-child":{paddingInlineEnd:0}},[`&-lg ${t}, &-lg > ${t}-group-addon`]:Object.assign({},IE(e)),[`&-sm ${t}, &-sm > ${t}-group-addon`]:Object.assign({},LE(e)),[`&-lg ${n}-select-single ${n}-select-selector`]:{height:e.controlHeightLG},[`&-sm ${n}-select-single ${n}-select-selector`]:{height:e.controlHeightSM},[`> ${t}`]:{display:"table-cell","&:not(:first-child):not(:last-child)":{borderRadius:0}},[`${t}-group`]:{"&-addon, &-wrap":{display:"table-cell",width:1,whiteSpace:"nowrap",verticalAlign:"middle","&:not(:first-child):not(:last-child)":{borderRadius:0}},"&-wrap > *":{display:"block !important"},"&-addon":{position:"relative",padding:`0 ${$e(e.paddingInline)}`,color:e.colorText,fontWeight:"normal",fontSize:e.inputFontSize,textAlign:"center",borderRadius:e.borderRadius,transition:`all ${e.motionDurationSlow}`,lineHeight:1,[`${n}-select`]:{margin:`${$e(e.calc(e.paddingBlock).add(1).mul(-1).equal())} ${$e(e.calc(e.paddingInline).mul(-1).equal())}`,[`&${n}-select-single:not(${n}-select-customize-input):not(${n}-pagination-size-changer)`]:{[`${n}-select-selector`]:{backgroundColor:"inherit",border:`${$e(e.lineWidth)} ${e.lineType} transparent`,boxShadow:"none"}}},[`${n}-cascader-picker`]:{margin:`-9px ${$e(e.calc(e.paddingInline).mul(-1).equal())}`,backgroundColor:"transparent",[`${n}-cascader-input`]:{textAlign:"start",border:0,boxShadow:"none"}}}},[t]:{width:"100%",marginBottom:0,textAlign:"inherit","&:focus":{zIndex:1,borderInlineEndWidth:1},"&:hover":{zIndex:1,borderInlineEndWidth:1,[`${t}-search-with-button &`]:{zIndex:0}}},[`> ${t}:first-child, ${t}-group-addon:first-child`]:{borderStartEndRadius:0,borderEndEndRadius:0,[`${n}-select ${n}-select-selector`]:{borderStartEndRadius:0,borderEndEndRadius:0}},[`> ${t}-affix-wrapper`]:{[`&:not(:first-child) ${t}`]:{borderStartStartRadius:0,borderEndStartRadius:0},[`&:not(:last-child) ${t}`]:{borderStartEndRadius:0,borderEndEndRadius:0}},[`> ${t}:last-child, ${t}-group-addon:last-child`]:{borderStartStartRadius:0,borderEndStartRadius:0,[`${n}-select ${n}-select-selector`]:{borderStartStartRadius:0,borderEndStartRadius:0}},[`${t}-affix-wrapper`]:{"&:not(:last-child)":{borderStartEndRadius:0,borderEndEndRadius:0,[`${t}-search &`]:{borderStartStartRadius:e.borderRadius,borderEndStartRadius:e.borderRadius}},[`&:not(:first-child), ${t}-search &:not(:first-child)`]:{borderStartStartRadius:0,borderEndStartRadius:0}},[`&${t}-group-compact`]:Object.assign(Object.assign({display:"block"},Oc()),{[`${t}-group-addon, ${t}-group-wrap, > ${t}`]:{"&:not(:first-child):not(:last-child)":{borderInlineEndWidth:e.lineWidth,"&:hover, &:focus":{zIndex:1}}},"& > *":{display:"inline-flex",float:"none",verticalAlign:"top",borderRadius:0},[` + & > ${t}-affix-wrapper, + & > ${t}-number-affix-wrapper, + & > ${n}-picker-range + `]:{display:"inline-flex"},"& > *:not(:last-child)":{marginInlineEnd:e.calc(e.lineWidth).mul(-1).equal(),borderInlineEndWidth:e.lineWidth},[t]:{float:"none"},[`& > ${n}-select > ${n}-select-selector, + & > ${n}-select-auto-complete ${t}, + & > ${n}-cascader-picker ${t}, + & > ${t}-group-wrapper ${t}`]:{borderInlineEndWidth:e.lineWidth,borderRadius:0,"&:hover, &:focus":{zIndex:1}},[`& > ${n}-select-focused`]:{zIndex:1},[`& > ${n}-select > ${n}-select-arrow`]:{zIndex:1},[`& > *:first-child, + & > ${n}-select:first-child > ${n}-select-selector, + & > ${n}-select-auto-complete:first-child ${t}, + & > ${n}-cascader-picker:first-child ${t}`]:{borderStartStartRadius:e.borderRadius,borderEndStartRadius:e.borderRadius},[`& > *:last-child, + & > ${n}-select:last-child > ${n}-select-selector, + & > ${n}-cascader-picker:last-child ${t}, + & > ${n}-cascader-picker-focused:last-child ${t}`]:{borderInlineEndWidth:e.lineWidth,borderStartEndRadius:e.borderRadius,borderEndEndRadius:e.borderRadius},[`& > ${n}-select-auto-complete ${t}`]:{verticalAlign:"top"},[`${t}-group-wrapper + ${t}-group-wrapper`]:{marginInlineStart:e.calc(e.lineWidth).mul(-1).equal(),[`${t}-affix-wrapper`]:{borderRadius:0}},[`${t}-group-wrapper:not(:last-child)`]:{[`&${t}-search > ${t}-group`]:{[`& > ${t}-group-addon > ${t}-search-button`]:{borderRadius:0},[`& > ${t}`]:{borderStartStartRadius:e.borderRadius,borderStartEndRadius:0,borderEndEndRadius:0,borderEndStartRadius:e.borderRadius}}}})}},ij=e=>{const{componentCls:t,controlHeightSM:n,lineWidth:r,calc:i}=e,l=i(n).sub(i(r).mul(2)).sub(16).div(2).equal();return{[t]:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},ci(e)),PE(e)),qz(e)),Jz(e)),Zz(e)),tj(e)),{'&[type="color"]':{height:e.controlHeight,[`&${t}-lg`]:{height:e.controlHeightLG},[`&${t}-sm`]:{height:n,paddingTop:l,paddingBottom:l}},'&[type="search"]::-webkit-search-cancel-button, &[type="search"]::-webkit-search-decoration':{appearance:"none"}})}},oj=e=>{const{componentCls:t}=e;return{[`${t}-clear-icon`]:{margin:0,padding:0,lineHeight:0,color:e.colorTextQuaternary,fontSize:e.fontSizeIcon,verticalAlign:-1,cursor:"pointer",transition:`color ${e.motionDurationSlow}`,border:"none",outline:"none",backgroundColor:"transparent","&:hover":{color:e.colorIcon},"&:active":{color:e.colorText},"&-hidden":{visibility:"hidden"},"&-has-suffix":{margin:`0 ${$e(e.inputAffixPadding)}`}}}},aj=e=>{const{componentCls:t,inputAffixPadding:n,colorTextDescription:r,motionDurationSlow:i,colorIcon:o,colorIconHover:l,iconCls:m}=e,u=`${t}-affix-wrapper`,p=`${t}-affix-wrapper-disabled`;return{[u]:Object.assign(Object.assign(Object.assign(Object.assign({},PE(e)),{display:"inline-flex",[`&:not(${t}-disabled):hover`]:{zIndex:1,[`${t}-search-with-button &`]:{zIndex:0}},"&-focused, &:focus":{zIndex:1},[`> input${t}`]:{padding:0},[`> input${t}, > textarea${t}`]:{fontSize:"inherit",border:"none",borderRadius:0,outline:"none",background:"transparent",color:"inherit","&::-ms-reveal":{display:"none"},"&:focus":{boxShadow:"none !important"}},"&::before":{display:"inline-block",width:0,visibility:"hidden",content:'"\\a0"'},[t]:{"&-prefix, &-suffix":{display:"flex",flex:"none",alignItems:"center","> *:not(:last-child)":{marginInlineEnd:e.paddingXS}},"&-show-count-suffix":{color:r,direction:"ltr"},"&-show-count-has-suffix":{marginInlineEnd:e.paddingXXS},"&-prefix":{marginInlineEnd:n},"&-suffix":{marginInlineStart:n}}}),oj(e)),{[`${m}${t}-password-icon`]:{color:o,cursor:"pointer",transition:`all ${i}`,"&:hover":{color:l}}}),[`${t}-underlined`]:{borderRadius:0},[p]:{[`${m}${t}-password-icon`]:{color:o,cursor:"not-allowed","&:hover":{color:o}}}}},sj=e=>{const{componentCls:t,borderRadiusLG:n,borderRadiusSM:r}=e;return{[`${t}-group`]:Object.assign(Object.assign(Object.assign({},ci(e)),rj(e)),{"&-rtl":{direction:"rtl"},"&-wrapper":Object.assign(Object.assign(Object.assign({display:"inline-block",width:"100%",textAlign:"start",verticalAlign:"top","&-rtl":{direction:"rtl"},"&-lg":{[`${t}-group-addon`]:{borderRadius:n,fontSize:e.inputFontSizeLG}},"&-sm":{[`${t}-group-addon`]:{borderRadius:r}}},Qz(e)),ej(e)),{[`&:not(${t}-compact-first-item):not(${t}-compact-last-item)${t}-compact-item`]:{[`${t}, ${t}-group-addon`]:{borderRadius:0}},[`&:not(${t}-compact-last-item)${t}-compact-first-item`]:{[`${t}, ${t}-group-addon`]:{borderStartEndRadius:0,borderEndEndRadius:0}},[`&:not(${t}-compact-first-item)${t}-compact-last-item`]:{[`${t}, ${t}-group-addon`]:{borderStartStartRadius:0,borderEndStartRadius:0}},[`&:not(${t}-compact-last-item)${t}-compact-item`]:{[`${t}-affix-wrapper`]:{borderStartEndRadius:0,borderEndEndRadius:0}},[`&:not(${t}-compact-first-item)${t}-compact-item`]:{[`${t}-affix-wrapper`]:{borderStartStartRadius:0,borderEndStartRadius:0}}})})}},lj=e=>{const{componentCls:t,antCls:n}=e,r=`${t}-search`;return{[r]:{[t]:{"&:hover, &:focus":{[`+ ${t}-group-addon ${r}-button:not(${n}-btn-color-primary):not(${n}-btn-variant-text)`]:{borderInlineStartColor:e.colorPrimaryHover}}},[`${t}-affix-wrapper`]:{height:e.controlHeight,borderRadius:0},[`${t}-lg`]:{lineHeight:e.calc(e.lineHeightLG).sub(2e-4).equal()},[`> ${t}-group`]:{[`> ${t}-group-addon:last-child`]:{insetInlineStart:-1,padding:0,border:0,[`${r}-button`]:{marginInlineEnd:-1,borderStartStartRadius:0,borderEndStartRadius:0,boxShadow:"none"},[`${r}-button:not(${n}-btn-color-primary)`]:{color:e.colorTextDescription,"&:hover":{color:e.colorPrimaryHover},"&:active":{color:e.colorPrimaryActive},[`&${n}-btn-loading::before`]:{inset:0}}}},[`${r}-button`]:{height:e.controlHeight,"&:hover, &:focus":{zIndex:1}},"&-large":{[`${t}-affix-wrapper, ${r}-button`]:{height:e.controlHeightLG}},"&-small":{[`${t}-affix-wrapper, ${r}-button`]:{height:e.controlHeightSM}},"&-rtl":{direction:"rtl"},[`&${t}-compact-item`]:{[`&:not(${t}-compact-last-item)`]:{[`${t}-group-addon`]:{[`${t}-search-button`]:{marginInlineEnd:e.calc(e.lineWidth).mul(-1).equal(),borderRadius:0}}},[`&:not(${t}-compact-first-item)`]:{[`${t},${t}-affix-wrapper`]:{borderRadius:0}},[`> ${t}-group-addon ${t}-search-button, + > ${t}, + ${t}-affix-wrapper`]:{"&:hover, &:focus, &:active":{zIndex:2}},[`> ${t}-affix-wrapper-focused`]:{zIndex:2}}}}},cj=e=>{const{componentCls:t}=e;return{[`${t}-out-of-range`]:{[`&, & input, & textarea, ${t}-show-count-suffix, ${t}-data-count`]:{color:e.colorError}}}},kE=gr(["Input","Shared"],e=>{const t=Sn(e,wf(e));return[ij(t),aj(t)]},Sf,{resetFont:!1}),NE=gr(["Input","Component"],e=>{const t=Sn(e,wf(e));return[sj(t),lj(t),cj(t),Ev(t)]},Sf,{resetFont:!1});var uj={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"}},{tag:"path",attrs:{d:"M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"}}]},name:"plus",theme:"outlined"},dj=function(t,n){return C.createElement(rr,nt({},t,{ref:n,icon:uj}))},fj=C.forwardRef(dj);const Cf=C.createContext(null);var hj=function(t){var n=t.activeTabOffset,r=t.horizontal,i=t.rtl,o=t.indicator,l=o===void 0?{}:o,m=l.size,u=l.align,p=u===void 0?"center":u,s=C.useState(),c=pe(s,2),d=c[0],h=c[1],f=C.useRef(),v=be.useCallback(function(b){return typeof m=="function"?m(b):typeof m=="number"?m:b},[m]);function y(){gn.cancel(f.current)}return C.useEffect(function(){var b={};if(n)if(r){b.width=v(n.width);var w=i?"right":"left";p==="start"&&(b[w]=n[w]),p==="center"&&(b[w]=n[w]+n.width/2,b.transform=i?"translateX(50%)":"translateX(-50%)"),p==="end"&&(b[w]=n[w]+n.width,b.transform="translateX(-100%)")}else b.height=v(n.height),p==="start"&&(b.top=n.top),p==="center"&&(b.top=n.top+n.height/2,b.transform="translateY(-50%)"),p==="end"&&(b.top=n.top+n.height,b.transform="translateY(-100%)");return y(),f.current=gn(function(){var x=d&&b&&Object.keys(b).every(function(E){var _=b[E],$=d[E];return typeof _=="number"&&typeof $=="number"?Math.round(_)===Math.round($):_===$});x||h(b)}),y},[JSON.stringify(n),r,i,p,v]),{style:d}},jS={width:0,height:0,left:0,top:0};function pj(e,t,n){return C.useMemo(function(){for(var r,i=new Map,o=t.get((r=e[0])===null||r===void 0?void 0:r.key)||jS,l=o.left+o.width,m=0;mM?(P=L,$.current="x"):(P=F,$.current="y"),t(-P,-P)&&k.preventDefault()}var N=C.useRef(null);N.current={onTouchStart:x,onTouchMove:E,onTouchEnd:_,onWheel:O},C.useEffect(function(){function k(A){N.current.onTouchStart(A)}function L(A){N.current.onTouchMove(A)}function F(A){N.current.onTouchEnd(A)}function P(A){N.current.onWheel(A)}return document.addEventListener("touchmove",L,{passive:!1}),document.addEventListener("touchend",F,{passive:!0}),e.current.addEventListener("touchstart",k,{passive:!0}),e.current.addEventListener("wheel",P,{passive:!1}),function(){document.removeEventListener("touchmove",L),document.removeEventListener("touchend",F)}},[])}function DE(e){var t=C.useState(0),n=pe(t,2),r=n[0],i=n[1],o=C.useRef(0),l=C.useRef();return l.current=e,Ng(function(){var m;(m=l.current)===null||m===void 0||m.call(l)},[r]),function(){o.current===r&&(o.current+=1,i(o.current))}}function vj(e){var t=C.useRef([]),n=C.useState({}),r=pe(n,2),i=r[1],o=C.useRef(typeof e=="function"?e():e),l=DE(function(){var u=o.current;t.current.forEach(function(p){u=p(u)}),t.current=[],o.current=u,i({})});function m(u){t.current.push(u),l()}return[o.current,m]}var VS={width:0,height:0,left:0,top:0,right:0};function yj(e,t,n,r,i,o,l){var m=l.tabs,u=l.tabPosition,p=l.rtl,s,c,d;return["top","bottom"].includes(u)?(s="width",c=p?"right":"left",d=Math.abs(n)):(s="height",c="top",d=-n),C.useMemo(function(){if(!m.length)return[0,0];for(var h=m.length,f=h,v=0;vMath.floor(d+t)){f=v-1;break}}for(var b=0,w=h-1;w>=0;w-=1){var x=e.get(m[w].key)||VS;if(x[c]=f?[0,0]:[b,f]},[e,t,r,i,o,d,u,m.map(function(h){return h.key}).join("_"),p])}function US(e){var t;return e instanceof Map?(t={},e.forEach(function(n,r){t[r]=n})):t=e,JSON.stringify(t)}var bj="TABS_DQ";function FE(e){return String(e).replace(/"/g,bj)}function Wv(e,t,n,r){return!(!n||r||e===!1||e===void 0&&(t===!1||t===null))}var zE=C.forwardRef(function(e,t){var n=e.prefixCls,r=e.editable,i=e.locale,o=e.style;return!r||r.showAdd===!1?null:C.createElement("button",{ref:t,type:"button",className:"".concat(n,"-nav-add"),style:o,"aria-label":(i==null?void 0:i.addAriaLabel)||"Add tab",onClick:function(m){r.onEdit("add",{event:m})}},r.addIcon||"+")}),GS=C.forwardRef(function(e,t){var n=e.position,r=e.prefixCls,i=e.extra;if(!i)return null;var o,l={};return wt(i)==="object"&&!C.isValidElement(i)?l=i:l.right=i,n==="right"&&(o=l.right),n==="left"&&(o=l.left),o?C.createElement("div",{className:"".concat(r,"-extra-content"),ref:t},o):null}),wj=C.forwardRef(function(e,t){var n=e.prefixCls,r=e.id,i=e.tabs,o=e.locale,l=e.mobile,m=e.more,u=m===void 0?{}:m,p=e.style,s=e.className,c=e.editable,d=e.tabBarGutter,h=e.rtl,f=e.removeAriaLabel,v=e.onTabClick,y=e.getPopupContainer,b=e.popupClassName,w=C.useState(!1),x=pe(w,2),E=x[0],_=x[1],$=C.useState(null),O=pe($,2),N=O[0],k=O[1],L=u.icon,F=L===void 0?"More":L,P="".concat(r,"-more-popup"),A="".concat(n,"-dropdown"),M=N!==null?"".concat(P,"-").concat(N):null,R=o==null?void 0:o.dropdownAriaLabel;function I(U,K){U.preventDefault(),U.stopPropagation(),c.onEdit("remove",{key:K,event:U})}var D=C.createElement(Fc,{onClick:function(K){var G=K.key,q=K.domEvent;v(G,q),_(!1)},prefixCls:"".concat(A,"-menu"),id:P,tabIndex:-1,role:"listbox","aria-activedescendant":M,selectedKeys:[N],"aria-label":R!==void 0?R:"expanded dropdown"},i.map(function(U){var K=U.closable,G=U.disabled,q=U.closeIcon,Z=U.key,Q=U.label,J=Wv(K,q,c,G);return C.createElement(bf,{key:Z,id:"".concat(P,"-").concat(Z),role:"option","aria-controls":r&&"".concat(r,"-panel-").concat(Z),disabled:G},C.createElement("span",null,Q),J&&C.createElement("button",{type:"button","aria-label":f||"remove",tabIndex:0,className:"".concat(A,"-menu-item-remove"),onClick:function(se){se.stopPropagation(),I(se,Z)}},q||c.removeIcon||"×"))}));function j(U){for(var K=i.filter(function(J){return!J.disabled}),G=K.findIndex(function(J){return J.key===N})||0,q=K.length,Z=0;ZLe?"left":"right"})}),A=pe(P,2),M=A[0],R=A[1],I=BS(0,function(st,Le){!F&&v&&v({direction:st>Le?"top":"bottom"})}),D=pe(I,2),j=D[0],B=D[1],V=C.useState([0,0]),H=pe(V,2),Y=H[0],U=H[1],K=C.useState([0,0]),G=pe(K,2),q=G[0],Z=G[1],Q=C.useState([0,0]),J=pe(Q,2),ie=J[0],se=J[1],ae=C.useState([0,0]),ge=pe(ae,2),me=ge[0],de=ge[1],we=vj(new Map),Oe=pe(we,2),xe=Oe[0],Pe=Oe[1],ze=pj(x,xe,q[0]),Ie=Xu(Y,F),Ye=Xu(q,F),Me=Xu(ie,F),ke=Xu(me,F),Je=Math.floor(Ie)Ae?Ae:st}var He=C.useRef(null),it=C.useState(),Ne=pe(it,2),Te=Ne[0],We=Ne[1];function te(){We(Date.now())}function fe(){He.current&&clearTimeout(He.current)}mj(O,function(st,Le){function Ct(Ft,en){Ft(function(hn){var Dn=De(hn+en);return Dn})}return Je?(F?Ct(R,st):Ct(B,Le),fe(),te(),!0):!1}),C.useEffect(function(){return fe(),Te&&(He.current=setTimeout(function(){We(0)},100)),fe},[Te]);var je=yj(ze,ce,F?M:j,Ye,Me,ke,oe(oe({},e),{},{tabs:x})),ct=pe(je,2),Jt=ct[0],kt=ct[1],rn=tr(function(){var st=arguments.length>0&&arguments[0]!==void 0?arguments[0]:l,Le=ze.get(st)||{width:0,height:0,left:0,right:0,top:0};if(F){var Ct=M;m?Le.rightM+ce&&(Ct=Le.right+Le.width-ce):Le.left<-M?Ct=-Le.left:Le.left+Le.width>-M+ce&&(Ct=-(Le.left+Le.width-ce)),B(0),R(De(Ct))}else{var Ft=j;Le.top<-j?Ft=-Le.top:Le.top+Le.height>-j+ce&&(Ft=-(Le.top+Le.height-ce)),R(0),B(De(Ft))}}),Qt=C.useState(),Lt=pe(Qt,2),Nt=Lt[0],Et=Lt[1],dt=C.useState(!1),et=pe(dt,2),Ke=et[0],_t=et[1],Tt=x.filter(function(st){return!st.disabled}).map(function(st){return st.key}),tt=function(Le){var Ct=Tt.indexOf(Nt||l),Ft=Tt.length,en=(Ct+Le+Ft)%Ft,hn=Tt[en];Et(hn)},Ze=function(Le){var Ct=Le.code,Ft=m&&F,en=Tt[0],hn=Tt[Tt.length-1];switch(Ct){case"ArrowLeft":{F&&tt(Ft?1:-1);break}case"ArrowRight":{F&&tt(Ft?-1:1);break}case"ArrowUp":{Le.preventDefault(),F||tt(-1);break}case"ArrowDown":{Le.preventDefault(),F||tt(1);break}case"Home":{Le.preventDefault(),Et(en);break}case"End":{Le.preventDefault(),Et(hn);break}case"Enter":case"Space":{Le.preventDefault(),f(Nt??l,Le);break}case"Backspace":case"Delete":{var Dn=Tt.indexOf(Nt),Yt=x.find(function(ln){return ln.key===Nt}),$n=Wv(Yt==null?void 0:Yt.closable,Yt==null?void 0:Yt.closeIcon,p,Yt==null?void 0:Yt.disabled);$n&&(Le.preventDefault(),Le.stopPropagation(),p.onEdit("remove",{key:Nt,event:Le}),Dn===Tt.length-1?tt(-1):tt(1));break}}},at={};F?at[m?"marginRight":"marginLeft"]=d:at.marginTop=d;var ot=x.map(function(st,Le){var Ct=st.key;return C.createElement(Cj,{id:i,prefixCls:w,key:Ct,tab:st,style:Le===0?void 0:at,closable:st.closable,editable:p,active:Ct===l,focus:Ct===Nt,renderWrapper:h,removeAriaLabel:s==null?void 0:s.removeAriaLabel,tabCount:Tt.length,currentPosition:Le+1,onClick:function(en){f(Ct,en)},onKeyDown:Ze,onFocus:function(){Ke||Et(Ct),rn(Ct),te(),O.current&&(m||(O.current.scrollLeft=0),O.current.scrollTop=0)},onBlur:function(){Et(void 0)},onMouseDown:function(){_t(!0)},onMouseUp:function(){_t(!1)}})}),rt=function(){return Pe(function(){var Le,Ct=new Map,Ft=(Le=N.current)===null||Le===void 0?void 0:Le.getBoundingClientRect();return x.forEach(function(en){var hn,Dn=en.key,Yt=(hn=N.current)===null||hn===void 0?void 0:hn.querySelector('[data-node-key="'.concat(FE(Dn),'"]'));if(Yt){var $n=$j(Yt,Ft),ln=pe($n,4),Wr=ln[0],Fn=ln[1],Gn=ln[2],qn=ln[3];Ct.set(Dn,{width:Wr,height:Fn,left:Gn,top:qn})}}),Ct})};C.useEffect(function(){rt()},[x.map(function(st){return st.key}).join("_")]);var vt=DE(function(){var st=Ms(E),Le=Ms(_),Ct=Ms($);U([st[0]-Le[0]-Ct[0],st[1]-Le[1]-Ct[1]]);var Ft=Ms(L);se(Ft);var en=Ms(k);de(en);var hn=Ms(N);Z([hn[0]-Ft[0],hn[1]-Ft[1]]),rt()}),on=x.slice(0,Jt),Bt=x.slice(kt+1),Gt=[].concat(Ge(on),Ge(Bt)),Dt=ze.get(l),Ht=hj({activeTabOffset:Dt,horizontal:F,indicator:y,rtl:m}),yn=Ht.style;C.useEffect(function(){rn()},[l,Re,Ae,US(Dt),US(ze),F]),C.useEffect(function(){vt()},[m]);var Cn=!!Gt.length,Rn="".concat(w,"-nav-wrap"),cn,Kt,Xe,ut;return F?m?(Kt=M>0,cn=M!==Ae):(cn=M<0,Kt=M!==Re):(Xe=j<0,ut=j!==Re),C.createElement(ki,{onResize:vt},C.createElement("div",{ref:Ga(t,E),role:"tablist","aria-orientation":F?"horizontal":"vertical",className:ve("".concat(w,"-nav"),n),style:r,onKeyDown:function(){te()}},C.createElement(GS,{ref:_,position:"left",extra:u,prefixCls:w}),C.createElement(ki,{onResize:vt},C.createElement("div",{className:ve(Rn,ne(ne(ne(ne({},"".concat(Rn,"-ping-left"),cn),"".concat(Rn,"-ping-right"),Kt),"".concat(Rn,"-ping-top"),Xe),"".concat(Rn,"-ping-bottom"),ut)),ref:O},C.createElement(ki,{onResize:vt},C.createElement("div",{ref:N,className:"".concat(w,"-nav-list"),style:{transform:"translate(".concat(M,"px, ").concat(j,"px)"),transition:Te?"none":void 0}},ot,C.createElement(zE,{ref:L,prefixCls:w,locale:s,editable:p,style:oe(oe({},ot.length===0?void 0:at),{},{visibility:Cn?"hidden":null})}),C.createElement("div",{className:ve("".concat(w,"-ink-bar"),ne({},"".concat(w,"-ink-bar-animated"),o.inkBar)),style:yn}))))),C.createElement(Sj,nt({},e,{removeAriaLabel:s==null?void 0:s.removeAriaLabel,ref:k,prefixCls:w,tabs:Gt,className:!Cn&&Ee,tabMoving:!!Te})),C.createElement(GS,{ref:$,position:"right",extra:u,prefixCls:w})))}),jE=C.forwardRef(function(e,t){var n=e.prefixCls,r=e.className,i=e.style,o=e.id,l=e.active,m=e.tabKey,u=e.children;return C.createElement("div",{id:o&&"".concat(o,"-panel-").concat(m),role:"tabpanel",tabIndex:l?0:-1,"aria-labelledby":o&&"".concat(o,"-tab-").concat(m),"aria-hidden":!l,style:i,className:ve(n,l&&"".concat(n,"-active"),r),ref:t},u)}),xj=["renderTabBar"],Ej=["label","key"],_j=function(t){var n=t.renderTabBar,r=At(t,xj),i=C.useContext(Cf),o=i.tabs;if(n){var l=oe(oe({},r),{},{panes:o.map(function(m){var u=m.label,p=m.key,s=At(m,Ej);return C.createElement(jE,nt({tab:u,key:p,tabKey:p},s))})});return n(l,KS)}return C.createElement(KS,r)},Mj=["key","forceRender","style","className","destroyInactiveTabPane"],Rj=function(t){var n=t.id,r=t.activeKey,i=t.animated,o=t.tabPosition,l=t.destroyInactiveTabPane,m=C.useContext(Cf),u=m.prefixCls,p=m.tabs,s=i.tabPane,c="".concat(u,"-tabpane");return C.createElement("div",{className:ve("".concat(u,"-content-holder"))},C.createElement("div",{className:ve("".concat(u,"-content"),"".concat(u,"-content-").concat(o),ne({},"".concat(u,"-content-animated"),s))},p.map(function(d){var h=d.key,f=d.forceRender,v=d.style,y=d.className,b=d.destroyInactiveTabPane,w=At(d,Mj),x=h===r;return C.createElement(Lo,nt({key:h,visible:x,forceRender:f,removeOnLeave:!!(l||b),leavedClassName:"".concat(c,"-hidden")},i.tabPaneMotion),function(E,_){var $=E.style,O=E.className;return C.createElement(jE,nt({},w,{prefixCls:c,id:n,tabKey:h,animated:s,active:x,style:oe(oe({},v),$),className:ve(y,O),ref:_}))})})))};function Oj(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{inkBar:!0,tabPane:!1},t;return e===!1?t={inkBar:!1,tabPane:!1}:e===!0?t={inkBar:!0,tabPane:!1}:t=oe({inkBar:!0},wt(e)==="object"?e:{}),t.tabPaneMotion&&t.tabPane===void 0&&(t.tabPane=!0),!t.tabPaneMotion&&t.tabPane&&(t.tabPane=!1),t}var Aj=["id","prefixCls","className","items","direction","activeKey","defaultActiveKey","editable","animated","tabPosition","tabBarGutter","tabBarStyle","tabBarExtraContent","locale","more","destroyInactiveTabPane","renderTabBar","onChange","onTabClick","onTabScroll","getPopupContainer","popupClassName","indicator"],YS=0,Tj=C.forwardRef(function(e,t){var n=e.id,r=e.prefixCls,i=r===void 0?"rc-tabs":r,o=e.className,l=e.items,m=e.direction,u=e.activeKey,p=e.defaultActiveKey,s=e.editable,c=e.animated,d=e.tabPosition,h=d===void 0?"top":d,f=e.tabBarGutter,v=e.tabBarStyle,y=e.tabBarExtraContent,b=e.locale,w=e.more,x=e.destroyInactiveTabPane,E=e.renderTabBar,_=e.onChange,$=e.onTabClick,O=e.onTabScroll,N=e.getPopupContainer,k=e.popupClassName,L=e.indicator,F=At(e,Aj),P=C.useMemo(function(){return(l||[]).filter(function(me){return me&&wt(me)==="object"&&"key"in me})},[l]),A=m==="rtl",M=Oj(c),R=C.useState(!1),I=pe(R,2),D=I[0],j=I[1];C.useEffect(function(){j(Tv())},[]);var B=Pr(function(){var me;return(me=P[0])===null||me===void 0?void 0:me.key},{value:u,defaultValue:p}),V=pe(B,2),H=V[0],Y=V[1],U=C.useState(function(){return P.findIndex(function(me){return me.key===H})}),K=pe(U,2),G=K[0],q=K[1];C.useEffect(function(){var me=P.findIndex(function(we){return we.key===H});if(me===-1){var de;me=Math.max(0,Math.min(G,P.length-1)),Y((de=P[me])===null||de===void 0?void 0:de.key)}q(me)},[P.map(function(me){return me.key}).join("_"),H,G]);var Z=Pr(null,{value:n}),Q=pe(Z,2),J=Q[0],ie=Q[1];C.useEffect(function(){n||(ie("rc-tabs-".concat(YS)),YS+=1)},[]);function se(me,de){$==null||$(me,de);var we=me!==H;Y(me),we&&(_==null||_(me))}var ae={id:J,activeKey:H,animated:M,tabPosition:h,rtl:A,mobile:D},ge=oe(oe({},ae),{},{editable:s,locale:b,more:w,tabBarGutter:f,onTabClick:se,onTabScroll:O,extra:y,style:v,panes:null,getPopupContainer:N,popupClassName:k,indicator:L});return C.createElement(Cf.Provider,{value:{tabs:P,prefixCls:i}},C.createElement("div",nt({ref:t,id:n,className:ve(i,"".concat(i,"-").concat(h),ne(ne(ne({},"".concat(i,"-mobile"),D),"".concat(i,"-editable"),s),"".concat(i,"-rtl"),A),o)},F),C.createElement(_j,nt({},ge,{renderTabBar:E})),C.createElement(Rj,nt({destroyInactiveTabPane:x},ae,{animated:M}))))});const Ij={motionAppear:!1,motionEnter:!0,motionLeave:!0};function Lj(e,t={inkBar:!0,tabPane:!1}){let n;return t===!1?n={inkBar:!1,tabPane:!1}:t===!0?n={inkBar:!0,tabPane:!0}:n=Object.assign({inkBar:!0},typeof t=="object"?t:{}),n.tabPane&&(n.tabPaneMotion=Object.assign(Object.assign({},Ij),{motionName:wv(e,"switch")})),n}var Pj=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);it)}function Nj(e,t){if(e)return e.map(r=>{var i;const o=(i=r.destroyOnHidden)!==null&&i!==void 0?i:r.destroyInactiveTabPane;return Object.assign(Object.assign({},r),{destroyInactiveTabPane:o})});const n=li(t).map(r=>{if(C.isValidElement(r)){const{key:i,props:o}=r,l=o||{},{tab:m}=l,u=Pj(l,["tab"]);return Object.assign(Object.assign({key:String(i)},u),{label:m})}return null});return kj(n)}const Dj=e=>{const{componentCls:t,motionDurationSlow:n}=e;return[{[t]:{[`${t}-switch`]:{"&-appear, &-enter":{transition:"none","&-start":{opacity:0},"&-active":{opacity:1,transition:`opacity ${n}`}},"&-leave":{position:"absolute",transition:"none",inset:0,"&-start":{opacity:1},"&-active":{opacity:0,transition:`opacity ${n}`}}}}},[Ld(e,"slide-up"),Ld(e,"slide-down")]]},Fj=e=>{const{componentCls:t,tabsCardPadding:n,cardBg:r,cardGutter:i,colorBorderSecondary:o,itemSelectedColor:l}=e;return{[`${t}-card`]:{[`> ${t}-nav, > div > ${t}-nav`]:{[`${t}-tab`]:{margin:0,padding:n,background:r,border:`${$e(e.lineWidth)} ${e.lineType} ${o}`,transition:`all ${e.motionDurationSlow} ${e.motionEaseInOut}`},[`${t}-tab-active`]:{color:l,background:e.colorBgContainer},[`${t}-tab-focus:has(${t}-tab-btn:focus-visible)`]:fv(e,-3),[`& ${t}-tab${t}-tab-focus ${t}-tab-btn:focus-visible`]:{outline:"none"},[`${t}-ink-bar`]:{visibility:"hidden"}},[`&${t}-top, &${t}-bottom`]:{[`> ${t}-nav, > div > ${t}-nav`]:{[`${t}-tab + ${t}-tab`]:{marginLeft:{_skip_check_:!0,value:$e(i)}}}},[`&${t}-top`]:{[`> ${t}-nav, > div > ${t}-nav`]:{[`${t}-tab`]:{borderRadius:`${$e(e.borderRadiusLG)} ${$e(e.borderRadiusLG)} 0 0`},[`${t}-tab-active`]:{borderBottomColor:e.colorBgContainer}}},[`&${t}-bottom`]:{[`> ${t}-nav, > div > ${t}-nav`]:{[`${t}-tab`]:{borderRadius:`0 0 ${$e(e.borderRadiusLG)} ${$e(e.borderRadiusLG)}`},[`${t}-tab-active`]:{borderTopColor:e.colorBgContainer}}},[`&${t}-left, &${t}-right`]:{[`> ${t}-nav, > div > ${t}-nav`]:{[`${t}-tab + ${t}-tab`]:{marginTop:$e(i)}}},[`&${t}-left`]:{[`> ${t}-nav, > div > ${t}-nav`]:{[`${t}-tab`]:{borderRadius:{_skip_check_:!0,value:`${$e(e.borderRadiusLG)} 0 0 ${$e(e.borderRadiusLG)}`}},[`${t}-tab-active`]:{borderRightColor:{_skip_check_:!0,value:e.colorBgContainer}}}},[`&${t}-right`]:{[`> ${t}-nav, > div > ${t}-nav`]:{[`${t}-tab`]:{borderRadius:{_skip_check_:!0,value:`0 ${$e(e.borderRadiusLG)} ${$e(e.borderRadiusLG)} 0`}},[`${t}-tab-active`]:{borderLeftColor:{_skip_check_:!0,value:e.colorBgContainer}}}}}}},zj=e=>{const{componentCls:t,itemHoverColor:n,dropdownEdgeChildVerticalPadding:r}=e;return{[`${t}-dropdown`]:Object.assign(Object.assign({},ci(e)),{position:"absolute",top:-9999,left:{_skip_check_:!0,value:-9999},zIndex:e.zIndexPopup,display:"block","&-hidden":{display:"none"},[`${t}-dropdown-menu`]:{maxHeight:e.tabsDropdownHeight,margin:0,padding:`${$e(r)} 0`,overflowX:"hidden",overflowY:"auto",textAlign:{_skip_check_:!0,value:"left"},listStyleType:"none",backgroundColor:e.colorBgContainer,backgroundClip:"padding-box",borderRadius:e.borderRadiusLG,outline:"none",boxShadow:e.boxShadowSecondary,"&-item":Object.assign(Object.assign({},Ys),{display:"flex",alignItems:"center",minWidth:e.tabsDropdownWidth,margin:0,padding:`${$e(e.paddingXXS)} ${$e(e.paddingSM)}`,color:e.colorText,fontWeight:"normal",fontSize:e.fontSize,lineHeight:e.lineHeight,cursor:"pointer",transition:`all ${e.motionDurationSlow}`,"> span":{flex:1,whiteSpace:"nowrap"},"&-remove":{flex:"none",marginLeft:{_skip_check_:!0,value:e.marginSM},color:e.colorIcon,fontSize:e.fontSizeSM,background:"transparent",border:0,cursor:"pointer","&:hover":{color:n}},"&:hover":{background:e.controlItemBgHover},"&-disabled":{"&, &:hover":{color:e.colorTextDisabled,background:"transparent",cursor:"not-allowed"}}})}})}},jj=e=>{const{componentCls:t,margin:n,colorBorderSecondary:r,horizontalMargin:i,verticalItemPadding:o,verticalItemMargin:l,calc:m}=e;return{[`${t}-top, ${t}-bottom`]:{flexDirection:"column",[`> ${t}-nav, > div > ${t}-nav`]:{margin:i,"&::before":{position:"absolute",right:{_skip_check_:!0,value:0},left:{_skip_check_:!0,value:0},borderBottom:`${$e(e.lineWidth)} ${e.lineType} ${r}`,content:"''"},[`${t}-ink-bar`]:{height:e.lineWidthBold,"&-animated":{transition:`width ${e.motionDurationSlow}, left ${e.motionDurationSlow}, + right ${e.motionDurationSlow}`}},[`${t}-nav-wrap`]:{"&::before, &::after":{top:0,bottom:0,width:e.controlHeight},"&::before":{left:{_skip_check_:!0,value:0},boxShadow:e.boxShadowTabsOverflowLeft},"&::after":{right:{_skip_check_:!0,value:0},boxShadow:e.boxShadowTabsOverflowRight},[`&${t}-nav-wrap-ping-left::before`]:{opacity:1},[`&${t}-nav-wrap-ping-right::after`]:{opacity:1}}}},[`${t}-top`]:{[`> ${t}-nav, + > div > ${t}-nav`]:{"&::before":{bottom:0},[`${t}-ink-bar`]:{bottom:0}}},[`${t}-bottom`]:{[`> ${t}-nav, > div > ${t}-nav`]:{order:1,marginTop:n,marginBottom:0,"&::before":{top:0},[`${t}-ink-bar`]:{top:0}},[`> ${t}-content-holder, > div > ${t}-content-holder`]:{order:0}},[`${t}-left, ${t}-right`]:{[`> ${t}-nav, > div > ${t}-nav`]:{flexDirection:"column",minWidth:m(e.controlHeight).mul(1.25).equal(),[`${t}-tab`]:{padding:o,textAlign:"center"},[`${t}-tab + ${t}-tab`]:{margin:l},[`${t}-nav-wrap`]:{flexDirection:"column","&::before, &::after":{right:{_skip_check_:!0,value:0},left:{_skip_check_:!0,value:0},height:e.controlHeight},"&::before":{top:0,boxShadow:e.boxShadowTabsOverflowTop},"&::after":{bottom:0,boxShadow:e.boxShadowTabsOverflowBottom},[`&${t}-nav-wrap-ping-top::before`]:{opacity:1},[`&${t}-nav-wrap-ping-bottom::after`]:{opacity:1}},[`${t}-ink-bar`]:{width:e.lineWidthBold,"&-animated":{transition:`height ${e.motionDurationSlow}, top ${e.motionDurationSlow}`}},[`${t}-nav-list, ${t}-nav-operations`]:{flex:"1 0 auto",flexDirection:"column"}}},[`${t}-left`]:{[`> ${t}-nav, > div > ${t}-nav`]:{[`${t}-ink-bar`]:{right:{_skip_check_:!0,value:0}}},[`> ${t}-content-holder, > div > ${t}-content-holder`]:{marginLeft:{_skip_check_:!0,value:$e(m(e.lineWidth).mul(-1).equal())},borderLeft:{_skip_check_:!0,value:`${$e(e.lineWidth)} ${e.lineType} ${e.colorBorder}`},[`> ${t}-content > ${t}-tabpane`]:{paddingLeft:{_skip_check_:!0,value:e.paddingLG}}}},[`${t}-right`]:{[`> ${t}-nav, > div > ${t}-nav`]:{order:1,[`${t}-ink-bar`]:{left:{_skip_check_:!0,value:0}}},[`> ${t}-content-holder, > div > ${t}-content-holder`]:{order:0,marginRight:{_skip_check_:!0,value:m(e.lineWidth).mul(-1).equal()},borderRight:{_skip_check_:!0,value:`${$e(e.lineWidth)} ${e.lineType} ${e.colorBorder}`},[`> ${t}-content > ${t}-tabpane`]:{paddingRight:{_skip_check_:!0,value:e.paddingLG}}}}}},Bj=e=>{const{componentCls:t,cardPaddingSM:n,cardPaddingLG:r,cardHeightSM:i,cardHeightLG:o,horizontalItemPaddingSM:l,horizontalItemPaddingLG:m}=e;return{[t]:{"&-small":{[`> ${t}-nav`]:{[`${t}-tab`]:{padding:l,fontSize:e.titleFontSizeSM}}},"&-large":{[`> ${t}-nav`]:{[`${t}-tab`]:{padding:m,fontSize:e.titleFontSizeLG,lineHeight:e.lineHeightLG}}}},[`${t}-card`]:{[`&${t}-small`]:{[`> ${t}-nav`]:{[`${t}-tab`]:{padding:n},[`${t}-nav-add`]:{minWidth:i,minHeight:i}},[`&${t}-bottom`]:{[`> ${t}-nav ${t}-tab`]:{borderRadius:`0 0 ${$e(e.borderRadius)} ${$e(e.borderRadius)}`}},[`&${t}-top`]:{[`> ${t}-nav ${t}-tab`]:{borderRadius:`${$e(e.borderRadius)} ${$e(e.borderRadius)} 0 0`}},[`&${t}-right`]:{[`> ${t}-nav ${t}-tab`]:{borderRadius:{_skip_check_:!0,value:`0 ${$e(e.borderRadius)} ${$e(e.borderRadius)} 0`}}},[`&${t}-left`]:{[`> ${t}-nav ${t}-tab`]:{borderRadius:{_skip_check_:!0,value:`${$e(e.borderRadius)} 0 0 ${$e(e.borderRadius)}`}}}},[`&${t}-large`]:{[`> ${t}-nav`]:{[`${t}-tab`]:{padding:r},[`${t}-nav-add`]:{minWidth:o,minHeight:o}}}}}},Hj=e=>{const{componentCls:t,itemActiveColor:n,itemHoverColor:r,iconCls:i,tabsHorizontalItemMargin:o,horizontalItemPadding:l,itemSelectedColor:m,itemColor:u}=e,p=`${t}-tab`;return{[p]:{position:"relative",WebkitTouchCallout:"none",WebkitTapHighlightColor:"transparent",display:"inline-flex",alignItems:"center",padding:l,fontSize:e.titleFontSize,background:"transparent",border:0,outline:"none",cursor:"pointer",color:u,"&-btn, &-remove":{"&:focus:not(:focus-visible), &:active":{color:n}},"&-btn":{outline:"none",transition:`all ${e.motionDurationSlow}`,[`${p}-icon:not(:last-child)`]:{marginInlineEnd:e.marginSM}},"&-remove":Object.assign({flex:"none",marginRight:{_skip_check_:!0,value:e.calc(e.marginXXS).mul(-1).equal()},marginLeft:{_skip_check_:!0,value:e.marginXS},color:e.colorIcon,fontSize:e.fontSizeSM,background:"transparent",border:"none",outline:"none",cursor:"pointer",transition:`all ${e.motionDurationSlow}`,"&:hover":{color:e.colorTextHeading}},Ha(e)),"&:hover":{color:r},[`&${p}-active ${p}-btn`]:{color:m,textShadow:e.tabsActiveTextShadow},[`&${p}-focus ${p}-btn:focus-visible`]:fv(e),[`&${p}-disabled`]:{color:e.colorTextDisabled,cursor:"not-allowed"},[`&${p}-disabled ${p}-btn, &${p}-disabled ${t}-remove`]:{"&:focus, &:active":{color:e.colorTextDisabled}},[`& ${p}-remove ${i}`]:{margin:0},[`${i}:not(:last-child)`]:{marginRight:{_skip_check_:!0,value:e.marginSM}}},[`${p} + ${p}`]:{margin:{_skip_check_:!0,value:o}}}},Wj=e=>{const{componentCls:t,tabsHorizontalItemMarginRTL:n,iconCls:r,cardGutter:i,calc:o}=e;return{[`${t}-rtl`]:{direction:"rtl",[`${t}-nav`]:{[`${t}-tab`]:{margin:{_skip_check_:!0,value:n},[`${t}-tab:last-of-type`]:{marginLeft:{_skip_check_:!0,value:0}},[r]:{marginRight:{_skip_check_:!0,value:0},marginLeft:{_skip_check_:!0,value:$e(e.marginSM)}},[`${t}-tab-remove`]:{marginRight:{_skip_check_:!0,value:$e(e.marginXS)},marginLeft:{_skip_check_:!0,value:$e(o(e.marginXXS).mul(-1).equal())},[r]:{margin:0}}}},[`&${t}-left`]:{[`> ${t}-nav`]:{order:1},[`> ${t}-content-holder`]:{order:0}},[`&${t}-right`]:{[`> ${t}-nav`]:{order:0},[`> ${t}-content-holder`]:{order:1}},[`&${t}-card${t}-top, &${t}-card${t}-bottom`]:{[`> ${t}-nav, > div > ${t}-nav`]:{[`${t}-tab + ${t}-tab`]:{marginRight:{_skip_check_:!0,value:i},marginLeft:{_skip_check_:!0,value:0}}}}},[`${t}-dropdown-rtl`]:{direction:"rtl"},[`${t}-menu-item`]:{[`${t}-dropdown-rtl`]:{textAlign:{_skip_check_:!0,value:"right"}}}}},Vj=e=>{const{componentCls:t,tabsCardPadding:n,cardHeight:r,cardGutter:i,itemHoverColor:o,itemActiveColor:l,colorBorderSecondary:m}=e;return{[t]:Object.assign(Object.assign(Object.assign(Object.assign({},ci(e)),{display:"flex",[`> ${t}-nav, > div > ${t}-nav`]:{position:"relative",display:"flex",flex:"none",alignItems:"center",[`${t}-nav-wrap`]:{position:"relative",display:"flex",flex:"auto",alignSelf:"stretch",overflow:"hidden",whiteSpace:"nowrap",transform:"translate(0)","&::before, &::after":{position:"absolute",zIndex:1,opacity:0,transition:`opacity ${e.motionDurationSlow}`,content:"''",pointerEvents:"none"}},[`${t}-nav-list`]:{position:"relative",display:"flex",transition:`opacity ${e.motionDurationSlow}`},[`${t}-nav-operations`]:{display:"flex",alignSelf:"stretch"},[`${t}-nav-operations-hidden`]:{position:"absolute",visibility:"hidden",pointerEvents:"none"},[`${t}-nav-more`]:{position:"relative",padding:n,background:"transparent",border:0,color:e.colorText,"&::after":{position:"absolute",right:{_skip_check_:!0,value:0},bottom:0,left:{_skip_check_:!0,value:0},height:e.calc(e.controlHeightLG).div(8).equal(),transform:"translateY(100%)",content:"''"}},[`${t}-nav-add`]:Object.assign({minWidth:r,minHeight:r,marginLeft:{_skip_check_:!0,value:i},background:"transparent",border:`${$e(e.lineWidth)} ${e.lineType} ${m}`,borderRadius:`${$e(e.borderRadiusLG)} ${$e(e.borderRadiusLG)} 0 0`,outline:"none",cursor:"pointer",color:e.colorText,transition:`all ${e.motionDurationSlow} ${e.motionEaseInOut}`,"&:hover":{color:o},"&:active, &:focus:not(:focus-visible)":{color:l}},Ha(e,-3))},[`${t}-extra-content`]:{flex:"none"},[`${t}-ink-bar`]:{position:"absolute",background:e.inkBarColor,pointerEvents:"none"}}),Hj(e)),{[`${t}-content`]:{position:"relative",width:"100%"},[`${t}-content-holder`]:{flex:"auto",minWidth:0,minHeight:0},[`${t}-tabpane`]:Object.assign(Object.assign({},Ha(e)),{"&-hidden":{display:"none"}})}),[`${t}-centered`]:{[`> ${t}-nav, > div > ${t}-nav`]:{[`${t}-nav-wrap`]:{[`&:not([class*='${t}-nav-wrap-ping']) > ${t}-nav-list`]:{margin:"auto"}}}}}},Uj=e=>{const{cardHeight:t,cardHeightSM:n,cardHeightLG:r,controlHeight:i,controlHeightLG:o}=e,l=t||o,m=n||i,u=r||o+8;return{zIndexPopup:e.zIndexPopupBase+50,cardBg:e.colorFillAlter,cardHeight:l,cardHeightSM:m,cardHeightLG:u,cardPadding:`${(l-e.fontHeight)/2-e.lineWidth}px ${e.padding}px`,cardPaddingSM:`${(m-e.fontHeight)/2-e.lineWidth}px ${e.paddingXS}px`,cardPaddingLG:`${(u-e.fontHeightLG)/2-e.lineWidth}px ${e.padding}px`,titleFontSize:e.fontSize,titleFontSizeLG:e.fontSizeLG,titleFontSizeSM:e.fontSize,inkBarColor:e.colorPrimary,horizontalMargin:`0 0 ${e.margin}px 0`,horizontalItemGutter:32,horizontalItemMargin:"",horizontalItemMarginRTL:"",horizontalItemPadding:`${e.paddingSM}px 0`,horizontalItemPaddingSM:`${e.paddingXS}px 0`,horizontalItemPaddingLG:`${e.padding}px 0`,verticalItemPadding:`${e.paddingXS}px ${e.paddingLG}px`,verticalItemMargin:`${e.margin}px 0 0 0`,itemColor:e.colorText,itemSelectedColor:e.colorPrimary,itemHoverColor:e.colorPrimaryHover,itemActiveColor:e.colorPrimaryActive,cardGutter:e.marginXXS/2}},Gj=gr("Tabs",e=>{const t=Sn(e,{tabsCardPadding:e.cardPadding,dropdownEdgeChildVerticalPadding:e.paddingXXS,tabsActiveTextShadow:"0 0 0.25px currentcolor",tabsDropdownHeight:200,tabsDropdownWidth:120,tabsHorizontalItemMargin:`0 0 0 ${$e(e.horizontalItemGutter)}`,tabsHorizontalItemMarginRTL:`0 0 0 ${$e(e.horizontalItemGutter)}`});return[Bj(t),Wj(t),jj(t),zj(t),Fj(t),Vj(t),Dj(t)]},Uj),Kj=()=>null;var Yj=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i{var t,n,r,i,o,l,m,u,p,s,c;const{type:d,className:h,rootClassName:f,size:v,onEdit:y,hideAdd:b,centered:w,addIcon:x,removeIcon:E,moreIcon:_,more:$,popupClassName:O,children:N,items:k,animated:L,style:F,indicatorSize:P,indicator:A,destroyInactiveTabPane:M,destroyOnHidden:R}=e,I=Yj(e,["type","className","rootClassName","size","onEdit","hideAdd","centered","addIcon","removeIcon","moreIcon","more","popupClassName","children","items","animated","style","indicatorSize","indicator","destroyInactiveTabPane","destroyOnHidden"]),{prefixCls:D}=I,{direction:j,tabs:B,getPrefixCls:V,getPopupContainer:H}=C.useContext(zt),Y=V("tabs",D),U=eo(Y),[K,G,q]=Gj(Y,U);let Z;d==="editable-card"&&(Z={onEdit:(me,{key:de,event:we})=>{y==null||y(me==="add"?we:de,me)},removeIcon:(t=E??(B==null?void 0:B.removeIcon))!==null&&t!==void 0?t:C.createElement(tf,null),addIcon:(x??(B==null?void 0:B.addIcon))||C.createElement(fj,null),showAdd:b!==!0});const Q=V(),J=to(v),ie=Nj(k,N),se=Lj(Y,L),ae=Object.assign(Object.assign({},B==null?void 0:B.style),F),ge={align:(n=A==null?void 0:A.align)!==null&&n!==void 0?n:(r=B==null?void 0:B.indicator)===null||r===void 0?void 0:r.align,size:(m=(o=(i=A==null?void 0:A.size)!==null&&i!==void 0?i:P)!==null&&o!==void 0?o:(l=B==null?void 0:B.indicator)===null||l===void 0?void 0:l.size)!==null&&m!==void 0?m:B==null?void 0:B.indicatorSize};return K(C.createElement(Tj,Object.assign({direction:j,getPopupContainer:H},I,{items:ie,className:ve({[`${Y}-${J}`]:J,[`${Y}-card`]:["card","editable-card"].includes(d),[`${Y}-editable-card`]:d==="editable-card",[`${Y}-centered`]:w},B==null?void 0:B.className,h,f,G,q,U),popupClassName:ve(O,G,q,U),style:ae,editable:Z,more:Object.assign({icon:(c=(s=(p=(u=B==null?void 0:B.more)===null||u===void 0?void 0:u.icon)!==null&&p!==void 0?p:B==null?void 0:B.moreIcon)!==null&&s!==void 0?s:_)!==null&&c!==void 0?c:C.createElement(Yz,null),transitionName:`${Q}-slide-up`},$),prefixCls:Y,animated:se,indicator:ge,destroyInactiveTabPane:R??M})))};BE.TabPane=Kj;var Xj=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i{var{prefixCls:t,className:n,hoverable:r=!0}=e,i=Xj(e,["prefixCls","className","hoverable"]);const{getPrefixCls:o}=C.useContext(zt),l=o("card",t),m=ve(`${l}-grid`,n,{[`${l}-grid-hoverable`]:r});return C.createElement("div",Object.assign({},i,{className:m}))},qj=e=>{const{antCls:t,componentCls:n,headerHeight:r,headerPadding:i,tabsMarginBottom:o}=e;return Object.assign(Object.assign({display:"flex",justifyContent:"center",flexDirection:"column",minHeight:r,marginBottom:-1,padding:`0 ${$e(i)}`,color:e.colorTextHeading,fontWeight:e.fontWeightStrong,fontSize:e.headerFontSize,background:e.headerBg,borderBottom:`${$e(e.lineWidth)} ${e.lineType} ${e.colorBorderSecondary}`,borderRadius:`${$e(e.borderRadiusLG)} ${$e(e.borderRadiusLG)} 0 0`},Oc()),{"&-wrapper":{width:"100%",display:"flex",alignItems:"center"},"&-title":Object.assign(Object.assign({display:"inline-block",flex:1},Ys),{[` + > ${n}-typography, + > ${n}-typography-edit-content + `]:{insetInlineStart:0,marginTop:0,marginBottom:0}}),[`${t}-tabs-top`]:{clear:"both",marginBottom:o,color:e.colorText,fontWeight:"normal",fontSize:e.fontSize,"&-bar":{borderBottom:`${$e(e.lineWidth)} ${e.lineType} ${e.colorBorderSecondary}`}}})},Qj=e=>{const{cardPaddingBase:t,colorBorderSecondary:n,cardShadow:r,lineWidth:i}=e;return{width:"33.33%",padding:t,border:0,borderRadius:0,boxShadow:` + ${$e(i)} 0 0 0 ${n}, + 0 ${$e(i)} 0 0 ${n}, + ${$e(i)} ${$e(i)} 0 0 ${n}, + ${$e(i)} 0 0 0 ${n} inset, + 0 ${$e(i)} 0 0 ${n} inset; + `,transition:`all ${e.motionDurationMid}`,"&-hoverable:hover":{position:"relative",zIndex:1,boxShadow:r}}},Zj=e=>{const{componentCls:t,iconCls:n,actionsLiMargin:r,cardActionsIconSize:i,colorBorderSecondary:o,actionsBg:l}=e;return Object.assign(Object.assign({margin:0,padding:0,listStyle:"none",background:l,borderTop:`${$e(e.lineWidth)} ${e.lineType} ${o}`,display:"flex",borderRadius:`0 0 ${$e(e.borderRadiusLG)} ${$e(e.borderRadiusLG)}`},Oc()),{"& > li":{margin:r,color:e.colorTextDescription,textAlign:"center","> span":{position:"relative",display:"block",minWidth:e.calc(e.cardActionsIconSize).mul(2).equal(),fontSize:e.fontSize,lineHeight:e.lineHeight,cursor:"pointer","&:hover":{color:e.colorPrimary,transition:`color ${e.motionDurationMid}`},[`a:not(${t}-btn), > ${n}`]:{display:"inline-block",width:"100%",color:e.colorIcon,lineHeight:$e(e.fontHeight),transition:`color ${e.motionDurationMid}`,"&:hover":{color:e.colorPrimary}},[`> ${n}`]:{fontSize:i,lineHeight:$e(e.calc(i).mul(e.lineHeight).equal())}},"&:not(:last-child)":{borderInlineEnd:`${$e(e.lineWidth)} ${e.lineType} ${o}`}}})},Jj=e=>Object.assign(Object.assign({margin:`${$e(e.calc(e.marginXXS).mul(-1).equal())} 0`,display:"flex"},Oc()),{"&-avatar":{paddingInlineEnd:e.padding},"&-detail":{overflow:"hidden",flex:1,"> div:not(:last-child)":{marginBottom:e.marginXS}},"&-title":Object.assign({color:e.colorTextHeading,fontWeight:e.fontWeightStrong,fontSize:e.fontSizeLG},Ys),"&-description":{color:e.colorTextDescription}}),e3=e=>{const{componentCls:t,colorFillAlter:n,headerPadding:r,bodyPadding:i}=e;return{[`${t}-head`]:{padding:`0 ${$e(r)}`,background:n,"&-title":{fontSize:e.fontSize}},[`${t}-body`]:{padding:`${$e(e.padding)} ${$e(i)}`}}},t3=e=>{const{componentCls:t}=e;return{overflow:"hidden",[`${t}-body`]:{userSelect:"none"}}},n3=e=>{const{componentCls:t,cardShadow:n,cardHeadPadding:r,colorBorderSecondary:i,boxShadowTertiary:o,bodyPadding:l,extraColor:m}=e;return{[t]:Object.assign(Object.assign({},ci(e)),{position:"relative",background:e.colorBgContainer,borderRadius:e.borderRadiusLG,[`&:not(${t}-bordered)`]:{boxShadow:o},[`${t}-head`]:qj(e),[`${t}-extra`]:{marginInlineStart:"auto",color:m,fontWeight:"normal",fontSize:e.fontSize},[`${t}-body`]:Object.assign({padding:l,borderRadius:`0 0 ${$e(e.borderRadiusLG)} ${$e(e.borderRadiusLG)}`},Oc()),[`${t}-grid`]:Qj(e),[`${t}-cover`]:{"> *":{display:"block",width:"100%",borderRadius:`${$e(e.borderRadiusLG)} ${$e(e.borderRadiusLG)} 0 0`}},[`${t}-actions`]:Zj(e),[`${t}-meta`]:Jj(e)}),[`${t}-bordered`]:{border:`${$e(e.lineWidth)} ${e.lineType} ${i}`,[`${t}-cover`]:{marginTop:-1,marginInlineStart:-1,marginInlineEnd:-1}},[`${t}-hoverable`]:{cursor:"pointer",transition:`box-shadow ${e.motionDurationMid}, border-color ${e.motionDurationMid}`,"&:hover":{borderColor:"transparent",boxShadow:n}},[`${t}-contain-grid`]:{borderRadius:`${$e(e.borderRadiusLG)} ${$e(e.borderRadiusLG)} 0 0 `,[`${t}-body`]:{display:"flex",flexWrap:"wrap"},[`&:not(${t}-loading) ${t}-body`]:{marginBlockStart:e.calc(e.lineWidth).mul(-1).equal(),marginInlineStart:e.calc(e.lineWidth).mul(-1).equal(),padding:0}},[`${t}-contain-tabs`]:{[`> div${t}-head`]:{minHeight:0,[`${t}-head-title, ${t}-extra`]:{paddingTop:r}}},[`${t}-type-inner`]:e3(e),[`${t}-loading`]:t3(e),[`${t}-rtl`]:{direction:"rtl"}}},r3=e=>{const{componentCls:t,bodyPaddingSM:n,headerPaddingSM:r,headerHeightSM:i,headerFontSizeSM:o}=e;return{[`${t}-small`]:{[`> ${t}-head`]:{minHeight:i,padding:`0 ${$e(r)}`,fontSize:o,[`> ${t}-head-wrapper`]:{[`> ${t}-extra`]:{fontSize:e.fontSize}}},[`> ${t}-body`]:{padding:n}},[`${t}-small${t}-contain-tabs`]:{[`> ${t}-head`]:{[`${t}-head-title, ${t}-extra`]:{paddingTop:0,display:"flex",alignItems:"center"}}}}},i3=e=>{var t,n;return{headerBg:"transparent",headerFontSize:e.fontSizeLG,headerFontSizeSM:e.fontSize,headerHeight:e.fontSizeLG*e.lineHeightLG+e.padding*2,headerHeightSM:e.fontSize*e.lineHeight+e.paddingXS*2,actionsBg:e.colorBgContainer,actionsLiMargin:`${e.paddingSM}px 0`,tabsMarginBottom:-e.padding-e.lineWidth,extraColor:e.colorText,bodyPaddingSM:12,headerPaddingSM:12,bodyPadding:(t=e.bodyPadding)!==null&&t!==void 0?t:e.paddingLG,headerPadding:(n=e.headerPadding)!==null&&n!==void 0?n:e.paddingLG}},o3=gr("Card",e=>{const t=Sn(e,{cardShadow:e.boxShadowCard,cardHeadPadding:e.padding,cardPaddingBase:e.paddingLG,cardActionsIconSize:e.fontSize});return[n3(t),r3(t)]},i3);var XS=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i{const{actionClasses:t,actions:n=[],actionStyle:r}=e;return C.createElement("ul",{className:t,style:r},n.map((i,o)=>{const l=`action-${o}`;return C.createElement("li",{style:{width:`${100/n.length}%`},key:l},C.createElement("span",null,i))}))},s3=C.forwardRef((e,t)=>{const{prefixCls:n,className:r,rootClassName:i,style:o,extra:l,headStyle:m={},bodyStyle:u={},title:p,loading:s,bordered:c,variant:d,size:h,type:f,cover:v,actions:y,tabList:b,children:w,activeTabKey:x,defaultActiveTabKey:E,tabBarExtraContent:_,hoverable:$,tabProps:O={},classNames:N,styles:k}=e,L=XS(e,["prefixCls","className","rootClassName","style","extra","headStyle","bodyStyle","title","loading","bordered","variant","size","type","cover","actions","tabList","children","activeTabKey","defaultActiveTabKey","tabBarExtraContent","hoverable","tabProps","classNames","styles"]),{getPrefixCls:F,direction:P,card:A}=C.useContext(zt),[M]=vf("card",d,c),R=ze=>{var Ie;(Ie=e.onTabChange)===null||Ie===void 0||Ie.call(e,ze)},I=ze=>{var Ie;return ve((Ie=A==null?void 0:A.classNames)===null||Ie===void 0?void 0:Ie[ze],N==null?void 0:N[ze])},D=ze=>{var Ie;return Object.assign(Object.assign({},(Ie=A==null?void 0:A.styles)===null||Ie===void 0?void 0:Ie[ze]),k==null?void 0:k[ze])},j=C.useMemo(()=>{let ze=!1;return C.Children.forEach(w,Ie=>{(Ie==null?void 0:Ie.type)===HE&&(ze=!0)}),ze},[w]),B=F("card",n),[V,H,Y]=o3(B),U=C.createElement(tl,{loading:!0,active:!0,paragraph:{rows:4},title:!1},w),K=x!==void 0,G=Object.assign(Object.assign({},O),{[K?"activeKey":"defaultActiveKey"]:K?x:E,tabBarExtraContent:_});let q;const Z=to(h),Q=!Z||Z==="default"?"large":Z,J=b?C.createElement(BE,Object.assign({size:Q},G,{className:`${B}-head-tabs`,onChange:R,items:b.map(ze=>{var{tab:Ie}=ze,Ye=XS(ze,["tab"]);return Object.assign({label:Ie},Ye)})})):null;if(p||l||J){const ze=ve(`${B}-head`,I("header")),Ie=ve(`${B}-head-title`,I("title")),Ye=ve(`${B}-extra`,I("extra")),Me=Object.assign(Object.assign({},m),D("header"));q=C.createElement("div",{className:ze,style:Me},C.createElement("div",{className:`${B}-head-wrapper`},p&&C.createElement("div",{className:Ie,style:D("title")},p),l&&C.createElement("div",{className:Ye,style:D("extra")},l)),J)}const ie=ve(`${B}-cover`,I("cover")),se=v?C.createElement("div",{className:ie,style:D("cover")},v):null,ae=ve(`${B}-body`,I("body")),ge=Object.assign(Object.assign({},u),D("body")),me=C.createElement("div",{className:ae,style:ge},s?U:w),de=ve(`${B}-actions`,I("actions")),we=y!=null&&y.length?C.createElement(a3,{actionClasses:de,actionStyle:D("actions"),actions:y}):null,Oe=Er(L,["onTabChange"]),xe=ve(B,A==null?void 0:A.className,{[`${B}-loading`]:s,[`${B}-bordered`]:M!=="borderless",[`${B}-hoverable`]:$,[`${B}-contain-grid`]:j,[`${B}-contain-tabs`]:b==null?void 0:b.length,[`${B}-${Z}`]:Z,[`${B}-type-${f}`]:!!f,[`${B}-rtl`]:P==="rtl"},r,i,H,Y),Pe=Object.assign(Object.assign({},A==null?void 0:A.style),o);return V(C.createElement("div",Object.assign({ref:t},Oe,{className:xe,style:Pe}),q,se,me,we))});var l3=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i{const{prefixCls:t,className:n,avatar:r,title:i,description:o}=e,l=l3(e,["prefixCls","className","avatar","title","description"]),{getPrefixCls:m}=C.useContext(zt),u=m("card",t),p=ve(`${u}-meta`,n),s=r?C.createElement("div",{className:`${u}-meta-avatar`},r):null,c=i?C.createElement("div",{className:`${u}-meta-title`},i):null,d=o?C.createElement("div",{className:`${u}-meta-description`},o):null,h=c||d?C.createElement("div",{className:`${u}-meta-detail`},c,d):null;return C.createElement("div",Object.assign({},l,{className:p}),s,h)},Vv=s3;Vv.Grid=HE;Vv.Meta=c3;const WE=C.createContext({});var u3=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i{const{getPrefixCls:n,direction:r}=C.useContext(zt),{gutter:i,wrap:o}=C.useContext(WE),{prefixCls:l,span:m,order:u,offset:p,push:s,pull:c,className:d,children:h,flex:f,style:v}=e,y=u3(e,["prefixCls","span","order","offset","push","pull","className","children","flex","style"]),b=n("col",l),[w,x,E]=UN(b),_={};let $={};d3.forEach(k=>{let L={};const F=e[k];typeof F=="number"?L.span=F:typeof F=="object"&&(L=F||{}),delete y[k],$=Object.assign(Object.assign({},$),{[`${b}-${k}-${L.span}`]:L.span!==void 0,[`${b}-${k}-order-${L.order}`]:L.order||L.order===0,[`${b}-${k}-offset-${L.offset}`]:L.offset||L.offset===0,[`${b}-${k}-push-${L.push}`]:L.push||L.push===0,[`${b}-${k}-pull-${L.pull}`]:L.pull||L.pull===0,[`${b}-rtl`]:r==="rtl"}),L.flex&&($[`${b}-${k}-flex`]=!0,_[`--${b}-${k}-flex`]=qS(L.flex))});const O=ve(b,{[`${b}-${m}`]:m!==void 0,[`${b}-order-${u}`]:u,[`${b}-offset-${p}`]:p,[`${b}-push-${s}`]:s,[`${b}-pull-${c}`]:c},d,$,x,E),N={};if(i&&i[0]>0){const k=i[0]/2;N.paddingLeft=k,N.paddingRight=k}return f&&(N.flex=qS(f),o===!1&&!N.minWidth&&(N.minWidth=0)),w(C.createElement("div",Object.assign({},y,{style:Object.assign(Object.assign(Object.assign({},N),v),_),className:O,ref:t}),h))});function f3(e,t){const n=[void 0,void 0],r=Array.isArray(e)?e:[e,void 0],i=t||{xs:!0,sm:!0,md:!0,lg:!0,xl:!0,xxl:!0};return r.forEach((o,l)=>{if(typeof o=="object"&&o!==null)for(let m=0;m{if(typeof e=="string"&&r(e),typeof e=="object")for(let o=0;o{i()},[JSON.stringify(e),t]),n}const VE=C.forwardRef((e,t)=>{const{prefixCls:n,justify:r,align:i,className:o,style:l,children:m,gutter:u=0,wrap:p}=e,s=h3(e,["prefixCls","justify","align","className","style","children","gutter","wrap"]),{getPrefixCls:c,direction:d}=C.useContext(zt),h=F4(!0,null),f=QS(i,h),v=QS(r,h),y=c("row",n),[b,w,x]=WN(y),E=f3(u,h),_=ve(y,{[`${y}-no-wrap`]:p===!1,[`${y}-${v}`]:v,[`${y}-${f}`]:f,[`${y}-rtl`]:d==="rtl"},o,w,x),$={},O=E[0]!=null&&E[0]>0?E[0]/-2:void 0;O&&($.marginLeft=O,$.marginRight=O);const[N,k]=E;$.rowGap=k;const L=C.useMemo(()=>({gutter:[N,k],wrap:p}),[N,k,p]);return b(C.createElement(WE.Provider,{value:L},C.createElement("div",Object.assign({},s,{className:_,style:Object.assign(Object.assign({},$),l),ref:t}),m)))});function p3(e){return!!(e.addonBefore||e.addonAfter)}function g3(e){return!!(e.prefix||e.suffix||e.allowClear)}function ZS(e,t,n){var r=t.cloneNode(!0),i=Object.create(e,{target:{value:r},currentTarget:{value:r}});return r.value=n,typeof t.selectionStart=="number"&&typeof t.selectionEnd=="number"&&(r.selectionStart=t.selectionStart,r.selectionEnd=t.selectionEnd),r.setSelectionRange=function(){t.setSelectionRange.apply(t,arguments)},i}function Dd(e,t,n,r){if(n){var i=t;if(t.type==="click"){i=ZS(t,e,""),n(i);return}if(e.type!=="file"&&r!==void 0){i=ZS(t,e,r),n(i);return}n(i)}}function UE(e,t){if(e){e.focus(t);var n=t||{},r=n.cursor;if(r){var i=e.value.length;switch(r){case"start":e.setSelectionRange(0,0);break;case"end":e.setSelectionRange(i,i);break;default:e.setSelectionRange(0,i)}}}}var GE=be.forwardRef(function(e,t){var n,r,i,o=e.inputElement,l=e.children,m=e.prefixCls,u=e.prefix,p=e.suffix,s=e.addonBefore,c=e.addonAfter,d=e.className,h=e.style,f=e.disabled,v=e.readOnly,y=e.focused,b=e.triggerFocus,w=e.allowClear,x=e.value,E=e.handleReset,_=e.hidden,$=e.classes,O=e.classNames,N=e.dataAttrs,k=e.styles,L=e.components,F=e.onClear,P=l??o,A=(L==null?void 0:L.affixWrapper)||"span",M=(L==null?void 0:L.groupWrapper)||"span",R=(L==null?void 0:L.wrapper)||"span",I=(L==null?void 0:L.groupAddon)||"span",D=C.useRef(null),j=function(de){var we;(we=D.current)!==null&&we!==void 0&&we.contains(de.target)&&(b==null||b())},B=g3(e),V=C.cloneElement(P,{value:x,className:ve((n=P.props)===null||n===void 0?void 0:n.className,!B&&(O==null?void 0:O.variant))||null}),H=C.useRef(null);if(be.useImperativeHandle(t,function(){return{nativeElement:H.current||D.current}}),B){var Y=null;if(w){var U=!f&&!v&&x,K="".concat(m,"-clear-icon"),G=wt(w)==="object"&&w!==null&&w!==void 0&&w.clearIcon?w.clearIcon:"✖";Y=be.createElement("button",{type:"button",tabIndex:-1,onClick:function(de){E==null||E(de),F==null||F()},onMouseDown:function(de){return de.preventDefault()},className:ve(K,ne(ne({},"".concat(K,"-hidden"),!U),"".concat(K,"-has-suffix"),!!p))},G)}var q="".concat(m,"-affix-wrapper"),Z=ve(q,ne(ne(ne(ne(ne({},"".concat(m,"-disabled"),f),"".concat(q,"-disabled"),f),"".concat(q,"-focused"),y),"".concat(q,"-readonly"),v),"".concat(q,"-input-with-clear-btn"),p&&w&&x),$==null?void 0:$.affixWrapper,O==null?void 0:O.affixWrapper,O==null?void 0:O.variant),Q=(p||w)&&be.createElement("span",{className:ve("".concat(m,"-suffix"),O==null?void 0:O.suffix),style:k==null?void 0:k.suffix},Y,p);V=be.createElement(A,nt({className:Z,style:k==null?void 0:k.affixWrapper,onClick:j},N==null?void 0:N.affixWrapper,{ref:D}),u&&be.createElement("span",{className:ve("".concat(m,"-prefix"),O==null?void 0:O.prefix),style:k==null?void 0:k.prefix},u),V,Q)}if(p3(e)){var J="".concat(m,"-group"),ie="".concat(J,"-addon"),se="".concat(J,"-wrapper"),ae=ve("".concat(m,"-wrapper"),J,$==null?void 0:$.wrapper,O==null?void 0:O.wrapper),ge=ve(se,ne({},"".concat(se,"-disabled"),f),$==null?void 0:$.group,O==null?void 0:O.groupWrapper);V=be.createElement(M,{className:ge,ref:H},be.createElement(R,{className:ae},s&&be.createElement(I,{className:ie},s),V,c&&be.createElement(I,{className:ie},c)))}return be.cloneElement(V,{className:ve((r=V.props)===null||r===void 0?void 0:r.className,d)||null,style:oe(oe({},(i=V.props)===null||i===void 0?void 0:i.style),h),hidden:_})}),m3=["show"];function KE(e,t){return C.useMemo(function(){var n={};t&&(n.show=wt(t)==="object"&&t.formatter?t.formatter:!!t),n=oe(oe({},n),e);var r=n,i=r.show,o=At(r,m3);return oe(oe({},o),{},{show:!!i,showFormatter:typeof i=="function"?i:void 0,strategy:o.strategy||function(l){return l.length}})},[e,t])}var v3=["autoComplete","onChange","onFocus","onBlur","onPressEnter","onKeyDown","onKeyUp","prefixCls","disabled","htmlSize","className","maxLength","suffix","showCount","count","type","classes","classNames","styles","onCompositionStart","onCompositionEnd"],y3=C.forwardRef(function(e,t){var n=e.autoComplete,r=e.onChange,i=e.onFocus,o=e.onBlur,l=e.onPressEnter,m=e.onKeyDown,u=e.onKeyUp,p=e.prefixCls,s=p===void 0?"rc-input":p,c=e.disabled,d=e.htmlSize,h=e.className,f=e.maxLength,v=e.suffix,y=e.showCount,b=e.count,w=e.type,x=w===void 0?"text":w,E=e.classes,_=e.classNames,$=e.styles,O=e.onCompositionStart,N=e.onCompositionEnd,k=At(e,v3),L=C.useState(!1),F=pe(L,2),P=F[0],A=F[1],M=C.useRef(!1),R=C.useRef(!1),I=C.useRef(null),D=C.useRef(null),j=function(ke){I.current&&UE(I.current,ke)},B=Pr(e.defaultValue,{value:e.value}),V=pe(B,2),H=V[0],Y=V[1],U=H==null?"":String(H),K=C.useState(null),G=pe(K,2),q=G[0],Z=G[1],Q=KE(b,y),J=Q.max||f,ie=Q.strategy(U),se=!!J&&ie>J;C.useImperativeHandle(t,function(){var Me;return{focus:j,blur:function(){var Je;(Je=I.current)===null||Je===void 0||Je.blur()},setSelectionRange:function(Je,ce,Ee){var Re;(Re=I.current)===null||Re===void 0||Re.setSelectionRange(Je,ce,Ee)},select:function(){var Je;(Je=I.current)===null||Je===void 0||Je.select()},input:I.current,nativeElement:((Me=D.current)===null||Me===void 0?void 0:Me.nativeElement)||I.current}}),C.useEffect(function(){R.current&&(R.current=!1),A(function(Me){return Me&&c?!1:Me})},[c]);var ae=function(ke,Je,ce){var Ee=Je;if(!M.current&&Q.exceedFormatter&&Q.max&&Q.strategy(Je)>Q.max){if(Ee=Q.exceedFormatter(Je,{max:Q.max}),Je!==Ee){var Re,Ae;Z([((Re=I.current)===null||Re===void 0?void 0:Re.selectionStart)||0,((Ae=I.current)===null||Ae===void 0?void 0:Ae.selectionEnd)||0])}}else if(ce.source==="compositionEnd")return;Y(Ee),I.current&&Dd(I.current,ke,r,Ee)};C.useEffect(function(){if(q){var Me;(Me=I.current)===null||Me===void 0||Me.setSelectionRange.apply(Me,Ge(q))}},[q]);var ge=function(ke){ae(ke,ke.target.value,{source:"change"})},me=function(ke){M.current=!1,ae(ke,ke.currentTarget.value,{source:"compositionEnd"}),N==null||N(ke)},de=function(ke){l&&ke.key==="Enter"&&!R.current&&(R.current=!0,l(ke)),m==null||m(ke)},we=function(ke){ke.key==="Enter"&&(R.current=!1),u==null||u(ke)},Oe=function(ke){A(!0),i==null||i(ke)},xe=function(ke){R.current&&(R.current=!1),A(!1),o==null||o(ke)},Pe=function(ke){Y(""),j(),I.current&&Dd(I.current,ke,r)},ze=se&&"".concat(s,"-out-of-range"),Ie=function(){var ke=Er(e,["prefixCls","onPressEnter","addonBefore","addonAfter","prefix","suffix","allowClear","defaultValue","showCount","count","classes","htmlSize","styles","classNames","onClear"]);return be.createElement("input",nt({autoComplete:n},ke,{onChange:ge,onFocus:Oe,onBlur:xe,onKeyDown:de,onKeyUp:we,className:ve(s,ne({},"".concat(s,"-disabled"),c),_==null?void 0:_.input),style:$==null?void 0:$.input,ref:I,size:d,type:x,onCompositionStart:function(ce){M.current=!0,O==null||O(ce)},onCompositionEnd:me}))},Ye=function(){var ke=Number(J)>0;if(v||Q.show){var Je=Q.showFormatter?Q.showFormatter({value:U,count:ie,maxLength:J}):"".concat(ie).concat(ke?" / ".concat(J):"");return be.createElement(be.Fragment,null,Q.show&&be.createElement("span",{className:ve("".concat(s,"-show-count-suffix"),ne({},"".concat(s,"-show-count-has-suffix"),!!v),_==null?void 0:_.count),style:oe({},$==null?void 0:$.count)},Je),v)}return null};return be.createElement(GE,nt({},k,{prefixCls:s,className:ve(h,ze),handleReset:Pe,value:U,focused:P,triggerFocus:j,suffix:Ye(),disabled:c,classes:E,classNames:_,styles:$,ref:D}),Ie())});const YE=e=>{let t;return typeof e=="object"&&(e!=null&&e.clearIcon)?t=e:e&&(t={clearIcon:be.createElement(Ac,null)}),t};function XE(e,t){const n=C.useRef([]),r=()=>{n.current.push(setTimeout(()=>{var i,o,l,m;!((i=e.current)===null||i===void 0)&&i.input&&((o=e.current)===null||o===void 0?void 0:o.input.getAttribute("type"))==="password"&&(!((l=e.current)===null||l===void 0)&&l.input.hasAttribute("value"))&&((m=e.current)===null||m===void 0||m.input.removeAttribute("value"))}))};return C.useEffect(()=>(t&&r(),()=>n.current.forEach(i=>{i&&clearTimeout(i)})),[]),r}function b3(e){return!!(e.prefix||e.suffix||e.allowClear||e.showCount)}var w3=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i{const{prefixCls:n,bordered:r=!0,status:i,size:o,disabled:l,onBlur:m,onFocus:u,suffix:p,allowClear:s,addonAfter:c,addonBefore:d,className:h,style:f,styles:v,rootClassName:y,onChange:b,classNames:w,variant:x}=e,E=w3(e,["prefixCls","bordered","status","size","disabled","onBlur","onFocus","suffix","allowClear","addonAfter","addonBefore","className","style","styles","rootClassName","onChange","classNames","variant"]),{getPrefixCls:_,direction:$,allowClear:O,autoComplete:N,className:k,style:L,classNames:F,styles:P}=Ji("input"),A=_("input",n),M=C.useRef(null),R=eo(A),[I,D,j]=kE(A,y),[B]=NE(A,R),{compactSize:V,compactItemClassnames:H}=Lc(A,$),Y=to(xe=>{var Pe;return(Pe=o??V)!==null&&Pe!==void 0?Pe:xe}),U=be.useContext(Ro),K=l??U,{status:G,hasFeedback:q,feedbackIcon:Z}=C.useContext(bi),Q=mf(G,i),J=b3(e)||!!q;C.useRef(J);const ie=XE(M,!0),se=xe=>{ie(),m==null||m(xe)},ae=xe=>{ie(),u==null||u(xe)},ge=xe=>{ie(),b==null||b(xe)},me=(q||p)&&be.createElement(be.Fragment,null,p,q&&Z),de=YE(s??O),[we,Oe]=vf("input",x,r);return I(B(be.createElement(y3,Object.assign({ref:wi(t,M),prefixCls:A,autoComplete:N},E,{disabled:K,onBlur:se,onFocus:ae,style:Object.assign(Object.assign({},L),f),styles:Object.assign(Object.assign({},P),v),suffix:me,allowClear:de,className:ve(h,y,j,R,H,k),onChange:ge,addonBefore:d&&be.createElement(bm,{form:!0,space:!0},d),addonAfter:c&&be.createElement(bm,{form:!0,space:!0},c),classNames:Object.assign(Object.assign(Object.assign({},w),F),{input:ve({[`${A}-sm`]:Y==="small",[`${A}-lg`]:Y==="large",[`${A}-rtl`]:$==="rtl"},w==null?void 0:w.input,F.input,D),variant:ve({[`${A}-${we}`]:Oe},kd(A,Q)),affixWrapper:ve({[`${A}-affix-wrapper-sm`]:Y==="small",[`${A}-affix-wrapper-lg`]:Y==="large",[`${A}-affix-wrapper-rtl`]:$==="rtl"},D),wrapper:ve({[`${A}-group-rtl`]:$==="rtl"},D),groupWrapper:ve({[`${A}-group-wrapper-sm`]:Y==="small",[`${A}-group-wrapper-lg`]:Y==="large",[`${A}-group-wrapper-rtl`]:$==="rtl",[`${A}-group-wrapper-${we}`]:Oe},kd(`${A}-group-wrapper`,Q,q),D)})}))))});function JS(e){return["small","middle","large"].includes(e)}function eC(e){return e?typeof e=="number"&&!Number.isNaN(e):!1}const qE=be.createContext({latestIndex:0}),S3=qE.Provider,C3=({className:e,index:t,children:n,split:r,style:i})=>{const{latestIndex:o}=C.useContext(qE);return n==null?null:C.createElement(C.Fragment,null,C.createElement("div",{className:e,style:i},n),t{var n;const{getPrefixCls:r,direction:i,size:o,className:l,style:m,classNames:u,styles:p}=Ji("space"),{size:s=o??"small",align:c,className:d,rootClassName:h,children:f,direction:v="horizontal",prefixCls:y,split:b,style:w,wrap:x=!1,classNames:E,styles:_}=e,$=$3(e,["size","align","className","rootClassName","children","direction","prefixCls","split","style","wrap","classNames","styles"]),[O,N]=Array.isArray(s)?s:[s,s],k=JS(N),L=JS(O),F=eC(N),P=eC(O),A=li(f,{keepEmpty:!0}),M=c===void 0&&v==="horizontal"?"center":c,R=r("space",y),[I,D,j]=lx(R),B=ve(R,l,D,`${R}-${v}`,{[`${R}-rtl`]:i==="rtl",[`${R}-align-${M}`]:M,[`${R}-gap-row-${N}`]:k,[`${R}-gap-col-${O}`]:L},d,h,j),V=ve(`${R}-item`,(n=E==null?void 0:E.item)!==null&&n!==void 0?n:u.item);let H=0;const Y=A.map((G,q)=>{var Z;G!=null&&(H=q);const Q=(G==null?void 0:G.key)||`${V}-${q}`;return C.createElement(C3,{className:V,key:Q,index:q,split:b,style:(Z=_==null?void 0:_.item)!==null&&Z!==void 0?Z:p.item},G)}),U=C.useMemo(()=>({latestIndex:H}),[H]);if(A.length===0)return null;const K={};return x&&(K.flexWrap="wrap"),!L&&P&&(K.columnGap=O),!k&&F&&(K.rowGap=N),I(C.createElement("div",Object.assign({ref:t,className:B,style:Object.assign(Object.assign(Object.assign({},K),m),w)},$),C.createElement(S3,{value:U},Y)))}),Im=x3;Im.Compact=P2;function E3(e){return e==null?null:typeof e=="object"&&!C.isValidElement(e)?e:{title:e}}var _3={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494zM504 618H320c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zM312 490v48c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H320c-4.4 0-8 3.6-8 8z"}}]},name:"file-text",theme:"outlined"};function Fd(e){const[t,n]=C.useState(e);return C.useEffect(()=>{const r=setTimeout(()=>{n(e)},e.length?0:10);return()=>{clearTimeout(r)}},[e]),t}const M3=e=>{const{componentCls:t}=e,n=`${t}-show-help`,r=`${t}-show-help-item`;return{[n]:{transition:`opacity ${e.motionDurationFast} ${e.motionEaseInOut}`,"&-appear, &-enter":{opacity:0,"&-active":{opacity:1}},"&-leave":{opacity:1,"&-active":{opacity:0}},[r]:{overflow:"hidden",transition:`height ${e.motionDurationFast} ${e.motionEaseInOut}, + opacity ${e.motionDurationFast} ${e.motionEaseInOut}, + transform ${e.motionDurationFast} ${e.motionEaseInOut} !important`,[`&${r}-appear, &${r}-enter`]:{transform:"translateY(-5px)",opacity:0,"&-active":{transform:"translateY(0)",opacity:1}},[`&${r}-leave-active`]:{transform:"translateY(-5px)"}}}}},R3=e=>({legend:{display:"block",width:"100%",marginBottom:e.marginLG,padding:0,color:e.colorTextDescription,fontSize:e.fontSizeLG,lineHeight:"inherit",border:0,borderBottom:`${$e(e.lineWidth)} ${e.lineType} ${e.colorBorder}`},'input[type="search"]':{boxSizing:"border-box"},'input[type="radio"], input[type="checkbox"]':{lineHeight:"normal"},'input[type="file"]':{display:"block"},'input[type="range"]':{display:"block",width:"100%"},"select[multiple], select[size]":{height:"auto"},"input[type='file']:focus,\n input[type='radio']:focus,\n input[type='checkbox']:focus":{outline:0,boxShadow:`0 0 0 ${$e(e.controlOutlineWidth)} ${e.controlOutline}`},output:{display:"block",paddingTop:15,color:e.colorText,fontSize:e.fontSize,lineHeight:e.lineHeight}}),tC=(e,t)=>{const{formItemCls:n}=e;return{[n]:{[`${n}-label > label`]:{height:t},[`${n}-control-input`]:{minHeight:t}}}},O3=e=>{const{componentCls:t}=e;return{[e.componentCls]:Object.assign(Object.assign(Object.assign({},ci(e)),R3(e)),{[`${t}-text`]:{display:"inline-block",paddingInlineEnd:e.paddingSM},"&-small":Object.assign({},tC(e,e.controlHeightSM)),"&-large":Object.assign({},tC(e,e.controlHeightLG))})}},A3=e=>{const{formItemCls:t,iconCls:n,rootPrefixCls:r,antCls:i,labelRequiredMarkColor:o,labelColor:l,labelFontSize:m,labelHeight:u,labelColonMarginInlineStart:p,labelColonMarginInlineEnd:s,itemMarginBottom:c}=e;return{[t]:Object.assign(Object.assign({},ci(e)),{marginBottom:c,verticalAlign:"top","&-with-help":{transition:"none"},[`&-hidden, + &-hidden${i}-row`]:{display:"none"},"&-has-warning":{[`${t}-split`]:{color:e.colorError}},"&-has-error":{[`${t}-split`]:{color:e.colorWarning}},[`${t}-label`]:{flexGrow:0,overflow:"hidden",whiteSpace:"nowrap",textAlign:"end",verticalAlign:"middle","&-left":{textAlign:"start"},"&-wrap":{overflow:"unset",lineHeight:e.lineHeight,whiteSpace:"unset","> label":{verticalAlign:"middle",textWrap:"balance"}},"> label":{position:"relative",display:"inline-flex",alignItems:"center",maxWidth:"100%",height:u,color:l,fontSize:m,[`> ${n}`]:{fontSize:e.fontSize,verticalAlign:"top"},[`&${t}-required`]:{"&::before":{display:"inline-block",marginInlineEnd:e.marginXXS,color:o,fontSize:e.fontSize,fontFamily:"SimSun, sans-serif",lineHeight:1,content:'"*"'},[`&${t}-required-mark-hidden, &${t}-required-mark-optional`]:{"&::before":{display:"none"}}},[`${t}-optional`]:{display:"inline-block",marginInlineStart:e.marginXXS,color:e.colorTextDescription,[`&${t}-required-mark-hidden`]:{display:"none"}},[`${t}-tooltip`]:{color:e.colorTextDescription,cursor:"help",writingMode:"horizontal-tb",marginInlineStart:e.marginXXS},"&::after":{content:'":"',position:"relative",marginBlock:0,marginInlineStart:p,marginInlineEnd:s},[`&${t}-no-colon::after`]:{content:'"\\a0"'}}},[`${t}-control`]:{"--ant-display":"flex",flexDirection:"column",flexGrow:1,[`&:first-child:not([class^="'${r}-col-'"]):not([class*="' ${r}-col-'"])`]:{width:"100%"},"&-input":{position:"relative",display:"flex",alignItems:"center",minHeight:e.controlHeight,"&-content":{flex:"auto",maxWidth:"100%"}}},[t]:{"&-additional":{display:"flex",flexDirection:"column"},"&-explain, &-extra":{clear:"both",color:e.colorTextDescription,fontSize:e.fontSize,lineHeight:e.lineHeight},"&-explain-connected":{width:"100%"},"&-extra":{minHeight:e.controlHeightSM,transition:`color ${e.motionDurationMid} ${e.motionEaseOut}`},"&-explain":{"&-error":{color:e.colorError},"&-warning":{color:e.colorWarning}}},[`&-with-help ${t}-explain`]:{height:"auto",opacity:1},[`${t}-feedback-icon`]:{fontSize:e.fontSize,textAlign:"center",visibility:"visible",animationName:$v,animationDuration:e.motionDurationMid,animationTimingFunction:e.motionEaseOutBack,pointerEvents:"none","&-success":{color:e.colorSuccess},"&-error":{color:e.colorError},"&-warning":{color:e.colorWarning},"&-validating":{color:e.colorPrimary}}})}},nC=(e,t)=>{const{formItemCls:n}=e;return{[`${t}-horizontal`]:{[`${n}-label`]:{flexGrow:0},[`${n}-control`]:{flex:"1 1 0",minWidth:0},[`${n}-label[class$='-24'], ${n}-label[class*='-24 ']`]:{[`& + ${n}-control`]:{minWidth:"unset"}}}}},T3=e=>{const{componentCls:t,formItemCls:n,inlineItemMarginBottom:r}=e;return{[`${t}-inline`]:{display:"flex",flexWrap:"wrap",[n]:{flex:"none",marginInlineEnd:e.margin,marginBottom:r,"&-row":{flexWrap:"nowrap"},[`> ${n}-label, + > ${n}-control`]:{display:"inline-block",verticalAlign:"top"},[`> ${n}-label`]:{flex:"none"},[`${t}-text`]:{display:"inline-block"},[`${n}-has-feedback`]:{display:"inline-block"}}}}},Yi=e=>({padding:e.verticalLabelPadding,margin:e.verticalLabelMargin,whiteSpace:"initial",textAlign:"start","> label":{margin:0,"&::after":{visibility:"hidden"}}}),QE=e=>{const{componentCls:t,formItemCls:n,rootPrefixCls:r}=e;return{[`${n} ${n}-label`]:Yi(e),[`${t}:not(${t}-inline)`]:{[n]:{flexWrap:"wrap",[`${n}-label, ${n}-control`]:{[`&:not([class*=" ${r}-col-xs"])`]:{flex:"0 0 100%",maxWidth:"100%"}}}}}},I3=e=>{const{componentCls:t,formItemCls:n,antCls:r}=e;return{[`${t}-vertical`]:{[`${n}:not(${n}-horizontal)`]:{[`${n}-row`]:{flexDirection:"column"},[`${n}-label > label`]:{height:"auto"},[`${n}-control`]:{width:"100%"},[`${n}-label, + ${r}-col-24${n}-label, + ${r}-col-xl-24${n}-label`]:Yi(e)}},[`@media (max-width: ${$e(e.screenXSMax)})`]:[QE(e),{[t]:{[`${n}:not(${n}-horizontal)`]:{[`${r}-col-xs-24${n}-label`]:Yi(e)}}}],[`@media (max-width: ${$e(e.screenSMMax)})`]:{[t]:{[`${n}:not(${n}-horizontal)`]:{[`${r}-col-sm-24${n}-label`]:Yi(e)}}},[`@media (max-width: ${$e(e.screenMDMax)})`]:{[t]:{[`${n}:not(${n}-horizontal)`]:{[`${r}-col-md-24${n}-label`]:Yi(e)}}},[`@media (max-width: ${$e(e.screenLGMax)})`]:{[t]:{[`${n}:not(${n}-horizontal)`]:{[`${r}-col-lg-24${n}-label`]:Yi(e)}}}}},L3=e=>{const{formItemCls:t,antCls:n}=e;return{[`${t}-vertical`]:{[`${t}-row`]:{flexDirection:"column"},[`${t}-label > label`]:{height:"auto"},[`${t}-control`]:{width:"100%"}},[`${t}-vertical ${t}-label, + ${n}-col-24${t}-label, + ${n}-col-xl-24${t}-label`]:Yi(e),[`@media (max-width: ${$e(e.screenXSMax)})`]:[QE(e),{[t]:{[`${n}-col-xs-24${t}-label`]:Yi(e)}}],[`@media (max-width: ${$e(e.screenSMMax)})`]:{[t]:{[`${n}-col-sm-24${t}-label`]:Yi(e)}},[`@media (max-width: ${$e(e.screenMDMax)})`]:{[t]:{[`${n}-col-md-24${t}-label`]:Yi(e)}},[`@media (max-width: ${$e(e.screenLGMax)})`]:{[t]:{[`${n}-col-lg-24${t}-label`]:Yi(e)}}}},P3=e=>({labelRequiredMarkColor:e.colorError,labelColor:e.colorTextHeading,labelFontSize:e.fontSize,labelHeight:e.controlHeight,labelColonMarginInlineStart:e.marginXXS/2,labelColonMarginInlineEnd:e.marginXS,itemMarginBottom:e.marginLG,verticalLabelPadding:`0 0 ${e.paddingXS}px`,verticalLabelMargin:0,inlineItemMarginBottom:0}),ZE=(e,t)=>Sn(e,{formItemCls:`${e.componentCls}-item`,rootPrefixCls:t}),Uv=gr("Form",(e,{rootPrefixCls:t})=>{const n=ZE(e,t);return[O3(n),A3(n),M3(n),nC(n,n.componentCls),nC(n,n.formItemCls),T3(n),I3(n),L3(n),gx(n),$v]},P3,{order:-1e3}),rC=[];function Up(e,t,n,r=0){return{key:typeof e=="string"?e:`${t}-${r}`,error:e,errorStatus:n}}const JE=({help:e,helpStatus:t,errors:n=rC,warnings:r=rC,className:i,fieldId:o,onVisibleChanged:l})=>{const{prefixCls:m}=C.useContext(Ov),u=`${m}-item-explain`,p=eo(m),[s,c,d]=Uv(m,p),h=C.useMemo(()=>am(m),[m]),f=Fd(n),v=Fd(r),y=C.useMemo(()=>e!=null?[Up(e,"help",t)]:[].concat(Ge(f.map((x,E)=>Up(x,"error","error",E))),Ge(v.map((x,E)=>Up(x,"warning","warning",E)))),[e,t,f,v]),b=C.useMemo(()=>{const x={};return y.forEach(({key:E})=>{x[E]=(x[E]||0)+1}),y.map((E,_)=>Object.assign(Object.assign({},E),{key:x[E.key]>1?`${E.key}-fallback-${_}`:E.key}))},[y]),w={};return o&&(w.id=`${o}_help`),s(C.createElement(Lo,{motionDeadline:h.motionDeadline,motionName:`${m}-show-help`,visible:!!b.length,onVisibleChanged:l},x=>{const{className:E,style:_}=x;return C.createElement("div",Object.assign({},w,{className:ve(u,E,d,p,i,c),style:_}),C.createElement(z$,Object.assign({keys:b},am(m),{motionName:`${m}-show-help-item`,component:!1}),$=>{const{key:O,error:N,errorStatus:k,className:L,style:F}=$;return C.createElement("div",{key:O,className:ve(L,{[`${u}-${k}`]:k}),style:F},N)}))}))},k3=["parentNode"],N3="form_item";function Zl(e){return e===void 0||e===!1?[]:Array.isArray(e)?e:[e]}function e_(e,t){if(!e.length)return;const n=e.join("_");return t?`${t}_${n}`:k3.includes(n)?`${N3}_${n}`:n}function t_(e,t,n,r,i,o){let l=r;return o!==void 0?l=o:n.validating?l="validating":e.length?l="error":t.length?l="warning":(n.touched||i&&n.validated)&&(l="success"),l}var D3=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);ie??Object.assign(Object.assign({},t),{__INTERNAL__:{itemRef:i=>o=>{const l=iC(i);o?n.current[l]=o:delete n.current[l]}},scrollToField:(i,o={})=>{const{focus:l}=o,m=D3(o,["focus"]),u=oC(i,r);u&&(zL(u,Object.assign({scrollMode:"if-needed",block:"nearest"},m)),l&&r.focusField(i))},focusField:i=>{var o,l;const m=r.getFieldInstance(i);typeof(m==null?void 0:m.focus)=="function"?m.focus():(l=(o=oC(i,r))===null||o===void 0?void 0:o.focus)===null||l===void 0||l.call(o)},getFieldInstance:i=>{const o=iC(i);return n.current[o]}}),[e,t]);return[r]}var F3=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i{const n=C.useContext(Ro),{getPrefixCls:r,direction:i,requiredMark:o,colon:l,scrollToFirstError:m,className:u,style:p}=Ji("form"),{prefixCls:s,className:c,rootClassName:d,size:h,disabled:f=n,form:v,colon:y,labelAlign:b,labelWrap:w,labelCol:x,wrapperCol:E,hideRequiredMark:_,layout:$="horizontal",scrollToFirstError:O,requiredMark:N,onFinishFailed:k,name:L,style:F,feedbackIcons:P,variant:A}=e,M=F3(e,["prefixCls","className","rootClassName","size","disabled","form","colon","labelAlign","labelWrap","labelCol","wrapperCol","hideRequiredMark","layout","scrollToFirstError","requiredMark","onFinishFailed","name","style","feedbackIcons","variant"]),R=to(h),I=C.useContext(f$),D=C.useMemo(()=>N!==void 0?N:_?!1:o!==void 0?o:!0,[_,N,o]),j=y??l,B=r("form",s),V=eo(B),[H,Y,U]=Uv(B,V),K=ve(B,`${B}-${$}`,{[`${B}-hide-required-mark`]:D===!1,[`${B}-rtl`]:i==="rtl",[`${B}-${R}`]:R},U,V,Y,u,c,d),[G]=n_(v),{__INTERNAL__:q}=G;q.name=L;const Z=C.useMemo(()=>({name:L,labelAlign:b,labelCol:x,labelWrap:w,wrapperCol:E,vertical:$==="vertical",colon:j,requiredMark:D,itemRef:q.itemRef,form:G,feedbackIcons:P}),[L,b,x,E,$,j,D,G,P]),Q=C.useRef(null);C.useImperativeHandle(t,()=>{var se;return Object.assign(Object.assign({},G),{nativeElement:(se=Q.current)===null||se===void 0?void 0:se.nativeElement})});const J=(se,ae)=>{if(se){let ge={block:"nearest"};typeof se=="object"&&(ge=Object.assign(Object.assign({},ge),se)),G.scrollToField(ae,ge)}},ie=se=>{if(k==null||k(se),se.errorFields.length){const ae=se.errorFields[0].name;if(O!==void 0){J(O,ae);return}m!==void 0&&J(m,ae)}};return H(C.createElement(Nx.Provider,{value:A},C.createElement(w$,{disabled:f},C.createElement(ja.Provider,{value:R},C.createElement(kx,{validateMessages:I},C.createElement(Ao.Provider,{value:Z},C.createElement(Js,Object.assign({id:L},M,{name:L,onFinishFailed:ie,form:G,ref:Q,style:Object.assign(Object.assign({},p),F),className:K}))))))))},j3=C.forwardRef(z3);function B3(e){if(typeof e=="function")return e;const t=li(e);return t.length<=1?t[0]:t}const r_=()=>{const{status:e,errors:t=[],warnings:n=[]}=C.useContext(bi);return{status:e,errors:t,warnings:n}};r_.Context=bi;function H3(e){const[t,n]=C.useState(e),r=C.useRef(null),i=C.useRef([]),o=C.useRef(!1);C.useEffect(()=>(o.current=!1,()=>{o.current=!0,gn.cancel(r.current),r.current=null}),[]);function l(m){o.current||(r.current===null&&(i.current=[],r.current=gn(()=>{r.current=null,n(u=>{let p=u;return i.current.forEach(s=>{p=s(p)}),p})})),i.current.push(m))}return[t,l]}function W3(){const{itemRef:e}=C.useContext(Ao),t=C.useRef({});function n(r,i){const o=i&&typeof i=="object"&&Ka(i),l=r.join("_");return(t.current.name!==l||t.current.originRef!==o)&&(t.current.name=l,t.current.originRef=o,t.current.ref=wi(e(r),o)),t.current.ref}return n}const V3=e=>{const{formItemCls:t}=e;return{"@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none)":{[`${t}-control`]:{display:"flex"}}}},U3=hv(["Form","item-item"],(e,{rootPrefixCls:t})=>{const n=ZE(e,t);return[V3(n)]});var G3=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i{const{prefixCls:t,status:n,labelCol:r,wrapperCol:i,children:o,errors:l,warnings:m,_internalItemRender:u,extra:p,help:s,fieldId:c,marginBottom:d,onErrorVisibleChanged:h,label:f}=e,v=`${t}-item`,y=C.useContext(Ao),b=C.useMemo(()=>{let M=Object.assign({},i||y.wrapperCol||{});return f===null&&!r&&!i&&y.labelCol&&[void 0,"xs","sm","md","lg","xl","xxl"].forEach(I=>{const D=I?[I]:[],j=Pi(y.labelCol,D),B=typeof j=="object"?j:{},V=Pi(M,D),H=typeof V=="object"?V:{};"span"in B&&!("offset"in H)&&B.span{const{labelCol:M,wrapperCol:R}=y;return G3(y,["labelCol","wrapperCol"])},[y]),E=C.useRef(null),[_,$]=C.useState(0);fn(()=>{p&&E.current?$(E.current.clientHeight):$(0)},[p]);const O=C.createElement("div",{className:`${v}-control-input`},C.createElement("div",{className:`${v}-control-input-content`},o)),N=C.useMemo(()=>({prefixCls:t,status:n}),[t,n]),k=d!==null||l.length||m.length?C.createElement(Ov.Provider,{value:N},C.createElement(JE,{fieldId:c,errors:l,warnings:m,help:s,helpStatus:n,className:`${v}-explain-connected`,onVisibleChanged:h})):null,L={};c&&(L.id=`${c}_extra`);const F=p?C.createElement("div",Object.assign({},L,{className:`${v}-extra`,ref:E}),p):null,P=k||F?C.createElement("div",{className:`${v}-additional`,style:d?{minHeight:d+_}:{}},k,F):null,A=u&&u.mark==="pro_table_render"&&u.render?u.render(e,{input:O,errorList:k,extra:F}):C.createElement(C.Fragment,null,O,P);return C.createElement(Ao.Provider,{value:x},C.createElement(Ta,Object.assign({},b,{className:w}),A),C.createElement(U3,{prefixCls:t}))};var X3={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M623.6 316.7C593.6 290.4 554 276 512 276s-81.6 14.5-111.6 40.7C369.2 344 352 380.7 352 420v7.6c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V420c0-44.1 43.1-80 96-80s96 35.9 96 80c0 31.1-22 59.6-56.1 72.7-21.2 8.1-39.2 22.3-52.1 40.9-13.1 19-19.9 41.8-19.9 64.9V620c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8v-22.7a48.3 48.3 0 0130.9-44.8c59-22.7 97.1-74.7 97.1-132.5.1-39.3-17.1-76-48.3-103.3zM472 732a40 40 0 1080 0 40 40 0 10-80 0z"}}]},name:"question-circle",theme:"outlined"},q3=function(t,n){return C.createElement(rr,nt({},t,{ref:n,icon:X3}))},Q3=C.forwardRef(q3),Z3=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i{var s;const[c]=Mc("Form"),{labelAlign:d,labelCol:h,labelWrap:f,colon:v}=C.useContext(Ao);if(!t)return null;const y=r||h||{},b=i||d,w=`${e}-item-label`,x=ve(w,b==="left"&&`${w}-left`,y.className,{[`${w}-wrap`]:!!f});let E=t;const _=o===!0||v!==!1&&o!==!1;_&&!p&&typeof t=="string"&&t.trim()&&(E=t.replace(/[:|:]\s*$/,""));const O=E3(u);if(O){const{icon:A=C.createElement(Q3,null)}=O,M=Z3(O,["icon"]),R=C.createElement(nl,Object.assign({},M),C.cloneElement(A,{className:`${e}-item-tooltip`,title:"",onClick:I=>{I.preventDefault()},tabIndex:null}));E=C.createElement(C.Fragment,null,E,R)}const N=m==="optional",k=typeof m=="function",L=m===!1;k?E=m(E,{required:!!l}):N&&!l&&(E=C.createElement(C.Fragment,null,E,C.createElement("span",{className:`${e}-item-optional`,title:""},(c==null?void 0:c.optional)||((s=za.Form)===null||s===void 0?void 0:s.optional))));let F;L?F="hidden":(N||k)&&(F="optional");const P=ve({[`${e}-item-required`]:l,[`${e}-item-required-mark-${F}`]:F,[`${e}-item-no-colon`]:!_});return C.createElement(Ta,Object.assign({},y,{className:x}),C.createElement("label",{htmlFor:n,className:P,title:typeof t=="string"?t:""},E))},eB={success:gv,warning:mv,error:Ac,validating:Tc};function i_({children:e,errors:t,warnings:n,hasFeedback:r,validateStatus:i,prefixCls:o,meta:l,noStyle:m}){const u=`${o}-item`,{feedbackIcons:p}=C.useContext(Ao),s=t_(t,n,l,null,!!r,i),{isFormItemInput:c,status:d,hasFeedback:h,feedbackIcon:f}=C.useContext(bi),v=C.useMemo(()=>{var y;let b;if(r){const x=r!==!0&&r.icons||p,E=s&&((y=x==null?void 0:x({status:s,errors:t,warnings:n}))===null||y===void 0?void 0:y[s]),_=s&&eB[s];b=E!==!1&&_?C.createElement("span",{className:ve(`${u}-feedback-icon`,`${u}-feedback-icon-${s}`)},E||C.createElement(_,null)):null}const w={status:s||"",errors:t,warnings:n,hasFeedback:!!r,feedbackIcon:b,isFormItemInput:!0};return m&&(w.status=(s??d)||"",w.isFormItemInput=c,w.hasFeedback=!!(r??h),w.feedbackIcon=r!==void 0?w.feedbackIcon:f),w},[s,r,m,c,d]);return C.createElement(bi.Provider,{value:v},e)}var tB=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i{if(F&&O.current){const B=getComputedStyle(O.current);M(parseInt(B.marginBottom,10))}},[F,P]);const R=B=>{B||M(null)},D=((B=!1)=>{const V=B?N:p.errors,H=B?k:p.warnings;return t_(V,H,p,"",!!s,u)})(),j=ve(x,n,r,{[`${x}-with-help`]:L||N.length||k.length,[`${x}-has-feedback`]:D&&s,[`${x}-has-success`]:D==="success",[`${x}-has-warning`]:D==="warning",[`${x}-has-error`]:D==="error",[`${x}-is-validating`]:D==="validating",[`${x}-hidden`]:c,[`${x}-${b}`]:b});return C.createElement("div",{className:j,style:i,ref:O},C.createElement(VE,Object.assign({className:`${x}-row`},Er(w,["_internalItemRender","colon","dependencies","extra","fieldKey","getValueFromEvent","getValueProps","htmlFor","id","initialValue","isListField","label","labelAlign","labelCol","labelWrap","messageVariables","name","normalize","noStyle","preserve","requiredMark","rules","shouldUpdate","trigger","tooltip","validateFirst","validateTrigger","valuePropName","wrapperCol","validateDebounce"])),C.createElement(J3,Object.assign({htmlFor:h},e,{requiredMark:E,required:f??v,prefixCls:t,vertical:$})),C.createElement(Y3,Object.assign({},e,p,{errors:N,warnings:k,prefixCls:t,status:D,help:o,marginBottom:A,onErrorVisibleChanged:R}),C.createElement(Px.Provider,{value:y},C.createElement(i_,{prefixCls:t,meta:p,errors:p.errors,warnings:p.warnings,hasFeedback:s,validateStatus:D},d)))),!!A&&C.createElement("div",{className:`${x}-margin-offset`,style:{marginBottom:-A}}))}const rB="__SPLIT__";function iB(e,t){const n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(i=>{const o=e[i],l=t[i];return o===l||typeof o=="function"||typeof l=="function"})}const oB=C.memo(({children:e})=>e,(e,t)=>iB(e.control,t.control)&&e.update===t.update&&e.childProps.length===t.childProps.length&&e.childProps.every((n,r)=>n===t.childProps[r]));function aC(){return{errors:[],warnings:[],touched:!1,validating:!1,name:[],validated:!1}}function aB(e){const{name:t,noStyle:n,className:r,dependencies:i,prefixCls:o,shouldUpdate:l,rules:m,children:u,required:p,label:s,messageVariables:c,trigger:d="onChange",validateTrigger:h,hidden:f,help:v,layout:y}=e,{getPrefixCls:b}=C.useContext(zt),{name:w}=C.useContext(Ao),x=B3(u),E=typeof x=="function",_=C.useContext(Px),{validateTrigger:$}=C.useContext(Va),O=h!==void 0?h:$,N=t!=null,k=b("form",o),L=eo(k),[F,P,A]=Uv(k,L);_c();const M=C.useContext(pc),R=C.useRef(null),[I,D]=H3({}),[j,B]=Ks(()=>aC()),V=Z=>{const Q=M==null?void 0:M.getKey(Z.name);if(B(Z.destroy?aC():Z,!0),n&&v!==!1&&_){let J=Z.name;if(Z.destroy)J=R.current||J;else if(Q!==void 0){const[ie,se]=Q;J=[ie].concat(Ge(se)),R.current=J}_(Z,J)}},H=(Z,Q)=>{D(J=>{const ie=Object.assign({},J),ae=[].concat(Ge(Z.name.slice(0,-1)),Ge(Q)).join(rB);return Z.destroy?delete ie[ae]:ie[ae]=Z,ie})},[Y,U]=C.useMemo(()=>{const Z=Ge(j.errors),Q=Ge(j.warnings);return Object.values(I).forEach(J=>{Z.push.apply(Z,Ge(J.errors||[])),Q.push.apply(Q,Ge(J.warnings||[]))}),[Z,Q]},[I,j.errors,j.warnings]),K=W3();function G(Z,Q,J){return n&&!f?C.createElement(i_,{prefixCls:k,hasFeedback:e.hasFeedback,validateStatus:e.validateStatus,meta:j,errors:Y,warnings:U,noStyle:!0},Z):C.createElement(nB,Object.assign({key:"row"},e,{className:ve(r,A,L,P),prefixCls:k,fieldId:Q,isRequired:J,errors:Y,warnings:U,meta:j,onSubItemMetaChange:H,layout:y}),Z)}if(!N&&!E&&!i)return F(G(x));let q={};return typeof s=="string"?q.label=s:t&&(q.label=String(t)),c&&(q=Object.assign(Object.assign({},q),c)),F(C.createElement(Mv,Object.assign({},e,{messageVariables:q,trigger:d,validateTrigger:O,onMetaChange:V}),(Z,Q,J)=>{const ie=Zl(t).length&&Q?Q.name:[],se=e_(ie,w),ae=p!==void 0?p:!!(m!=null&&m.some(de=>{if(de&&typeof de=="object"&&de.required&&!de.warningOnly)return!0;if(typeof de=="function"){const we=de(J);return(we==null?void 0:we.required)&&!(we!=null&&we.warningOnly)}return!1})),ge=Object.assign({},Z);let me=null;if(Array.isArray(x)&&N)me=x;else if(!(E&&(!(l||i)||N))){if(!(i&&!E&&!N))if(C.isValidElement(x)){const de=Object.assign(Object.assign({},x.props),ge);if(de.id||(de.id=se),v||Y.length>0||U.length>0||e.extra){const xe=[];(v||Y.length>0)&&xe.push(`${se}_help`),e.extra&&xe.push(`${se}_extra`),de["aria-describedby"]=xe.join(" ")}Y.length>0&&(de["aria-invalid"]="true"),ae&&(de["aria-required"]="true"),fa(x)&&(de.ref=K(ie,x)),new Set([].concat(Ge(Zl(d)),Ge(Zl(O)))).forEach(xe=>{de[xe]=(...Pe)=>{var ze,Ie,Ye,Me,ke;(Ye=ge[xe])===null||Ye===void 0||(ze=Ye).call.apply(ze,[ge].concat(Pe)),(ke=(Me=x.props)[xe])===null||ke===void 0||(Ie=ke).call.apply(Ie,[Me].concat(Pe))}});const Oe=[de["aria-required"],de["aria-invalid"],de["aria-describedby"]];me=C.createElement(oB,{control:ge,update:x,childProps:Oe},Oo(x,de))}else E&&(l||i)&&!N?me=x(J):me=x}return G(me,se,ae)}))}const o_=aB;o_.useStatus=r_;var sB=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i{var{prefixCls:t,children:n}=e,r=sB(e,["prefixCls","children"]);const{getPrefixCls:i}=C.useContext(zt),o=i("form",t),l=C.useMemo(()=>({prefixCls:o,status:"error"}),[o]);return C.createElement(Ax,Object.assign({},r),(m,u,p)=>C.createElement(Ov.Provider,{value:l},n(m.map(s=>Object.assign(Object.assign({},s),{fieldKey:s.key})),u,{errors:p.errors,warnings:p.warnings})))};function cB(){const{form:e}=C.useContext(Ao);return e}const Xr=j3;Xr.Item=o_;Xr.List=lB;Xr.ErrorList=JE;Xr.useForm=n_;Xr.useFormInstance=cB;Xr.useWatch=Lx;Xr.Provider=kx;Xr.create=()=>{};var uB={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M942.2 486.2C847.4 286.5 704.1 186 512 186c-192.2 0-335.4 100.5-430.2 300.3a60.3 60.3 0 000 51.5C176.6 737.5 319.9 838 512 838c192.2 0 335.4-100.5 430.2-300.3 7.7-16.2 7.7-35 0-51.5zM512 766c-161.3 0-279.4-81.8-362.7-254C232.6 339.8 350.7 258 512 258c161.3 0 279.4 81.8 362.7 254C791.5 684.2 673.4 766 512 766zm-4-430c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm0 288c-61.9 0-112-50.1-112-112s50.1-112 112-112 112 50.1 112 112-50.1 112-112 112z"}}]},name:"eye",theme:"outlined"},dB=function(t,n){return C.createElement(rr,nt({},t,{ref:n,icon:uB}))},fB=C.forwardRef(dB);const hB=e=>{const{getPrefixCls:t,direction:n}=C.useContext(zt),{prefixCls:r,className:i}=e,o=t("input-group",r),l=t("input"),[m,u,p]=NE(l),s=ve(o,p,{[`${o}-lg`]:e.size==="large",[`${o}-sm`]:e.size==="small",[`${o}-compact`]:e.compact,[`${o}-rtl`]:n==="rtl"},u,i),c=C.useContext(bi),d=C.useMemo(()=>Object.assign(Object.assign({},c),{isFormItemInput:!1}),[c]);return m(C.createElement("span",{className:s,style:e.style,onMouseEnter:e.onMouseEnter,onMouseLeave:e.onMouseLeave,onFocus:e.onFocus,onBlur:e.onBlur},C.createElement(bi.Provider,{value:d},e.children)))},pB=e=>{const{componentCls:t,paddingXS:n}=e;return{[t]:{display:"inline-flex",alignItems:"center",flexWrap:"nowrap",columnGap:n,[`${t}-input-wrapper`]:{position:"relative",[`${t}-mask-icon`]:{position:"absolute",zIndex:"1",top:"50%",right:"50%",transform:"translate(50%, -50%)",pointerEvents:"none"},[`${t}-mask-input`]:{color:"transparent",caretColor:"var(--ant-color-text)"},[`${t}-mask-input[type=number]::-webkit-inner-spin-button`]:{"-webkit-appearance":"none",margin:0},[`${t}-mask-input[type=number]`]:{"-moz-appearance":"textfield"}},"&-rtl":{direction:"rtl"},[`${t}-input`]:{textAlign:"center",paddingInline:e.paddingXXS},[`&${t}-sm ${t}-input`]:{paddingInline:e.calc(e.paddingXXS).div(2).equal()},[`&${t}-lg ${t}-input`]:{paddingInline:e.paddingXS}}}},gB=gr(["Input","OTP"],e=>{const t=Sn(e,wf(e));return[pB(t)]},Sf);var mB=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i{const{className:n,value:r,onChange:i,onActiveChange:o,index:l,mask:m}=e,u=mB(e,["className","value","onChange","onActiveChange","index","mask"]),{getPrefixCls:p}=C.useContext(zt),s=p("otp"),c=typeof m=="string"?m:r,d=C.useRef(null);C.useImperativeHandle(t,()=>d.current);const h=b=>{i(l,b.target.value)},f=()=>{gn(()=>{var b;const w=(b=d.current)===null||b===void 0?void 0:b.input;document.activeElement===w&&w&&w.select()})},v=b=>{const{key:w,ctrlKey:x,metaKey:E}=b;w==="ArrowLeft"?o(l-1):w==="ArrowRight"?o(l+1):w==="z"&&(x||E)&&b.preventDefault(),f()},y=b=>{b.key==="Backspace"&&!r&&o(l-1),f()};return C.createElement("span",{className:`${s}-input-wrapper`,role:"presentation"},m&&r!==""&&r!==void 0&&C.createElement("span",{className:`${s}-mask-icon`,"aria-hidden":"true"},c),C.createElement($f,Object.assign({"aria-label":`OTP Input ${l+1}`,type:m===!0?"password":"text"},u,{ref:d,value:r,onInput:h,onFocus:f,onKeyDown:v,onKeyUp:y,onMouseDown:f,onMouseUp:f,className:ve(n,{[`${s}-mask-input`]:m})})))});var yB=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i{const{index:t,prefixCls:n,separator:r}=e,i=typeof r=="function"?r(t):r;return i?C.createElement("span",{className:`${n}-separator`},i):null},wB=C.forwardRef((e,t)=>{const{prefixCls:n,length:r=6,size:i,defaultValue:o,value:l,onChange:m,formatter:u,separator:p,variant:s,disabled:c,status:d,autoFocus:h,mask:f,type:v,onInput:y,inputMode:b}=e,w=yB(e,["prefixCls","length","size","defaultValue","value","onChange","formatter","separator","variant","disabled","status","autoFocus","mask","type","onInput","inputMode"]),{getPrefixCls:x,direction:E}=C.useContext(zt),_=x("otp",n),$=Wa(w,{aria:!0,data:!0,attr:!0}),[O,N,k]=gB(_),L=to(K=>i??K),F=C.useContext(bi),P=mf(F.status,d),A=C.useMemo(()=>Object.assign(Object.assign({},F),{status:P,hasFeedback:!1,feedbackIcon:null}),[F,P]),M=C.useRef(null),R=C.useRef({});C.useImperativeHandle(t,()=>({focus:()=>{var K;(K=R.current[0])===null||K===void 0||K.focus()},blur:()=>{var K;for(let G=0;Gu?u(K):K,[D,j]=C.useState(()=>qu(I(o||"")));C.useEffect(()=>{l!==void 0&&j(qu(l))},[l]);const B=tr(K=>{j(K),y&&y(K),m&&K.length===r&&K.every(G=>G)&&K.some((G,q)=>D[q]!==G)&&m(K.join(""))}),V=tr((K,G)=>{let q=Ge(D);for(let Q=0;Q=0&&!q[Q];Q-=1)q.pop();const Z=I(q.map(Q=>Q||" ").join(""));return q=qu(Z).map((Q,J)=>Q===" "&&!q[J]?q[J]:Q),q}),H=(K,G)=>{var q;const Z=V(K,G),Q=Math.min(K+G.length,r-1);Q!==K&&Z[K]!==void 0&&((q=R.current[Q])===null||q===void 0||q.focus()),B(Z)},Y=K=>{var G;(G=R.current[K])===null||G===void 0||G.focus()},U={variant:s,disabled:c,status:P,mask:f,type:v,inputMode:b};return O(C.createElement("div",Object.assign({},$,{ref:M,className:ve(_,{[`${_}-sm`]:L==="small",[`${_}-lg`]:L==="large",[`${_}-rtl`]:E==="rtl"},k,N),role:"group"}),C.createElement(bi.Provider,{value:A},Array.from({length:r}).map((K,G)=>{const q=`otp-${G}`,Z=D[G]||"";return C.createElement(C.Fragment,{key:q},C.createElement(vB,Object.assign({ref:Q=>{R.current[G]=Q},index:G,size:L,htmlSize:1,className:`${_}-input`,onChange:H,value:Z,onActiveChange:Y,autoFocus:G===0&&h},U)),Ge?C.createElement(fB,null):C.createElement($B,null),_B={click:"onClick",hover:"onMouseOver"},MB=C.forwardRef((e,t)=>{const{disabled:n,action:r="click",visibilityToggle:i=!0,iconRender:o=EB}=e,l=C.useContext(Ro),m=n??l,u=typeof i=="object"&&i.visible!==void 0,[p,s]=C.useState(()=>u?i.visible:!1),c=C.useRef(null);C.useEffect(()=>{u&&s(i.visible)},[u,i]);const d=XE(c),h=()=>{var L;if(m)return;p&&d();const F=!p;s(F),typeof i=="object"&&((L=i.onVisibleChange)===null||L===void 0||L.call(i,F))},f=L=>{const F=_B[r]||"",P=o(p),A={[F]:h,className:`${L}-icon`,key:"passwordIcon",onMouseDown:M=>{M.preventDefault()},onMouseUp:M=>{M.preventDefault()}};return C.cloneElement(C.isValidElement(P)?P:C.createElement("span",null,P),A)},{className:v,prefixCls:y,inputPrefixCls:b,size:w}=e,x=xB(e,["className","prefixCls","inputPrefixCls","size"]),{getPrefixCls:E}=C.useContext(zt),_=E("input",b),$=E("input-password",y),O=i&&f($),N=ve($,v,{[`${$}-${w}`]:!!w}),k=Object.assign(Object.assign({},Er(x,["suffix","iconRender","visibilityToggle"])),{type:p?"text":"password",className:N,prefixCls:_,suffix:O});return w&&(k.size=w),C.createElement($f,Object.assign({ref:wi(t,c)},k))});var RB=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i{const{prefixCls:n,inputPrefixCls:r,className:i,size:o,suffix:l,enterButton:m=!1,addonAfter:u,loading:p,disabled:s,onSearch:c,onChange:d,onCompositionStart:h,onCompositionEnd:f,variant:v}=e,y=RB(e,["prefixCls","inputPrefixCls","className","size","suffix","enterButton","addonAfter","loading","disabled","onSearch","onChange","onCompositionStart","onCompositionEnd","variant"]),{getPrefixCls:b,direction:w}=C.useContext(zt),x=C.useRef(!1),E=b("input-search",n),_=b("input",r),{compactSize:$}=Lc(E,w),O=to(Y=>{var U;return(U=o??$)!==null&&U!==void 0?U:Y}),N=C.useRef(null),k=Y=>{Y!=null&&Y.target&&Y.type==="click"&&c&&c(Y.target.value,Y,{source:"clear"}),d==null||d(Y)},L=Y=>{var U;document.activeElement===((U=N.current)===null||U===void 0?void 0:U.input)&&Y.preventDefault()},F=Y=>{var U,K;c&&c((K=(U=N.current)===null||U===void 0?void 0:U.input)===null||K===void 0?void 0:K.value,Y,{source:"input"})},P=Y=>{x.current||p||F(Y)},A=typeof m=="boolean"?C.createElement(cE,null):null,M=`${E}-button`;let R;const I=m||{},D=I.type&&I.type.__ANT_BUTTON===!0;D||I.type==="button"?R=Oo(I,Object.assign({onMouseDown:L,onClick:Y=>{var U,K;(K=(U=I==null?void 0:I.props)===null||U===void 0?void 0:U.onClick)===null||K===void 0||K.call(U,Y),F(Y)},key:"enterButton"},D?{className:M,size:O}:{})):R=C.createElement(Pc,{className:M,color:m?"primary":"default",size:O,disabled:s,key:"enterButton",onMouseDown:L,onClick:F,loading:p,icon:A,variant:v==="borderless"||v==="filled"||v==="underlined"?"text":m?"solid":void 0},m),u&&(R=[R,Oo(u,{key:"addonAfter"})]);const j=ve(E,{[`${E}-rtl`]:w==="rtl",[`${E}-${O}`]:!!O,[`${E}-with-button`]:!!m},i),B=Y=>{x.current=!0,h==null||h(Y)},V=Y=>{x.current=!1,f==null||f(Y)},H=Object.assign(Object.assign({},y),{className:j,prefixCls:_,type:"search",size:O,variant:v,onPressEnter:P,onCompositionStart:B,onCompositionEnd:V,addonAfter:R,suffix:l,onChange:k,disabled:s});return C.createElement($f,Object.assign({ref:wi(N,t)},H))});var AB=` + min-height:0 !important; + max-height:none !important; + height:0 !important; + visibility:hidden !important; + overflow:hidden !important; + position:absolute !important; + z-index:-1000 !important; + top:0 !important; + right:0 !important; + pointer-events: none !important; +`,TB=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break","white-space"],Gp={},mi;function IB(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=e.getAttribute("id")||e.getAttribute("data-reactid")||e.getAttribute("name");if(t&&Gp[n])return Gp[n];var r=window.getComputedStyle(e),i=r.getPropertyValue("box-sizing")||r.getPropertyValue("-moz-box-sizing")||r.getPropertyValue("-webkit-box-sizing"),o=parseFloat(r.getPropertyValue("padding-bottom"))+parseFloat(r.getPropertyValue("padding-top")),l=parseFloat(r.getPropertyValue("border-bottom-width"))+parseFloat(r.getPropertyValue("border-top-width")),m=TB.map(function(p){return"".concat(p,":").concat(r.getPropertyValue(p))}).join(";"),u={sizingStyle:m,paddingSize:o,borderSize:l,boxSizing:i};return t&&n&&(Gp[n]=u),u}function LB(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;mi||(mi=document.createElement("textarea"),mi.setAttribute("tab-index","-1"),mi.setAttribute("aria-hidden","true"),mi.setAttribute("name","hiddenTextarea"),document.body.appendChild(mi)),e.getAttribute("wrap")?mi.setAttribute("wrap",e.getAttribute("wrap")):mi.removeAttribute("wrap");var i=IB(e,t),o=i.paddingSize,l=i.borderSize,m=i.boxSizing,u=i.sizingStyle;mi.setAttribute("style","".concat(u,";").concat(AB)),mi.value=e.value||e.placeholder||"";var p=void 0,s=void 0,c,d=mi.scrollHeight;if(m==="border-box"?d+=l:m==="content-box"&&(d-=o),n!==null||r!==null){mi.value=" ";var h=mi.scrollHeight-o;n!==null&&(p=h*n,m==="border-box"&&(p=p+o+l),d=Math.max(p,d)),r!==null&&(s=h*r,m==="border-box"&&(s=s+o+l),c=d>s?"":"hidden",d=Math.min(s,d))}var f={height:d,overflowY:c,resize:"none"};return p&&(f.minHeight=p),s&&(f.maxHeight=s),f}var PB=["prefixCls","defaultValue","value","autoSize","onResize","className","style","disabled","onChange","onInternalAutoSize"],Kp=0,Yp=1,Xp=2,kB=C.forwardRef(function(e,t){var n=e,r=n.prefixCls,i=n.defaultValue,o=n.value,l=n.autoSize,m=n.onResize,u=n.className,p=n.style,s=n.disabled,c=n.onChange;n.onInternalAutoSize;var d=At(n,PB),h=Pr(i,{value:o,postState:function(K){return K??""}}),f=pe(h,2),v=f[0],y=f[1],b=function(K){y(K.target.value),c==null||c(K)},w=C.useRef();C.useImperativeHandle(t,function(){return{textArea:w.current}});var x=C.useMemo(function(){return l&&wt(l)==="object"?[l.minRows,l.maxRows]:[]},[l]),E=pe(x,2),_=E[0],$=E[1],O=!!l,N=function(){try{if(document.activeElement===w.current){var K=w.current,G=K.selectionStart,q=K.selectionEnd,Z=K.scrollTop;w.current.setSelectionRange(G,q),w.current.scrollTop=Z}}catch{}},k=C.useState(Xp),L=pe(k,2),F=L[0],P=L[1],A=C.useState(),M=pe(A,2),R=M[0],I=M[1],D=function(){P(Kp)};fn(function(){O&&D()},[o,_,$,O]),fn(function(){if(F===Kp)P(Yp);else if(F===Yp){var U=LB(w.current,!1,_,$);P(Xp),I(U)}else N()},[F]);var j=C.useRef(),B=function(){gn.cancel(j.current)},V=function(K){F===Xp&&(m==null||m(K),l&&(B(),j.current=gn(function(){D()})))};C.useEffect(function(){return B},[]);var H=O?R:null,Y=oe(oe({},p),H);return(F===Kp||F===Yp)&&(Y.overflowY="hidden",Y.overflowX="hidden"),C.createElement(ki,{onResize:V,disabled:!(l||m)},C.createElement("textarea",nt({},d,{ref:w,style:Y,className:ve(r,u,ne({},"".concat(r,"-disabled"),s)),disabled:s,value:v,onChange:b})))}),NB=["defaultValue","value","onFocus","onBlur","onChange","allowClear","maxLength","onCompositionStart","onCompositionEnd","suffix","prefixCls","showCount","count","className","style","disabled","hidden","classNames","styles","onResize","onClear","onPressEnter","readOnly","autoSize","onKeyDown"],DB=be.forwardRef(function(e,t){var n,r=e.defaultValue,i=e.value,o=e.onFocus,l=e.onBlur,m=e.onChange,u=e.allowClear,p=e.maxLength,s=e.onCompositionStart,c=e.onCompositionEnd,d=e.suffix,h=e.prefixCls,f=h===void 0?"rc-textarea":h,v=e.showCount,y=e.count,b=e.className,w=e.style,x=e.disabled,E=e.hidden,_=e.classNames,$=e.styles,O=e.onResize,N=e.onClear,k=e.onPressEnter,L=e.readOnly,F=e.autoSize,P=e.onKeyDown,A=At(e,NB),M=Pr(r,{value:i,defaultValue:r}),R=pe(M,2),I=R[0],D=R[1],j=I==null?"":String(I),B=be.useState(!1),V=pe(B,2),H=V[0],Y=V[1],U=be.useRef(!1),K=be.useState(null),G=pe(K,2),q=G[0],Z=G[1],Q=C.useRef(null),J=C.useRef(null),ie=function(){var Te;return(Te=J.current)===null||Te===void 0?void 0:Te.textArea},se=function(){ie().focus()};C.useImperativeHandle(t,function(){var Ne;return{resizableTextArea:J.current,focus:se,blur:function(){ie().blur()},nativeElement:((Ne=Q.current)===null||Ne===void 0?void 0:Ne.nativeElement)||ie()}}),C.useEffect(function(){Y(function(Ne){return!x&&Ne})},[x]);var ae=be.useState(null),ge=pe(ae,2),me=ge[0],de=ge[1];be.useEffect(function(){if(me){var Ne;(Ne=ie()).setSelectionRange.apply(Ne,Ge(me))}},[me]);var we=KE(y,v),Oe=(n=we.max)!==null&&n!==void 0?n:p,xe=Number(Oe)>0,Pe=we.strategy(j),ze=!!Oe&&Pe>Oe,Ie=function(Te,We){var te=We;!U.current&&we.exceedFormatter&&we.max&&we.strategy(We)>we.max&&(te=we.exceedFormatter(We,{max:we.max}),We!==te&&de([ie().selectionStart||0,ie().selectionEnd||0])),D(te),Dd(Te.currentTarget,Te,m,te)},Ye=function(Te){U.current=!0,s==null||s(Te)},Me=function(Te){U.current=!1,Ie(Te,Te.currentTarget.value),c==null||c(Te)},ke=function(Te){Ie(Te,Te.target.value)},Je=function(Te){Te.key==="Enter"&&k&&k(Te),P==null||P(Te)},ce=function(Te){Y(!0),o==null||o(Te)},Ee=function(Te){Y(!1),l==null||l(Te)},Re=function(Te){D(""),se(),Dd(ie(),Te,m)},Ae=d,De;we.show&&(we.showFormatter?De=we.showFormatter({value:j,count:Pe,maxLength:Oe}):De="".concat(Pe).concat(xe?" / ".concat(Oe):""),Ae=be.createElement(be.Fragment,null,Ae,be.createElement("span",{className:ve("".concat(f,"-data-count"),_==null?void 0:_.count),style:$==null?void 0:$.count},De)));var He=function(Te){var We;O==null||O(Te),(We=ie())!==null&&We!==void 0&&We.style.height&&Z(!0)},it=!F&&!v&&!u;return be.createElement(GE,{ref:Q,value:j,allowClear:u,handleReset:Re,suffix:Ae,prefixCls:f,classNames:oe(oe({},_),{},{affixWrapper:ve(_==null?void 0:_.affixWrapper,ne(ne({},"".concat(f,"-show-count"),v),"".concat(f,"-textarea-allow-clear"),u))}),disabled:x,focused:H,className:ve(b,ze&&"".concat(f,"-out-of-range")),style:oe(oe({},w),q&&!it?{height:"auto"}:{}),dataAttrs:{affixWrapper:{"data-count":typeof De=="string"?De:void 0}},hidden:E,readOnly:L,onClear:N},be.createElement(kB,nt({},A,{autoSize:F,maxLength:p,onKeyDown:Je,onChange:ke,onFocus:ce,onBlur:Ee,onCompositionStart:Ye,onCompositionEnd:Me,className:ve(_==null?void 0:_.textarea),style:oe(oe({},$==null?void 0:$.textarea),{},{resize:w==null?void 0:w.resize}),disabled:x,prefixCls:f,onResize:He,ref:J,readOnly:L})))});const FB=e=>{const{componentCls:t,paddingLG:n}=e,r=`${t}-textarea`;return{[`textarea${t}`]:{maxWidth:"100%",height:"auto",minHeight:e.controlHeight,lineHeight:e.lineHeight,verticalAlign:"bottom",transition:`all ${e.motionDurationSlow}`,resize:"vertical",[`&${t}-mouse-active`]:{transition:`all ${e.motionDurationSlow}, height 0s, width 0s`}},[`${t}-textarea-affix-wrapper-resize-dirty`]:{width:"auto"},[r]:{position:"relative","&-show-count":{[`${t}-data-count`]:{position:"absolute",bottom:e.calc(e.fontSize).mul(e.lineHeight).mul(-1).equal(),insetInlineEnd:0,color:e.colorTextDescription,whiteSpace:"nowrap",pointerEvents:"none"}},[` + &-allow-clear > ${t}, + &-affix-wrapper${r}-has-feedback ${t} + `]:{paddingInlineEnd:n},[`&-affix-wrapper${t}-affix-wrapper`]:{padding:0,[`> textarea${t}`]:{fontSize:"inherit",border:"none",outline:"none",background:"transparent",minHeight:e.calc(e.controlHeight).sub(e.calc(e.lineWidth).mul(2)).equal(),"&:focus":{boxShadow:"none !important"}},[`${t}-suffix`]:{margin:0,"> *:not(:last-child)":{marginInline:0},[`${t}-clear-icon`]:{position:"absolute",insetInlineEnd:e.paddingInline,insetBlockStart:e.paddingXS},[`${r}-suffix`]:{position:"absolute",top:0,insetInlineEnd:e.paddingInline,bottom:0,zIndex:1,display:"inline-flex",alignItems:"center",margin:"auto",pointerEvents:"none"}}},[`&-affix-wrapper${t}-affix-wrapper-rtl`]:{[`${t}-suffix`]:{[`${t}-data-count`]:{direction:"ltr",insetInlineStart:0}}},[`&-affix-wrapper${t}-affix-wrapper-sm`]:{[`${t}-suffix`]:{[`${t}-clear-icon`]:{insetInlineEnd:e.paddingInlineSM}}}}}},zB=gr(["Input","TextArea"],e=>{const t=Sn(e,wf(e));return[FB(t)]},Sf,{resetFont:!1});var jB=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i{var n;const{prefixCls:r,bordered:i=!0,size:o,disabled:l,status:m,allowClear:u,classNames:p,rootClassName:s,className:c,style:d,styles:h,variant:f,showCount:v,onMouseDown:y,onResize:b}=e,w=jB(e,["prefixCls","bordered","size","disabled","status","allowClear","classNames","rootClassName","className","style","styles","variant","showCount","onMouseDown","onResize"]),{getPrefixCls:x,direction:E,allowClear:_,autoComplete:$,className:O,style:N,classNames:k,styles:L}=Ji("textArea"),F=C.useContext(Ro),P=l??F,{status:A,hasFeedback:M,feedbackIcon:R}=C.useContext(bi),I=mf(A,m),D=C.useRef(null);C.useImperativeHandle(t,()=>{var we;return{resizableTextArea:(we=D.current)===null||we===void 0?void 0:we.resizableTextArea,focus:Oe=>{var xe,Pe;UE((Pe=(xe=D.current)===null||xe===void 0?void 0:xe.resizableTextArea)===null||Pe===void 0?void 0:Pe.textArea,Oe)},blur:()=>{var Oe;return(Oe=D.current)===null||Oe===void 0?void 0:Oe.blur()}}});const j=x("input",r),B=eo(j),[V,H,Y]=kE(j,s),[U]=zB(j,B),{compactSize:K,compactItemClassnames:G}=Lc(j,E),q=to(we=>{var Oe;return(Oe=o??K)!==null&&Oe!==void 0?Oe:we}),[Z,Q]=vf("textArea",f,i),J=YE(u??_),[ie,se]=C.useState(!1),[ae,ge]=C.useState(!1),me=we=>{se(!0),y==null||y(we);const Oe=()=>{se(!1),document.removeEventListener("mouseup",Oe)};document.addEventListener("mouseup",Oe)},de=we=>{var Oe,xe;if(b==null||b(we),ie&&typeof getComputedStyle=="function"){const Pe=(xe=(Oe=D.current)===null||Oe===void 0?void 0:Oe.nativeElement)===null||xe===void 0?void 0:xe.querySelector("textarea");Pe&&getComputedStyle(Pe).resize==="both"&&ge(!0)}};return V(U(C.createElement(DB,Object.assign({autoComplete:$},w,{style:Object.assign(Object.assign({},N),d),styles:Object.assign(Object.assign({},L),h),disabled:P,allowClear:J,className:ve(Y,B,c,s,G,O,ae&&`${j}-textarea-affix-wrapper-resize-dirty`),classNames:Object.assign(Object.assign(Object.assign({},p),k),{textarea:ve({[`${j}-sm`]:q==="small",[`${j}-lg`]:q==="large"},H,p==null?void 0:p.textarea,k.textarea,ie&&`${j}-mouse-active`),variant:ve({[`${j}-${Z}`]:Q},kd(j,I)),affixWrapper:ve(`${j}-textarea-affix-wrapper`,{[`${j}-affix-wrapper-rtl`]:E==="rtl",[`${j}-affix-wrapper-sm`]:q==="small",[`${j}-affix-wrapper-lg`]:q==="large",[`${j}-textarea-show-count`]:v||((n=e.count)===null||n===void 0?void 0:n.show)},H)}),prefixCls:j,suffix:M&&C.createElement("span",{className:`${j}-textarea-suffix`},R),showCount:v,ref:D,onResize:de,onMouseDown:me}))))}),_o=$f;_o.Group=hB;_o.Search=OB;_o.TextArea=a_;_o.Password=MB;_o.OTP=wB;const BB=(e,t=!1)=>t&&e==null?[]:Array.isArray(e)?e:[e];let Ii=null,Pa=e=>e(),yc=[],bc={};function sC(){const{getContainer:e,duration:t,rtl:n,maxCount:r,top:i}=bc,o=(e==null?void 0:e())||document.body;return{getContainer:()=>o,duration:t,rtl:n,maxCount:r,top:i}}const HB=be.forwardRef((e,t)=>{const{messageConfig:n,sync:r}=e,{getPrefixCls:i}=C.useContext(zt),o=bc.prefixCls||i("message"),l=C.useContext(Wx),[m,u]=ax(Object.assign(Object.assign(Object.assign({},n),{prefixCls:o}),l.message));return be.useImperativeHandle(t,()=>{const p=Object.assign({},m);return Object.keys(p).forEach(s=>{p[s]=(...c)=>(r(),m[s].apply(m,c))}),{instance:p,sync:r}}),u}),WB=be.forwardRef((e,t)=>{const[n,r]=be.useState(sC),i=()=>{r(sC)};be.useEffect(i,[]);const o=W$(),l=o.getRootPrefixCls(),m=o.getIconPrefixCls(),u=o.getTheme(),p=be.createElement(HB,{ref:t,sync:i,messageConfig:n});return be.createElement(ha,{prefixCls:l,iconPrefixCls:m,theme:u},o.holderRender?o.holderRender(p):p)});function xf(){if(!Ii){const e=document.createDocumentFragment(),t={fragment:e};Ii=t,Pa(()=>{bv()(be.createElement(WB,{ref:r=>{const{instance:i,sync:o}=r||{};Promise.resolve().then(()=>{!t.instance&&i&&(t.instance=i,t.sync=o,xf())})}}),e)});return}Ii.instance&&(yc.forEach(e=>{const{type:t,skipped:n}=e;if(!n)switch(t){case"open":{Pa(()=>{const r=Ii.instance.open(Object.assign(Object.assign({},bc),e.config));r==null||r.then(e.resolve),e.setCloseFn(r)});break}case"destroy":Pa(()=>{Ii==null||Ii.instance.destroy(e.key)});break;default:Pa(()=>{var r;const i=(r=Ii.instance)[t].apply(r,Ge(e.args));i==null||i.then(e.resolve),e.setCloseFn(i)})}}),yc=[])}function VB(e){bc=Object.assign(Object.assign({},bc),e),Pa(()=>{var t;(t=Ii==null?void 0:Ii.sync)===null||t===void 0||t.call(Ii)})}function UB(e){const t=yv(n=>{let r;const i={type:"open",config:e,resolve:n,setCloseFn:o=>{r=o}};return yc.push(i),()=>{r?Pa(()=>{r()}):i.skipped=!0}});return xf(),t}function GB(e,t){const n=yv(r=>{let i;const o={type:e,args:t,resolve:r,setCloseFn:l=>{i=l}};return yc.push(o),()=>{i?Pa(()=>{i()}):o.skipped=!0}});return xf(),n}const KB=e=>{yc.push({type:"destroy",key:e}),xf()},YB=["success","info","warning","error","loading"],XB={open:UB,destroy:KB,config:VB,useMessage:c2,_InternalPanelDoNotUseOrYouWillBeFired:t2},s_=XB;YB.forEach(e=>{s_[e]=(...t)=>GB(e,t)});let Ki=null,vd=e=>e(),zd=[],wc={};function lC(){const{getContainer:e,rtl:t,maxCount:n,top:r,bottom:i,showProgress:o,pauseOnHover:l}=wc,m=(e==null?void 0:e())||document.body;return{getContainer:()=>m,rtl:t,maxCount:n,top:r,bottom:i,showProgress:o,pauseOnHover:l}}const qB=be.forwardRef((e,t)=>{const{notificationConfig:n,sync:r}=e,{getPrefixCls:i}=C.useContext(zt),o=wc.prefixCls||i("notification"),l=C.useContext(Wx),[m,u]=Hx(Object.assign(Object.assign(Object.assign({},n),{prefixCls:o}),l.notification));return be.useEffect(r,[]),be.useImperativeHandle(t,()=>{const p=Object.assign({},m);return Object.keys(p).forEach(s=>{p[s]=(...c)=>(r(),m[s].apply(m,c))}),{instance:p,sync:r}}),u}),QB=be.forwardRef((e,t)=>{const[n,r]=be.useState(lC),i=()=>{r(lC)};be.useEffect(i,[]);const o=W$(),l=o.getRootPrefixCls(),m=o.getIconPrefixCls(),u=o.getTheme(),p=be.createElement(qB,{ref:t,sync:i,notificationConfig:n});return be.createElement(ha,{prefixCls:l,iconPrefixCls:m,theme:u},o.holderRender?o.holderRender(p):p)});function Gv(){if(!Ki){const e=document.createDocumentFragment(),t={fragment:e};Ki=t,vd(()=>{bv()(be.createElement(QB,{ref:r=>{const{instance:i,sync:o}=r||{};Promise.resolve().then(()=>{!t.instance&&i&&(t.instance=i,t.sync=o,Gv())})}}),e)});return}Ki.instance&&(zd.forEach(e=>{switch(e.type){case"open":{vd(()=>{Ki.instance.open(Object.assign(Object.assign({},wc),e.config))});break}case"destroy":vd(()=>{Ki==null||Ki.instance.destroy(e.key)});break}}),zd=[])}function ZB(e){wc=Object.assign(Object.assign({},wc),e),vd(()=>{var t;(t=Ki==null?void 0:Ki.sync)===null||t===void 0||t.call(Ki)})}function l_(e){zd.push({type:"open",config:e}),Gv()}const JB=e=>{zd.push({type:"destroy",key:e}),Gv()},e5=["success","info","warning","error"],t5={open:l_,destroy:JB,config:ZB,useNotification:hD,_InternalPanelDoNotUseOrYouWillBeFired:rD},Kv=t5;e5.forEach(e=>{Kv[e]=t=>l_(Object.assign(Object.assign({},t),{type:e}))});var c_={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z"}}]},name:"copy",theme:"outlined"},n5=function(t,n){return C.createElement(rr,nt({},t,{ref:n,icon:c_}))},r5=C.forwardRef(n5),i5={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M257.7 752c2 0 4-.2 6-.5L431.9 722c2-.4 3.9-1.3 5.3-2.8l423.9-423.9a9.96 9.96 0 000-14.1L694.9 114.9c-1.9-1.9-4.4-2.9-7.1-2.9s-5.2 1-7.1 2.9L256.8 538.8c-1.5 1.5-2.4 3.3-2.8 5.3l-29.5 168.2a33.5 33.5 0 009.4 29.8c6.6 6.4 14.9 9.9 23.8 9.9zm67.4-174.4L687.8 215l73.3 73.3-362.7 362.6-88.9 15.7 15.6-89zM880 836H144c-17.7 0-32 14.3-32 32v36c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-36c0-17.7-14.3-32-32-32z"}}]},name:"edit",theme:"outlined"},o5=function(t,n){return C.createElement(rr,nt({},t,{ref:n,icon:i5}))},a5=C.forwardRef(o5),s5={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M864 170h-60c-4.4 0-8 3.6-8 8v518H310v-73c0-6.7-7.8-10.5-13-6.3l-141.9 112a8 8 0 000 12.6l141.9 112c5.3 4.2 13 .4 13-6.3v-75h498c35.3 0 64-28.7 64-64V178c0-4.4-3.6-8-8-8z"}}]},name:"enter",theme:"outlined"},l5=function(t,n){return C.createElement(rr,nt({},t,{ref:n,icon:s5}))},c5=C.forwardRef(l5),u5={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M400 317.7h73.9V656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V317.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 163a8 8 0 00-12.6 0l-112 141.7c-4.1 5.3-.4 13 6.3 13zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"}}]},name:"upload",theme:"outlined"},d5={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M859.9 780H164.1c-4.5 0-8.1 3.6-8.1 8v60c0 4.4 3.6 8 8.1 8h695.8c4.5 0 8.1-3.6 8.1-8v-60c0-4.4-3.6-8-8.1-8zM505.7 669a8 8 0 0012.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9h-74.1V176c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8z"}}]},name:"vertical-align-bottom",theme:"outlined"};const f5=(e,t,n,r)=>{const{titleMarginBottom:i,fontWeightStrong:o}=r;return{marginBottom:i,color:n,fontWeight:o,fontSize:e,lineHeight:t}},h5=e=>{const t=[1,2,3,4,5],n={};return t.forEach(r=>{n[` + h${r}&, + div&-h${r}, + div&-h${r} > textarea, + h${r} + `]=f5(e[`fontSizeHeading${r}`],e[`lineHeightHeading${r}`],e.colorTextHeading,e)}),n},p5=e=>{const{componentCls:t}=e;return{"a&, a":Object.assign(Object.assign({},R$(e)),{userSelect:"text",[`&[disabled], &${t}-disabled`]:{color:e.colorTextDisabled,cursor:"not-allowed","&:active, &:hover":{color:e.colorTextDisabled},"&:active":{pointerEvents:"none"}}})}},g5=e=>({code:{margin:"0 0.2em",paddingInline:"0.4em",paddingBlock:"0.2em 0.1em",fontSize:"85%",fontFamily:e.fontFamilyCode,background:"rgba(150, 150, 150, 0.1)",border:"1px solid rgba(100, 100, 100, 0.2)",borderRadius:3},kbd:{margin:"0 0.2em",paddingInline:"0.4em",paddingBlock:"0.15em 0.1em",fontSize:"90%",fontFamily:e.fontFamilyCode,background:"rgba(150, 150, 150, 0.06)",border:"1px solid rgba(100, 100, 100, 0.2)",borderBottomWidth:2,borderRadius:3},mark:{padding:0,backgroundColor:Rd[2]},"u, ins":{textDecoration:"underline",textDecorationSkipInk:"auto"},"s, del":{textDecoration:"line-through"},strong:{fontWeight:600},"ul, ol":{marginInline:0,marginBlock:"0 1em",padding:0,li:{marginInline:"20px 0",marginBlock:0,paddingInline:"4px 0",paddingBlock:0}},ul:{listStyleType:"circle",ul:{listStyleType:"disc"}},ol:{listStyleType:"decimal"},"pre, blockquote":{margin:"1em 0"},pre:{padding:"0.4em 0.6em",whiteSpace:"pre-wrap",wordWrap:"break-word",background:"rgba(150, 150, 150, 0.1)",border:"1px solid rgba(100, 100, 100, 0.2)",borderRadius:3,fontFamily:e.fontFamilyCode,code:{display:"inline",margin:0,padding:0,fontSize:"inherit",fontFamily:"inherit",background:"transparent",border:0}},blockquote:{paddingInline:"0.6em 0",paddingBlock:0,borderInlineStart:"4px solid rgba(100, 100, 100, 0.2)",opacity:.85}}),m5=e=>{const{componentCls:t,paddingSM:n}=e,r=n;return{"&-edit-content":{position:"relative","div&":{insetInlineStart:e.calc(e.paddingSM).mul(-1).equal(),marginTop:e.calc(r).mul(-1).equal(),marginBottom:`calc(1em - ${$e(r)})`},[`${t}-edit-content-confirm`]:{position:"absolute",insetInlineEnd:e.calc(e.marginXS).add(2).equal(),insetBlockEnd:e.marginXS,color:e.colorIcon,fontWeight:"normal",fontSize:e.fontSize,fontStyle:"normal",pointerEvents:"none"},textarea:{margin:"0!important",MozTransition:"none",height:"1em"}}}},v5=e=>({[`${e.componentCls}-copy-success`]:{"\n &,\n &:hover,\n &:focus":{color:e.colorSuccess}},[`${e.componentCls}-copy-icon-only`]:{marginInlineStart:0}}),y5=()=>({"\n a&-ellipsis,\n span&-ellipsis\n ":{display:"inline-block",maxWidth:"100%"},"&-ellipsis-single-line":{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis","a&, span&":{verticalAlign:"bottom"},"> code":{paddingBlock:0,maxWidth:"calc(100% - 1.2em)",display:"inline-block",overflow:"hidden",textOverflow:"ellipsis",verticalAlign:"bottom",boxSizing:"content-box"}},"&-ellipsis-multiple-line":{display:"-webkit-box",overflow:"hidden",WebkitLineClamp:3,WebkitBoxOrient:"vertical"}}),b5=e=>{const{componentCls:t,titleMarginTop:n}=e;return{[t]:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({color:e.colorText,wordBreak:"break-word",lineHeight:e.lineHeight,[`&${t}-secondary`]:{color:e.colorTextDescription},[`&${t}-success`]:{color:e.colorSuccessText},[`&${t}-warning`]:{color:e.colorWarningText},[`&${t}-danger`]:{color:e.colorErrorText,"a&:active, a&:focus":{color:e.colorErrorTextActive},"a&:hover":{color:e.colorErrorTextHover}},[`&${t}-disabled`]:{color:e.colorTextDisabled,cursor:"not-allowed",userSelect:"none"},"\n div&,\n p\n ":{marginBottom:"1em"}},h5(e)),{[` + & + h1${t}, + & + h2${t}, + & + h3${t}, + & + h4${t}, + & + h5${t} + `]:{marginTop:n},"\n div,\n ul,\n li,\n p,\n h1,\n h2,\n h3,\n h4,\n h5":{"\n + h1,\n + h2,\n + h3,\n + h4,\n + h5\n ":{marginTop:n}}}),g5(e)),p5(e)),{[` + ${t}-expand, + ${t}-collapse, + ${t}-edit, + ${t}-copy + `]:Object.assign(Object.assign({},R$(e)),{marginInlineStart:e.marginXXS})}),m5(e)),v5(e)),y5()),{"&-rtl":{direction:"rtl"}})}},w5=()=>({titleMarginTop:"1.2em",titleMarginBottom:"0.5em"}),u_=gr("Typography",e=>[b5(e)],w5),S5=e=>{const{prefixCls:t,"aria-label":n,className:r,style:i,direction:o,maxLength:l,autoSize:m=!0,value:u,onSave:p,onCancel:s,onEnd:c,component:d,enterIcon:h=C.createElement(c5,null)}=e,f=C.useRef(null),v=C.useRef(!1),y=C.useRef(null),[b,w]=C.useState(u);C.useEffect(()=>{w(u)},[u]),C.useEffect(()=>{var M;if(!((M=f.current)===null||M===void 0)&&M.resizableTextArea){const{textArea:R}=f.current.resizableTextArea;R.focus();const{length:I}=R.value;R.setSelectionRange(I,I)}},[]);const x=({target:M})=>{w(M.value.replace(/[\n\r]/g,""))},E=()=>{v.current=!0},_=()=>{v.current=!1},$=({keyCode:M})=>{v.current||(y.current=M)},O=()=>{p(b.trim())},N=({keyCode:M,ctrlKey:R,altKey:I,metaKey:D,shiftKey:j})=>{y.current!==M||v.current||R||I||D||j||(M===mt.ENTER?(O(),c==null||c()):M===mt.ESC&&s())},k=()=>{O()},[L,F,P]=u_(t),A=ve(t,`${t}-edit-content`,{[`${t}-rtl`]:o==="rtl",[`${t}-${d}`]:!!d},r,F,P);return L(C.createElement("div",{className:A,style:i},C.createElement(a_,{ref:f,maxLength:l,value:b,onChange:x,onKeyDown:$,onKeyUp:N,onCompositionStart:E,onCompositionEnd:_,onBlur:k,"aria-label":n,rows:1,autoSize:m}),h!==null?Oo(h,{className:`${t}-edit-content-confirm`}):null))};var qp,cC;function C5(){return cC||(cC=1,qp=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,n=[],r=0;r"u"){m&&console.warn("unable to use e.clipboardData"),m&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var y=t[l.format]||t.default;window.clipboardData.setData(y,o)}else v.clipboardData.clearData(),v.clipboardData.setData(l.format,o);l.onCopy&&(v.preventDefault(),l.onCopy(v.clipboardData))}),document.body.appendChild(d),s.selectNodeContents(d),c.addRange(s);var f=document.execCommand("copy");if(!f)throw new Error("copy command was unsuccessful");h=!0}catch(v){m&&console.error("unable to copy using execCommand: ",v),m&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(l.format||"text",o),l.onCopy&&l.onCopy(window.clipboardData),h=!0}catch(y){m&&console.error("unable to copy using clipboardData: ",y),m&&console.error("falling back to prompt"),u=r("message"in l?l.message:n),window.prompt(u,o)}}finally{c&&(typeof c.removeRange=="function"?c.removeRange(s):c.removeAllRanges()),d&&document.body.removeChild(d),p()}return h}return Qp=i,Qp}var x5=$5();const E5=Cc(x5);var _5=function(e,t,n,r){function i(o){return o instanceof n?o:new n(function(l){l(o)})}return new(n||(n=Promise))(function(o,l){function m(s){try{p(r.next(s))}catch(c){l(c)}}function u(s){try{p(r.throw(s))}catch(c){l(c)}}function p(s){s.done?o(s.value):i(s.value).then(m,u)}p((r=r.apply(e,t||[])).next())})};const M5=({copyConfig:e,children:t})=>{const[n,r]=C.useState(!1),[i,o]=C.useState(!1),l=C.useRef(null),m=()=>{l.current&&clearTimeout(l.current)},u={};e.format&&(u.format=e.format),C.useEffect(()=>m,[]);const p=tr(s=>_5(void 0,void 0,void 0,function*(){var c;s==null||s.preventDefault(),s==null||s.stopPropagation(),o(!0);try{const d=typeof e.text=="function"?yield e.text():e.text;E5(d||BB(t,!0).join("")||"",u),o(!1),r(!0),m(),l.current=setTimeout(()=>{r(!1)},3e3),(c=e.onCopy)===null||c===void 0||c.call(e,s)}catch(d){throw o(!1),d}}));return{copied:n,copyLoading:i,onClick:p}};function Zp(e,t){return C.useMemo(()=>{const n=!!e;return[n,Object.assign(Object.assign({},t),n&&typeof e=="object"?e:null)]},[e])}const R5=e=>{const t=C.useRef(void 0);return C.useEffect(()=>{t.current=e}),t.current},O5=(e,t,n)=>C.useMemo(()=>e===!0?{title:t??n}:C.isValidElement(e)?{title:e}:typeof e=="object"?Object.assign({title:t??n},e):{title:e},[e,t,n]);var A5=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i{const{prefixCls:n,component:r="article",className:i,rootClassName:o,setContentRef:l,children:m,direction:u,style:p}=e,s=A5(e,["prefixCls","component","className","rootClassName","setContentRef","children","direction","style"]),{getPrefixCls:c,direction:d,className:h,style:f}=Ji("typography"),v=u??d,y=l?wi(t,l):t,b=c("typography",n),[w,x,E]=u_(b),_=ve(b,h,{[`${b}-rtl`]:v==="rtl"},i,o,x,E),$=Object.assign(Object.assign({},f),p);return w(C.createElement(r,Object.assign({className:_,style:$,ref:y},s),m))});function dC(e){return e===!1?[!1,!1]:Array.isArray(e)?e:[e]}function Jp(e,t,n){return e===!0||e===void 0?t:e||n&&t}function T5(e){const t=document.createElement("em");e.appendChild(t);const n=e.getBoundingClientRect(),r=t.getBoundingClientRect();return e.removeChild(t),n.left>r.left||r.right>n.right||n.top>r.top||r.bottom>n.bottom}const Yv=e=>["string","number"].includes(typeof e),I5=({prefixCls:e,copied:t,locale:n,iconOnly:r,tooltips:i,icon:o,tabIndex:l,onCopy:m,loading:u})=>{const p=dC(i),s=dC(o),{copied:c,copy:d}=n??{},h=t?c:d,f=Jp(p[t?1:0],h),v=typeof f=="string"?f:h;return C.createElement(nl,{title:f},C.createElement("button",{type:"button",className:ve(`${e}-copy`,{[`${e}-copy-success`]:t,[`${e}-copy-icon-only`]:r}),onClick:m,"aria-label":v,tabIndex:l},t?Jp(s[1],C.createElement(lE,null),!0):Jp(s[0],u?C.createElement(Tc,null):C.createElement(r5,null),!0)))},Qu=C.forwardRef(({style:e,children:t},n)=>{const r=C.useRef(null);return C.useImperativeHandle(n,()=>({isExceed:()=>{const i=r.current;return i.scrollHeight>i.clientHeight},getHeight:()=>r.current.clientHeight})),C.createElement("span",{"aria-hidden":!0,ref:r,style:Object.assign({position:"fixed",display:"block",left:0,top:0,pointerEvents:"none",backgroundColor:"rgba(255, 0, 0, 0.65)"},e)},t)}),L5=e=>e.reduce((t,n)=>t+(Yv(n)?String(n).length:1),0);function fC(e,t){let n=0;const r=[];for(let i=0;it){const p=t-n;return r.push(String(o).slice(0,p)),r}r.push(o),n=u}return e}const eg=0,tg=1,ng=2,rg=3,hC=4,Zu={display:"-webkit-box",overflow:"hidden",WebkitBoxOrient:"vertical"};function P5(e){const{enableMeasure:t,width:n,text:r,children:i,rows:o,expanded:l,miscDeps:m,onEllipsis:u}=e,p=C.useMemo(()=>li(r),[r]),s=C.useMemo(()=>L5(p),[r]),c=C.useMemo(()=>i(p,!1),[r]),[d,h]=C.useState(null),f=C.useRef(null),v=C.useRef(null),y=C.useRef(null),b=C.useRef(null),w=C.useRef(null),[x,E]=C.useState(!1),[_,$]=C.useState(eg),[O,N]=C.useState(0),[k,L]=C.useState(null);fn(()=>{$(t&&n&&s?tg:eg)},[n,r,o,t,p]),fn(()=>{var M,R,I,D;if(_===tg){$(ng);const j=v.current&&getComputedStyle(v.current).whiteSpace;L(j)}else if(_===ng){const j=!!(!((M=y.current)===null||M===void 0)&&M.isExceed());$(j?rg:hC),h(j?[0,s]:null),E(j);const B=((R=y.current)===null||R===void 0?void 0:R.getHeight())||0,V=o===1?0:((I=b.current)===null||I===void 0?void 0:I.getHeight())||0,H=((D=w.current)===null||D===void 0?void 0:D.getHeight())||0,Y=Math.max(B,V+H);N(Y+1),u(j)}},[_]);const F=d?Math.ceil((d[0]+d[1])/2):0;fn(()=>{var M;const[R,I]=d||[0,0];if(R!==I){const j=(((M=f.current)===null||M===void 0?void 0:M.getHeight())||0)>O;let B=F;I-R===1&&(B=j?R:I),h(j?[R,B]:[B,I])}},[d,F]);const P=C.useMemo(()=>{if(!t)return i(p,!1);if(_!==rg||!d||d[0]!==d[1]){const M=i(p,!1);return[hC,eg].includes(_)?M:C.createElement("span",{style:Object.assign(Object.assign({},Zu),{WebkitLineClamp:o})},M)}return i(l?p:fC(p,d[0]),x)},[l,_,d,p].concat(Ge(m))),A={width:n,margin:0,padding:0,whiteSpace:k==="nowrap"?"normal":"inherit"};return C.createElement(C.Fragment,null,P,_===ng&&C.createElement(C.Fragment,null,C.createElement(Qu,{style:Object.assign(Object.assign(Object.assign({},A),Zu),{WebkitLineClamp:o}),ref:y},c),C.createElement(Qu,{style:Object.assign(Object.assign(Object.assign({},A),Zu),{WebkitLineClamp:o-1}),ref:b},c),C.createElement(Qu,{style:Object.assign(Object.assign(Object.assign({},A),Zu),{WebkitLineClamp:1}),ref:w},i([],!0))),_===rg&&d&&d[0]!==d[1]&&C.createElement(Qu,{style:Object.assign(Object.assign({},A),{top:400}),ref:f},i(fC(p,F),!0)),_===tg&&C.createElement("span",{style:{whiteSpace:"inherit"},ref:v}))}const k5=({enableEllipsis:e,isEllipsis:t,children:n,tooltipProps:r})=>!(r!=null&&r.title)||!e?n:C.createElement(nl,Object.assign({open:t?void 0:!1},r),n);var N5=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i{var n;const{prefixCls:r,className:i,style:o,type:l,disabled:m,children:u,ellipsis:p,editable:s,copyable:c,component:d,title:h}=e,f=N5(e,["prefixCls","className","style","type","disabled","children","ellipsis","editable","copyable","component","title"]),{getPrefixCls:v,direction:y}=C.useContext(zt),[b]=Mc("Text"),w=C.useRef(null),x=C.useRef(null),E=v("typography",r),_=Er(f,pC),[$,O]=Zp(s),[N,k]=Pr(!1,{value:O.editing}),{triggerType:L=["icon"]}=O,F=te=>{var fe;te&&((fe=O.onStart)===null||fe===void 0||fe.call(O)),k(te)},P=R5(N);fn(()=>{var te;!N&&P&&((te=x.current)===null||te===void 0||te.focus())},[N]);const A=te=>{te==null||te.preventDefault(),F(!0)},M=te=>{var fe;(fe=O.onChange)===null||fe===void 0||fe.call(O,te),F(!1)},R=()=>{var te;(te=O.onCancel)===null||te===void 0||te.call(O),F(!1)},[I,D]=Zp(c),{copied:j,copyLoading:B,onClick:V}=M5({copyConfig:D,children:u}),[H,Y]=C.useState(!1),[U,K]=C.useState(!1),[G,q]=C.useState(!1),[Z,Q]=C.useState(!1),[J,ie]=C.useState(!0),[se,ae]=Zp(p,{expandable:!1,symbol:te=>te?b==null?void 0:b.collapse:b==null?void 0:b.expand}),[ge,me]=Pr(ae.defaultExpanded||!1,{value:ae.expanded}),de=se&&(!ge||ae.expandable==="collapsible"),{rows:we=1}=ae,Oe=C.useMemo(()=>de&&(ae.suffix!==void 0||ae.onEllipsis||ae.expandable||$||I),[de,ae,$,I]);fn(()=>{se&&!Oe&&(Y(nS("webkitLineClamp")),K(nS("textOverflow")))},[Oe,se]);const[xe,Pe]=C.useState(de),ze=C.useMemo(()=>Oe?!1:we===1?U:H,[Oe,U,H]);fn(()=>{Pe(ze&&de)},[ze,de]);const Ie=de&&(xe?Z:G),Ye=de&&we===1&&xe,Me=de&&we>1&&xe,ke=(te,fe)=>{var je;me(fe.expanded),(je=ae.onExpand)===null||je===void 0||je.call(ae,te,fe)},[Je,ce]=C.useState(0),Ee=({offsetWidth:te})=>{ce(te)},Re=te=>{var fe;q(te),G!==te&&((fe=ae.onEllipsis)===null||fe===void 0||fe.call(ae,te))};C.useEffect(()=>{const te=w.current;if(se&&xe&&te){const fe=T5(te);Z!==fe&&Q(fe)}},[se,xe,u,Me,J,Je]),C.useEffect(()=>{const te=w.current;if(typeof IntersectionObserver>"u"||!te||!xe||!de)return;const fe=new IntersectionObserver(()=>{ie(!!te.offsetParent)});return fe.observe(te),()=>{fe.disconnect()}},[xe,de]);const Ae=O5(ae.tooltip,O.text,u),De=C.useMemo(()=>{if(!(!se||xe))return[O.text,u,h,Ae.title].find(Yv)},[se,xe,h,Ae.title,Ie]);if(N)return C.createElement(S5,{value:(n=O.text)!==null&&n!==void 0?n:typeof u=="string"?u:"",onSave:M,onCancel:R,onEnd:O.onEnd,prefixCls:E,className:i,style:o,direction:y,component:d,maxLength:O.maxLength,autoSize:O.autoSize,enterIcon:O.enterIcon});const He=()=>{const{expandable:te,symbol:fe}=ae;return te?C.createElement("button",{type:"button",key:"expand",className:`${E}-${ge?"collapse":"expand"}`,onClick:je=>ke(je,{expanded:!ge}),"aria-label":ge?b.collapse:b==null?void 0:b.expand},typeof fe=="function"?fe(ge):fe):null},it=()=>{if(!$)return;const{icon:te,tooltip:fe,tabIndex:je}=O,ct=li(fe)[0]||(b==null?void 0:b.edit),Jt=typeof ct=="string"?ct:"";return L.includes("icon")?C.createElement(nl,{key:"edit",title:fe===!1?"":ct},C.createElement("button",{type:"button",ref:x,className:`${E}-edit`,onClick:A,"aria-label":Jt,tabIndex:je},te||C.createElement(a5,{role:"button"}))):null},Ne=()=>I?C.createElement(I5,Object.assign({key:"copy"},D,{prefixCls:E,copied:j,locale:b,onCopy:V,loading:B,iconOnly:u==null})):null,Te=te=>[te&&He(),it(),Ne()],We=te=>[te&&!ge&&C.createElement("span",{"aria-hidden":!0,key:"ellipsis"},F5),ae.suffix,Te(te)];return C.createElement(ki,{onResize:Ee,disabled:!de},te=>C.createElement(k5,{tooltipProps:Ae,enableEllipsis:de,isEllipsis:Ie},C.createElement(d_,Object.assign({className:ve({[`${E}-${l}`]:l,[`${E}-disabled`]:m,[`${E}-ellipsis`]:se,[`${E}-ellipsis-single-line`]:Ye,[`${E}-ellipsis-multiple-line`]:Me},i),prefixCls:r,style:Object.assign(Object.assign({},o),{WebkitLineClamp:Me?we:void 0}),component:d,ref:wi(te,w,t),direction:y,onClick:L.includes("text")?A:void 0,"aria-label":De==null?void 0:De.toString(),title:h},_),C.createElement(P5,{enableMeasure:de&&!xe,text:u,rows:we,width:Je,onEllipsis:Re,expanded:ge,miscDeps:[j,ge,B,$,I,b].concat(Ge(pC.map(fe=>e[fe])))},(fe,je)=>D5(e,C.createElement(C.Fragment,null,fe.length>0&&je&&!ge&&De?C.createElement("span",{key:"show-content","aria-hidden":!0},fe):fe,We(je)))))))});var z5=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i{var{ellipsis:n,rel:r}=e,i=z5(e,["ellipsis","rel"]);const o=Object.assign(Object.assign({},i),{rel:r===void 0&&i.target==="_blank"?"noopener noreferrer":r});return delete o.navigate,C.createElement(Ef,Object.assign({},o,{ref:t,ellipsis:!!n,component:"a"}))}),B5=C.forwardRef((e,t)=>C.createElement(Ef,Object.assign({ref:t},e,{component:"div"})));var H5=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i{var{ellipsis:n}=e,r=H5(e,["ellipsis"]);const i=C.useMemo(()=>n&&typeof n=="object"?Er(n,["expandable","rows"]):n,[n]);return C.createElement(Ef,Object.assign({ref:t},r,{ellipsis:i,component:"span"}))},V5=C.forwardRef(W5);var U5=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i{const{level:n=1}=e,r=U5(e,["level"]),i=G5.includes(n)?`h${n}`:"h1";return C.createElement(Ef,Object.assign({ref:t},r,{component:i}))}),zc=d_;zc.Text=V5;zc.Link=j5;zc.Title=K5;zc.Paragraph=B5;const Os={search:"search_full_catalog_refresh",on_search:"on_search_full_catalog_refresh",inc_search:"search_inc_refresh",inc_onsearch:"on_search_inc_refresh",select:"select",on_select:"on_select",select_out_of_stock:"select_out_of_stock",on_select_out_of_stock:"on_select_out_of_stock",init:"init",on_init:"on_init",confirm:"confirm",on_confirm:"on_confirm",cancel:"cancel",on_cancel:"on_cancel",on_status_pending:"on_status_pending",on_status_packed:"on_status_packed",on_status_picked:"on_status_picked",on_status_out_for_delivery:"on_status_out_for_delivery",on_status_delivered:"on_status_delivered",on_status_rto_delivered:"on_status_rto_delivered",on_update:"on_update",update:"update",update_settlement_part_cancel:"update_settlement_part_cancel",on_update_part_cancel:"on_update_part_cancel",update_liquidated:"update_liquidated",on_update_interim_liquidated:"on_update_interim_liquidated",on_update_liquidated:"on_update_liquidated",update_settlement_liquidated:"update_settlement_liquidated",catalog_rejection:"catalog_rejection",update_address:"update_address",on_update_address:"on_update_address",update_instructions:"update_instructions",on_update_instructions:"on_update_instructions"},Y5=["1","2","012","3","4","5","6","7","8","9","020","01C","008","003","00F","011","017","00D","00E","016","01F"],Jl={1:["search","on_search","inc_search","inc_onsearch"],2:["search","on_search","select","on_select","init","on_init","confirm","on_confirm","on_status_pending","on_status_packed","on_status_picked","on_status_out_for_delivery","on_status_delivered"],3:["search","on_search","select_out_of_stock","on_select_out_of_stock","select","on_select","init","on_init","confirm","on_confirm","on_status_pending","on_status_packed","on_status_picked","on_status_out_for_delivery","on_status_delivered"],4:["search","on_search","select","on_select","init","on_init","confirm","on_confirm","cancel","on_cancel"],5:["search","on_search","select","on_select","init","on_init","confirm","on_confirm","on_update_part_cancel","update_settlement_part_cancel","on_status_pending","on_status_packed","on_status_picked","on_status_out_for_delivery","on_cancel","on_status_rto_delivered"],6:["search","on_search","select","on_select","init","on_init","confirm","on_confirm","on_status_pending","on_status_packed","on_status_picked","on_status_out_for_delivery","on_status_delivered","update_liquidated","on_update_interim_liquidated","on_update_liquidated","update_settlement_liquidated"],7:["search","on_search","catalog_rejection"],8:["search","on_search"],9:["inc_search","inc_onsearch","catalog_rejection"],"020":["search","on_search","select","on_select","init","on_init","confirm","on_confirm","on_status_pending","on_status_packed","on_status_picked","on_status_out_for_delivery","on_status_delivered"],"01C":["search","on_search","select","on_select","init","on_init","confirm","on_confirm","on_status_pending","on_status_packed","on_status_picked","on_status_out_for_delivery","on_status_delivered"],"008":["search","on_search","select","on_select","init","on_init"],"003":["search","on_search","select","on_select","init","on_init","confirm","on_confirm","on_status_pending","on_status_packed","on_status_picked"],"00F":["search","on_search","select","on_select","init","on_init","confirm","on_confirm","update_address","on_update_address"],"011":["search","on_search","select","on_select","init","on_init","confirm","on_confirm","update_instructions","on_update_instructions"],"017":["search","on_search","select","on_select","init","on_init","confirm","on_confirm","on_status_pending","on_status_packed","on_status_picked","on_status_out_for_delivery","on_status_delivered","on_update","on_cancel"],"00D":["search","on_search","select","on_select","init","on_init","confirm","on_confirm","on_status_pending","on_status_packed","on_status_picked","on_status_out_for_delivery","on_status_delivered","cancel","on_cancel"],"00E":["search","on_search","select","on_select","init","on_init","confirm","on_confirm","on_status_pending","on_status_packed","on_status_picked","update"],"012":["search","on_search","select","on_select","init","on_init","confirm","on_confirm","on_status_pending","on_status_packed","on_status_picked","on_status_out_for_delivery","on_status_delivered"],"016":["search","on_search","select","on_select","init","on_init","confirm","on_confirm"],"01F":["search","on_search","select","on_select","init","on_init","confirm","on_confirm"]},X5=Bn.div` + padding: 1.5rem 2rem; + background-color: var(--color-white); + border-bottom: 1px solid var(--color-light); + width: 100%; + + input { + &:hover{ + border-color:var(--color-primary) !important; + } +} +`,q5=Bn(Xr)` + width: 100%; + + .ant-form-item-label > label { + color: var(--color-primary); + font-weight: 500; + } +`,Q5=Bn(Xa)` + width: 100%; + select{ + &:hover{ + border-color:var(--color-primary) !important; +}} +`,Z5=({onFormChange:e})=>{const[t]=Xr.useForm(),n=()=>{const r=t.getFieldsValue();e(r)};return qe.jsx(X5,{children:qe.jsx(q5,{form:t,layout:"horizontal",onValuesChange:n,children:qe.jsxs(VE,{gutter:24,children:[qe.jsx(Ta,{xs:24,sm:12,md:4,children:qe.jsx(Xr.Item,{label:"Domain",name:"domain",rules:[{required:!0,message:"Please enter domain!"}],children:qe.jsx(_o,{placeholder:"Enter domain"})})}),qe.jsx(Ta,{xs:24,sm:12,md:4,children:qe.jsx(Xr.Item,{label:"Version",name:"version",rules:[{required:!0,message:"Please enter version!"}],children:qe.jsx(_o,{placeholder:"Enter version"})})}),qe.jsx(Ta,{xs:24,sm:12,md:5,children:qe.jsx(Xr.Item,{label:"BPP ID",name:"bppId",rules:[{required:!0,message:"Please enter BPP ID!"}],children:qe.jsx(_o,{placeholder:"Enter BPP ID"})})}),qe.jsx(Ta,{xs:24,sm:12,md:5,children:qe.jsx(Xr.Item,{label:"BAP ID",name:"bapId",rules:[{required:!0,message:"Please enter BAP ID!"}],children:qe.jsx(_o,{placeholder:"Enter BAP ID"})})}),qe.jsx(Ta,{xs:24,md:6,children:qe.jsx(Xr.Item,{label:"Flow Name",name:"flowName",rules:[{required:!0,message:"Please select a flow!"}],children:qe.jsx(Q5,{placeholder:"Select a flow",children:Y5.map(r=>qe.jsxs(Xa.Option,{value:r,children:["Flow ",r]},r))})})})]})})})};var ea={},ta={},ig={exports:{}},gC;function jd(){return gC||(gC=1,function(e,t){(function(){var n="ace",r=function(){return this}();!r&&typeof window<"u"&&(r=window);var i=function(s,c,d){if(typeof s!="string"){i.original?i.original.apply(this,arguments):(console.error("dropping module because define wasn't a string."),console.trace());return}arguments.length==2&&(d=c),i.modules[s]||(i.payloads[s]=d,i.modules[s]=null)};i.modules={},i.payloads={};var o=function(s,c,d){if(typeof c=="string"){var h=u(s,c);if(h!=null)return d&&d(),h}else if(Object.prototype.toString.call(c)==="[object Array]"){for(var f=[],v=0,y=c.length;vu.length)&&(m=u.length),m-=l.length;var p=u.indexOf(l,m);return p!==-1&&p===m}),String.prototype.repeat||o(String.prototype,"repeat",function(l){for(var m="",u=this;l>0;)l&1&&(m+=u),(l>>=1)&&(u+=u);return m}),String.prototype.includes||o(String.prototype,"includes",function(l,m){return this.indexOf(l,m)!=-1}),Object.assign||(Object.assign=function(l){if(l==null)throw new TypeError("Cannot convert undefined or null to object");for(var m=Object(l),u=1;u>>0,p=arguments[1],s=p>>0,c=s<0?Math.max(u+s,0):Math.min(s,u),d=arguments[2],h=d===void 0?u:d>>0,f=h<0?Math.max(u+h,0):Math.min(h,u);c0;)u&1&&(p+=m),(u>>=1)&&(m+=m);return p};var o=/^\s\s*/,l=/\s\s*$/;r.stringTrimLeft=function(m){return m.replace(o,"")},r.stringTrimRight=function(m){return m.replace(l,"")},r.copyObject=function(m){var u={};for(var p in m)u[p]=m[p];return u},r.copyArray=function(m){for(var u=[],p=0,s=m.length;p65535?2:1}}),ace.define("ace/lib/useragent",["require","exports","module"],function(n,r,i){r.OS={LINUX:"LINUX",MAC:"MAC",WINDOWS:"WINDOWS"},r.getOS=function(){return r.isMac?r.OS.MAC:r.isLinux?r.OS.LINUX:r.OS.WINDOWS};var o=typeof navigator=="object"?navigator:{},l=(/mac|win|linux/i.exec(o.platform)||["other"])[0].toLowerCase(),m=o.userAgent||"",u=o.appName||"";r.isWin=l=="win",r.isMac=l=="mac",r.isLinux=l=="linux",r.isIE=u=="Microsoft Internet Explorer"||u.indexOf("MSAppHost")>=0?parseFloat((m.match(/(?:MSIE |Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/)||[])[1]):parseFloat((m.match(/(?:Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/)||[])[1]),r.isOldIE=r.isIE&&r.isIE<9,r.isGecko=r.isMozilla=m.match(/ Gecko\/\d+/),r.isOpera=typeof opera=="object"&&Object.prototype.toString.call(window.opera)=="[object Opera]",r.isWebKit=parseFloat(m.split("WebKit/")[1])||void 0,r.isChrome=parseFloat(m.split(" Chrome/")[1])||void 0,r.isSafari=parseFloat(m.split(" Safari/")[1])&&!r.isChrome||void 0,r.isEdge=parseFloat(m.split(" Edge/")[1])||void 0,r.isAIR=m.indexOf("AdobeAIR")>=0,r.isAndroid=m.indexOf("Android")>=0,r.isChromeOS=m.indexOf(" CrOS ")>=0,r.isIOS=/iPad|iPhone|iPod/.test(m)&&!window.MSStream,r.isIOS&&(r.isMac=!0),r.isMobile=r.isIOS||r.isAndroid}),ace.define("ace/lib/dom",["require","exports","module","ace/lib/useragent"],function(n,r,i){var o=n("./useragent"),l="http://www.w3.org/1999/xhtml";r.buildDom=function d(h,f,v){if(typeof h=="string"&&h){var y=document.createTextNode(h);return f&&f.appendChild(y),y}if(!Array.isArray(h))return h&&h.appendChild&&f&&f.appendChild(h),h;if(typeof h[0]!="string"||!h[0]){for(var b=[],w=0;w"u")){if(u){if(f)p();else if(f===!1)return u.push([d,h])}if(!m){var v=f;!f||!f.getRootNode?v=document:(v=f.getRootNode(),(!v||v==f)&&(v=document));var y=v.ownerDocument||v;if(h&&r.hasCssString(h,v))return null;h&&(d+=` +/*# sourceURL=ace/css/`+h+" */");var b=r.createElement("style");b.appendChild(y.createTextNode(d)),h&&(b.id=h),v==y&&(v=r.getDocumentHead(y)),v.insertBefore(b,v.firstChild)}}}if(r.importCssString=s,r.importCssStylsheet=function(d,h){r.buildDom(["link",{rel:"stylesheet",href:d}],r.getDocumentHead(h))},r.scrollbarWidth=function(d){var h=r.createElement("ace_inner");h.style.width="100%",h.style.minWidth="0px",h.style.height="200px",h.style.display="block";var f=r.createElement("ace_outer"),v=f.style;v.position="absolute",v.left="-10000px",v.overflow="hidden",v.width="200px",v.minWidth="0px",v.height="150px",v.display="block",f.appendChild(h);var y=d&&d.documentElement||document&&document.documentElement;if(!y)return 0;y.appendChild(f);var b=h.offsetWidth;v.overflow="scroll";var w=h.offsetWidth;return b===w&&(w=f.clientWidth),y.removeChild(f),b-w},r.computedStyle=function(d,h){return window.getComputedStyle(d,"")||{}},r.setStyle=function(d,h,f){d[h]!==f&&(d[h]=f)},r.HAS_CSS_ANIMATION=!1,r.HAS_CSS_TRANSFORMS=!1,r.HI_DPI=o.isWin?typeof window<"u"&&window.devicePixelRatio>=1.5:!0,o.isChromeOS&&(r.HI_DPI=!1),typeof document<"u"){var c=document.createElement("div");r.HI_DPI&&c.style.transform!==void 0&&(r.HAS_CSS_TRANSFORMS=!0),!o.isEdge&&typeof c.style.animationName<"u"&&(r.HAS_CSS_ANIMATION=!0),c=null}r.HAS_CSS_TRANSFORMS?r.translate=function(d,h,f){d.style.transform="translate("+Math.round(h)+"px, "+Math.round(f)+"px)"}:r.translate=function(d,h,f){d.style.top=Math.round(f)+"px",d.style.left=Math.round(h)+"px"}}),ace.define("ace/lib/net",["require","exports","module","ace/lib/dom"],function(n,r,i){/* +* based on code from: +* +* @license RequireJS text 0.25.0 Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved. +* Available via the MIT or new BSD license. +* see: http://github.com/jrburke/requirejs for details +*/var o=n("./dom");r.get=function(l,m){var u=new XMLHttpRequest;u.open("GET",l,!0),u.onreadystatechange=function(){u.readyState===4&&m(u.responseText)},u.send(null)},r.loadScript=function(l,m){var u=o.getDocumentHead(),p=document.createElement("script");p.src=l,u.appendChild(p),p.onload=p.onreadystatechange=function(s,c){(c||!p.readyState||p.readyState=="loaded"||p.readyState=="complete")&&(p=p.onload=p.onreadystatechange=null,c||m())}},r.qualifyURL=function(l){var m=document.createElement("a");return m.href=l,m.href}}),ace.define("ace/lib/oop",["require","exports","module"],function(n,r,i){r.inherits=function(o,l){o.super_=l,o.prototype=Object.create(l.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}})},r.mixin=function(o,l){for(var m in l)o[m]=l[m];return o},r.implement=function(o,l){r.mixin(o,l)}}),ace.define("ace/lib/event_emitter",["require","exports","module"],function(n,r,i){var o={},l=function(){this.propagationStopped=!0},m=function(){this.defaultPrevented=!0};o._emit=o._dispatchEvent=function(u,p){this._eventRegistry||(this._eventRegistry={}),this._defaultHandlers||(this._defaultHandlers={});var s=this._eventRegistry[u]||[],c=this._defaultHandlers[u];if(!(!s.length&&!c)){(typeof p!="object"||!p)&&(p={}),p.type||(p.type=u),p.stopPropagation||(p.stopPropagation=l),p.preventDefault||(p.preventDefault=m),s=s.slice();for(var d=0;d1&&(b=v[v.length-2]);var x=p[f+"Path"];return x==null?x=p.basePath:y=="/"&&(f=y=""),x&&x.slice(-1)!="/"&&(x+="/"),x+f+y+b+this.get("suffix")},r.setModuleUrl=function(h,f){return p.$moduleUrls[h]=f};var s=function(h,f){if(h==="ace/theme/textmate"||h==="./theme/textmate")return f(null,n("./theme/textmate"));if(c)return c(h,f);console.error("loader is not configured")},c;r.setLoader=function(h){c=h},r.dynamicModules=Object.create(null),r.$loading={},r.$loaded={},r.loadModule=function(h,f){var v;if(Array.isArray(h))var y=h[0],b=h[1];else if(typeof h=="string")var b=h;var w=function(x){if(x&&!r.$loading[b])return f&&f(x);if(r.$loading[b]||(r.$loading[b]=[]),r.$loading[b].push(f),!(r.$loading[b].length>1)){var E=function(){s(b,function(_,$){$&&(r.$loaded[b]=$),r._emit("load.module",{name:b,module:$});var O=r.$loading[b];r.$loading[b]=null,O.forEach(function(N){N&&N($)})})};if(!r.get("packaged"))return E();l.loadScript(r.moduleUrl(b,y),E),d()}};if(r.dynamicModules[b])r.dynamicModules[b]().then(function(x){x.default?w(x.default):w(x)});else{try{v=this.$require(b)}catch{}w(v||r.$loaded[b])}},r.$require=function(h){if(typeof i.require=="function"){var f="require";return i[f](h)}},r.setModuleLoader=function(h,f){r.dynamicModules[h]=f};var d=function(){!p.basePath&&!p.workerPath&&!p.modePath&&!p.themePath&&!Object.keys(p.$moduleUrls).length&&(console.error("Unable to infer path to ace from script src,","use ace.config.set('basePath', 'path') to enable dynamic loading of modes and themes","or with webpack use ace/webpack-resolver"),d=function(){})};r.version="1.41.0"}),ace.define("ace/loader_build",["require","exports","module","ace/lib/fixoldbrowsers","ace/config"],function(n,r,i){n("./lib/fixoldbrowsers");var o=n("./config");o.setLoader(function(p,s){n([p],function(c){s(null,c)})});var l=function(){return this||typeof window<"u"&&window}();i.exports=function(p){o.init=m,o.$require=n,p.require=n},m(!0);function m(p){if(!(!l||!l.document)){o.set("packaged",p||n.packaged||i.packaged||l.define&&(void 0).packaged);var s={},c="",d=document.currentScript||document._currentScript,h=d&&d.ownerDocument||document;d&&d.src&&(c=d.src.split(/[?#]/)[0].split("/").slice(0,-1).join("/")||"");for(var f=h.getElementsByTagName("script"),v=0;v ["+this.end.row+"/"+this.end.column+"]"},l.prototype.contains=function(m,u){return this.compare(m,u)==0},l.prototype.compareRange=function(m){var u,p=m.end,s=m.start;return u=this.compare(p.row,p.column),u==1?(u=this.compare(s.row,s.column),u==1?2:u==0?1:0):u==-1?-2:(u=this.compare(s.row,s.column),u==-1?-1:u==1?42:0)},l.prototype.comparePoint=function(m){return this.compare(m.row,m.column)},l.prototype.containsRange=function(m){return this.comparePoint(m.start)==0&&this.comparePoint(m.end)==0},l.prototype.intersects=function(m){var u=this.compareRange(m);return u==-1||u==0||u==1},l.prototype.isEnd=function(m,u){return this.end.row==m&&this.end.column==u},l.prototype.isStart=function(m,u){return this.start.row==m&&this.start.column==u},l.prototype.setStart=function(m,u){typeof m=="object"?(this.start.column=m.column,this.start.row=m.row):(this.start.row=m,this.start.column=u)},l.prototype.setEnd=function(m,u){typeof m=="object"?(this.end.column=m.column,this.end.row=m.row):(this.end.row=m,this.end.column=u)},l.prototype.inside=function(m,u){return this.compare(m,u)==0?!(this.isEnd(m,u)||this.isStart(m,u)):!1},l.prototype.insideStart=function(m,u){return this.compare(m,u)==0?!this.isEnd(m,u):!1},l.prototype.insideEnd=function(m,u){return this.compare(m,u)==0?!this.isStart(m,u):!1},l.prototype.compare=function(m,u){return!this.isMultiLine()&&m===this.start.row?uthis.end.column?1:0:mthis.end.row?1:this.start.row===m?u>=this.start.column?0:-1:this.end.row===m?u<=this.end.column?0:1:0},l.prototype.compareStart=function(m,u){return this.start.row==m&&this.start.column==u?-1:this.compare(m,u)},l.prototype.compareEnd=function(m,u){return this.end.row==m&&this.end.column==u?1:this.compare(m,u)},l.prototype.compareInside=function(m,u){return this.end.row==m&&this.end.column==u?1:this.start.row==m&&this.start.column==u?-1:this.compare(m,u)},l.prototype.clipRows=function(m,u){if(this.end.row>u)var p={row:u+1,column:0};else if(this.end.rowu)var s={row:u+1,column:0};else if(this.start.row1?(N++,N>4&&(N=1)):N=1,l.isIE){var R=Math.abs(M.clientX-k)>5||Math.abs(M.clientY-L)>5;(!F||R)&&(N=1),F&&clearTimeout(F),F=setTimeout(function(){F=null},E[N-1]||600),N==1&&(k=M.clientX,L=M.clientY)}if(M._clicks=N,_[$]("mousedown",M),N>4)N=0;else if(N>1)return _[$](P[N],M)}Array.isArray(x)||(x=[x]),x.forEach(function(M){h(M,"mousedown",A,O)})};function v(x){return 0|(x.ctrlKey?1:0)|(x.altKey?2:0)|(x.shiftKey?4:0)|(x.metaKey?8:0)}r.getModifierString=function(x){return o.KEY_MODS[v(x)]};function y(x,E,_){var $=v(E);if(!_&&E.code&&(_=o.$codeToKeyCode[E.code]||_),!l.isMac&&m){if(E.getModifierState&&(E.getModifierState("OS")||E.getModifierState("Win"))&&($|=8),m.altGr)if((3&$)!=3)m.altGr=0;else return;if(_===18||_===17){var O=E.location;if(_===17&&O===1)m[_]==1&&(u=E.timeStamp);else if(_===18&&$===3&&O===2){var N=E.timeStamp-u;N<50&&(m.altGr=!0)}}}if(_ in o.MODIFIER_KEYS&&(_=-1),!(!$&&_===13&&E.location===3&&(x(E,$,-_),E.defaultPrevented))){if(l.isChromeOS&&$&8){if(x(E,$,_),E.defaultPrevented)return;$&=-9}return!$&&!(_ in o.FUNCTION_KEYS)&&!(_ in o.PRINTABLE_KEYS)?!1:x(E,$,_)}}r.addCommandKeyListener=function(x,E,_){var $=null;h(x,"keydown",function(O){m[O.keyCode]=(m[O.keyCode]||0)+1;var N=y(E,O,O.keyCode);return $=O.defaultPrevented,N},_),h(x,"keypress",function(O){$&&(O.ctrlKey||O.altKey||O.shiftKey||O.metaKey)&&(r.stopEvent(O),$=null)},_),h(x,"keyup",function(O){m[O.keyCode]=null},_),m||(b(),h(window,"focus",b))};function b(){m=Object.create(null)}if(typeof window=="object"&&window.postMessage&&!l.isOldIE){var w=1;r.nextTick=function(x,E){E=E||window;var _="zero-timeout-message-"+w++,$=function(O){O.data==_&&(r.stopPropagation(O),f(E,"message",$),x())};h(E,"message",$),E.postMessage(_,"*")}}r.$idleBlocked=!1,r.onIdle=function(x,E){return setTimeout(function _(){r.$idleBlocked?setTimeout(_,100):x()},E)},r.$idleBlockId=null,r.blockIdle=function(x){r.$idleBlockId&&clearTimeout(r.$idleBlockId),r.$idleBlocked=!0,r.$idleBlockId=setTimeout(function(){r.$idleBlocked=!1},x||100)},r.nextFrame=typeof window=="object"&&(window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||window.oRequestAnimationFrame),r.nextFrame?r.nextFrame=r.nextFrame.bind(window):r.nextFrame=function(x){setTimeout(x,17)}}),ace.define("ace/clipboard",["require","exports","module"],function(n,r,i){var o;i.exports={lineMode:!1,pasteCancelled:function(){return o&&o>Date.now()-50?!0:o=!1},cancel:function(){o=Date.now()}}}),ace.define("ace/keyboard/textinput",["require","exports","module","ace/lib/event","ace/config","ace/lib/useragent","ace/lib/dom","ace/lib/lang","ace/clipboard","ace/lib/keys"],function(n,r,i){var o=n("../lib/event"),l=n("../config").nls,m=n("../lib/useragent"),u=n("../lib/dom"),p=n("../lib/lang"),s=n("../clipboard"),c=m.isChrome<18,d=m.isIE,h=m.isChrome>63,f=400,v=n("../lib/keys"),y=v.KEY_MODS,b=m.isIOS,w=b?/\s/:/\n/,x=m.isMobile,E;E=function(_,$){var O=u.createElement("textarea");O.className="ace_text-input",O.setAttribute("wrap","off"),O.setAttribute("autocorrect","off"),O.setAttribute("autocapitalize","off"),O.setAttribute("spellcheck","false"),O.style.opacity="0",_.insertBefore(O,_.firstChild),this.setHost=function(ce){$=ce};var N=!1,k=!1,L=!1,F=!1,P="";x||(O.style.fontSize="1px");var A=!1,M=!1,R="",I=0,D=0,j=0,B=Number.MAX_SAFE_INTEGER,V=Number.MIN_SAFE_INTEGER,H=0;try{var Y=document.activeElement===O}catch{}this.setNumberOfExtraLines=function(ce){if(B=Number.MAX_SAFE_INTEGER,V=Number.MIN_SAFE_INTEGER,ce<0){H=0;return}H=ce},this.setAriaLabel=function(){var ce="";if($.$textInputAriaLabel&&(ce+="".concat($.$textInputAriaLabel,", ")),$.session){var Ee=$.session.selection.cursor.row;ce+=l("text-input.aria-label","Cursor at row $0",[Ee+1])}O.setAttribute("aria-label",ce)},this.setAriaOptions=function(ce){ce.activeDescendant?(O.setAttribute("aria-haspopup","true"),O.setAttribute("aria-autocomplete",ce.inline?"both":"list"),O.setAttribute("aria-activedescendant",ce.activeDescendant)):(O.setAttribute("aria-haspopup","false"),O.setAttribute("aria-autocomplete","both"),O.removeAttribute("aria-activedescendant")),ce.role&&O.setAttribute("role",ce.role),ce.setLabel&&(O.setAttribute("aria-roledescription",l("text-input.aria-roledescription","editor")),this.setAriaLabel())},this.setAriaOptions({role:"textbox"}),o.addListener(O,"blur",function(ce){M||($.onBlur(ce),Y=!1)},$),o.addListener(O,"focus",function(ce){if(!M){if(Y=!0,m.isEdge)try{if(!document.hasFocus())return}catch{}$.onFocus(ce),m.isEdge?setTimeout(K):K()}},$),this.$focusScroll=!1,this.focus=function(){if(this.setAriaOptions({setLabel:$.renderer.enableKeyboardAccessibility}),P||h||this.$focusScroll=="browser")return O.focus({preventScroll:!0});var ce=O.style.top;O.style.position="fixed",O.style.top="0px";try{var Ee=O.getBoundingClientRect().top!=0}catch{return}var Re=[];if(Ee)for(var Ae=O.parentElement;Ae&&Ae.nodeType==1;)Re.push(Ae),Ae.setAttribute("ace_nocontext","true"),!Ae.parentElement&&Ae.getRootNode?Ae=Ae.getRootNode().host:Ae=Ae.parentElement;O.focus({preventScroll:!0}),Ee&&Re.forEach(function(De){De.removeAttribute("ace_nocontext")}),setTimeout(function(){O.style.position="",O.style.top=="0px"&&(O.style.top=ce)},0)},this.blur=function(){O.blur()},this.isFocused=function(){return Y},$.on("beforeEndOperation",function(){var ce=$.curOp,Ee=ce&&ce.command&&ce.command.name;if(Ee!="insertstring"){var Re=Ee&&(ce.docChanged||ce.selectionChanged);L&&Re&&(R=O.value="",xe()),K()}}),$.on("changeSelection",this.setAriaLabel);var U=function(ce,Ee){for(var Re=Ee,Ae=1;Ae<=ce-B&&Ae<2*H+1;Ae++)Re+=$.session.getLine(ce-Ae).length+1;return Re},K=b?function(ce){if(!(!Y||N&&!ce||F)){ce||(ce="");var Ee=` + ab`+ce+`cde fg +`;Ee!=O.value&&(O.value=R=Ee);var Re=4,Ae=4+(ce.length||($.selection.isEmpty()?0:1));(I!=Re||D!=Ae)&&O.setSelectionRange(Re,Ae),I=Re,D=Ae}}:function(){if(!(L||F)&&!(!Y&&!Q)){L=!0;var ce=0,Ee=0,Re="";if($.session){var Ae=$.selection,De=Ae.getRange(),He=Ae.cursor.row;He===V+1?(B=V+1,V=B+2*H):He===B-1?(V=B-1,B=V-2*H):(HeV+1)&&(B=He>H?He-H:0,V=He>H?He+H:2*H);for(var it=[],Ne=B;Ne<=V;Ne++)it.push($.session.getLine(Ne));if(Re=it.join(` +`),ce=U(De.start.row,De.start.column),Ee=U(De.end.row,De.end.column),De.start.rowV){var We=$.session.getLine(V+1);Ee=De.end.row>V+1?We.length:De.end.column,Ee+=Re.length+1,Re=Re+` +`+We}else x&&He>0&&(Re=` +`+Re,Ee+=1,ce+=1);Re.length>f&&(ce=R.length&&ce.value===R&&R&&ce.selectionEnd!==D},q=function(ce){L||(N?N=!1:G(O)?($.selectAll(),K()):x&&O.selectionStart!=I&&K())},Z=null;this.setInputHandler=function(ce){Z=ce},this.getInputHandler=function(){return Z};var Q=!1,J=function(ce,Ee){if(Q&&(Q=!1),k)return K(),ce&&$.onPaste(ce),k=!1,"";for(var Re=O.selectionStart,Ae=O.selectionEnd,De=I,He=R.length-D,it=ce,Ne=ce.length-Re,Te=ce.length-Ae,We=0;De>0&&R[We]==ce[We];)We++,De--;for(it=it.slice(We),We=1;He>0&&R.length-We>I-1&&R[R.length-We]==ce[ce.length-We];)We++,He--;Ne-=We-1,Te-=We-1;var te=it.length-We+1;if(te<0&&(De=-te,te=0),it=it.slice(0,te),!Ee&&!it&&!Ne&&!De&&!He&&!Te)return"";F=!0;var fe=!1;return m.isAndroid&&it==". "&&(it=" ",fe=!0),it&&!De&&!He&&!Ne&&!Te||A?$.onTextInput(it):$.onTextInput(it,{extendLeft:De,extendRight:He,restoreStart:Ne,restoreEnd:Te}),F=!1,R=ce,I=Re,D=Ae,j=Te,fe?` +`:it},ie=function(ce){if(L)return Oe();if(ce&&ce.inputType){if(ce.inputType=="historyUndo")return $.execCommand("undo");if(ce.inputType=="historyRedo")return $.execCommand("redo")}var Ee=O.value,Re=J(Ee,!0);(Ee.length>f+100||w.test(Re)||x&&I<1&&I==D)&&K()},se=function(ce,Ee,Re){var Ae=ce.clipboardData||window.clipboardData;if(!(!Ae||c)){var De=d||Re?"Text":"text/plain";try{return Ee?Ae.setData(De,Ee)!==!1:Ae.getData(De)}catch(He){if(!Re)return se(He,Ee,!0)}}},ae=function(ce,Ee){var Re=$.getCopyText();if(!Re)return o.preventDefault(ce);se(ce,Re)?(b&&(K(Re),N=Re,setTimeout(function(){N=!1},10)),Ee?$.onCut():$.onCopy(),o.preventDefault(ce)):(N=!0,O.value=Re,O.select(),setTimeout(function(){N=!1,K(),Ee?$.onCut():$.onCopy()}))},ge=function(ce){ae(ce,!0)},me=function(ce){ae(ce,!1)},de=function(ce){var Ee=se(ce);s.pasteCancelled()||(typeof Ee=="string"?(Ee&&$.onPaste(Ee,ce),m.isIE&&setTimeout(K),o.preventDefault(ce)):(O.value="",k=!0))};o.addCommandKeyListener(O,function(ce,Ee,Re){if(!L)return $.onCommandKey(ce,Ee,Re)},$),o.addListener(O,"select",q,$),o.addListener(O,"input",ie,$),o.addListener(O,"cut",ge,$),o.addListener(O,"copy",me,$),o.addListener(O,"paste",de,$),(!("oncut"in O)||!("oncopy"in O)||!("onpaste"in O))&&o.addListener(_,"keydown",function(ce){if(!(m.isMac&&!ce.metaKey||!ce.ctrlKey))switch(ce.keyCode){case 67:me(ce);break;case 86:de(ce);break;case 88:ge(ce);break}},$);var we=function(ce){if(!(L||!$.onCompositionStart||$.$readOnly)&&(L={},!A)){ce.data&&(L.useTextareaForIME=!1),setTimeout(Oe,0),$._signal("compositionStart"),$.on("mousedown",Pe);var Ee=$.getSelectionRange();Ee.end.row=Ee.start.row,Ee.end.column=Ee.start.column,L.markerRange=Ee,L.selectionStart=I,$.onCompositionStart(L),L.useTextareaForIME?(R=O.value="",I=0,D=0):(O.msGetInputContext&&(L.context=O.msGetInputContext()),O.getInputContext&&(L.context=O.getInputContext()))}},Oe=function(){if(!(!L||!$.onCompositionUpdate||$.$readOnly)){if(A)return Pe();if(L.useTextareaForIME)$.onCompositionUpdate(O.value);else{var ce=O.value;J(ce),L.markerRange&&(L.context&&(L.markerRange.start.column=L.selectionStart=L.context.compositionStartOffset),L.markerRange.end.column=L.markerRange.start.column+D-L.selectionStart+j)}}},xe=function(ce){!$.onCompositionEnd||$.$readOnly||(L=!1,$.onCompositionEnd(),$.off("mousedown",Pe),ce&&ie())};function Pe(){M=!0,O.blur(),O.focus(),M=!1}var ze=p.delayedCall(Oe,50).schedule.bind(null,null);function Ie(ce){ce.keyCode==27&&O.value.lengthD&&R[Te]==` +`?We=v.end:NeD&&R.slice(0,Te).split(` +`).length>2?We=v.down:Te>D&&R[Te-1]==" "?(We=v.right,te=y.option):(Te>D||Te==D&&D!=I&&Ne==Te)&&(We=v.right),Ne!==Te&&(te|=y.shift),We){var fe=Ee.onCommandKey({},te,We);if(!fe&&Ee.commands){We=v.keyCodeToString(We);var je=Ee.commands.findKeyCommand(te,We);je&&Ee.execCommand(je)}I=Ne,D=Te,K("")}}};document.addEventListener("selectionchange",He),Ee.on("destroy",function(){document.removeEventListener("selectionchange",He)})}this.destroy=function(){O.parentElement&&O.parentElement.removeChild(O)}},r.TextInput=E,r.$setUserAgentForTests=function(_,$){x=_,b=$}}),ace.define("ace/mouse/default_handlers",["require","exports","module","ace/lib/useragent"],function(n,r,i){var o=n("../lib/useragent"),l=0,m=550,u=function(){function c(d){d.$clickSelection=null;var h=d.editor;h.setDefaultHandler("mousedown",this.onMouseDown.bind(d)),h.setDefaultHandler("dblclick",this.onDoubleClick.bind(d)),h.setDefaultHandler("tripleclick",this.onTripleClick.bind(d)),h.setDefaultHandler("quadclick",this.onQuadClick.bind(d)),h.setDefaultHandler("mousewheel",this.onMouseWheel.bind(d));var f=["select","startSelect","selectEnd","selectAllEnd","selectByWordsEnd","selectByLinesEnd","dragWait","dragWaitEnd","focusWait"];f.forEach(function(v){d[v]=this[v]},this),d.selectByLines=this.extendSelectionBy.bind(d,"getLineRange"),d.selectByWords=this.extendSelectionBy.bind(d,"getWordRange")}return c.prototype.onMouseDown=function(d){var h=d.inSelection(),f=d.getDocumentPosition();this.mousedownEvent=d;var v=this.editor,y=d.getButton();if(y!==0){var b=v.getSelectionRange(),w=b.isEmpty();(w||y==1)&&v.selection.moveToPosition(f),y==2&&(v.textInput.onContextMenu(d.domEvent),o.isMozilla||d.preventDefault());return}if(this.mousedownEvent.time=Date.now(),h&&!v.isFocused()&&(v.focus(),this.$focusTimeout&&!this.$clickSelection&&!v.inMultiSelectMode)){this.setState("focusWait"),this.captureMouse(d);return}return this.captureMouse(d),this.startSelect(f,d.domEvent._clicks>1),d.preventDefault()},c.prototype.startSelect=function(d,h){d=d||this.editor.renderer.screenToTextCoordinates(this.x,this.y);var f=this.editor;this.mousedownEvent&&(this.mousedownEvent.getShiftKey()?f.selection.selectToPosition(d):h||f.selection.moveToPosition(d),h||this.select(),f.setStyle("ace_selecting"),this.setState("select"))},c.prototype.select=function(){var d,h=this.editor,f=h.renderer.screenToTextCoordinates(this.x,this.y);if(this.$clickSelection){var v=this.$clickSelection.comparePoint(f);if(v==-1)d=this.$clickSelection.end;else if(v==1)d=this.$clickSelection.start;else{var y=s(this.$clickSelection,f);f=y.cursor,d=y.anchor}h.selection.setSelectionAnchor(d.row,d.column)}h.selection.selectToPosition(f),h.renderer.scrollCursorIntoView()},c.prototype.extendSelectionBy=function(d){var h,f=this.editor,v=f.renderer.screenToTextCoordinates(this.x,this.y),y=f.selection[d](v.row,v.column);if(this.$clickSelection){var b=this.$clickSelection.comparePoint(y.start),w=this.$clickSelection.comparePoint(y.end);if(b==-1&&w<=0)h=this.$clickSelection.end,(y.end.row!=v.row||y.end.column!=v.column)&&(v=y.start);else if(w==1&&b>=0)h=this.$clickSelection.start,(y.start.row!=v.row||y.start.column!=v.column)&&(v=y.end);else if(b==-1&&w==1)v=y.end,h=y.start;else{var x=s(this.$clickSelection,v);v=x.cursor,h=x.anchor}f.selection.setSelectionAnchor(h.row,h.column)}f.selection.selectToPosition(v),f.renderer.scrollCursorIntoView()},c.prototype.selectByLinesEnd=function(){this.$clickSelection=null,this.editor.unsetStyle("ace_selecting")},c.prototype.focusWait=function(){var d=p(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y),h=Date.now();(d>l||h-this.mousedownEvent.time>this.$focusTimeout)&&this.startSelect(this.mousedownEvent.getDocumentPosition())},c.prototype.onDoubleClick=function(d){var h=d.getDocumentPosition(),f=this.editor,v=f.session,y=v.getBracketRange(h);y?(y.isEmpty()&&(y.start.column--,y.end.column++),this.setState("select")):(y=f.selection.getWordRange(h.row,h.column),this.setState("selectByWords")),this.$clickSelection=y,this.select()},c.prototype.onTripleClick=function(d){var h=d.getDocumentPosition(),f=this.editor;this.setState("selectByLines");var v=f.getSelectionRange();v.isMultiLine()&&v.contains(h.row,h.column)?(this.$clickSelection=f.selection.getLineRange(v.start.row),this.$clickSelection.end=f.selection.getLineRange(v.end.row).end):this.$clickSelection=f.selection.getLineRange(h.row),this.select()},c.prototype.onQuadClick=function(d){var h=this.editor;h.selectAll(),this.$clickSelection=h.getSelectionRange(),this.setState("selectAll")},c.prototype.onMouseWheel=function(d){if(!d.getAccelKey()){d.getShiftKey()&&d.wheelY&&!d.wheelX&&(d.wheelX=d.wheelY,d.wheelY=0);var h=this.editor;this.$lastScroll||(this.$lastScroll={t:0,vx:0,vy:0,allowed:0});var f=this.$lastScroll,v=d.domEvent.timeStamp,y=v-f.t,b=y?d.wheelX/y:f.vx,w=y?d.wheelY/y:f.vy;y=1&&h.renderer.isScrollableBy(d.wheelX*d.speed,0)&&(E=!0),x<=1&&h.renderer.isScrollableBy(0,d.wheelY*d.speed)&&(E=!0),E)f.allowed=v;else if(v-f.allowedm.clientHeight;u||l.preventDefault()}}),ace.define("ace/tooltip",["require","exports","module","ace/lib/dom","ace/lib/event","ace/range","ace/lib/scroll"],function(n,r,i){var o=this&&this.__extends||function(){var v=function(y,b){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(w,x){w.__proto__=x}||function(w,x){for(var E in x)Object.prototype.hasOwnProperty.call(x,E)&&(w[E]=x[E])},v(y,b)};return function(y,b){if(typeof b!="function"&&b!==null)throw new TypeError("Class extends value "+String(b)+" is not a constructor or null");v(y,b);function w(){this.constructor=y}y.prototype=b===null?Object.create(b):(w.prototype=b.prototype,new w)}}(),l=this&&this.__values||function(v){var y=typeof Symbol=="function"&&Symbol.iterator,b=y&&v[y],w=0;if(b)return b.call(v);if(v&&typeof v.length=="number")return{next:function(){return v&&w>=v.length&&(v=void 0),{value:v&&v[w++],done:!v}}};throw new TypeError(y?"Object is not iterable.":"Symbol.iterator is not defined.")},m=n("./lib/dom");n("./lib/event");var u=n("./range").Range,p=n("./lib/scroll").preventParentScroll,s="ace_tooltip",c=function(){function v(y){this.isOpen=!1,this.$element=null,this.$parentNode=y}return v.prototype.$init=function(){return this.$element=m.createElement("div"),this.$element.className=s,this.$element.style.display="none",this.$parentNode.appendChild(this.$element),this.$element},v.prototype.getElement=function(){return this.$element||this.$init()},v.prototype.setText=function(y){this.getElement().textContent=y},v.prototype.setHtml=function(y){this.getElement().innerHTML=y},v.prototype.setPosition=function(y,b){this.getElement().style.left=y+"px",this.getElement().style.top=b+"px"},v.prototype.setClassName=function(y){m.addCssClass(this.getElement(),y)},v.prototype.setTheme=function(y){this.$element.className=s+" "+(y.isDark?"ace_dark ":"")+(y.cssClass||"")},v.prototype.show=function(y,b,w){y!=null&&this.setText(y),b!=null&&w!=null&&this.setPosition(b,w),this.isOpen||(this.getElement().style.display="block",this.isOpen=!0)},v.prototype.hide=function(y){this.isOpen&&(this.getElement().style.display="none",this.getElement().className=s,this.isOpen=!1)},v.prototype.getHeight=function(){return this.getElement().offsetHeight},v.prototype.getWidth=function(){return this.getElement().offsetWidth},v.prototype.destroy=function(){this.isOpen=!1,this.$element&&this.$element.parentNode&&this.$element.parentNode.removeChild(this.$element)},v}(),d=function(){function v(){this.popups=[]}return v.prototype.addPopup=function(y){this.popups.push(y),this.updatePopups()},v.prototype.removePopup=function(y){var b=this.popups.indexOf(y);b!==-1&&(this.popups.splice(b,1),this.updatePopups())},v.prototype.updatePopups=function(){var y,b,w,x;this.popups.sort(function(P,A){return A.priority-P.priority});var E=[];try{for(var _=l(this.popups),$=_.next();!$.done;$=_.next()){var O=$.value,N=!0;try{for(var k=(w=void 0,l(E)),L=k.next();!L.done;L=k.next()){var F=L.value;if(this.doPopupsOverlap(F,O)){N=!1;break}}}catch(P){w={error:P}}finally{try{L&&!L.done&&(x=k.return)&&x.call(k)}finally{if(w)throw w.error}}N?E.push(O):O.hide()}}catch(P){y={error:P}}finally{try{$&&!$.done&&(b=_.return)&&b.call(_)}finally{if(y)throw y.error}}},v.prototype.doPopupsOverlap=function(y,b){var w=y.getElement().getBoundingClientRect(),x=b.getElement().getBoundingClientRect();return w.leftx.left&&w.topx.top},v}(),h=new d;r.popupManager=h,r.Tooltip=c;var f=function(v){o(y,v);function y(b){b===void 0&&(b=document.body);var w=v.call(this,b)||this;w.timeout=void 0,w.lastT=0,w.idleTime=350,w.lastEvent=void 0,w.onMouseOut=w.onMouseOut.bind(w),w.onMouseMove=w.onMouseMove.bind(w),w.waitForHover=w.waitForHover.bind(w),w.hide=w.hide.bind(w);var x=w.getElement();return x.style.whiteSpace="pre-wrap",x.style.pointerEvents="auto",x.addEventListener("mouseout",w.onMouseOut),x.tabIndex=-1,x.addEventListener("blur",(function(){x.contains(document.activeElement)||this.hide()}).bind(w)),x.addEventListener("wheel",p),w}return y.prototype.addToEditor=function(b){b.on("mousemove",this.onMouseMove),b.on("mousedown",this.hide),b.renderer.getMouseEventTarget().addEventListener("mouseout",this.onMouseOut,!0)},y.prototype.removeFromEditor=function(b){b.off("mousemove",this.onMouseMove),b.off("mousedown",this.hide),b.renderer.getMouseEventTarget().removeEventListener("mouseout",this.onMouseOut,!0),this.timeout&&(clearTimeout(this.timeout),this.timeout=null)},y.prototype.onMouseMove=function(b,w){this.lastEvent=b,this.lastT=Date.now();var x=w.$mouseHandler.isMousePressed;if(this.isOpen){var E=this.lastEvent&&this.lastEvent.getDocumentPosition();(!this.range||!this.range.contains(E.row,E.column)||x||this.isOutsideOfText(this.lastEvent))&&this.hide()}this.timeout||x||(this.lastEvent=b,this.timeout=setTimeout(this.waitForHover,this.idleTime))},y.prototype.waitForHover=function(){this.timeout&&clearTimeout(this.timeout);var b=Date.now()-this.lastT;if(this.idleTime-b>10){this.timeout=setTimeout(this.waitForHover,this.idleTime-b);return}this.timeout=null,this.lastEvent&&!this.isOutsideOfText(this.lastEvent)&&this.$gatherData(this.lastEvent,this.lastEvent.editor)},y.prototype.isOutsideOfText=function(b){var w=b.editor,x=b.getDocumentPosition(),E=w.session.getLine(x.row);if(x.column==E.length){var _=w.renderer.pixelToScreenCoordinates(b.clientX,b.clientY),$=w.session.documentToScreenPosition(x.row,x.column);if($.column!=_.column||$.row!=_.row)return!0}return!1},y.prototype.setDataProvider=function(b){this.$gatherData=b},y.prototype.showForRange=function(b,w,x,E){var _=10;if(!(E&&E!=this.lastEvent)&&!(this.isOpen&&document.activeElement==this.getElement())){var $=b.renderer;this.isOpen||(h.addPopup(this),this.$registerCloseEvents(),this.setTheme($.theme)),this.isOpen=!0,this.addMarker(w,b.session),this.range=u.fromPoints(w.start,w.end);var O=$.textToScreenCoordinates(w.start.row,w.start.column),N=$.scroller.getBoundingClientRect();O.pageX=v.length&&(v=void 0),{value:v&&v[w++],done:!v}}};throw new TypeError(y?"Object is not iterable.":"Symbol.iterator is not defined.")},m=n("../lib/dom"),u=n("../lib/event"),p=n("../tooltip").Tooltip,s=n("../config").nls,c=5,d=3;r.GUTTER_TOOLTIP_LEFT_OFFSET=c,r.GUTTER_TOOLTIP_TOP_OFFSET=d;function h(v){var y=v.editor,b=y.renderer.$gutterLayer,w=new f(y,!0);v.editor.setDefaultHandler("guttermousedown",function(N){if(!(!y.isFocused()||N.getButton()!=0)){var k=b.getRegion(N);if(k!="foldWidgets"){var L=N.getDocumentPosition().row,F=y.session.selection;if(N.getShiftKey())F.selectTo(L,0);else{if(N.domEvent.detail==2)return y.selectAll(),N.preventDefault();v.$clickSelection=y.selection.getLineRange(L)}return v.setState("selectByLines"),v.captureMouse(N),N.preventDefault()}}});var x,E;function _(){var N=E.getDocumentPosition().row,k=y.session.getLength();if(N==k){var L=y.renderer.pixelToScreenCoordinates(0,E.y).row,F=E.$pos;if(L>y.session.documentToScreenRow(F.row,F.column))return $()}if(w.showTooltip(N),!!w.isOpen)if(y.on("mousewheel",$),y.on("changeSession",$),window.addEventListener("keydown",$,!0),v.$tooltipFollowsMouse)O(E);else{var P=E.getGutterRow(),A=b.$lines.get(P);if(A){var M=A.element.querySelector(".ace_gutter_annotation"),R=M.getBoundingClientRect(),I=w.getElement().style;I.left=R.right-c+"px",I.top=R.bottom-d+"px"}else O(E)}}function $(N){N&&N.type==="keydown"&&(N.ctrlKey||N.metaKey)||N&&N.type==="mouseout"&&(!N.relatedTarget||w.getElement().contains(N.relatedTarget))||(x&&(x=clearTimeout(x)),w.isOpen&&(w.hideTooltip(),y.off("mousewheel",$),y.off("changeSession",$),window.removeEventListener("keydown",$,!0)))}function O(N){w.setPosition(N.x,N.y)}v.editor.setDefaultHandler("guttermousemove",function(N){var k=N.domEvent.target||N.domEvent.srcElement;if(m.hasCssClass(k,"ace_fold-widget")||m.hasCssClass(k,"ace_custom-widget"))return $();w.isOpen&&v.$tooltipFollowsMouse&&O(N),E=N,!x&&(x=setTimeout(function(){x=null,E&&!v.isMousePressed&&_()},50))}),u.addListener(y.renderer.$gutter,"mouseout",function(N){E=null,w.isOpen&&(x=setTimeout(function(){x=null,$(N)},50))},y)}r.GutterHandler=h;var f=function(v){o(y,v);function y(b,w){w===void 0&&(w=!1);var x=v.call(this,b.container)||this;x.editor=b,x.visibleTooltipRow;var E=x.getElement();return E.setAttribute("role","tooltip"),E.style.pointerEvents="auto",w&&(x.onMouseOut=x.onMouseOut.bind(x),E.addEventListener("mouseout",x.onMouseOut)),x}return y.prototype.onMouseOut=function(b){this.isOpen&&(!b.relatedTarget||this.getElement().contains(b.relatedTarget)||b&&b.currentTarget.contains(b.relatedTarget)||this.hideTooltip())},y.prototype.setPosition=function(b,w){var x=window.innerWidth||document.documentElement.clientWidth,E=window.innerHeight||document.documentElement.clientHeight,_=this.getWidth(),$=this.getHeight();b+=15,w+=15,b+_>x&&(b-=b+_-x),w+$>E&&(w-=20+$),p.prototype.setPosition.call(this,b,w)},Object.defineProperty(y,"annotationLabels",{get:function(){return{error:{singular:s("gutter-tooltip.aria-label.error.singular","error"),plural:s("gutter-tooltip.aria-label.error.plural","errors")},security:{singular:s("gutter-tooltip.aria-label.security.singular","security finding"),plural:s("gutter-tooltip.aria-label.security.plural","security findings")},warning:{singular:s("gutter-tooltip.aria-label.warning.singular","warning"),plural:s("gutter-tooltip.aria-label.warning.plural","warnings")},info:{singular:s("gutter-tooltip.aria-label.info.singular","information message"),plural:s("gutter-tooltip.aria-label.info.plural","information messages")},hint:{singular:s("gutter-tooltip.aria-label.hint.singular","suggestion"),plural:s("gutter-tooltip.aria-label.hint.plural","suggestions")}}},enumerable:!1,configurable:!0}),y.prototype.showTooltip=function(b){var w,x=this.editor.renderer.$gutterLayer,E=x.$annotations[b],_;E?_={displayText:Array.from(E.displayText),type:Array.from(E.type)}:_={displayText:[],type:[]};var $=x.session.getFoldLine(b);if($&&x.$showFoldedAnnotations){for(var O={error:[],security:[],warning:[],info:[],hint:[]},N={error:1,security:2,warning:3,info:4,hint:5},k,L=b+1;L<=$.end.row;L++)if(x.$annotations[L])for(var F=0;Fs?P=null:G-P>=p&&(f.renderer.scrollCursorIntoView(),P=null)}}function R(U,K){var G=Date.now(),q=f.renderer.layerConfig.lineHeight,Z=f.renderer.layerConfig.characterWidth,Q=f.renderer.scroller.getBoundingClientRect(),J={x:{left:x-Q.left,right:Q.right-x},y:{top:E-Q.top,bottom:Q.bottom-E}},ie=Math.min(J.x.left,J.x.right),se=Math.min(J.y.top,J.y.bottom),ae={row:U.row,column:U.column};ie/Z<=2&&(ae.column+=J.x.left=u&&f.renderer.scrollCursorIntoView(ae):F=G:F=null}function I(){var U=O;O=f.renderer.screenToTextCoordinates(x,E),M(O,U),R(O,U)}function D(){$=f.selection.toOrientedRange(),w=f.session.addMarker($,"ace_selection",f.getSelectionStyle()),f.clearSelection(),f.isFocused()&&f.renderer.$cursorLayer.setBlinking(!1),clearInterval(_),I(),_=setInterval(I,20),N=0,l.addListener(document,"mousemove",V)}function j(){clearInterval(_),f.session.removeMarker(w),w=null,f.selection.fromOrientedRange($),f.isFocused()&&!L&&f.$resetCursorStyle(),$=null,O=null,N=0,F=null,P=null,l.removeListener(document,"mousemove",V)}var B=null;function V(){B==null&&(B=setTimeout(function(){B!=null&&w&&j()},20))}function H(U){var K=U.types;return!K||Array.prototype.some.call(K,function(G){return G=="text/plain"||G=="Text"})}function Y(U){var K=["copy","copymove","all","uninitialized"],G=["move","copymove","linkmove","all","uninitialized"],q=m.isMac?U.altKey:U.ctrlKey,Z="uninitialized";try{Z=U.dataTransfer.effectAllowed.toLowerCase()}catch{}var Q="none";return q&&K.indexOf(Z)>=0?Q="copy":G.indexOf(Z)>=0?Q="move":K.indexOf(Z)>=0&&(Q="copy"),Q}}(function(){this.dragWait=function(){var h=Date.now()-this.mousedownEvent.time;h>this.editor.getDragDelay()&&this.startDrag()},this.dragWaitEnd=function(){var h=this.editor.container;h.draggable=!1,this.startSelect(this.mousedownEvent.getDocumentPosition()),this.selectEnd()},this.dragReadyEnd=function(h){this.editor.$resetCursorStyle(),this.editor.unsetStyle("ace_dragging"),this.editor.renderer.setCursorStyle(""),this.dragWaitEnd()},this.startDrag=function(){this.cancelDrag=!1;var h=this.editor,f=h.container;f.draggable=!0,h.renderer.$cursorLayer.setBlinking(!1),h.setStyle("ace_dragging");var v=m.isWin?"default":"move";h.renderer.setCursorStyle(v),this.setState("dragReady")},this.onMouseDrag=function(h){var f=this.editor.container;if(m.isIE&&this.state=="dragReady"){var v=d(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y);v>3&&f.dragDrop()}if(this.state==="dragWait"){var v=d(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y);v>0&&(f.draggable=!1,this.startSelect(this.mousedownEvent.getDocumentPosition()))}},this.onMouseDown=function(h){if(this.$dragEnabled){this.mousedownEvent=h;var f=this.editor,v=h.inSelection(),y=h.getButton(),b=h.domEvent.detail||1;if(b===1&&y===0&&v){if(h.editor.inMultiSelectMode&&(h.getAccelKey()||h.getShiftKey()))return;this.mousedownEvent.time=Date.now();var w=h.domEvent.target||h.domEvent.srcElement;if("unselectable"in w&&(w.unselectable="on"),f.getDragDelay()){if(m.isWebKit){this.cancelDrag=!0;var x=f.container;x.draggable=!0}this.setState("dragWait")}else this.startDrag();this.captureMouse(h,this.onMouseDrag.bind(this)),h.defaultPrevented=!0}}}}).call(c.prototype);function d(h,f,v,y){return Math.sqrt(Math.pow(v-h,2)+Math.pow(y-f,2))}r.DragdropHandler=c}),ace.define("ace/mouse/touch_handler",["require","exports","module","ace/mouse/mouse_event","ace/lib/event","ace/lib/dom"],function(n,r,i){var o=n("./mouse_event").MouseEvent,l=n("../lib/event"),m=n("../lib/dom");r.addTouchListeners=function(u,p){var s="scroll",c,d,h,f,v,y,b=0,w,x=0,E=0,_=0,$,O;function N(){var M=window.navigator&&window.navigator.clipboard,R=!1,I=function(){var B=p.getCopyText(),V=p.session.getUndoManager().hasUndo();O.replaceChild(m.buildDom(R?["span",!B&&D("selectall")&&["span",{class:"ace_mobile-button",action:"selectall"},"Select All"],B&&D("copy")&&["span",{class:"ace_mobile-button",action:"copy"},"Copy"],B&&D("cut")&&["span",{class:"ace_mobile-button",action:"cut"},"Cut"],M&&D("paste")&&["span",{class:"ace_mobile-button",action:"paste"},"Paste"],V&&D("undo")&&["span",{class:"ace_mobile-button",action:"undo"},"Undo"],D("find")&&["span",{class:"ace_mobile-button",action:"find"},"Find"],D("openCommandPalette")&&["span",{class:"ace_mobile-button",action:"openCommandPalette"},"Palette"]]:["span"]),O.firstChild)},D=function(B){return p.commands.canExecute(B,p)},j=function(B){var V=B.target.getAttribute("action");if(V=="more"||!R)return R=!R,I();V=="paste"?M.readText().then(function(H){p.execCommand(V,H)}):V&&((V=="cut"||V=="copy")&&(M?M.writeText(p.getCopyText()):document.execCommand("copy")),p.execCommand(V)),O.firstChild.style.display="none",R=!1,V!="openCommandPalette"&&p.focus()};O=m.buildDom(["div",{class:"ace_mobile-menu",ontouchstart:function(B){s="menu",B.stopPropagation(),B.preventDefault(),p.textInput.focus()},ontouchend:function(B){B.stopPropagation(),B.preventDefault(),j(B)},onclick:j},["span"],["span",{class:"ace_mobile-button",action:"more"},"..."]],p.container)}function k(){if(!p.getOption("enableMobileMenu")){O&&L();return}O||N();var M=p.selection.cursor,R=p.renderer.textToScreenCoordinates(M.row,M.column),I=p.renderer.textToScreenCoordinates(0,0).pageX,D=p.renderer.scrollLeft,j=p.container.getBoundingClientRect();O.style.top=R.pageY-j.top-3+"px",R.pageX-j.left=2?p.selection.getLineRange(w.row):p.session.getBracketRange(w);M&&!M.isEmpty()?p.selection.setRange(M):p.selection.selectWord(),s="wait"}l.addListener(u,"contextmenu",function(M){if($){var R=p.textInput.getElement();R.focus()}},p),l.addListener(u,"touchstart",function(M){var R=M.touches;if(v||R.length>1){clearTimeout(v),v=null,h=-1,s="zoom";return}$=p.$mouseHandler.isMousePressed=!0;var I=p.renderer.layerConfig.lineHeight,D=p.renderer.layerConfig.lineHeight,j=M.timeStamp;f=j;var B=R[0],V=B.clientX,H=B.clientY;Math.abs(c-V)+Math.abs(d-H)>I&&(h=-1),c=M.clientX=V,d=M.clientY=H,E=_=0;var Y=new o(M,p);if(w=Y.getDocumentPosition(),j-h<500&&R.length==1&&!b)x++,M.preventDefault(),M.button=0,P();else{x=0;var U=p.selection.cursor,K=p.selection.isEmpty()?U:p.selection.anchor,G=p.renderer.$cursorLayer.getPixelPosition(U,!0),q=p.renderer.$cursorLayer.getPixelPosition(K,!0),Z=p.renderer.scroller.getBoundingClientRect(),Q=p.renderer.layerConfig.offset,J=p.renderer.scrollLeft,ie=function(ge,me){return ge=ge/D,me=me/I-.75,ge*ge+me*me};if(M.clientXae?"cursor":"anchor"),ae<3.5?s="anchor":se<3.5?s="cursor":s="scroll",v=setTimeout(F,450)}h=j},p),l.addListener(u,"touchend",function(M){$=p.$mouseHandler.isMousePressed=!1,y&&clearInterval(y),s=="zoom"?(s="",b=0):v?(p.selection.moveToPosition(w),b=0,k()):s=="scroll"?(A(),L()):k(),clearTimeout(v),v=null},p),l.addListener(u,"touchmove",function(M){v&&(clearTimeout(v),v=null);var R=M.touches;if(!(R.length>1||s=="zoom")){var I=R[0],D=c-I.clientX,j=d-I.clientY;if(s=="wait")if(D*D+j*j>4)s="cursor";else return M.preventDefault();c=I.clientX,d=I.clientY,M.clientX=I.clientX,M.clientY=I.clientY;var B=M.timeStamp,V=B-f;if(f=B,s=="scroll"){var H=new o(M,p);H.speed=1,H.wheelX=D,H.wheelY=j,10*Math.abs(D)0)if(ae==16){for(de=me;de-1){for(de=me;de=0&&q[xe]==$;xe--)K[xe]=o}}}function V(U,K,G){if(!(l=U){for(Q=Z+1;Q=U;)Q++;for(J=Z,ie=Q-1;J=K.length||(Q=G[q-1])!=y&&Q!=b||(J=K[q+1])!=y&&J!=b?w:(m&&(J=b),J==Q?J:w);case N:return Q=q>0?G[q-1]:x,Q==y&&q+10&&G[q-1]==y)return y;if(m)return w;for(se=q+1,ie=K.length;se=1425&&ae<=2303||ae==64286;if(Q=K[se],ge&&(Q==v||Q==_))return v}return q<1||(Q=K[q-1])==x?w:G[q-1];case x:return m=!1,u=!0,o;case E:return p=!0,w;case F:case P:case M:case R:case A:m=!1;case I:return w}}function Y(U){var K=U.charCodeAt(0),G=K>>8;return G==0?K>191?f:D[K]:G==5?/[\u0591-\u05f4]/.test(U)?v:f:G==6?/[\u0610-\u061a\u064b-\u065f\u06d6-\u06e4\u06e7-\u06ed]/.test(U)?L:/[\u0660-\u0669\u066b-\u066c]/.test(U)?b:K==1642?k:/[\u06f0-\u06f9]/.test(U)?y:_:G==32&&K<=8287?j[K&255]:G==254&&K>=65136?_:w}r.L=f,r.R=v,r.EN=y,r.ON_R=3,r.AN=4,r.R_H=5,r.B=6,r.RLE=7,r.DOT="·",r.doBidiReorder=function(U,K,G){if(U.length<2)return{};var q=U.split(""),Z=new Array(q.length),Q=new Array(q.length),J=[];o=G?h:d,B(q,J,q.length,K);for(var ie=0;ie_&&K[ie]0&&q[ie-1]==="ل"&&/\u0622|\u0623|\u0625|\u0627/.test(q[ie])&&(J[ie-1]=J[ie]=r.R_H,ie++);q[q.length-1]===r.DOT&&(J[q.length-1]=r.B),q[0]==="‫"&&(J[0]=r.RLE);for(var ie=0;ie=0&&(s=this.session.$docRowCache[d])}return s},p.prototype.getSplitIndex=function(){var s=0,c=this.session.$screenRowCache;if(c.length)for(var d,h=this.session.$getRowCacheIndex(c,this.currentRow);this.currentRow-s>0&&(d=this.session.$getRowCacheIndex(c,this.currentRow-s-1),d===h);)h=d,s++;else s=this.currentRow;return s},p.prototype.updateRowLine=function(s,c){s===void 0&&(s=this.getDocumentRow());var d=s===this.session.getLength()-1,h=d?this.EOF:this.EOL;if(this.wrapIndent=0,this.line=this.session.getLine(s),this.isRtlDir=this.$isRtl||this.line.charAt(0)===this.RLE,this.session.$useWrapMode){var f=this.session.$wrapData[s];f&&(c===void 0&&(c=this.getSplitIndex()),c>0&&f.length?(this.wrapIndent=f.indent,this.wrapOffset=this.wrapIndent*this.charWidths[o.L],this.line=cc?this.session.getOverwrite()?s:s-1:c,h=o.getVisualFromLogicalIdx(d,this.bidiMap),f=this.bidiMap.bidiLevels,v=0;!this.session.getOverwrite()&&s<=c&&f[h]%2!==0&&h++;for(var y=0;yc&&f[h]%2===0&&(v+=this.charWidths[f[h]]),this.wrapIndent&&(v+=this.isRtlDir?-1*this.wrapOffset:this.wrapOffset),this.isRtlDir&&(v+=this.rtlLineOffset),v},p.prototype.getSelections=function(s,c){var d=this.bidiMap,h=d.bidiLevels,f,v=[],y=0,b=Math.min(s,c)-this.wrapIndent,w=Math.max(s,c)-this.wrapIndent,x=!1,E=!1,_=0;this.wrapIndent&&(y+=this.isRtlDir?-1*this.wrapOffset:this.wrapOffset);for(var $,O=0;O=b&&$h+y/2;){if(h+=y,f===v.length-1){y=0;break}y=this.charWidths[v[++f]]}return f>0&&v[f-1]%2!==0&&v[f]%2===0?(d0&&v[f-1]%2===0&&v[f]%2!==0?c=1+(d>h?this.bidiMap.logicalFromVisual[f]:this.bidiMap.logicalFromVisual[f-1]):this.isRtlDir&&f===v.length-1&&y===0&&v[f-1]%2===0||!this.isRtlDir&&f===0&&v[f]%2!==0?c=1+this.bidiMap.logicalFromVisual[f]:(f>0&&v[f-1]%2!==0&&y!==0&&f--,c=this.bidiMap.logicalFromVisual[f]),c===0&&this.isRtlDir&&c++,c+this.wrapIndent},p}();r.BidiHandler=u}),ace.define("ace/selection",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/lib/event_emitter","ace/range"],function(n,r,i){var o=n("./lib/oop"),l=n("./lib/lang"),m=n("./lib/event_emitter").EventEmitter,u=n("./range").Range,p=function(){function s(c){this.session=c,this.doc=c.getDocument(),this.clearSelection(),this.cursor=this.lead=this.doc.createAnchor(0,0),this.anchor=this.doc.createAnchor(0,0),this.$silent=!1;var d=this;this.cursor.on("change",function(h){d.$cursorChanged=!0,d.$silent||d._emit("changeCursor"),!d.$isEmpty&&!d.$silent&&d._emit("changeSelection"),!d.$keepDesiredColumnOnChange&&h.old.column!=h.value.column&&(d.$desiredColumn=null)}),this.anchor.on("change",function(){d.$anchorChanged=!0,!d.$isEmpty&&!d.$silent&&d._emit("changeSelection")})}return s.prototype.isEmpty=function(){return this.$isEmpty||this.anchor.row==this.lead.row&&this.anchor.column==this.lead.column},s.prototype.isMultiLine=function(){return!this.$isEmpty&&this.anchor.row!=this.cursor.row},s.prototype.getCursor=function(){return this.lead.getPosition()},s.prototype.setAnchor=function(c,d){this.$isEmpty=!1,this.anchor.setPosition(c,d)},s.prototype.getAnchor=function(){return this.$isEmpty?this.getSelectionLead():this.anchor.getPosition()},s.prototype.getSelectionLead=function(){return this.lead.getPosition()},s.prototype.isBackwards=function(){var c=this.anchor,d=this.lead;return c.row>d.row||c.row==d.row&&c.column>d.column},s.prototype.getRange=function(){var c=this.anchor,d=this.lead;return this.$isEmpty?u.fromPoints(d,d):this.isBackwards()?u.fromPoints(d,c):u.fromPoints(c,d)},s.prototype.clearSelection=function(){this.$isEmpty||(this.$isEmpty=!0,this._emit("changeSelection"))},s.prototype.selectAll=function(){this.$setSelection(0,0,Number.MAX_VALUE,Number.MAX_VALUE)},s.prototype.setRange=function(c,d){var h=d?c.end:c.start,f=d?c.start:c.end;this.$setSelection(h.row,h.column,f.row,f.column)},s.prototype.$setSelection=function(c,d,h,f){if(!this.$silent){var v=this.$isEmpty,y=this.inMultiSelectMode;this.$silent=!0,this.$cursorChanged=this.$anchorChanged=!1,this.anchor.setPosition(c,d),this.cursor.setPosition(h,f),this.$isEmpty=!u.comparePoints(this.anchor,this.cursor),this.$silent=!1,this.$cursorChanged&&this._emit("changeCursor"),(this.$cursorChanged||this.$anchorChanged||v!=this.$isEmpty||y)&&this._emit("changeSelection")}},s.prototype.$moveSelection=function(c){var d=this.lead;this.$isEmpty&&this.setSelectionAnchor(d.row,d.column),c.call(this)},s.prototype.selectTo=function(c,d){this.$moveSelection(function(){this.moveCursorTo(c,d)})},s.prototype.selectToPosition=function(c){this.$moveSelection(function(){this.moveCursorToPosition(c)})},s.prototype.moveTo=function(c,d){this.clearSelection(),this.moveCursorTo(c,d)},s.prototype.moveToPosition=function(c){this.clearSelection(),this.moveCursorToPosition(c)},s.prototype.selectUp=function(){this.$moveSelection(this.moveCursorUp)},s.prototype.selectDown=function(){this.$moveSelection(this.moveCursorDown)},s.prototype.selectRight=function(){this.$moveSelection(this.moveCursorRight)},s.prototype.selectLeft=function(){this.$moveSelection(this.moveCursorLeft)},s.prototype.selectLineStart=function(){this.$moveSelection(this.moveCursorLineStart)},s.prototype.selectLineEnd=function(){this.$moveSelection(this.moveCursorLineEnd)},s.prototype.selectFileEnd=function(){this.$moveSelection(this.moveCursorFileEnd)},s.prototype.selectFileStart=function(){this.$moveSelection(this.moveCursorFileStart)},s.prototype.selectWordRight=function(){this.$moveSelection(this.moveCursorWordRight)},s.prototype.selectWordLeft=function(){this.$moveSelection(this.moveCursorWordLeft)},s.prototype.getWordRange=function(c,d){if(typeof d>"u"){var h=c||this.lead;c=h.row,d=h.column}return this.session.getWordRange(c,d)},s.prototype.selectWord=function(){this.setSelectionRange(this.getWordRange())},s.prototype.selectAWord=function(){var c=this.getCursor(),d=this.session.getAWordRange(c.row,c.column);this.setSelectionRange(d)},s.prototype.getLineRange=function(c,d){var h=typeof c=="number"?c:this.lead.row,f,v=this.session.getFoldLine(h);return v?(h=v.start.row,f=v.end.row):f=h,d===!0?new u(h,0,f,this.session.getLine(f).length):new u(h,0,f+1,0)},s.prototype.selectLine=function(){this.setSelectionRange(this.getLineRange())},s.prototype.moveCursorUp=function(){this.moveCursorBy(-1,0)},s.prototype.moveCursorDown=function(){this.moveCursorBy(1,0)},s.prototype.wouldMoveIntoSoftTab=function(c,d,h){var f=c.column,v=c.column+d;return h<0&&(f=c.column-d,v=c.column),this.session.isTabStop(c)&&this.doc.getLine(c.row).slice(f,v).split(" ").length-1==d},s.prototype.moveCursorLeft=function(){var c=this.lead.getPosition(),d;if(d=this.session.getFoldAt(c.row,c.column,-1))this.moveCursorTo(d.start.row,d.start.column);else if(c.column===0)c.row>0&&this.moveCursorTo(c.row-1,this.doc.getLine(c.row-1).length);else{var h=this.session.getTabSize();this.wouldMoveIntoSoftTab(c,h,-1)&&!this.session.getNavigateWithinSoftTabs()?this.moveCursorBy(0,-h):this.moveCursorBy(0,-1)}},s.prototype.moveCursorRight=function(){var c=this.lead.getPosition(),d;if(d=this.session.getFoldAt(c.row,c.column,1))this.moveCursorTo(d.end.row,d.end.column);else if(this.lead.column==this.doc.getLine(this.lead.row).length)this.lead.row0&&(d.column=f)}}this.moveCursorTo(d.row,d.column)},s.prototype.moveCursorFileEnd=function(){var c=this.doc.getLength()-1,d=this.doc.getLine(c).length;this.moveCursorTo(c,d)},s.prototype.moveCursorFileStart=function(){this.moveCursorTo(0,0)},s.prototype.moveCursorLongWordRight=function(){var c=this.lead.row,d=this.lead.column,h=this.doc.getLine(c),f=h.substring(d);this.session.nonTokenRe.lastIndex=0,this.session.tokenRe.lastIndex=0;var v=this.session.getFoldAt(c,d,1);if(v){this.moveCursorTo(v.end.row,v.end.column);return}if(this.session.nonTokenRe.exec(f)&&(d+=this.session.nonTokenRe.lastIndex,this.session.nonTokenRe.lastIndex=0,f=h.substring(d)),d>=h.length){this.moveCursorTo(c,h.length),this.moveCursorRight(),c0&&this.moveCursorWordLeft();return}this.session.tokenRe.exec(v)&&(d-=this.session.tokenRe.lastIndex,this.session.tokenRe.lastIndex=0),this.moveCursorTo(c,d)},s.prototype.$shortWordEndIndex=function(c){var d=0,h,f=/\s/,v=this.session.tokenRe;if(v.lastIndex=0,this.session.tokenRe.exec(c))d=this.session.tokenRe.lastIndex;else{for(;(h=c[d])&&f.test(h);)d++;if(d<1){for(v.lastIndex=0;(h=c[d])&&!v.test(h);)if(v.lastIndex=0,d++,f.test(h))if(d>2){d--;break}else{for(;(h=c[d])&&f.test(h);)d++;if(d>2)break}}}return v.lastIndex=0,d},s.prototype.moveCursorShortWordRight=function(){var c=this.lead.row,d=this.lead.column,h=this.doc.getLine(c),f=h.substring(d),v=this.session.getFoldAt(c,d,1);if(v)return this.moveCursorTo(v.end.row,v.end.column);if(d==h.length){var y=this.doc.getLength();do c++,f=this.doc.getLine(c);while(c0&&/^\s*$/.test(f));d=f.length,/\s+$/.test(f)||(f="")}var v=l.stringReverse(f),y=this.$shortWordEndIndex(v);return this.moveCursorTo(c,d-y)},s.prototype.moveCursorWordRight=function(){this.session.$selectLongWords?this.moveCursorLongWordRight():this.moveCursorShortWordRight()},s.prototype.moveCursorWordLeft=function(){this.session.$selectLongWords?this.moveCursorLongWordLeft():this.moveCursorShortWordLeft()},s.prototype.moveCursorBy=function(c,d){var h=this.session.documentToScreenPosition(this.lead.row,this.lead.column),f;if(d===0&&(c!==0&&(this.session.$bidiHandler.isBidiRow(h.row,this.lead.row)?(f=this.session.$bidiHandler.getPosLeft(h.column),h.column=Math.round(f/this.session.$bidiHandler.charWidths[0])):f=h.column*this.session.$bidiHandler.charWidths[0]),this.$desiredColumn?h.column=this.$desiredColumn:this.$desiredColumn=h.column),c!=0&&this.session.lineWidgets&&this.session.lineWidgets[this.lead.row]){var v=this.session.lineWidgets[this.lead.row];c<0?c-=v.rowsAbove||0:c>0&&(c+=v.rowCount-(v.rowsAbove||0))}var y=this.session.screenToDocumentPosition(h.row+c,h.column,f);c!==0&&d===0&&y.row===this.lead.row&&(y.column,this.lead.column),this.moveCursorTo(y.row,y.column+d,d===0)},s.prototype.moveCursorToPosition=function(c){this.moveCursorTo(c.row,c.column)},s.prototype.moveCursorTo=function(c,d,h){var f=this.session.getFoldAt(c,d,1);f&&(c=f.start.row,d=f.start.column),this.$keepDesiredColumnOnChange=!0;var v=this.session.getLine(c);/[\uDC00-\uDFFF]/.test(v.charAt(d))&&v.charAt(d-1)&&(this.lead.row==c&&this.lead.column==d+1?d=d-1:d=d+1),this.lead.setPosition(c,d),this.$keepDesiredColumnOnChange=!1,h||(this.$desiredColumn=null)},s.prototype.moveCursorToScreen=function(c,d,h){var f=this.session.screenToDocumentPosition(c,d);this.moveCursorTo(f.row,f.column,h)},s.prototype.detach=function(){this.lead.detach(),this.anchor.detach()},s.prototype.fromOrientedRange=function(c){this.setSelectionRange(c,c.cursor==c.start),this.$desiredColumn=c.desiredColumn||this.$desiredColumn},s.prototype.toOrientedRange=function(c){var d=this.getRange();return c?(c.start.column=d.start.column,c.start.row=d.start.row,c.end.column=d.end.column,c.end.row=d.end.row):c=d,c.cursor=this.isBackwards()?c.start:c.end,c.desiredColumn=this.$desiredColumn,c},s.prototype.getRangeOfMovements=function(c){var d=this.getCursor();try{c(this);var h=this.getCursor();return u.fromPoints(d,h)}catch{return u.fromPoints(d,d)}finally{this.moveCursorToPosition(d)}},s.prototype.toJSON=function(){if(this.rangeCount)var c=this.ranges.map(function(d){var h=d.clone();return h.isBackwards=d.cursor==d.start,h});else{var c=this.getRange();c.isBackwards=this.isBackwards()}return c},s.prototype.fromJSON=function(c){if(c.start==null)if(this.rangeList&&c.length>1){this.toSingleRange(c[0]);for(var d=c.length;d--;){var h=u.fromPoints(c[d].start,c[d].end);c[d].isBackwards&&(h.cursor=h.start),this.addRange(h,!0)}return}else c=c[0];this.rangeList&&this.toSingleRange(c),this.setSelectionRange(c,c.isBackwards)},s.prototype.isEqual=function(c){if((c.length||this.rangeCount)&&c.length!=this.rangeCount)return!1;if(!c.length||!this.ranges)return this.getRange().isEqual(c);for(var d=this.ranges.length;d--;)if(!this.ranges[d].isEqual(c[d]))return!1;return!0},s}();p.prototype.setSelectionAnchor=p.prototype.setAnchor,p.prototype.getSelectionAnchor=p.prototype.getAnchor,p.prototype.setSelectionRange=p.prototype.setRange,o.implement(p.prototype,m),r.Selection=p}),ace.define("ace/tokenizer",["require","exports","module","ace/lib/report_error"],function(n,r,i){var o=n("./lib/report_error").reportError,l=2e3,m=function(){function u(p){this.splitRegex,this.states=p,this.regExps={},this.matchMappings={};for(var s in this.states){for(var c=this.states[s],d=[],h=0,f=this.matchMappings[s]={defaultToken:"text"},v="g",y=[],b=0;b1?w.onMatch=this.$applyToken:w.onMatch=w.token),E>1&&(/\\\d/.test(w.regex)?x=w.regex.replace(/\\([0-9]+)/g,function(_,$){return"\\"+(parseInt($,10)+h+1)}):(E=1,x=this.removeCapturingGroups(w.regex)),!w.splitRegex&&typeof w.token!="string"&&y.push(w)),f[h]=b,h+=E,d.push(x),w.onMatch||(w.onMatch=null)}}d.length||(f[0]=0,d.push("$")),y.forEach(function(_){_.splitRegex=this.createSplitterRegexp(_.regex,v)},this),this.regExps[s]=new RegExp("("+d.join(")|(")+")|($)",v)}}return u.prototype.$setMaxTokenCount=function(p){l=p|0},u.prototype.$applyToken=function(p){var s=this.splitRegex.exec(p).slice(1),c=this.token.apply(this,s);if(typeof c=="string")return[{type:c,value:p}];for(var d=[],h=0,f=c.length;hw){var k=p.substring(w,N-O.length);E.type==_?E.value+=k:(E.type&&b.push(E),E={type:_,value:k})}for(var L=0;Ll){for(x>2*p.length&&this.reportError("infinite loop with in ace tokenizer",{startState:s,line:p});w1&&c[0]!==d&&c.unshift("#tmp",d),{tokens:b,state:c.length?c:d}},u}();m.prototype.reportError=o,r.Tokenizer=m}),ace.define("ace/mode/text_highlight_rules",["require","exports","module","ace/lib/deep_copy"],function(n,r,i){var o=n("../lib/deep_copy").deepCopy,l;l=function(){this.$rules={start:[{token:"empty_line",regex:"^$"},{defaultToken:"text"}]}},(function(){this.addRules=function(p,s){if(!s){for(var c in p)this.$rules[c]=p[c];return}for(var c in p){for(var d=p[c],h=0;h=this.$rowTokens.length;){if(this.$row+=1,u||(u=this.$session.getLength()),this.$row>=u)return this.$row=u-1,null;this.$rowTokens=this.$session.getTokens(this.$row),this.$tokenIndex=0}return this.$rowTokens[this.$tokenIndex]},m.prototype.getCurrentToken=function(){return this.$rowTokens[this.$tokenIndex]},m.prototype.getCurrentTokenRow=function(){return this.$row},m.prototype.getCurrentTokenColumn=function(){var u=this.$rowTokens,p=this.$tokenIndex,s=u[p].start;if(s!==void 0)return s;for(s=0;p>0;)p-=1,s+=u[p].value.length;return s},m.prototype.getCurrentTokenPosition=function(){return{row:this.$row,column:this.getCurrentTokenColumn()}},m.prototype.getCurrentTokenRange=function(){var u=this.$rowTokens[this.$tokenIndex],p=this.getCurrentTokenColumn();return new o(this.$row,p,this.$row,p+u.value.length)},m}();r.TokenIterator=l}),ace.define("ace/mode/behaviour/cstyle",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"],function(n,r,i){var o=n("../../lib/oop"),l=n("../behaviour").Behaviour,m=n("../../token_iterator").TokenIterator,u=n("../../lib/lang"),p=["text","paren.rparen","rparen","paren","punctuation.operator"],s=["text","paren.rparen","rparen","paren","punctuation.operator","comment"],c,d={},h={'"':'"',"'":"'"},f=function(b){var w=-1;if(b.multiSelect&&(w=b.selection.index,d.rangeCount!=b.multiSelect.rangeCount&&(d={rangeCount:b.multiSelect.rangeCount})),d[w])return c=d[w];c=d[w]={autoInsertedBrackets:0,autoInsertedRow:-1,autoInsertedLineEnd:"",maybeInsertedBrackets:0,maybeInsertedRow:-1,maybeInsertedLineStart:"",maybeInsertedLineEnd:""}},v=function(b,w,x,E){var _=b.end.row-b.start.row;return{text:x+w+E,selection:[0,b.start.column+1,_,b.end.column+(_?0:1)]}},y;y=function(b){b=b||{},this.add("braces","insertion",function(w,x,E,_,$){var O=E.getCursorPosition(),N=_.doc.getLine(O.row);if($=="{"){f(E);var k=E.getSelectionRange(),L=_.doc.getTextRange(k),F=_.getTokenAt(O.row,O.column);if(L!==""&&L!=="{"&&E.getWrapBehavioursEnabled())return v(k,L,"{","}");if(F&&/(?:string)\.quasi|\.xml/.test(F.type)){var P=[/tag\-(?:open|name)/,/attribute\-name/];return P.some(function(B){return B.test(F.type)})||/(string)\.quasi/.test(F.type)&&F.value[O.column-F.start-1]!=="$"?void 0:(y.recordAutoInsert(E,_,"}"),{text:"{}",selection:[1,1]})}else if(y.isSaneInsertion(E,_))return/[\]\}\)]/.test(N[O.column])||E.inMultiSelectMode||b.braces?(y.recordAutoInsert(E,_,"}"),{text:"{}",selection:[1,1]}):(y.recordMaybeInsert(E,_,"{"),{text:"{",selection:[1,1]})}else if($=="}"){f(E);var A=N.substring(O.column,O.column+1);if(A=="}"){var M=_.$findOpeningBracket("}",{column:O.column+1,row:O.row});if(M!==null&&y.isAutoInsertedClosing(O,N,$))return y.popAutoInsertedClosing(),{text:"",selection:[1,1]}}}else if($==` +`||$==`\r +`){f(E);var R="";y.isMaybeInsertedClosing(O,N)&&(R=u.stringRepeat("}",c.maybeInsertedBrackets),y.clearMaybeInsertedClosing());var A=N.substring(O.column,O.column+1);if(A==="}"){var I=_.findMatchingBracket({row:O.row,column:O.column+1},"}");if(!I)return null;var D=this.$getIndent(_.getLine(I.row))}else if(R)var D=this.$getIndent(N);else{y.clearMaybeInsertedClosing();return}var j=D+_.getTabString();return{text:` +`+j+` +`+D+R,selection:[1,j.length,1,j.length]}}else y.clearMaybeInsertedClosing()}),this.add("braces","deletion",function(w,x,E,_,$){var O=_.doc.getTextRange($);if(!$.isMultiLine()&&O=="{"){f(E);var N=_.doc.getLine($.start.row),k=N.substring($.end.column,$.end.column+1);if(k=="}")return $.end.column++,$;c.maybeInsertedBrackets--}}),this.add("parens","insertion",function(w,x,E,_,$){if($=="("){f(E);var O=E.getSelectionRange(),N=_.doc.getTextRange(O);if(N!==""&&E.getWrapBehavioursEnabled())return v(O,N,"(",")");if(y.isSaneInsertion(E,_))return y.recordAutoInsert(E,_,")"),{text:"()",selection:[1,1]}}else if($==")"){f(E);var k=E.getCursorPosition(),L=_.doc.getLine(k.row),F=L.substring(k.column,k.column+1);if(F==")"){var P=_.$findOpeningBracket(")",{column:k.column+1,row:k.row});if(P!==null&&y.isAutoInsertedClosing(k,L,$))return y.popAutoInsertedClosing(),{text:"",selection:[1,1]}}}}),this.add("parens","deletion",function(w,x,E,_,$){var O=_.doc.getTextRange($);if(!$.isMultiLine()&&O=="("){f(E);var N=_.doc.getLine($.start.row),k=N.substring($.start.column+1,$.start.column+2);if(k==")")return $.end.column++,$}}),this.add("brackets","insertion",function(w,x,E,_,$){if($=="["){f(E);var O=E.getSelectionRange(),N=_.doc.getTextRange(O);if(N!==""&&E.getWrapBehavioursEnabled())return v(O,N,"[","]");if(y.isSaneInsertion(E,_))return y.recordAutoInsert(E,_,"]"),{text:"[]",selection:[1,1]}}else if($=="]"){f(E);var k=E.getCursorPosition(),L=_.doc.getLine(k.row),F=L.substring(k.column,k.column+1);if(F=="]"){var P=_.$findOpeningBracket("]",{column:k.column+1,row:k.row});if(P!==null&&y.isAutoInsertedClosing(k,L,$))return y.popAutoInsertedClosing(),{text:"",selection:[1,1]}}}}),this.add("brackets","deletion",function(w,x,E,_,$){var O=_.doc.getTextRange($);if(!$.isMultiLine()&&O=="["){f(E);var N=_.doc.getLine($.start.row),k=N.substring($.start.column+1,$.start.column+2);if(k=="]")return $.end.column++,$}}),this.add("string_dquotes","insertion",function(w,x,E,_,$){var O=_.$mode.$quotes||h;if($.length==1&&O[$]){if(this.lineCommentStart&&this.lineCommentStart.indexOf($)!=-1)return;f(E);var N=$,k=E.getSelectionRange(),L=_.doc.getTextRange(k);if(L!==""&&(L.length!=1||!O[L])&&E.getWrapBehavioursEnabled())return v(k,L,N,N);if(!L){var F=E.getCursorPosition(),P=_.doc.getLine(F.row),A=P.substring(F.column-1,F.column),M=P.substring(F.column,F.column+1),R=_.getTokenAt(F.row,F.column),I=_.getTokenAt(F.row,F.column+1);if(A=="\\"&&R&&/escape/.test(R.type))return null;var D=R&&/string|escape/.test(R.type),j=!I||/string|escape/.test(I.type),B;if(M==N)B=D!==j,B&&/string\.end/.test(I.type)&&(B=!1);else{if(D&&!j||D&&j)return null;var V=_.$mode.tokenRe;V.lastIndex=0;var H=V.test(A);V.lastIndex=0;var Y=V.test(M),U=_.$mode.$pairQuotesAfter,K=U&&U[N]&&U[N].test(A);if(!K&&H||Y||M&&!/[\s;,.})\]\\]/.test(M))return null;var G=P[F.column-2];if(A==N&&(G==N||V.test(G)))return null;B=!0}return{text:B?N+N:"",selection:[1,1]}}}}),this.add("string_dquotes","deletion",function(w,x,E,_,$){var O=_.$mode.$quotes||h,N=_.doc.getTextRange($);if(!$.isMultiLine()&&O.hasOwnProperty(N)){f(E);var k=_.doc.getLine($.start.row),L=k.substring($.start.column+1,$.start.column+2);if(L==N)return $.end.column++,$}}),b.closeDocComment!==!1&&this.add("doc comment end","insertion",function(w,x,E,_,$){if(w==="doc-start"&&($===` +`||$===`\r +`)&&E.selection.isEmpty()){var O=E.getCursorPosition();if(O.column===0)return;for(var N=_.doc.getLine(O.row),k=_.doc.getLine(O.row+1),L=_.getTokens(O.row),F=0,P=0;P=O.column){if(F===O.column){if(!/\.doc/.test(A.type))return;if(/\*\//.test(A.value)){var M=L[P+1];if(!M||!/\.doc/.test(M.type))return}}var R=O.column-(F-A.value.length),I=A.value.indexOf("*/"),D=A.value.indexOf("/**",I>-1?I+2:0);if(D!==-1&&R>D&&R=I&&R<=D||!/\.doc/.test(A.type))return;break}}var j=this.$getIndent(N);if(/\s*\*/.test(k))return/^\s*\*/.test(N)?{text:$+j+"* ",selection:[1,2+j.length,1,2+j.length]}:{text:$+j+" * ",selection:[1,3+j.length,1,3+j.length]};if(/\/\*\*/.test(N.substring(0,O.column)))return{text:$+j+" * "+$+" "+j+"*/",selection:[1,4+j.length,1,4+j.length]}}})},y.isSaneInsertion=function(b,w){var x=b.getCursorPosition(),E=new m(w,x.row,x.column);if(!this.$matchTokenType(E.getCurrentToken()||"text",p)){if(/[)}\]]/.test(b.session.getLine(x.row)[x.column]))return!0;var _=new m(w,x.row,x.column+1);if(!this.$matchTokenType(_.getCurrentToken()||"text",p))return!1}return E.stepForward(),E.getCurrentTokenRow()!==x.row||this.$matchTokenType(E.getCurrentToken()||"text",s)},y.$matchTokenType=function(b,w){return w.indexOf(b.type||b)>-1},y.recordAutoInsert=function(b,w,x){var E=b.getCursorPosition(),_=w.doc.getLine(E.row);this.isAutoInsertedClosing(E,_,c.autoInsertedLineEnd[0])||(c.autoInsertedBrackets=0),c.autoInsertedRow=E.row,c.autoInsertedLineEnd=x+_.substr(E.column),c.autoInsertedBrackets++},y.recordMaybeInsert=function(b,w,x){var E=b.getCursorPosition(),_=w.doc.getLine(E.row);this.isMaybeInsertedClosing(E,_)||(c.maybeInsertedBrackets=0),c.maybeInsertedRow=E.row,c.maybeInsertedLineStart=_.substr(0,E.column)+x,c.maybeInsertedLineEnd=_.substr(E.column),c.maybeInsertedBrackets++},y.isAutoInsertedClosing=function(b,w,x){return c.autoInsertedBrackets>0&&b.row===c.autoInsertedRow&&x===c.autoInsertedLineEnd[0]&&w.substr(b.column)===c.autoInsertedLineEnd},y.isMaybeInsertedClosing=function(b,w){return c.maybeInsertedBrackets>0&&b.row===c.maybeInsertedRow&&w.substr(b.column)===c.maybeInsertedLineEnd&&w.substr(0,b.column)==c.maybeInsertedLineStart},y.popAutoInsertedClosing=function(){c.autoInsertedLineEnd=c.autoInsertedLineEnd.substr(1),c.autoInsertedBrackets--},y.clearMaybeInsertedClosing=function(){c&&(c.maybeInsertedBrackets=0,c.maybeInsertedRow=-1)},o.inherits(y,l),r.CstyleBehaviour=y}),ace.define("ace/unicode",["require","exports","module"],function(n,r,i){for(var o=[48,9,8,25,5,0,2,25,48,0,11,0,5,0,6,22,2,30,2,457,5,11,15,4,8,0,2,0,18,116,2,1,3,3,9,0,2,2,2,0,2,19,2,82,2,138,2,4,3,155,12,37,3,0,8,38,10,44,2,0,2,1,2,1,2,0,9,26,6,2,30,10,7,61,2,9,5,101,2,7,3,9,2,18,3,0,17,58,3,100,15,53,5,0,6,45,211,57,3,18,2,5,3,11,3,9,2,1,7,6,2,2,2,7,3,1,3,21,2,6,2,0,4,3,3,8,3,1,3,3,9,0,5,1,2,4,3,11,16,2,2,5,5,1,3,21,2,6,2,1,2,1,2,1,3,0,2,4,5,1,3,2,4,0,8,3,2,0,8,15,12,2,2,8,2,2,2,21,2,6,2,1,2,4,3,9,2,2,2,2,3,0,16,3,3,9,18,2,2,7,3,1,3,21,2,6,2,1,2,4,3,8,3,1,3,2,9,1,5,1,2,4,3,9,2,0,17,1,2,5,4,2,2,3,4,1,2,0,2,1,4,1,4,2,4,11,5,4,4,2,2,3,3,0,7,0,15,9,18,2,2,7,2,2,2,22,2,9,2,4,4,7,2,2,2,3,8,1,2,1,7,3,3,9,19,1,2,7,2,2,2,22,2,9,2,4,3,8,2,2,2,3,8,1,8,0,2,3,3,9,19,1,2,7,2,2,2,22,2,15,4,7,2,2,2,3,10,0,9,3,3,9,11,5,3,1,2,17,4,23,2,8,2,0,3,6,4,0,5,5,2,0,2,7,19,1,14,57,6,14,2,9,40,1,2,0,3,1,2,0,3,0,7,3,2,6,2,2,2,0,2,0,3,1,2,12,2,2,3,4,2,0,2,5,3,9,3,1,35,0,24,1,7,9,12,0,2,0,2,0,5,9,2,35,5,19,2,5,5,7,2,35,10,0,58,73,7,77,3,37,11,42,2,0,4,328,2,3,3,6,2,0,2,3,3,40,2,3,3,32,2,3,3,6,2,0,2,3,3,14,2,56,2,3,3,66,5,0,33,15,17,84,13,619,3,16,2,25,6,74,22,12,2,6,12,20,12,19,13,12,2,2,2,1,13,51,3,29,4,0,5,1,3,9,34,2,3,9,7,87,9,42,6,69,11,28,4,11,5,11,11,39,3,4,12,43,5,25,7,10,38,27,5,62,2,28,3,10,7,9,14,0,89,75,5,9,18,8,13,42,4,11,71,55,9,9,4,48,83,2,2,30,14,230,23,280,3,5,3,37,3,5,3,7,2,0,2,0,2,0,2,30,3,52,2,6,2,0,4,2,2,6,4,3,3,5,5,12,6,2,2,6,67,1,20,0,29,0,14,0,17,4,60,12,5,0,4,11,18,0,5,0,3,9,2,0,4,4,7,0,2,0,2,0,2,3,2,10,3,3,6,4,5,0,53,1,2684,46,2,46,2,132,7,6,15,37,11,53,10,0,17,22,10,6,2,6,2,6,2,6,2,6,2,6,2,6,2,6,2,31,48,0,470,1,36,5,2,4,6,1,5,85,3,1,3,2,2,89,2,3,6,40,4,93,18,23,57,15,513,6581,75,20939,53,1164,68,45,3,268,4,27,21,31,3,13,13,1,2,24,9,69,11,1,38,8,3,102,3,1,111,44,25,51,13,68,12,9,7,23,4,0,5,45,3,35,13,28,4,64,15,10,39,54,10,13,3,9,7,22,4,1,5,66,25,2,227,42,2,1,3,9,7,11171,13,22,5,48,8453,301,3,61,3,105,39,6,13,4,6,11,2,12,2,4,2,0,2,1,2,1,2,107,34,362,19,63,3,53,41,11,5,15,17,6,13,1,25,2,33,4,2,134,20,9,8,25,5,0,2,25,12,88,4,5,3,5,3,5,3,2],l=0,m=[],u=0;u2?G%$!=$-1:G%$==0}}else{if(!this.blockComment)return!1;var N=this.blockComment.start,k=this.blockComment.end,L=new RegExp("^(\\s*)(?:"+s.escapeRegExp(N)+")"),F=new RegExp("(?:"+s.escapeRegExp(k)+")\\s*$"),P=function(B,V){M(B,V)||(!x||/\S/.test(B))&&(w.insertInLine({row:V,column:B.length},k),w.insertInLine({row:V,column:_},N))},A=function(B,V){var H;(H=B.match(F))&&w.removeInLine(V,B.length-H[0].length,B.length),(H=B.match(L))&&w.removeInLine(V,H[1].length,H[0].length)},M=function(B,V){if(L.test(B))return!0;for(var H=v.getTokens(V),Y=0;YB.length&&(j=B.length)}),_==1/0&&(_=j,x=!1,E=!1),O&&_%$!=0&&(_=Math.floor(_/$)*$),D(E?A:P)},this.toggleBlockComment=function(f,v,y,b){var w=this.blockComment;if(w){!w.start&&w[0]&&(w=w[0]);var x=new c(v,b.row,b.column),E=x.getCurrentToken();v.selection;var _=v.selection.toOrientedRange(),$,O;if(E&&/comment/.test(E.type)){for(var N,k;E&&/comment/.test(E.type);){var L=E.value.indexOf(w.start);if(L!=-1){var F=x.getCurrentTokenRow(),P=x.getCurrentTokenColumn()+L;N=new d(F,P,F,P+w.start.length);break}E=x.stepBackward()}for(var x=new c(v,b.row,b.column),E=x.getCurrentToken();E&&/comment/.test(E.type);){var L=E.value.indexOf(w.end);if(L!=-1){var F=x.getCurrentTokenRow(),P=x.getCurrentTokenColumn()+L;k=new d(F,P,F,P+w.end.length);break}E=x.stepForward()}k&&v.remove(k),N&&(v.remove(N),$=N.start.row,O=-w.start.length)}else O=w.start.length,$=y.start.row,v.insert(y.end,w.end),v.insert(y.start,w.start);_.start.row==$&&(_.start.column+=O),_.end.row==$&&(_.end.column+=O),v.selection.fromOrientedRange(_)}},this.getNextLineIndent=function(f,v,y){return this.$getIndent(v)},this.checkOutdent=function(f,v,y){return!1},this.autoOutdent=function(f,v,y){},this.$getIndent=function(f){return f.match(/^\s*/)[0]},this.createWorker=function(f){return null},this.createModeDelegates=function(f){this.$embeds=[],this.$modes={};for(var v in f)if(f[v]){var y=f[v],b=y.prototype.$id,w=o.$modes[b];w||(o.$modes[b]=w=new y),o.$modes[v]||(o.$modes[v]=w),this.$embeds.push(v),this.$modes[v]=w}for(var x=["toggleBlockComment","toggleCommentLines","getNextLineIndent","checkOutdent","autoOutdent","transformAction","getCompletions"],E=function($){(function(O){var N=x[$],k=O[N];O[x[$]]=function(){return this.$delegator(N,arguments,k)}})(_)},_=this,v=0;vp[s].column&&s++,h.unshift(s,0),p.splice.apply(p,h),this.$updateRows()}}},m.prototype.$updateRows=function(){var u=this.session.lineWidgets;if(u){var p=!0;u.forEach(function(s,c){if(s)for(p=!1,s.row=c;s.$oldWidget;)s.$oldWidget.row=c,s=s.$oldWidget}),p&&(this.session.lineWidgets=null)}},m.prototype.$registerLineWidget=function(u){this.session.lineWidgets||(this.session.lineWidgets=new Array(this.session.getLength()));var p=this.session.lineWidgets[u.row];return p&&(u.$oldWidget=p,p.el&&p.el.parentNode&&(p.el.parentNode.removeChild(p.el),p._inDocument=!1)),this.session.lineWidgets[u.row]=u,u},m.prototype.addLineWidget=function(u){if(this.$registerLineWidget(u),u.session=this.session,!this.editor)return u;var p=this.editor.renderer;u.html&&!u.el&&(u.el=o.createElement("div"),u.el.innerHTML=u.html),u.text&&!u.el&&(u.el=o.createElement("div"),u.el.textContent=u.text),u.el&&(o.addCssClass(u.el,"ace_lineWidgetContainer"),u.className&&o.addCssClass(u.el,u.className),u.el.style.position="absolute",u.el.style.zIndex="5",p.container.appendChild(u.el),u._inDocument=!0,u.coverGutter||(u.el.style.zIndex="3"),u.pixelHeight==null&&(u.pixelHeight=u.el.offsetHeight)),u.rowCount==null&&(u.rowCount=u.pixelHeight/p.layerConfig.lineHeight);var s=this.session.getFoldAt(u.row,0);if(u.$fold=s,s){var c=this.session.lineWidgets;u.row==s.end.row&&!c[s.start.row]?c[s.start.row]=u:u.hidden=!0}return this.session._emit("changeFold",{data:{start:{row:u.row}}}),this.$updateRows(),this.renderWidgets(null,p),this.onWidgetChanged(u),u},m.prototype.removeLineWidget=function(u){if(u._inDocument=!1,u.session=null,u.el&&u.el.parentNode&&u.el.parentNode.removeChild(u.el),u.editor&&u.editor.destroy)try{u.editor.destroy()}catch{}if(this.session.lineWidgets){var p=this.session.lineWidgets[u.row];if(p==u)this.session.lineWidgets[u.row]=u.$oldWidget,u.$oldWidget&&this.onWidgetChanged(u.$oldWidget);else for(;p;){if(p.$oldWidget==u){p.$oldWidget=u.$oldWidget;break}p=p.$oldWidget}}this.session._emit("changeFold",{data:{start:{row:u.row}}}),this.$updateRows()},m.prototype.getWidgetsAtRow=function(u){for(var p=this.session.lineWidgets,s=p&&p[u],c=[];s;)c.push(s),s=s.$oldWidget;return c},m.prototype.onWidgetChanged=function(u){this.session._changedWidgets.push(u),this.editor&&this.editor.renderer.updateFull()},m.prototype.measureWidgets=function(u,p){var s=this.session._changedWidgets,c=p.layerConfig;if(!(!s||!s.length)){for(var d=1/0,h=0;h0&&!c[d];)d--;this.firstRow=s.firstRow,this.lastRow=s.lastRow,p.$cursorLayer.config=s;for(var f=d;f<=h;f++){var v=c[f];if(!(!v||!v.el)){if(v.hidden){v.el.style.top=-100-(v.pixelHeight||0)+"px";continue}v._inDocument||(v._inDocument=!0,p.container.appendChild(v.el));var y=p.$cursorLayer.getPixelPosition({row:f,column:0},!0).top;v.coverLine||(y+=s.lineHeight*this.session.getRowLineCount(v.row)),v.el.style.top=y-s.offset+"px";var b=v.coverGutter?0:p.gutterWidth;v.fixedWidth||(b-=p.scrollLeft),v.el.style.left=b+"px",v.fullWidth&&v.screenWidth&&(v.el.style.minWidth=s.width+2*s.padding+"px"),v.fixedWidth?v.el.style.right=p.scrollBar.getWidth()+"px":v.el.style.right=""}}}},m}();r.LineWidgets=l}),ace.define("ace/apply_delta",["require","exports","module"],function(n,r,i){r.applyDelta=function(o,l,m){var u=l.start.row,p=l.start.column,s=o[u]||"";switch(l.action){case"insert":var c=l.lines;if(c.length===1)o[u]=s.substring(0,p)+l.lines[0]+s.substring(p);else{var d=[u,1].concat(l.lines);o.splice.apply(o,d),o[u]=s.substring(0,p)+o[u],o[u+l.lines.length-1]+=s.substring(p)}break;case"remove":var h=l.end.column,f=l.end.row;u===f?o[u]=s.substring(0,p)+s.substring(h):o.splice(u,f-u+1,s.substring(0,p)+o[f].substring(h));break}}}),ace.define("ace/anchor",["require","exports","module","ace/lib/oop","ace/lib/event_emitter"],function(n,r,i){var o=n("./lib/oop"),l=n("./lib/event_emitter").EventEmitter,m=function(){function s(c,d,h){this.$onChange=this.onChange.bind(this),this.attach(c),typeof d!="number"?this.setPosition(d.row,d.column):this.setPosition(d,h)}return s.prototype.getPosition=function(){return this.$clipPositionToDocument(this.row,this.column)},s.prototype.getDocument=function(){return this.document},s.prototype.onChange=function(c){if(!(c.start.row==c.end.row&&c.start.row!=this.row)&&!(c.start.row>this.row)){var d=p(c,{row:this.row,column:this.column},this.$insertRight);this.setPosition(d.row,d.column,!0)}},s.prototype.setPosition=function(c,d,h){var f;if(h?f={row:c,column:d}:f=this.$clipPositionToDocument(c,d),!(this.row==f.row&&this.column==f.column)){var v={row:this.row,column:this.column};this.row=f.row,this.column=f.column,this._signal("change",{old:v,value:f})}},s.prototype.detach=function(){this.document.off("change",this.$onChange)},s.prototype.attach=function(c){this.document=c||this.document,this.document.on("change",this.$onChange)},s.prototype.$clipPositionToDocument=function(c,d){var h={};return c>=this.document.getLength()?(h.row=Math.max(0,this.document.getLength()-1),h.column=this.document.getLine(h.row).length):c<0?(h.row=0,h.column=0):(h.row=c,h.column=Math.min(this.document.getLine(h.row).length,Math.max(0,d))),d<0&&(h.column=0),h},s}();m.prototype.$insertRight=!1,o.implement(m.prototype,l);function u(s,c,d){var h=d?s.column<=c.column:s.column=f&&(d=f-1,h=void 0);var v=this.getLine(d);return h==null&&(h=v.length),h=Math.min(Math.max(h,0),v.length),{row:d,column:h}},c.prototype.clonePos=function(d){return{row:d.row,column:d.column}},c.prototype.pos=function(d,h){return{row:d,column:h}},c.prototype.$clipPosition=function(d){var h=this.getLength();return d.row>=h?(d.row=Math.max(0,h-1),d.column=this.getLine(h-1).length):(d.row=Math.max(0,d.row),d.column=Math.min(Math.max(d.column,0),this.getLine(d.row).length)),d},c.prototype.insertFullLines=function(d,h){d=Math.min(Math.max(d,0),this.getLength());var f=0;d0,v=h=0&&this.applyDelta({start:this.pos(d,this.getLine(d).length),end:this.pos(d+1,0),action:"remove",lines:["",""]})},c.prototype.replace=function(d,h){if(d instanceof u||(d=u.fromPoints(d.start,d.end)),h.length===0&&d.isEmpty())return d.start;if(h==this.getTextRange(d))return d.end;this.remove(d);var f;return h?f=this.insert(d.start,h):f=d.start,f},c.prototype.applyDeltas=function(d){for(var h=0;h=0;h--)this.revertDelta(d[h])},c.prototype.applyDelta=function(d,h){var f=d.action=="insert";(f?d.lines.length<=1&&!d.lines[0]:!u.comparePoints(d.start,d.end))||(f&&d.lines.length>2e4?this.$splitAndapplyLargeDelta(d,2e4):(l(this.$lines,d,h),this._signal("change",d)))},c.prototype.$safeApplyDelta=function(d){var h=this.$lines.length;(d.action=="remove"&&d.start.row20){c.running=setTimeout(c.$worker,20);break}}c.currentLine=h,f==-1&&(f=h),y<=f&&c.fireUpdateEvent(y,f)}}}return u.prototype.setTokenizer=function(p){this.tokenizer=p,this.lines=[],this.states=[],this.start(0)},u.prototype.setDocument=function(p){this.doc=p,this.lines=[],this.states=[],this.stop()},u.prototype.fireUpdateEvent=function(p,s){var c={first:p,last:s};this._signal("update",{data:c})},u.prototype.start=function(p){this.currentLine=Math.min(p||0,this.currentLine,this.doc.getLength()),this.lines.splice(this.currentLine,this.lines.length),this.states.splice(this.currentLine,this.states.length),this.stop(),this.running=setTimeout(this.$worker,700)},u.prototype.scheduleStart=function(){this.running||(this.running=setTimeout(this.$worker,700))},u.prototype.$updateOnChange=function(p){var s=p.start.row,c=p.end.row-s;if(c===0)this.lines[s]=null;else if(p.action=="remove")this.lines.splice(s,c+1,null),this.states.splice(s,c+1,null);else{var d=Array(c+1);d.unshift(s,1),this.lines.splice.apply(this.lines,d),this.states.splice.apply(this.states,d)}this.currentLine=Math.min(s,this.currentLine,this.doc.getLength()),this.stop()},u.prototype.stop=function(){this.running&&clearTimeout(this.running),this.running=!1},u.prototype.getTokens=function(p){return this.lines[p]||this.$tokenizeRow(p)},u.prototype.getState=function(p){return this.currentLine==p&&this.$tokenizeRow(p),this.states[p]||"start"},u.prototype.$tokenizeRow=function(p){var s=this.doc.getLine(p),c=this.states[p-1],d=this.tokenizer.getLineTokens(s,c,p);return this.states[p]+""!=d.state+""?(this.states[p]=d.state,this.lines[p+1]=null,this.currentLine>p+1&&(this.currentLine=p+1)):this.currentLine==p&&(this.currentLine=p+1),this.lines[p]=d.tokens},u.prototype.cleanup=function(){this.running=!1,this.lines=[],this.states=[],this.currentLine=0,this.removeAllListeners()},u}();o.implement(m.prototype,l),r.BackgroundTokenizer=m}),ace.define("ace/search_highlight",["require","exports","module","ace/lib/lang","ace/range"],function(n,r,i){var o=n("./lib/lang"),l=n("./range").Range,m=function(){function u(p,s,c){c===void 0&&(c="text"),this.setRegexp(p),this.clazz=s,this.type=c,this.docLen=0}return u.prototype.setRegexp=function(p){this.regExp+""!=p+""&&(this.regExp=p,this.cache=[])},u.prototype.update=function(p,s,c,d){if(this.regExp){for(var h=d.firstRow,f=d.lastRow,v={},y=c.$editor&&c.$editor.$search,b=y&&y.$isMultilineSearch(c.$editor.getLastSearchOptions()),w=h;w<=f;w++){var x=this.cache[w];if(x==null||c.getValue().length!=this.docLen){if(b){x=[];var E=y.$multiLineForward(c,this.regExp,w,f);if(E){var _=E.endRow<=f?E.endRow-1:f;_>w&&(w=_),x.push(new l(E.startRow,E.startCol,E.endRow,E.endCol))}x.length>this.MAX_RANGES&&(x=x.slice(0,this.MAX_RANGES))}else x=o.getMatchOffsets(c.getLine(w),this.regExp),x.length>this.MAX_RANGES&&(x=x.slice(0,this.MAX_RANGES)),x=x.map(function(k){return new l(w,k.offset,w,k.offset+k.length)});this.cache[w]=x.length?x:""}if(x.length!==0)for(var $=x.length;$--;){var O=x[$].toScreenRange(c),N=O.toString();v[N]||(v[N]=!0,s.drawSingleLineMarker(p,O,this.clazz,d))}}this.docLen=c.getValue().length}},u}();m.prototype.MAX_RANGES=500,r.SearchHighlight=m}),ace.define("ace/undomanager",["require","exports","module","ace/range"],function(n,r,i){var o=function(){function _(){this.$keepRedoStack,this.$maxRev=0,this.$fromUndo=!1,this.$undoDepth=1/0,this.reset()}return _.prototype.addSession=function($){this.$session=$},_.prototype.add=function($,O,N){if(!this.$fromUndo&&$!=this.$lastDelta){if(this.$keepRedoStack||(this.$redoStack.length=0),O===!1||!this.lastDeltas){this.lastDeltas=[];var k=this.$undoStack.length;k>this.$undoDepth-1&&this.$undoStack.splice(0,k-this.$undoDepth+1),this.$undoStack.push(this.lastDeltas),$.id=this.$rev=++this.$maxRev}($.action=="remove"||$.action=="insert")&&(this.$lastDelta=$),this.lastDeltas.push($)}},_.prototype.addSelection=function($,O){this.selections.push({value:$,rev:O||this.$rev})},_.prototype.startNewGroup=function(){return this.lastDeltas=null,this.$rev},_.prototype.markIgnored=function($,O){O==null&&(O=this.$rev+1);for(var N=this.$undoStack,k=N.length;k--;){var L=N[k][0];if(L.id<=$)break;L.id0},_.prototype.canRedo=function(){return this.$redoStack.length>0},_.prototype.bookmark=function($){$==null&&($=this.$rev),this.mark=$},_.prototype.isAtBookmark=function(){return this.$rev===this.mark},_.prototype.toJSON=function(){return{$redoStack:this.$redoStack,$undoStack:this.$undoStack}},_.prototype.fromJSON=function($){this.reset(),this.$undoStack=$.$undoStack,this.$redoStack=$.$redoStack},_.prototype.$prettyPrint=function($){return $?c($):c(this.$undoStack)+` +--- +`+c(this.$redoStack)},_}();o.prototype.hasUndo=o.prototype.canUndo,o.prototype.hasRedo=o.prototype.canRedo,o.prototype.isClean=o.prototype.isAtBookmark,o.prototype.markClean=o.prototype.bookmark;function l(_,$){for(var O=$;O--;){var N=_[O];if(N&&!N[0].ignore){for(;O<$-1;){var k=f(_[O],_[O+1]);_[O]=k[0],_[O+1]=k[1],O++}return!0}}}var m=n("./range").Range,u=m.comparePoints;m.comparePoints;function p(_){return{row:_.row,column:_.column}}function s(_){return{start:p(_.start),end:p(_.end),action:_.action,lines:_.lines.slice()}}function c(_){if(_=_||this,Array.isArray(_))return _.map(c).join(` +`);var $="";return _.action?($=_.action=="insert"?"+":"-",$+="["+_.lines+"]"):_.value&&(Array.isArray(_.value)?$=_.value.map(d).join(` +`):$=d(_.value)),_.start&&($+=d(_)),(_.id||_.rev)&&($+=" ("+(_.id||_.rev)+")"),$}function d(_){return _.start.row+":"+_.start.column+"=>"+_.end.row+":"+_.end.column}function h(_,$){var O=_.action=="insert",N=$.action=="insert";if(O&&N)if(u($.start,_.end)>=0)y($,_,-1);else if(u($.start,_.start)<=0)y(_,$,1);else return null;else if(O&&!N)if(u($.start,_.end)>=0)y($,_,-1);else if(u($.end,_.start)<=0)y(_,$,-1);else return null;else if(!O&&N)if(u($.start,_.start)>=0)y($,_,1);else if(u($.start,_.start)<=0)y(_,$,1);else return null;else if(!O&&!N)if(u($.start,_.start)>=0)y($,_,1);else if(u($.end,_.start)<=0)y(_,$,-1);else return null;return[$,_]}function f(_,$){for(var O=_.length;O--;)for(var N=0;N<$.length;N++)if(!h(_[O],$[N])){for(;O<_.length;){for(;N--;)h($[N],_[O]);N=$.length,O++}return[_,$]}return _.selectionBefore=$.selectionBefore=_.selectionAfter=$.selectionAfter=null,[$,_]}function v(_,$){var O=_.action=="insert",N=$.action=="insert";if(O&&N)u(_.start,$.start)<0?y($,_,1):y(_,$,1);else if(O&&!N)u(_.start,$.end)>=0?y(_,$,-1):(u(_.start,$.start)<=0||y(_,m.fromPoints($.start,_.start),-1),y($,_,1));else if(!O&&N)u($.start,_.end)>=0?y($,_,-1):(u($.start,_.start)<=0||y($,m.fromPoints(_.start,$.start),-1),y(_,$,1));else if(!O&&!N)if(u($.start,_.end)>=0)y($,_,-1);else if(u($.end,_.start)<=0)y(_,$,-1);else{var k,L;return u(_.start,$.start)<0&&(k=_,_=w(_,$.start)),u(_.end,$.end)>0&&(L=w(_,$.end)),b($.end,_.start,_.end,-1),L&&!k&&(_.lines=L.lines,_.start=L.start,_.end=L.end,L=_),[$,k,L].filter(Boolean)}return[$,_]}function y(_,$,O){b(_.start,$.start,$.end,O),b(_.end,$.start,$.end,O)}function b(_,$,O,N){_.row==(N==1?$:O).row&&(_.column+=N*(O.column-$.column)),_.row+=N*(O.row-$.row)}function w(_,$){var O=_.lines,N=_.end;_.end=p($);var k=_.end.row-_.start.row,L=O.splice(k,O.length),F=k?$.column:$.column-_.start.column;O.push(L[0].substring(0,F)),L[0]=L[0].substr(F);var P={start:p($),end:N,lines:L,action:_.action};return P}function x(_,$){$=s($);for(var O=_.length;O--;){for(var N=_[O],k=0;kthis.endRow)throw new Error("Can't add a fold to this FoldLine as it has no connection");this.folds.push(u),this.folds.sort(function(p,s){return-p.range.compareEnd(s.start.row,s.start.column)}),this.range.compareEnd(u.start.row,u.start.column)>0?(this.end.row=u.end.row,this.end.column=u.end.column):this.range.compareStart(u.end.row,u.end.column)<0&&(this.start.row=u.start.row,this.start.column=u.start.column)}else if(u.start.row==this.end.row)this.folds.push(u),this.end.row=u.end.row,this.end.column=u.end.column;else if(u.end.row==this.start.row)this.folds.unshift(u),this.start.row=u.start.row,this.start.column=u.start.column;else throw new Error("Trying to add fold to FoldRow that doesn't have a matching row");u.foldLine=this},m.prototype.containsRow=function(u){return u>=this.start.row&&u<=this.end.row},m.prototype.walk=function(u,p,s){var c=0,d=this.folds,h,f,v,y=!0;p==null&&(p=this.end.row,s=this.end.column);for(var b=0;b0)){var y=l(p,f.start);return v===0?s&&y!==0?-h-2:h:y>0||y===0&&!s?h:-h-1}}return-h-1},u.prototype.add=function(p){var s=!p.isEmpty(),c=this.pointIndex(p.start,s);c<0&&(c=-c-1);var d=this.pointIndex(p.end,s,c);return d<0?d=-d-1:d++,this.ranges.splice(c,d-c,p)},u.prototype.addList=function(p){for(var s=[],c=p.length;c--;)s.push.apply(s,this.add(p[c]));return s},u.prototype.substractPoint=function(p){var s=this.pointIndex(p);if(s>=0)return this.ranges.splice(s,1)},u.prototype.merge=function(){var p=[],s=this.ranges;s=s.sort(function(v,y){return l(v.start,y.start)});for(var c=s[0],d,h=1;h=0},u.prototype.containsPoint=function(p){return this.pointIndex(p)>=0},u.prototype.rangeAtPoint=function(p){var s=this.pointIndex(p);if(s>=0)return this.ranges[s]},u.prototype.clipRows=function(p,s){var c=this.ranges;if(c[0].start.row>s||c[c.length-1].start.row=d)break}if(p.action=="insert")for(var w=h-d,x=-s.column+c.column;vd)break;if(b.start.row==d&&b.start.column>=s.column&&(b.start.column==s.column&&this.$bias<=0||(b.start.column+=x,b.start.row+=w)),b.end.row==d&&b.end.column>=s.column){if(b.end.column==s.column&&this.$bias<0)continue;b.end.column==s.column&&x>0&&vb.start.column&&b.end.column==f[v+1].start.column&&(b.end.column-=x),b.end.column+=x,b.end.row+=w}}else for(var w=d-h,x=s.column-c.column;vh)break;b.end.rows.column)&&(b.end.column=s.column,b.end.row=s.row):(b.end.column+=x,b.end.row+=w):b.end.row>h&&(b.end.row+=w),b.start.rows.column)&&(b.start.column=s.column,b.start.row=s.row):(b.start.column+=x,b.start.row+=w):b.start.row>h&&(b.start.row+=w)}if(w!=0&&v=c)return v;if(v.end.row>c)return null}return null},this.getNextFoldLine=function(c,d){var h=this.$foldData,f=0;for(d&&(f=h.indexOf(d)),f==-1&&(f=0),f;f=c)return v}return null},this.getFoldedRowCount=function(c,d){for(var h=this.$foldData,f=d-c+1,v=0;v=d){w=c?f-=d-w:f=0);break}else b>=c&&(w>=c?f-=b-w:f-=b-c+1)}return f},this.$addFoldLine=function(c){return this.$foldData.push(c),this.$foldData.sort(function(d,h){return d.start.row-h.start.row}),c},this.addFold=function(c,d){var h=this.$foldData,f=!1,v;c instanceof m?v=c:(v=new m(d,c),v.collapseChildren=d.collapseChildren),this.$clipRangeToDocument(v.range);var y=v.start.row,b=v.start.column,w=v.end.row,x=v.end.column,E=this.getFoldAt(y,b,1),_=this.getFoldAt(w,x,-1);if(E&&_==E)return E.addSubFold(v);E&&!E.range.isStart(y,b)&&this.removeFold(E),_&&!_.range.isEnd(w,x)&&this.removeFold(_);var $=this.getFoldsInRange(v.range);$.length>0&&(this.removeFolds($),v.collapseChildren||$.forEach(function(L){v.addSubFold(L)}));for(var O=0;O0&&this.foldAll(c.start.row+1,c.end.row,c.collapseChildren-1),c.subFolds=[]},this.expandFolds=function(c){c.forEach(function(d){this.expandFold(d)},this)},this.unfold=function(c,d){var h,f;if(c==null)h=new o(0,0,this.getLength(),0),d==null&&(d=!0);else if(typeof c=="number")h=new o(c,0,c,this.getLine(c).length);else if("row"in c)h=o.fromPoints(c,c);else{if(Array.isArray(c))return f=[],c.forEach(function(y){f=f.concat(this.unfold(y))},this),f;h=c}f=this.getFoldsInRangeList(h);for(var v=f;f.length==1&&o.comparePoints(f[0].start,h.start)<0&&o.comparePoints(f[0].end,h.end)>0;)this.expandFolds(f),f=this.getFoldsInRangeList(h);if(d!=!1?this.removeFolds(f):this.expandFolds(f),v.length)return v},this.isRowFolded=function(c,d){return!!this.getFoldLine(c,d)},this.getRowFoldEnd=function(c,d){var h=this.getFoldLine(c,d);return h?h.end.row:c},this.getRowFoldStart=function(c,d){var h=this.getFoldLine(c,d);return h?h.start.row:c},this.getFoldDisplayLine=function(c,d,h,f,v){f==null&&(f=c.start.row),v==null&&(v=0),d==null&&(d=c.end.row),h==null&&(h=this.getLine(d).length);var y=this.doc,b="";return c.walk(function(w,x,E,_){if(!(xE)break;while(v&&b.test(v.type));v=f.stepBackward()}else v=f.getCurrentToken();return w.end.row=f.getCurrentTokenRow(),w.end.column=f.getCurrentTokenColumn(),w.start.row==w.end.row&&w.start.column>w.end.column?void 0:w}},this.foldAll=function(c,d,h,f){h==null&&(h=1e5);var v=this.foldWidgets;if(v){d=d||this.getLength(),c=c||0;for(var y=c;y=c&&(y=b.end.row,b.collapseChildren=h,this.addFold("...",b))}}},this.foldToLevel=function(c){for(this.foldAll();c-- >0;)this.unfold(null,!1)},this.foldAllComments=function(){var c=this;this.foldAll(null,null,null,function(d){for(var h=c.getTokens(d),f=0;f=0;){var y=h[f];if(y==null&&(y=h[f]=this.getFoldWidget(f)),y=="start"){var b=this.getFoldWidgetRange(f);if(v||(v=b),b&&b.end.row>=c)break}f--}return{range:f!==-1&&b,firstRange:v}},this.onFoldWidgetClick=function(c,d){d instanceof p&&(d=d.domEvent);var h={children:d.shiftKey,all:d.ctrlKey||d.metaKey,siblings:d.altKey},f=this.$toggleFoldWidget(c,h);if(!f){var v=d.target||d.srcElement;v&&/ace_fold-widget/.test(v.className)&&(v.className+=" ace_invalid")}},this.$toggleFoldWidget=function(c,d){if(this.getFoldWidget){var h=this.getFoldWidget(c),f=this.getLine(c),v=h==="end"?-1:1,y=this.getFoldAt(c,v===-1?0:f.length,v);if(y)return d.children||d.all?this.removeFold(y):this.expandFold(y),y;var b=this.getFoldWidgetRange(c,!0);if(b&&!b.isMultiLine()&&(y=this.getFoldAt(b.start.row,b.start.column,1),y&&b.isEqual(y.range)))return this.removeFold(y),y;if(d.siblings){var w=this.getParentFoldRangeData(c);if(w.range)var x=w.range.start.row+1,E=w.range.end.row;this.foldAll(x,E,d.all?1e4:0)}else d.children?(E=b?b.end.row:this.getLength(),this.foldAll(c+1,E,d.all?1e4:0)):b&&(d.all&&(b.collapseChildren=1e4),this.addFold("...",b));return b}},this.toggleFoldWidget=function(c){var d=this.selection.getCursor().row;d=this.getRowFoldStart(d);var h=this.$toggleFoldWidget(d,{});if(!h){var f=this.getParentFoldRangeData(d,!0);if(h=f.range||f.firstRange,h){d=h.start.row;var v=this.getFoldAt(d,this.getLine(d).length,1);v?this.removeFold(v):this.addFold("...",h)}}},this.updateFoldWidgets=function(c){var d=c.start.row,h=c.end.row-d;if(h===0)this.foldWidgets[d]=null;else if(c.action=="remove")this.foldWidgets.splice(d,h+1,null);else{var f=Array(h+1);f.unshift(d,1),this.foldWidgets.splice.apply(this.foldWidgets,f)}},this.tokenizerUpdateFoldWidgets=function(c){var d=c.data;d.first!=d.last&&this.foldWidgets.length>d.first&&this.foldWidgets.splice(d.first,this.foldWidgets.length)}}r.Folding=s}),ace.define("ace/edit_session/bracket_match",["require","exports","module","ace/token_iterator","ace/range"],function(n,r,i){var o=n("../token_iterator").TokenIterator,l=n("../range").Range;function m(){this.findMatchingBracket=function(u,p){if(u.column==0)return null;var s=p||this.getLine(u.row).charAt(u.column-1);if(s=="")return null;var c=s.match(/([\(\[\{])|([\)\]\}])/);return c?c[1]?this.$findClosingBracket(c[1],u):this.$findOpeningBracket(c[2],u):null},this.getBracketRange=function(u){var p=this.getLine(u.row),s=!0,c,d=p.charAt(u.column-1),h=d&&d.match(/([\(\[\{])|([\)\]\}])/);if(h||(d=p.charAt(u.column),u={row:u.row,column:u.column+1},h=d&&d.match(/([\(\[\{])|([\)\]\}])/),s=!1),!h)return null;if(h[1]){var f=this.$findClosingBracket(h[1],u);if(!f)return null;c=l.fromPoints(u,f),s||(c.end.column++,c.start.column--),c.cursor=c.end}else{var f=this.$findOpeningBracket(h[2],u);if(!f)return null;c=l.fromPoints(f,u),s||(c.start.column++,c.end.column--),c.cursor=c.start}return c},this.getMatchingBracketRanges=function(u,p){var s=this.getLine(u.row),c=/([\(\[\{])|([\)\]\}])/,d=!p&&s.charAt(u.column-1),h=d&&d.match(c);if(h||(d=(p===void 0||p)&&s.charAt(u.column),u={row:u.row,column:u.column+1},h=d&&d.match(c)),!h)return null;var f=new l(u.row,u.column-1,u.row,u.column),v=h[1]?this.$findClosingBracket(h[1],u):this.$findOpeningBracket(h[2],u);if(!v)return[f];var y=new l(v.row,v.column,v.row,v.column+1);return[f,y]},this.$brackets={")":"(","(":")","]":"[","[":"]","{":"}","}":"{","<":">",">":"<"},this.$findOpeningBracket=function(u,p,s){var c=this.$brackets[u],d=1,h=new o(this,p.row,p.column),f=h.getCurrentToken();if(f||(f=h.stepForward()),!!f){s||(s=new RegExp("(\\.?"+f.type.replace(".","\\.").replace("rparen",".paren").replace(/\b(?:end)\b/,"(?:start|begin|end)").replace(/-close\b/,"-(close|open)")+")+"));for(var v=p.column-h.getCurrentTokenColumn()-2,y=f.value;;){for(;v>=0;){var b=y.charAt(v);if(b==c){if(d-=1,d==0)return{row:h.getCurrentTokenRow(),column:v+h.getCurrentTokenColumn()}}else b==u&&(d+=1);v-=1}do f=h.stepBackward();while(f&&!s.test(f.type));if(f==null)break;y=f.value,v=y.length-1}return null}},this.$findClosingBracket=function(u,p,s){var c=this.$brackets[u],d=1,h=new o(this,p.row,p.column),f=h.getCurrentToken();if(f||(f=h.stepForward()),!!f){s||(s=new RegExp("(\\.?"+f.type.replace(".","\\.").replace("lparen",".paren").replace(/\b(?:start|begin)\b/,"(?:start|begin|end)").replace(/-open\b/,"-(close|open)")+")+"));for(var v=p.column-h.getCurrentTokenColumn();;){for(var y=f.value,b=y.length;v"?c=!0:p.type.indexOf("tag-name")!==-1&&(s=!0));while(p&&!s);return p},this.$findClosingTag=function(u,p){var s,c=p.value,d=p.value,h=0,f=new l(u.getCurrentTokenRow(),u.getCurrentTokenColumn(),u.getCurrentTokenRow(),u.getCurrentTokenColumn()+1);p=u.stepForward();var v=new l(u.getCurrentTokenRow(),u.getCurrentTokenColumn(),u.getCurrentTokenRow(),u.getCurrentTokenColumn()+p.value.length),y=!1;do{if(s=p,s.type.indexOf("tag-close")!==-1&&!y){var b=new l(u.getCurrentTokenRow(),u.getCurrentTokenColumn(),u.getCurrentTokenRow(),u.getCurrentTokenColumn()+1);y=!0}if(p=u.stepForward(),p){if(p.value===">"&&!y){var b=new l(u.getCurrentTokenRow(),u.getCurrentTokenColumn(),u.getCurrentTokenRow(),u.getCurrentTokenColumn()+1);y=!0}if(p.type.indexOf("tag-name")!==-1){if(c=p.value,d===c){if(s.value==="<")h++;else if(s.value==="")var E=new l(u.getCurrentTokenRow(),u.getCurrentTokenColumn(),u.getCurrentTokenRow(),u.getCurrentTokenColumn()+1);else return}}}else if(d===c&&p.value==="/>"&&(h--,h<0))var w=new l(u.getCurrentTokenRow(),u.getCurrentTokenColumn(),u.getCurrentTokenRow(),u.getCurrentTokenColumn()+2),x=w,E=x,b=new l(v.end.row,v.end.column,v.end.row,v.end.column+1)}}while(p&&h>=0);if(f&&b&&w&&E&&v&&x)return{openTag:new l(f.start.row,f.start.column,b.end.row,b.end.column),closeTag:new l(w.start.row,w.start.column,E.end.row,E.end.column),openTagName:v,closeTagName:x}},this.$findOpeningTag=function(u,p){var s=u.getCurrentToken(),c=p.value,d=0,h=u.getCurrentTokenRow(),f=u.getCurrentTokenColumn(),v=f+2,y=new l(h,f,h,v);u.stepForward();var b=new l(u.getCurrentTokenRow(),u.getCurrentTokenColumn(),u.getCurrentTokenRow(),u.getCurrentTokenColumn()+p.value.length);if(p.type.indexOf("tag-close")===-1&&(p=u.stepForward()),!(!p||p.value!==">")){var w=new l(u.getCurrentTokenRow(),u.getCurrentTokenColumn(),u.getCurrentTokenRow(),u.getCurrentTokenColumn()+1);u.stepBackward(),u.stepBackward();do if(p=s,h=u.getCurrentTokenRow(),f=u.getCurrentTokenColumn(),v=f+p.value.length,s=u.stepBackward(),p){if(p.type.indexOf("tag-name")!==-1){if(c===p.value)if(s.value==="<"){if(d++,d>0){var x=new l(h,f,h,v),E=new l(u.getCurrentTokenRow(),u.getCurrentTokenColumn(),u.getCurrentTokenRow(),u.getCurrentTokenColumn()+1);do p=u.stepForward();while(p&&p.value!==">");var _=new l(u.getCurrentTokenRow(),u.getCurrentTokenColumn(),u.getCurrentTokenRow(),u.getCurrentTokenColumn()+1)}}else s.value===""){for(var $=0,O=s;O;){if(O.type.indexOf("tag-name")!==-1&&O.value===c){d--;break}else if(O.value==="<")break;O=u.stepBackward(),$++}for(var N=0;N<$;N++)u.stepForward()}}while(s&&d<=0);if(E&&_&&y&&w&&x&&b)return{openTag:new l(E.start.row,E.start.column,_.end.row,_.end.column),closeTag:new l(y.start.row,y.start.column,w.end.row,w.end.column),openTagName:x,closeTagName:b}}}}r.BracketMatch=m}),ace.define("ace/edit_session",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/bidihandler","ace/config","ace/lib/event_emitter","ace/selection","ace/mode/text","ace/range","ace/line_widgets","ace/document","ace/background_tokenizer","ace/search_highlight","ace/undomanager","ace/edit_session/folding","ace/edit_session/bracket_match"],function(n,r,i){var o=n("./lib/oop"),l=n("./lib/lang"),m=n("./bidihandler").BidiHandler,u=n("./config"),p=n("./lib/event_emitter").EventEmitter,s=n("./selection").Selection,c=n("./mode/text").Mode,d=n("./range").Range,h=n("./line_widgets").LineWidgets,f=n("./document").Document,v=n("./background_tokenizer").BackgroundTokenizer,y=n("./search_highlight").SearchHighlight,b=n("./undomanager").UndoManager,w=function(){function P(A,M){this.doc,this.$breakpoints=[],this.$decorations=[],this.$frontMarkers={},this.$backMarkers={},this.$markerId=1,this.$undoSelect=!0,this.$editor=null,this.prevOp={},this.$foldData=[],this.id="session"+ ++P.$uid,this.$foldData.toString=function(){return this.join(` +`)},this.$gutterCustomWidgets={},this.bgTokenizer=new v(new c().getTokenizer(),this);var R=this;this.bgTokenizer.on("update",function(I){R._signal("tokenizerUpdate",I)}),this.on("changeFold",this.onChangeFold.bind(this)),this.$onChange=this.onChange.bind(this),(typeof A!="object"||!A.getLine)&&(A=new f(A)),this.setDocument(A),this.selection=new s(this),this.$onSelectionChange=this.onSelectionChange.bind(this),this.selection.on("changeSelection",this.$onSelectionChange),this.selection.on("changeCursor",this.$onSelectionChange),this.$bidiHandler=new m(this),u.resetOptions(this),this.setMode(M),u._signal("session",this),this.destroyed=!1,this.$initOperationListeners()}return P.prototype.$initOperationListeners=function(){var A=this;this.curOp=null,this.on("change",function(){A.curOp||(A.startOperation(),A.curOp.selectionBefore=A.$lastSel),A.curOp.docChanged=!0},!0),this.on("changeSelection",function(){A.curOp||(A.startOperation(),A.curOp.selectionBefore=A.$lastSel),A.curOp.selectionChanged=!0},!0),this.$operationResetTimer=l.delayedCall(this.endOperation.bind(this,!0))},P.prototype.startOperation=function(A){if(this.curOp){if(!A||this.curOp.command)return;this.prevOp=this.curOp}A||(A={}),this.$operationResetTimer.schedule(),this.curOp={command:A.command||{},args:A.args},this.curOp.selectionBefore=this.selection.toJSON(),this._signal("startOperation",A)},P.prototype.endOperation=function(A){if(this.curOp){if(A&&A.returnValue===!1){this.curOp=null,this._signal("endOperation",A);return}if(A==!0&&this.curOp.command&&this.curOp.command.name=="mouse")return;var M=this.selection.toJSON();this.curOp.selectionAfter=M,this.$lastSel=this.selection.toJSON(),this.getUndoManager().addSelection(M),this._signal("beforeEndOperation"),this.prevOp=this.curOp,this.curOp=null,this._signal("endOperation",A)}},P.prototype.setDocument=function(A){this.doc&&this.doc.off("change",this.$onChange),this.doc=A,A.on("change",this.$onChange,!0),this.bgTokenizer.setDocument(this.getDocument()),this.resetCaches()},P.prototype.getDocument=function(){return this.doc},Object.defineProperty(P.prototype,"widgetManager",{get:function(){var A=new h(this);return this.widgetManager=A,this.$editor&&A.attach(this.$editor),A},set:function(A){Object.defineProperty(this,"widgetManager",{writable:!0,enumerable:!0,configurable:!0,value:A})},enumerable:!1,configurable:!0}),P.prototype.$resetRowCache=function(A){if(!A){this.$docRowCache=[],this.$screenRowCache=[];return}var M=this.$docRowCache.length,R=this.$getRowCacheIndex(this.$docRowCache,A)+1;M>R&&(this.$docRowCache.splice(R,M),this.$screenRowCache.splice(R,M))},P.prototype.$getRowCacheIndex=function(A,M){for(var R=0,I=A.length-1;R<=I;){var D=R+I>>1,j=A[D];if(M>j)R=D+1;else if(M=M));j++);return I=R[j],I?(I.index=j,I.start=D-I.value.length,I):null},P.prototype.setUndoManager=function(A){if(this.$undoManager=A,this.$informUndoManager&&this.$informUndoManager.cancel(),A){var M=this;A.addSession(this),this.$syncInformUndoManager=function(){M.$informUndoManager.cancel(),M.mergeUndoDeltas=!1},this.$informUndoManager=l.delayedCall(this.$syncInformUndoManager)}else this.$syncInformUndoManager=function(){}},P.prototype.markUndoGroup=function(){this.$syncInformUndoManager&&this.$syncInformUndoManager()},P.prototype.getUndoManager=function(){return this.$undoManager||this.$defaultUndoManager},P.prototype.getTabString=function(){return this.getUseSoftTabs()?l.stringRepeat(" ",this.getTabSize()):" "},P.prototype.setUseSoftTabs=function(A){this.setOption("useSoftTabs",A)},P.prototype.getUseSoftTabs=function(){return this.$useSoftTabs&&!this.$mode.$indentWithTabs},P.prototype.setTabSize=function(A){this.setOption("tabSize",A)},P.prototype.getTabSize=function(){return this.$tabSize},P.prototype.isTabStop=function(A){return this.$useSoftTabs&&A.column%this.$tabSize===0},P.prototype.setNavigateWithinSoftTabs=function(A){this.setOption("navigateWithinSoftTabs",A)},P.prototype.getNavigateWithinSoftTabs=function(){return this.$navigateWithinSoftTabs},P.prototype.setOverwrite=function(A){this.setOption("overwrite",A)},P.prototype.getOverwrite=function(){return this.$overwrite},P.prototype.toggleOverwrite=function(){this.setOverwrite(!this.$overwrite)},P.prototype.addGutterDecoration=function(A,M){this.$decorations[A]||(this.$decorations[A]=""),this.$decorations[A]+=" "+M,this._signal("changeBreakpoint",{})},P.prototype.removeGutterCustomWidget=function(A){this.$editor&&this.$editor.renderer.$gutterLayer.$removeCustomWidget(A)},P.prototype.addGutterCustomWidget=function(A,M){this.$editor&&this.$editor.renderer.$gutterLayer.$addCustomWidget(A,M)},P.prototype.removeGutterDecoration=function(A,M){this.$decorations[A]=(this.$decorations[A]||"").replace(" "+M,""),this._signal("changeBreakpoint",{})},P.prototype.getBreakpoints=function(){return this.$breakpoints},P.prototype.setBreakpoints=function(A){this.$breakpoints=[];for(var M=0;M0&&(I=!!R.charAt(M-1).match(this.tokenRe)),I||(I=!!R.charAt(M).match(this.tokenRe)),I)var D=this.tokenRe;else if(/^\s+$/.test(R.slice(M-1,M+1)))var D=/\s/;else var D=this.nonTokenRe;var j=M;if(j>0){do j--;while(j>=0&&R.charAt(j).match(D));j++}for(var B=M;BA&&(A=M.screenWidth)}),this.lineWidgetWidth=A},P.prototype.$computeWidth=function(A){if(this.$modified||A){if(this.$modified=!1,this.$useWrapMode)return this.screenWidth=this.$wrapLimit;for(var M=this.doc.getAllLines(),R=this.$rowLengthCache,I=0,D=0,j=this.$foldData[D],B=j?j.start.row:1/0,V=M.length,H=0;HB){if(H=j.end.row+1,H>=V)break;j=this.$foldData[D++],B=j?j.start.row:1/0}R[H]==null&&(R[H]=this.$getStringScreenWidth(M[H])[0]),R[H]>I&&(I=R[H])}this.screenWidth=I}},P.prototype.getLine=function(A){return this.doc.getLine(A)},P.prototype.getLines=function(A,M){return this.doc.getLines(A,M)},P.prototype.getLength=function(){return this.doc.getLength()},P.prototype.getTextRange=function(A){return this.doc.getTextRange(A||this.selection.getRange())},P.prototype.insert=function(A,M){return this.doc.insert(A,M)},P.prototype.remove=function(A){return this.doc.remove(A)},P.prototype.removeFullLines=function(A,M){return this.doc.removeFullLines(A,M)},P.prototype.undoChanges=function(A,M){if(A.length){this.$fromUndo=!0;for(var R=A.length-1;R!=-1;R--){var I=A[R];I.action=="insert"||I.action=="remove"?this.doc.revertDelta(I):I.folds&&this.addFolds(I.folds)}!M&&this.$undoSelect&&(A.selectionBefore?this.selection.fromJSON(A.selectionBefore):this.selection.setRange(this.$getUndoSelection(A,!0))),this.$fromUndo=!1}},P.prototype.redoChanges=function(A,M){if(A.length){this.$fromUndo=!0;for(var R=0;RA.end.column&&(j.start.column+=V),j.end.row==A.end.row&&j.end.column>A.end.column&&(j.end.column+=V)),B&&j.start.row>=A.end.row&&(j.start.row+=B,j.end.row+=B)}if(j.end=this.insert(j.start,I),D.length){var H=A.start,Y=j.start,B=Y.row-H.row,V=Y.column-H.column;this.addFolds(D.map(function(G){return G=G.clone(),G.start.row==H.row&&(G.start.column+=V),G.end.row==H.row&&(G.end.column+=V),G.start.row+=B,G.end.row+=B,G}))}return j},P.prototype.indentRows=function(A,M,R){R=R.replace(/\t/g,this.getTabString());for(var I=A;I<=M;I++)this.doc.insertInLine({row:I,column:0},R)},P.prototype.outdentRows=function(A){for(var M=A.collapseRows(),R=new d(0,0,0,0),I=this.getTabSize(),D=M.start.row;D<=M.end.row;++D){var j=this.getLine(D);R.start.row=D,R.end.row=D;for(var B=0;B0){var I=this.getRowFoldEnd(M+R);if(I>this.doc.getLength()-1)return 0;var D=I-M}else{A=this.$clipRowToDocument(A),M=this.$clipRowToDocument(M);var D=M-A+1}var j=new d(A,0,M,Number.MAX_VALUE),B=this.getFoldsInRange(j).map(function(H){return H=H.clone(),H.start.row+=D,H.end.row+=D,H}),V=R==0?this.doc.getLines(A,M):this.doc.removeFullLines(A,M);return this.doc.insertFullLines(A+D,V),B.length&&this.addFolds(B),D},P.prototype.moveLinesUp=function(A,M){return this.$moveLines(A,M,-1)},P.prototype.moveLinesDown=function(A,M){return this.$moveLines(A,M,1)},P.prototype.duplicateLines=function(A,M){return this.$moveLines(A,M,0)},P.prototype.$clipRowToDocument=function(A){return Math.max(0,Math.min(A,this.doc.getLength()-1))},P.prototype.$clipColumnToRow=function(A,M){return M<0?0:Math.min(this.doc.getLine(A).length,M)},P.prototype.$clipPositionToDocument=function(A,M){if(M=Math.max(0,M),A<0)A=0,M=0;else{var R=this.doc.getLength();A>=R?(A=R-1,M=this.doc.getLine(R-1).length):M=Math.min(this.doc.getLine(A).length,M)}return{row:A,column:M}},P.prototype.$clipRangeToDocument=function(A){A.start.row<0?(A.start.row=0,A.start.column=0):A.start.column=this.$clipColumnToRow(A.start.row,A.start.column);var M=this.doc.getLength()-1;return A.end.row>M?(A.end.row=M,A.end.column=this.doc.getLine(M).length):A.end.column=this.$clipColumnToRow(A.end.row,A.end.column),A},P.prototype.setUseWrapMode=function(A){if(A!=this.$useWrapMode){if(this.$useWrapMode=A,this.$modified=!0,this.$resetRowCache(0),A){var M=this.getLength();this.$wrapData=Array(M),this.$updateWrapData(0,M-1)}this._signal("changeWrapMode")}},P.prototype.getUseWrapMode=function(){return this.$useWrapMode},P.prototype.setWrapLimitRange=function(A,M){(this.$wrapLimitRange.min!==A||this.$wrapLimitRange.max!==M)&&(this.$wrapLimitRange={min:A,max:M},this.$modified=!0,this.$bidiHandler.markAsDirty(),this.$useWrapMode&&this._signal("changeWrapMode"))},P.prototype.adjustWrapLimit=function(A,M){var R=this.$wrapLimitRange;R.max<0&&(R={min:M,max:M});var I=this.$constrainWrapLimit(A,R.min,R.max);return I!=this.$wrapLimit&&I>1?(this.$wrapLimit=I,this.$modified=!0,this.$useWrapMode&&(this.$updateWrapData(0,this.getLength()-1),this.$resetRowCache(0),this._signal("changeWrapLimit")),!0):!1},P.prototype.$constrainWrapLimit=function(A,M,R){return M&&(A=Math.max(M,A)),R&&(A=Math.min(R,A)),A},P.prototype.getWrapLimit=function(){return this.$wrapLimit},P.prototype.setWrapLimit=function(A){this.setWrapLimitRange(A,A)},P.prototype.getWrapLimitRange=function(){return{min:this.$wrapLimitRange.min,max:this.$wrapLimitRange.max}},P.prototype.$updateInternalDataOnChange=function(A){var M=this.$useWrapMode,R=A.action,I=A.start,D=A.end,j=I.row,B=D.row,V=B-j,H=null;if(this.$updating=!0,V!=0)if(R==="remove"){this[M?"$wrapData":"$rowLengthCache"].splice(j,V);var Y=this.$foldData;H=this.getFoldsInRange(A),this.removeFolds(H);var U=this.getFoldLine(D.row),K=0;if(U){U.addRemoveChars(D.row,D.column,I.column-D.column),U.shiftRow(-V);var G=this.getFoldLine(j);G&&G!==U&&(G.merge(U),U=G),K=Y.indexOf(U)+1}for(K;K=D.row&&U.shiftRow(-V)}B=j}else{var q=Array(V);q.unshift(j,0);var Z=M?this.$wrapData:this.$rowLengthCache;Z.splice.apply(Z,q);var Y=this.$foldData,U=this.getFoldLine(j),K=0;if(U){var Q=U.range.compareInside(I.row,I.column);Q==0?(U=U.split(I.row,I.column),U&&(U.shiftRow(V),U.addRemoveChars(B,0,D.column-I.column))):Q==-1&&(U.addRemoveChars(j,0,D.column-I.column),U.shiftRow(V)),K=Y.indexOf(U)+1}for(K;K=j&&U.shiftRow(V)}}else{V=Math.abs(A.start.column-A.end.column),R==="remove"&&(H=this.getFoldsInRange(A),this.removeFolds(H),V=-V);var U=this.getFoldLine(j);U&&U.addRemoveChars(j,I.column,V)}return M&&this.$wrapData.length!=this.doc.getLength()&&console.error("doc.getLength() and $wrapData.length have to be the same!"),this.$updating=!1,M?this.$updateWrapData(j,B):this.$updateRowLengthCache(j,B),H},P.prototype.$updateRowLengthCache=function(A,M){this.$rowLengthCache[A]=null,this.$rowLengthCache[M]=null},P.prototype.$updateWrapData=function(A,M){var R=this.doc.getAllLines(),I=this.getTabSize(),D=this.$wrapData,j=this.$wrapLimit,B,V,H=A;for(M=Math.min(M,R.length-1);H<=M;)V=this.getFoldLine(H,V),V?(B=[],V.walk((function(Y,U,K,G){var q;if(Y!=null){q=this.$getDisplayTokens(Y,B.length),q[0]=_;for(var Z=1;ZM-G;){var q=j+M-G;if(A[q-1]>=N&&A[q]>=N){K(q);continue}if(A[q]==_||A[q]==$){for(q;q!=j-1&&A[q]!=_;q--);if(q>j){K(q);continue}for(q=j+M,q;q>2)),j-1);q>Z&&A[q]<_;)q--;if(V){for(;q>Z&&A[q]<_;)q--;for(;q>Z&&A[q]==O;)q--}else for(;q>Z&&A[q]Z){K(++q);continue}q=j+M,A[q]==E&&q--,K(q-G)}return I},P.prototype.$getDisplayTokens=function(A,M){var R=[],I;M=M||0;for(var D=0;D39&&j<48||j>57&&j<64?R.push(O):j>=4352&&F(j)?R.push(x,E):R.push(x)}return R},P.prototype.$getStringScreenWidth=function(A,M,R){if(M==0)return[0,0];M==null&&(M=1/0),R=R||0;var I,D;for(D=0;D=4352&&F(I)?R+=2:R+=1,!(R>M));D++);return[R,D]},P.prototype.getRowLength=function(A){var M=1;return this.lineWidgets&&(M+=this.lineWidgets[A]&&this.lineWidgets[A].rowCount||0),!this.$useWrapMode||!this.$wrapData[A]?M:this.$wrapData[A].length+M},P.prototype.getRowLineCount=function(A){return!this.$useWrapMode||!this.$wrapData[A]?1:this.$wrapData[A].length+1},P.prototype.getRowWrapIndent=function(A){if(this.$useWrapMode){var M=this.screenToDocumentPosition(A,Number.MAX_VALUE),R=this.$wrapData[M.row];return R.length&&R[0]=0)var V=Y[U],D=this.$docRowCache[U],G=A>Y[K-1];else var G=!K;for(var q=this.getLength()-1,Z=this.getNextFoldLine(D),Q=Z?Z.start.row:1/0;V<=A&&(H=this.getRowLength(D),!(V+H>A||D>=q));)V+=H,D++,D>Q&&(D=Z.end.row+1,Z=this.getNextFoldLine(D,Z),Q=Z?Z.start.row:1/0),G&&(this.$docRowCache.push(D),this.$screenRowCache.push(V));if(Z&&Z.start.row<=D)I=this.getFoldDisplayLine(Z),D=Z.start.row;else{if(V+H<=A||D>q)return{row:q,column:this.getLine(q).length};I=this.getLine(D),Z=null}var J=0,ie=Math.floor(A-V);if(this.$useWrapMode){var se=this.$wrapData[D];se&&(B=se[ie],ie>0&&se.length&&(J=se.indent,j=se[ie-1]||se[se.length-1],I=I.substring(j)))}return R!==void 0&&this.$bidiHandler.isBidiRow(V+ie,D,ie)&&(M=this.$bidiHandler.offsetToCol(R)),j+=this.$getStringScreenWidth(I,M-J)[1],this.$useWrapMode&&j>=B&&(j=B-1),Z?Z.idxToPosition(j):{row:D,column:j}},P.prototype.documentToScreenPosition=function(A,M){if(typeof M>"u")var R=this.$clipPositionToDocument(A.row,A.column);else R=this.$clipPositionToDocument(A,M);A=R.row,M=R.column;var I=0,D=null,j=null;j=this.getFoldAt(A,M,1),j&&(A=j.start.row,M=j.start.column);var B,V=0,H=this.$docRowCache,Y=this.$getRowCacheIndex(H,A),U=H.length;if(U&&Y>=0)var V=H[Y],I=this.$screenRowCache[Y],K=A>H[U-1];else var K=!U;for(var G=this.getNextFoldLine(V),q=G?G.start.row:1/0;V=q){if(B=G.end.row+1,B>A)break;G=this.getNextFoldLine(B,G),q=G?G.start.row:1/0}else B=V+1;I+=this.getRowLength(V),V=B,K&&(this.$docRowCache.push(V),this.$screenRowCache.push(I))}var Z="";G&&V>=q?(Z=this.getFoldDisplayLine(G,A,M),D=G.start.row):(Z=this.getLine(A).substring(0,M),D=A);var Q=0;if(this.$useWrapMode){var J=this.$wrapData[D];if(J){for(var ie=0;Z.length>=J[ie];)I++,ie++;Z=Z.substring(J[ie-1]||0,Z.length),Q=ie>0?J.indent:0}}return this.lineWidgets&&this.lineWidgets[V]&&this.lineWidgets[V].rowsAbove&&(I+=this.lineWidgets[V].rowsAbove),{row:I,column:Q+this.$getStringScreenWidth(Z)[0]}},P.prototype.documentToScreenColumn=function(A,M){return this.documentToScreenPosition(A,M).column},P.prototype.documentToScreenRow=function(A,M){return this.documentToScreenPosition(A,M).row},P.prototype.getScreenLength=function(){var A=0,M=null;if(this.$useWrapMode)for(var D=this.$wrapData.length,j=0,I=0,M=this.$foldData[I++],B=M?M.start.row:1/0;jB&&(j=M.end.row+1,M=this.$foldData[I++],B=M?M.start.row:1/0)}else{A=this.getLength();for(var R=this.$foldData,I=0;IR));j++);return[I,j]})},P.prototype.getPrecedingCharacter=function(){var A=this.selection.getCursor();if(A.column===0)return A.row===0?"":this.doc.getNewLineCharacter();var M=this.getLine(A.row);return M[A.column-1]},P.prototype.destroy=function(){this.destroyed||(this.bgTokenizer.setDocument(null),this.bgTokenizer.cleanup(),this.destroyed=!0),this.endOperation(),this.$stopWorker(),this.removeAllListeners(),this.doc&&this.doc.off("change",this.$onChange),this.selection&&(this.selection.off("changeCursor",this.$onSelectionChange),this.selection.off("changeSelection",this.$onSelectionChange)),this.selection.detach()},P}();w.$uid=0,w.prototype.$modes=u.$modes,w.prototype.getValue=w.prototype.toString,w.prototype.$defaultUndoManager={undo:function(){},redo:function(){},hasUndo:function(){},hasRedo:function(){},reset:function(){},add:function(){},addSelection:function(){},startNewGroup:function(){},addSession:function(){}},w.prototype.$overwrite=!1,w.prototype.$mode=null,w.prototype.$modeId=null,w.prototype.$scrollTop=0,w.prototype.$scrollLeft=0,w.prototype.$wrapLimit=80,w.prototype.$useWrapMode=!1,w.prototype.$wrapLimitRange={min:null,max:null},w.prototype.lineWidgets=null,w.prototype.isFullWidth=F,o.implement(w.prototype,p);var x=1,E=2,_=3,$=4,O=9,N=10,k=11,L=12;function F(P){return P<4352?!1:P>=4352&&P<=4447||P>=4515&&P<=4519||P>=4602&&P<=4607||P>=9001&&P<=9002||P>=11904&&P<=11929||P>=11931&&P<=12019||P>=12032&&P<=12245||P>=12272&&P<=12283||P>=12288&&P<=12350||P>=12353&&P<=12438||P>=12441&&P<=12543||P>=12549&&P<=12589||P>=12593&&P<=12686||P>=12688&&P<=12730||P>=12736&&P<=12771||P>=12784&&P<=12830||P>=12832&&P<=12871||P>=12880&&P<=13054||P>=13056&&P<=19903||P>=19968&&P<=42124||P>=42128&&P<=42182||P>=43360&&P<=43388||P>=44032&&P<=55203||P>=55216&&P<=55238||P>=55243&&P<=55291||P>=63744&&P<=64255||P>=65040&&P<=65049||P>=65072&&P<=65106||P>=65108&&P<=65126||P>=65128&&P<=65131||P>=65281&&P<=65376||P>=65504&&P<=65510}n("./edit_session/folding").Folding.call(w.prototype),n("./edit_session/bracket_match").BracketMatch.call(w.prototype),u.defineOptions(w.prototype,"session",{wrap:{set:function(P){if(!P||P=="off"?P=!1:P=="free"?P=!0:P=="printMargin"?P=-1:typeof P=="string"&&(P=parseInt(P,10)||!1),this.$wrap!=P)if(this.$wrap=P,!P)this.setUseWrapMode(!1);else{var A=typeof P=="number"?P:null;this.setWrapLimitRange(A,A),this.setUseWrapMode(!0)}},get:function(){return this.getUseWrapMode()?this.$wrap==-1?"printMargin":this.getWrapLimitRange().min?this.$wrap:"free":"off"},handlesSet:!0},wrapMethod:{set:function(P){P=P=="auto"?this.$mode.type!="text":P!="text",P!=this.$wrapAsCode&&(this.$wrapAsCode=P,this.$useWrapMode&&(this.$useWrapMode=!1,this.setUseWrapMode(!0)))},initialValue:"auto"},indentedSoftWrap:{set:function(){this.$useWrapMode&&(this.$useWrapMode=!1,this.setUseWrapMode(!0))},initialValue:!0},firstLineNumber:{set:function(){this._signal("changeBreakpoint")},initialValue:1},useWorker:{set:function(P){this.$useWorker=P,this.$stopWorker(),P&&this.$startWorker()},initialValue:!0},useSoftTabs:{initialValue:!0},tabSize:{set:function(P){P=parseInt(P),P>0&&this.$tabSize!==P&&(this.$modified=!0,this.$rowLengthCache=[],this.$tabSize=P,this._signal("changeTabSize"))},initialValue:4,handlesSet:!0},navigateWithinSoftTabs:{initialValue:!1},foldStyle:{set:function(P){this.setFoldStyle(P)},handlesSet:!0},overwrite:{set:function(P){this._signal("changeOverwrite")},initialValue:!1},newLineMode:{set:function(P){this.doc.setNewLineMode(P)},get:function(){return this.doc.getNewLineMode()},handlesSet:!0},mode:{set:function(P){this.setMode(P)},get:function(){return this.$modeId},handlesSet:!0}}),r.EditSession=w}),ace.define("ace/search",["require","exports","module","ace/lib/lang","ace/lib/oop","ace/range"],function(n,r,i){var o=n("./lib/lang"),l=n("./lib/oop"),m=n("./range").Range,u=function(){function d(){this.$options={}}return d.prototype.set=function(h){return l.mixin(this.$options,h),this},d.prototype.getOptions=function(){return o.copyObject(this.$options)},d.prototype.setOptions=function(h){this.$options=h},d.prototype.find=function(h){var f=this.$options,v=this.$matchIterator(h,f);if(!v)return!1;var y=null;return v.forEach(function(b,w,x,E){return y=new m(b,w,x,E),w==E&&f.start&&f.start.start&&f.skipCurrent!=!1&&y.isEqual(f.start)?(y=null,!1):!0}),y},d.prototype.findAll=function(h){var f=this.$options;if(!f.needle)return[];this.$assembleRegExp(f);var v=f.range,y=v?h.getLines(v.start.row,v.end.row):h.doc.getAllLines(),b=[],w=f.re;if(f.$isMultiLine){var x=w.length,E=y.length-x,_;e:for(var $=w.offset||0;$<=E;$++){for(var O=0;OL||(b.push(_=new m($,L,$+x-1,F)),x>2&&($=$+x-2))}}else for(var P,A=0;AA&&(A=R),b.push(new m(P.startRow,P.startCol,P.endRow,P.endCol))}}else{P=o.getMatchOffsets(y[A],w);for(var O=0;Oj&&b[O].end.row==B;)O--;for(b=b.slice(A,O+1),A=0,O=b.length;A=b){v+="\\";break}var x=h.charCodeAt(y);switch(x){case f.Backslash:v+="\\";break;case f.n:v+=` +`;break;case f.t:v+=" ";break}continue}if(w===f.DollarSign){if(y++,y>=b){v+="$";break}var E=h.charCodeAt(y);if(E===f.DollarSign){v+="$$";continue}if(E===f.Digit0||E===f.Ampersand){v+="$&";continue}if(f.Digit1<=E&&E<=f.Digit9){v+="$"+h[y];continue}}v+=h[y]}return v||h},d.prototype.replace=function(h,f){var v=this.$options,y=this.$assembleRegExp(v);if(v.$isMultiLine)return f;if(y){var b=this.$isMultilineSearch(v);b&&(h=h.replace(/\r\n|\r|\n/g,` +`));var w=y.exec(h);if(!w||!b&&w[0].length!=h.length)return null;if(f=v.regExp?this.parseReplaceString(f):f.replace(/\$/g,"$$$$"),f=h.replace(y,f),v.preserveCase){f=f.split("");for(var x=Math.min(h.length,h.length);x--;){var E=h[x];E&&E.toLowerCase()!=E?f[x]=f[x].toUpperCase():f[x]=f[x].toLowerCase()}f=f.join("")}return f}},d.prototype.$assembleRegExp=function(h,f){if(h.needle instanceof RegExp)return h.re=h.needle;var v=h.needle;if(!h.needle)return h.re=!1;h.regExp||(v=o.escapeRegExp(v));var y=h.caseSensitive?"gm":"gmi";try{new RegExp(v,"u"),h.$supportsUnicodeFlag=!0,y+="u"}catch{h.$supportsUnicodeFlag=!1}if(h.wholeWord&&(v=p(v,h)),h.$isMultiLine=!f&&/[\n\r]/.test(v),h.$isMultiLine)return h.re=this.$assembleMultilineRegExp(v,y);try{var b=new RegExp(v,y)}catch{b=!1}return h.re=b},d.prototype.$assembleMultilineRegExp=function(h,f){for(var v=h.replace(/\r\n|\r|\n/g,`$ +^`).split(` +`),y=[],b=0;by);E++){var _=h.getLine(x++);b=b==null?_:b+` +`+_}var $=f.exec(b);if(f.lastIndex=0,$){var O=b.slice(0,$.index).split(` +`),N=$[0].split(` +`),k=v+O.length-1,L=O[O.length-1].length,F=k+N.length-1,P=N.length==1?L+N[0].length:N[N.length-1].length;return{startRow:k,startCol:L,endRow:F,endCol:P}}}return null},d.prototype.$multiLineBackward=function(h,f,v,y,b){for(var w,x=c(h,y),E=h.getLine(y).length-v,_=y;_>=b;){for(var $=0;$=b;$++){var O=h.getLine(_--);w=w==null?O:O+` +`+w}var N=s(w,f,E);if(N){var k=w.slice(0,N.index).split(` +`),L=N[0].split(` +`),F=_+k.length,P=k[k.length-1].length,A=F+L.length-1,M=L.length==1?P+L[0].length:L[L.length-1].length;return{startRow:F,startCol:P,endRow:A,endCol:M}}}return null},d.prototype.$matchIterator=function(h,f){var v=this.$assembleRegExp(f);if(!v)return!1;var y=this.$isMultilineSearch(f),b=this.$multiLineForward,w=this.$multiLineBackward,x=f.backwards==!0,E=f.skipCurrent!=!1,_=v.unicode,$=f.range,O=f.start;O||(O=$?$[x?"end":"start"]:h.selection.getRange()),O.start&&(O=O[E!=x?"end":"start"]);var N=$?$.start.row:0,k=$?$.end.row:h.getLength()-1;if(x)var L=function(A){var M=O.row;if(!P(M,O.column,A)){for(M--;M>=N;M--)if(P(M,Number.MAX_VALUE,A))return;if(f.wrap!=!1){for(M=k,N=O.row;M>=N;M--)if(P(M,Number.MAX_VALUE,A))return}}};else var L=function(M){var R=O.row;if(!P(R,O.column,M)){for(R=R+1;R<=k;R++)if(P(R,0,M))return;if(f.wrap!=!1){for(R=N,k=O.row;R<=k;R++)if(P(R,0,M))return}}};if(f.$isMultiLine)var F=v.length,P=function(A,M,R){var I=x?A-F+1:A;if(!(I<0||I+F>h.getLength())){var D=h.getLine(I),j=D.search(v[0]);if(!(!x&&jM)&&R(I,j,I+F-1,V))return!0}}};else if(x)var P=function(M,R,I){if(y){var D=w(h,v,R,M,N);if(!D)return!1;if(I(D.startRow,D.startCol,D.endRow,D.endCol))return!0}else{var j=h.getLine(M),B=[],V,H=0;for(v.lastIndex=0;V=v.exec(j);){var Y=V[0].length;if(H=V.index,!Y){if(H>=j.length)break;v.lastIndex=H+=o.skipEmptyMatch(j,H,_)}if(V.index+Y>R)break;B.push(V.index,Y)}for(var U=B.length-1;U>=0;U-=2){var K=B[U-1],Y=B[U];if(I(M,K,M,K+Y))return!0}}};else var P=function(M,R,I){if(v.lastIndex=R,y){var D=b(h,v,M,k);if(D){var j=D.endRow<=k?D.endRow-1:k;j>M&&(M=j)}if(!D)return!1;if(I(D.startRow,D.startCol,D.endRow,D.endCol))return!0}else for(var B=h.getLine(M),V,H;H=v.exec(B);){var Y=H[0].length;if(V=H.index,I(M,V,M,V+Y))return!0;if(!Y&&(v.lastIndex=V+=o.skipEmptyMatch(B,V,_),V>=B.length))return!1}};return{forEach:L}},d}();function p(d,h){var f=o.supportsLookbehind();function v(x,E){E===void 0&&(E=!0);var _=f&&h.$supportsUnicodeFlag?new RegExp("[\\p{L}\\p{N}_]","u"):new RegExp("\\w");return _.test(x)||h.regExp?f&&h.$supportsUnicodeFlag?E?"(?<=^|[^\\p{L}\\p{N}_])":"(?=[^\\p{L}\\p{N}_]|$)":"\\b":""}var y=Array.from(d),b=y[0],w=y[y.length-1];return v(b)+d+v(w,!1)}function s(d,h,f){for(var v=null,y=0;y<=d.length;){h.lastIndex=y;var b=h.exec(d);if(!b)break;var w=b.index+b[0].length;if(w>d.length-f)break;(!v||w>v.index+v[0].length)&&(v=b),y=b.index+1}return v}function c(d,h){var f=5e3,v={row:h,column:0},y=d.doc.positionToIndex(v),b=y+f,w=d.doc.indexToPosition(b),x=w.row;return x+1}r.Search=u}),ace.define("ace/keyboard/hash_handler",["require","exports","module","ace/lib/keys","ace/lib/useragent"],function(n,r,i){var o=this&&this.__extends||function(){var d=function(h,f){return d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(v,y){v.__proto__=y}||function(v,y){for(var b in y)Object.prototype.hasOwnProperty.call(y,b)&&(v[b]=y[b])},d(h,f)};return function(h,f){if(typeof f!="function"&&f!==null)throw new TypeError("Class extends value "+String(f)+" is not a constructor or null");d(h,f);function v(){this.constructor=h}h.prototype=f===null?Object.create(f):(v.prototype=f.prototype,new v)}}(),l=n("../lib/keys"),m=n("../lib/useragent"),u=l.KEY_MODS,p=function(){function d(h,f){this.$init(h,f,!1)}return d.prototype.$init=function(h,f,v){this.platform=f||(m.isMac?"mac":"win"),this.commands={},this.commandKeyBinding={},this.addCommands(h),this.$singleCommand=v},d.prototype.addCommand=function(h){this.commands[h.name]&&this.removeCommand(h),this.commands[h.name]=h,h.bindKey&&this._buildKeyHash(h)},d.prototype.removeCommand=function(h,f){var v=h&&(typeof h=="string"?h:h.name);h=this.commands[v],f||delete this.commands[v];var y=this.commandKeyBinding;for(var b in y){var w=y[b];if(w==h)delete y[b];else if(Array.isArray(w)){var x=w.indexOf(h);x!=-1&&(w.splice(x,1),w.length==1&&(y[b]=w[0]))}}},d.prototype.bindKey=function(h,f,v){if(typeof h=="object"&&h&&(v==null&&(v=h.position),h=h[this.platform]),!!h){if(typeof f=="function")return this.addCommand({exec:f,bindKey:h,name:f.name||h});h.split("|").forEach(function(y){var b="";if(y.indexOf(" ")!=-1){var w=y.split(/\s+/);y=w.pop(),w.forEach(function(_){var $=this.parseKeys(_),O=u[$.hashId]+$.key;b+=(b?" ":"")+O,this._addCommandToBinding(b,"chainKeys")},this),b+=" "}var x=this.parseKeys(y),E=u[x.hashId]+x.key;this._addCommandToBinding(b+E,f,v)},this)}},d.prototype._addCommandToBinding=function(h,f,v){var y=this.commandKeyBinding,b;if(!f)delete y[h];else if(!y[h]||this.$singleCommand)y[h]=f;else{Array.isArray(y[h])?(b=y[h].indexOf(f))!=-1&&y[h].splice(b,1):y[h]=[y[h]],typeof v!="number"&&(v=s(f));var w=y[h];for(b=0;bv)break}w.splice(b,0,f)}},d.prototype.addCommands=function(h){h&&Object.keys(h).forEach(function(f){var v=h[f];if(v){if(typeof v=="string")return this.bindKey(v,f);typeof v=="function"&&(v={exec:v}),typeof v=="object"&&(v.name||(v.name=f),this.addCommand(v))}},this)},d.prototype.removeCommands=function(h){Object.keys(h).forEach(function(f){this.removeCommand(h[f])},this)},d.prototype.bindKeys=function(h){Object.keys(h).forEach(function(f){this.bindKey(f,h[f])},this)},d.prototype._buildKeyHash=function(h){this.bindKey(h.bindKey,h)},d.prototype.parseKeys=function(h){var f=h.toLowerCase().split(/[\-\+]([\-\+])?/).filter(function(E){return E}),v=f.pop(),y=l[v];if(l.FUNCTION_KEYS[y])v=l.FUNCTION_KEYS[y].toLowerCase();else if(f.length){if(f.length==1&&f[0]=="shift")return{key:v.toUpperCase(),hashId:-1}}else return{key:v,hashId:-1};for(var b=0,w=f.length;w--;){var x=l.KEY_MODS[f[w]];if(x==null)return typeof console<"u"&&console.error("invalid modifier "+f[w]+" in "+h),!1;b|=x}return{key:v,hashId:b}},d.prototype.findKeyCommand=function(h,f){var v=u[h]+f;return this.commandKeyBinding[v]},d.prototype.handleKeyboard=function(h,f,v,y){if(!(y<0)){var b=u[f]+v,w=this.commandKeyBinding[b];return h.$keyChain&&(h.$keyChain+=" "+b,w=this.commandKeyBinding[h.$keyChain]||w),w&&(w=="chainKeys"||w[w.length-1]=="chainKeys")?(h.$keyChain=h.$keyChain||b,{command:"null"}):(h.$keyChain&&((!f||f==4)&&v.length==1?h.$keyChain=h.$keyChain.slice(0,-b.length-1):(f==-1||y>0)&&(h.$keyChain="")),{command:w})}},d.prototype.getStatusText=function(h,f){return f.$keyChain||""},d}();function s(d){return typeof d=="object"&&d.bindKey&&d.bindKey.position||(d.isDefault?-100:0)}var c=function(d){o(h,d);function h(f,v){var y=d.call(this,f,v)||this;return y.$singleCommand=!0,y}return h}(p);c.call=function(d,h,f){p.prototype.$init.call(d,h,f,!0)},p.call=function(d,h,f){p.prototype.$init.call(d,h,f,!1)},r.HashHandler=c,r.MultiHashHandler=p}),ace.define("ace/commands/command_manager",["require","exports","module","ace/lib/oop","ace/keyboard/hash_handler","ace/lib/event_emitter"],function(n,r,i){var o=this&&this.__extends||function(){var s=function(c,d){return s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(h,f){h.__proto__=f}||function(h,f){for(var v in f)Object.prototype.hasOwnProperty.call(f,v)&&(h[v]=f[v])},s(c,d)};return function(c,d){if(typeof d!="function"&&d!==null)throw new TypeError("Class extends value "+String(d)+" is not a constructor or null");s(c,d);function h(){this.constructor=c}c.prototype=d===null?Object.create(d):(h.prototype=d.prototype,new h)}}(),l=n("../lib/oop"),m=n("../keyboard/hash_handler").MultiHashHandler,u=n("../lib/event_emitter").EventEmitter,p=function(s){o(c,s);function c(d,h){var f=s.call(this,h,d)||this;return f.byName=f.commands,f.setDefaultHandler("exec",function(v){return v.args?v.command.exec(v.editor,v.args,v.event,!1):v.command.exec(v.editor,{},v.event,!0)}),f}return c.prototype.exec=function(d,h,f){if(Array.isArray(d)){for(var v=d.length;v--;)if(this.exec(d[v],h,f))return!0;return!1}typeof d=="string"&&(d=this.commands[d]);var y={editor:h,command:d,args:f};return this.canExecute(d,h)?(y.returnValue=this._emit("exec",y),this._signal("afterExec",y),y.returnValue!==!1):(this._signal("commandUnavailable",y),!1)},c.prototype.canExecute=function(d,h){return typeof d=="string"&&(d=this.commands[d]),!(!d||h&&h.$readOnly&&!d.readOnly||this.$checkCommandState!=!1&&d.isAvailable&&!d.isAvailable(h))},c.prototype.toggleRecording=function(d){if(!this.$inReplay)return d&&d._emit("changeStatus"),this.recording?(this.macro.pop(),this.off("exec",this.$addCommandToMacro),this.macro.length||(this.macro=this.oldMacro),this.recording=!1):(this.$addCommandToMacro||(this.$addCommandToMacro=(function(h){this.macro.push([h.command,h.args])}).bind(this)),this.oldMacro=this.macro,this.macro=[],this.on("exec",this.$addCommandToMacro),this.recording=!0)},c.prototype.replay=function(d){if(!(this.$inReplay||!this.macro)){if(this.recording)return this.toggleRecording(d);try{this.$inReplay=!0,this.macro.forEach(function(h){typeof h=="string"?this.exec(h,d):this.exec(h[0],d,h[1])},this)}finally{this.$inReplay=!1}}},c.prototype.trimMacro=function(d){return d.map(function(h){return typeof h[0]!="string"&&(h[0]=h[0].name),h[1]||(h=h[0]),h})},c}(m);l.implement(p.prototype,u),r.CommandManager=p}),ace.define("ace/commands/default_commands",["require","exports","module","ace/lib/lang","ace/config","ace/range"],function(n,r,i){var o=n("../lib/lang"),l=n("../config"),m=n("../range").Range;function u(s,c){return{win:s,mac:c}}r.commands=[{name:"showSettingsMenu",description:"Show settings menu",bindKey:u("Ctrl-,","Command-,"),exec:function(s){l.loadModule("ace/ext/settings_menu",function(c){c.init(s),s.showSettingsMenu()})},readOnly:!0},{name:"goToNextError",description:"Go to next error",bindKey:u("Alt-E","F4"),exec:function(s){l.loadModule("ace/ext/error_marker",function(c){c.showErrorMarker(s,1)})},scrollIntoView:"animate",readOnly:!0},{name:"goToPreviousError",description:"Go to previous error",bindKey:u("Alt-Shift-E","Shift-F4"),exec:function(s){l.loadModule("ace/ext/error_marker",function(c){c.showErrorMarker(s,-1)})},scrollIntoView:"animate",readOnly:!0},{name:"selectall",description:"Select all",bindKey:u("Ctrl-A","Command-A"),exec:function(s){s.selectAll()},readOnly:!0},{name:"centerselection",description:"Center selection",bindKey:u(null,"Ctrl-L"),exec:function(s){s.centerSelection()},readOnly:!0},{name:"gotoline",description:"Go to line...",bindKey:u("Ctrl-L","Command-L"),exec:function(s,c){typeof c=="number"&&!isNaN(c)&&s.gotoLine(c),s.prompt({$type:"gotoLine"})},readOnly:!0},{name:"fold",bindKey:u("Alt-L|Ctrl-F1","Command-Alt-L|Command-F1"),exec:function(s){s.session.toggleFold(!1)},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"unfold",bindKey:u("Alt-Shift-L|Ctrl-Shift-F1","Command-Alt-Shift-L|Command-Shift-F1"),exec:function(s){s.session.toggleFold(!0)},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"toggleFoldWidget",description:"Toggle fold widget",bindKey:u("F2","F2"),exec:function(s){s.session.toggleFoldWidget()},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"toggleParentFoldWidget",description:"Toggle parent fold widget",bindKey:u("Alt-F2","Alt-F2"),exec:function(s){s.session.toggleFoldWidget(!0)},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"foldall",description:"Fold all",bindKey:u(null,"Ctrl-Command-Option-0"),exec:function(s){s.session.foldAll()},scrollIntoView:"center",readOnly:!0},{name:"foldAllComments",description:"Fold all comments",bindKey:u(null,"Ctrl-Command-Option-0"),exec:function(s){s.session.foldAllComments()},scrollIntoView:"center",readOnly:!0},{name:"foldOther",description:"Fold other",bindKey:u("Alt-0","Command-Option-0"),exec:function(s){s.session.foldAll(),s.session.unfold(s.selection.getAllRanges())},scrollIntoView:"center",readOnly:!0},{name:"unfoldall",description:"Unfold all",bindKey:u("Alt-Shift-0","Command-Option-Shift-0"),exec:function(s){s.session.unfold()},scrollIntoView:"center",readOnly:!0},{name:"findnext",description:"Find next",bindKey:u("Ctrl-K","Command-G"),exec:function(s){s.findNext()},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"findprevious",description:"Find previous",bindKey:u("Ctrl-Shift-K","Command-Shift-G"),exec:function(s){s.findPrevious()},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"selectOrFindNext",description:"Select or find next",bindKey:u("Alt-K","Ctrl-G"),exec:function(s){s.selection.isEmpty()?s.selection.selectWord():s.findNext()},readOnly:!0},{name:"selectOrFindPrevious",description:"Select or find previous",bindKey:u("Alt-Shift-K","Ctrl-Shift-G"),exec:function(s){s.selection.isEmpty()?s.selection.selectWord():s.findPrevious()},readOnly:!0},{name:"find",description:"Find",bindKey:u("Ctrl-F","Command-F"),exec:function(s){l.loadModule("ace/ext/searchbox",function(c){c.Search(s)})},readOnly:!0},{name:"overwrite",description:"Overwrite",bindKey:"Insert",exec:function(s){s.toggleOverwrite()},readOnly:!0},{name:"selecttostart",description:"Select to start",bindKey:u("Ctrl-Shift-Home","Command-Shift-Home|Command-Shift-Up"),exec:function(s){s.getSelection().selectFileStart()},multiSelectAction:"forEach",readOnly:!0,scrollIntoView:"animate",aceCommandGroup:"fileJump"},{name:"gotostart",description:"Go to start",bindKey:u("Ctrl-Home","Command-Home|Command-Up"),exec:function(s){s.navigateFileStart()},multiSelectAction:"forEach",readOnly:!0,scrollIntoView:"animate",aceCommandGroup:"fileJump"},{name:"selectup",description:"Select up",bindKey:u("Shift-Up","Shift-Up|Ctrl-Shift-P"),exec:function(s){s.getSelection().selectUp()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"golineup",description:"Go line up",bindKey:u("Up","Up|Ctrl-P"),exec:function(s,c){s.navigateUp(c.times)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selecttoend",description:"Select to end",bindKey:u("Ctrl-Shift-End","Command-Shift-End|Command-Shift-Down"),exec:function(s){s.getSelection().selectFileEnd()},multiSelectAction:"forEach",readOnly:!0,scrollIntoView:"animate",aceCommandGroup:"fileJump"},{name:"gotoend",description:"Go to end",bindKey:u("Ctrl-End","Command-End|Command-Down"),exec:function(s){s.navigateFileEnd()},multiSelectAction:"forEach",readOnly:!0,scrollIntoView:"animate",aceCommandGroup:"fileJump"},{name:"selectdown",description:"Select down",bindKey:u("Shift-Down","Shift-Down|Ctrl-Shift-N"),exec:function(s){s.getSelection().selectDown()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"golinedown",description:"Go line down",bindKey:u("Down","Down|Ctrl-N"),exec:function(s,c){s.navigateDown(c.times)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectwordleft",description:"Select word left",bindKey:u("Ctrl-Shift-Left","Option-Shift-Left"),exec:function(s){s.getSelection().selectWordLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotowordleft",description:"Go to word left",bindKey:u("Ctrl-Left","Option-Left"),exec:function(s){s.navigateWordLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selecttolinestart",description:"Select to line start",bindKey:u("Alt-Shift-Left","Command-Shift-Left|Ctrl-Shift-A"),exec:function(s){s.getSelection().selectLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotolinestart",description:"Go to line start",bindKey:u("Alt-Left|Home","Command-Left|Home|Ctrl-A"),exec:function(s){s.navigateLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectleft",description:"Select left",bindKey:u("Shift-Left","Shift-Left|Ctrl-Shift-B"),exec:function(s){s.getSelection().selectLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotoleft",description:"Go to left",bindKey:u("Left","Left|Ctrl-B"),exec:function(s,c){s.navigateLeft(c.times)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectwordright",description:"Select word right",bindKey:u("Ctrl-Shift-Right","Option-Shift-Right"),exec:function(s){s.getSelection().selectWordRight()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotowordright",description:"Go to word right",bindKey:u("Ctrl-Right","Option-Right"),exec:function(s){s.navigateWordRight()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selecttolineend",description:"Select to line end",bindKey:u("Alt-Shift-Right","Command-Shift-Right|Shift-End|Ctrl-Shift-E"),exec:function(s){s.getSelection().selectLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotolineend",description:"Go to line end",bindKey:u("Alt-Right|End","Command-Right|End|Ctrl-E"),exec:function(s){s.navigateLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectright",description:"Select right",bindKey:u("Shift-Right","Shift-Right"),exec:function(s){s.getSelection().selectRight()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotoright",description:"Go to right",bindKey:u("Right","Right|Ctrl-F"),exec:function(s,c){s.navigateRight(c.times)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectpagedown",description:"Select page down",bindKey:"Shift-PageDown",exec:function(s){s.selectPageDown()},readOnly:!0},{name:"pagedown",description:"Page down",bindKey:u(null,"Option-PageDown"),exec:function(s){s.scrollPageDown()},readOnly:!0},{name:"gotopagedown",description:"Go to page down",bindKey:u("PageDown","PageDown|Ctrl-V"),exec:function(s){s.gotoPageDown()},readOnly:!0},{name:"selectpageup",description:"Select page up",bindKey:"Shift-PageUp",exec:function(s){s.selectPageUp()},readOnly:!0},{name:"pageup",description:"Page up",bindKey:u(null,"Option-PageUp"),exec:function(s){s.scrollPageUp()},readOnly:!0},{name:"gotopageup",description:"Go to page up",bindKey:"PageUp",exec:function(s){s.gotoPageUp()},readOnly:!0},{name:"scrollup",description:"Scroll up",bindKey:u("Ctrl-Up",null),exec:function(s){s.renderer.scrollBy(0,-2*s.renderer.layerConfig.lineHeight)},readOnly:!0},{name:"scrolldown",description:"Scroll down",bindKey:u("Ctrl-Down",null),exec:function(s){s.renderer.scrollBy(0,2*s.renderer.layerConfig.lineHeight)},readOnly:!0},{name:"selectlinestart",description:"Select line start",bindKey:"Shift-Home",exec:function(s){s.getSelection().selectLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectlineend",description:"Select line end",bindKey:"Shift-End",exec:function(s){s.getSelection().selectLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"togglerecording",description:"Toggle recording",bindKey:u("Ctrl-Alt-E","Command-Option-E"),exec:function(s){s.commands.toggleRecording(s)},readOnly:!0},{name:"replaymacro",description:"Replay macro",bindKey:u("Ctrl-Shift-E","Command-Shift-E"),exec:function(s){s.commands.replay(s)},readOnly:!0},{name:"jumptomatching",description:"Jump to matching",bindKey:u("Ctrl-\\|Ctrl-P","Command-\\"),exec:function(s){s.jumpToMatching()},multiSelectAction:"forEach",scrollIntoView:"animate",readOnly:!0},{name:"selecttomatching",description:"Select to matching",bindKey:u("Ctrl-Shift-\\|Ctrl-Shift-P","Command-Shift-\\"),exec:function(s){s.jumpToMatching(!0)},multiSelectAction:"forEach",scrollIntoView:"animate",readOnly:!0},{name:"expandToMatching",description:"Expand to matching",bindKey:u("Ctrl-Shift-M","Ctrl-Shift-M"),exec:function(s){s.jumpToMatching(!0,!0)},multiSelectAction:"forEach",scrollIntoView:"animate",readOnly:!0},{name:"passKeysToBrowser",description:"Pass keys to browser",bindKey:u(null,null),exec:function(){},passEvent:!0,readOnly:!0},{name:"copy",description:"Copy",exec:function(s){},readOnly:!0},{name:"cut",description:"Cut",exec:function(s){var c=s.$copyWithEmptySelection&&s.selection.isEmpty(),d=c?s.selection.getLineRange():s.selection.getRange();s._emit("cut",d),d.isEmpty()||s.session.remove(d),s.clearSelection()},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"paste",description:"Paste",exec:function(s,c){s.$handlePaste(c)},scrollIntoView:"cursor"},{name:"removeline",description:"Remove line",bindKey:u("Ctrl-D","Command-D"),exec:function(s){s.removeLines()},scrollIntoView:"cursor",multiSelectAction:"forEachLine"},{name:"duplicateSelection",description:"Duplicate selection",bindKey:u("Ctrl-Shift-D","Command-Shift-D"),exec:function(s){s.duplicateSelection()},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"sortlines",description:"Sort lines",bindKey:u("Ctrl-Alt-S","Command-Alt-S"),exec:function(s){s.sortLines()},scrollIntoView:"selection",multiSelectAction:"forEachLine"},{name:"togglecomment",description:"Toggle comment",bindKey:u("Ctrl-/","Command-/"),exec:function(s){s.toggleCommentLines()},multiSelectAction:"forEachLine",scrollIntoView:"selectionPart"},{name:"toggleBlockComment",description:"Toggle block comment",bindKey:u("Ctrl-Shift-/","Command-Shift-/"),exec:function(s){s.toggleBlockComment()},multiSelectAction:"forEach",scrollIntoView:"selectionPart"},{name:"modifyNumberUp",description:"Modify number up",bindKey:u("Ctrl-Shift-Up","Alt-Shift-Up"),exec:function(s){s.modifyNumber(1)},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"modifyNumberDown",description:"Modify number down",bindKey:u("Ctrl-Shift-Down","Alt-Shift-Down"),exec:function(s){s.modifyNumber(-1)},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"replace",description:"Replace",bindKey:u("Ctrl-H","Command-Option-F"),exec:function(s){l.loadModule("ace/ext/searchbox",function(c){c.Search(s,!0)})}},{name:"undo",description:"Undo",bindKey:u("Ctrl-Z","Command-Z"),exec:function(s){s.undo()}},{name:"redo",description:"Redo",bindKey:u("Ctrl-Shift-Z|Ctrl-Y","Command-Shift-Z|Command-Y"),exec:function(s){s.redo()}},{name:"copylinesup",description:"Copy lines up",bindKey:u("Alt-Shift-Up","Command-Option-Up"),exec:function(s){s.copyLinesUp()},scrollIntoView:"cursor"},{name:"movelinesup",description:"Move lines up",bindKey:u("Alt-Up","Option-Up"),exec:function(s){s.moveLinesUp()},scrollIntoView:"cursor"},{name:"copylinesdown",description:"Copy lines down",bindKey:u("Alt-Shift-Down","Command-Option-Down"),exec:function(s){s.copyLinesDown()},scrollIntoView:"cursor"},{name:"movelinesdown",description:"Move lines down",bindKey:u("Alt-Down","Option-Down"),exec:function(s){s.moveLinesDown()},scrollIntoView:"cursor"},{name:"del",description:"Delete",bindKey:u("Delete","Delete|Ctrl-D|Shift-Delete"),exec:function(s){s.remove("right")},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"backspace",description:"Backspace",bindKey:u("Shift-Backspace|Backspace","Ctrl-Backspace|Shift-Backspace|Backspace|Ctrl-H"),exec:function(s){s.remove("left")},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"cut_or_delete",description:"Cut or delete",bindKey:u("Shift-Delete",null),exec:function(s){if(s.selection.isEmpty())s.remove("left");else return!1},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removetolinestart",description:"Remove to line start",bindKey:u("Alt-Backspace","Command-Backspace"),exec:function(s){s.removeToLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removetolineend",description:"Remove to line end",bindKey:u("Alt-Delete","Ctrl-K|Command-Delete"),exec:function(s){s.removeToLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removetolinestarthard",description:"Remove to line start hard",bindKey:u("Ctrl-Shift-Backspace",null),exec:function(s){var c=s.selection.getRange();c.start.column=0,s.session.remove(c)},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removetolineendhard",description:"Remove to line end hard",bindKey:u("Ctrl-Shift-Delete",null),exec:function(s){var c=s.selection.getRange();c.end.column=Number.MAX_VALUE,s.session.remove(c)},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removewordleft",description:"Remove word left",bindKey:u("Ctrl-Backspace","Alt-Backspace|Ctrl-Alt-Backspace"),exec:function(s){s.removeWordLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removewordright",description:"Remove word right",bindKey:u("Ctrl-Delete","Alt-Delete"),exec:function(s){s.removeWordRight()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"outdent",description:"Outdent",bindKey:u("Shift-Tab","Shift-Tab"),exec:function(s){s.blockOutdent()},multiSelectAction:"forEach",scrollIntoView:"selectionPart"},{name:"indent",description:"Indent",bindKey:u("Tab","Tab"),exec:function(s){s.indent()},multiSelectAction:"forEach",scrollIntoView:"selectionPart"},{name:"blockoutdent",description:"Block outdent",bindKey:u("Ctrl-[","Ctrl-["),exec:function(s){s.blockOutdent()},multiSelectAction:"forEachLine",scrollIntoView:"selectionPart"},{name:"blockindent",description:"Block indent",bindKey:u("Ctrl-]","Ctrl-]"),exec:function(s){s.blockIndent()},multiSelectAction:"forEachLine",scrollIntoView:"selectionPart"},{name:"insertstring",description:"Insert string",exec:function(s,c){s.insert(c)},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"inserttext",description:"Insert text",exec:function(s,c){s.insert(o.stringRepeat(c.text||"",c.times||1))},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"splitline",description:"Split line",bindKey:u(null,"Ctrl-O"),exec:function(s){s.splitLine()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"transposeletters",description:"Transpose letters",bindKey:u("Alt-Shift-X","Ctrl-T"),exec:function(s){s.transposeLetters()},multiSelectAction:function(s){s.transposeSelections(1)},scrollIntoView:"cursor"},{name:"touppercase",description:"To uppercase",bindKey:u("Ctrl-U","Ctrl-U"),exec:function(s){s.toUpperCase()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"tolowercase",description:"To lowercase",bindKey:u("Ctrl-Shift-U","Ctrl-Shift-U"),exec:function(s){s.toLowerCase()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"autoindent",description:"Auto Indent",bindKey:u(null,null),exec:function(s){s.autoIndent()},scrollIntoView:"animate"},{name:"expandtoline",description:"Expand to line",bindKey:u("Ctrl-Shift-L","Command-Shift-L"),exec:function(s){var c=s.selection.getRange();c.start.column=c.end.column=0,c.end.row++,s.selection.setRange(c,!1)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"openlink",bindKey:u("Ctrl+F3","F3"),exec:function(s){s.openLink()}},{name:"joinlines",description:"Join lines",bindKey:u(null,null),exec:function(s){for(var c=s.selection.isBackwards(),d=c?s.selection.getSelectionLead():s.selection.getSelectionAnchor(),h=c?s.selection.getSelectionAnchor():s.selection.getSelectionLead(),f=s.session.doc.getLine(d.row).length,v=s.session.doc.getTextRange(s.selection.getRange()),y=v.replace(/\n\s*/," ").length,b=s.session.doc.getLine(d.row),w=d.row+1;w<=h.row+1;w++){var x=o.stringTrimLeft(o.stringTrimRight(s.session.doc.getLine(w)));x.length!==0&&(x=" "+x),b+=x}h.row+10?(s.selection.moveCursorTo(d.row,d.column),s.selection.selectTo(d.row,d.column+y)):(f=s.session.doc.getLine(d.row).length>f?f+1:f,s.selection.moveCursorTo(d.row,f))},multiSelectAction:"forEach",readOnly:!0},{name:"invertSelection",description:"Invert selection",bindKey:u(null,null),exec:function(s){var c=s.session.doc.getLength()-1,d=s.session.doc.getLine(c).length,h=s.selection.rangeList.ranges,f=[];h.length<1&&(h=[s.selection.getRange()]);for(var v=0;v0||s+c=0&&this.$isCustomWidgetVisible(s-c))return s-c;if(s+c<=this.lines.getLength()-1&&this.$isCustomWidgetVisible(s+c))return s+c;if(s-c>=0&&this.$isFoldWidgetVisible(s-c))return s-c;if(s+c<=this.lines.getLength()-1&&this.$isFoldWidgetVisible(s+c))return s+c}return null},p.prototype.$findNearestAnnotation=function(s){if(this.$isAnnotationVisible(s))return s;for(var c=0;s-c>0||s+c=0&&this.$isAnnotationVisible(s-c))return s-c;if(s+c<=this.lines.getLength()-1&&this.$isAnnotationVisible(s+c))return s+c}return null},p.prototype.$focusFoldWidget=function(s){if(s!=null){var c=this.$getFoldWidget(s);c.classList.add(this.editor.renderer.keyboardFocusClassName),c.focus()}},p.prototype.$focusCustomWidget=function(s){if(s!=null){var c=this.$getCustomWidget(s);c&&(c.classList.add(this.editor.renderer.keyboardFocusClassName),c.focus())}},p.prototype.$focusAnnotation=function(s){if(s!=null){var c=this.$getAnnotation(s);c.classList.add(this.editor.renderer.keyboardFocusClassName),c.focus()}},p.prototype.$blurFoldWidget=function(s){var c=this.$getFoldWidget(s);c.classList.remove(this.editor.renderer.keyboardFocusClassName),c.blur()},p.prototype.$blurCustomWidget=function(s){var c=this.$getCustomWidget(s);c&&(c.classList.remove(this.editor.renderer.keyboardFocusClassName),c.blur())},p.prototype.$blurAnnotation=function(s){var c=this.$getAnnotation(s);c.classList.remove(this.editor.renderer.keyboardFocusClassName),c.blur()},p.prototype.$moveFoldWidgetUp=function(){for(var s=this.activeRowIndex;s>0;)if(s--,this.$isFoldWidgetVisible(s)||this.$isCustomWidgetVisible(s)){this.$blurFoldWidget(this.activeRowIndex),this.$blurCustomWidget(this.activeRowIndex),this.activeRowIndex=s,this.$isFoldWidgetVisible(s)?this.$focusFoldWidget(this.activeRowIndex):this.$focusCustomWidget(this.activeRowIndex);return}},p.prototype.$moveFoldWidgetDown=function(){for(var s=this.activeRowIndex;s0;)if(s--,this.$isAnnotationVisible(s)){this.$blurAnnotation(this.activeRowIndex),this.activeRowIndex=s,this.$focusAnnotation(this.activeRowIndex);return}},p.prototype.$moveAnnotationDown=function(){for(var s=this.activeRowIndex;s=M.length&&(M=void 0),{value:M&&M[D++],done:!M}}};throw new TypeError(R?"Object is not iterable.":"Symbol.iterator is not defined.")},l=n("./lib/oop"),m=n("./lib/dom"),u=n("./lib/lang"),p=n("./lib/useragent"),s=n("./keyboard/textinput").TextInput,c=n("./mouse/mouse_handler").MouseHandler,d=n("./mouse/fold_handler").FoldHandler,h=n("./keyboard/keybinding").KeyBinding,f=n("./edit_session").EditSession,v=n("./search").Search,y=n("./range").Range,b=n("./lib/event_emitter").EventEmitter,w=n("./commands/command_manager").CommandManager,x=n("./commands/default_commands").commands,E=n("./config"),_=n("./token_iterator").TokenIterator,$=n("./keyboard/gutter_handler").GutterKeyboardHandler,O=n("./config").nls,N=n("./clipboard"),k=n("./lib/keys"),L=n("./lib/event"),F=n("./tooltip").HoverTooltip,P=function(){function M(R,I,D){this.id="editor"+ ++M.$uid,this.session,this.$toDestroy=[];var j=R.getContainerElement();this.container=j,this.renderer=R,this.commands=new w(p.isMac?"mac":"win",x),typeof document=="object"&&(this.textInput=new s(R.getTextAreaContainer(),this),this.renderer.textarea=this.textInput.getElement(),this.$mouseHandler=new c(this),new d(this)),this.keyBinding=new h(this),this.$search=new v().set({wrap:!0}),this.$historyTracker=this.$historyTracker.bind(this),this.commands.on("exec",this.$historyTracker),this.$initOperationListeners(),this._$emitInputEvent=u.delayedCall((function(){this._signal("input",{}),this.session&&!this.session.destroyed&&this.session.bgTokenizer.scheduleStart()}).bind(this)),this.on("change",function(B,V){V._$emitInputEvent.schedule(31)}),this.setSession(I||D&&D.session||new f("")),E.resetOptions(this),D&&this.setOptions(D),E._signal("editor",this)}return M.prototype.$initOperationListeners=function(){this.commands.on("exec",this.startOperation.bind(this),!0),this.commands.on("afterExec",this.endOperation.bind(this),!0)},M.prototype.startOperation=function(R){this.session.startOperation(R)},M.prototype.endOperation=function(R){this.session.endOperation(R)},M.prototype.onStartOperation=function(R){this.curOp=this.session.curOp,this.curOp.scrollTop=this.renderer.scrollTop,this.prevOp=this.session.prevOp,R||(this.previousCommand=null)},M.prototype.onEndOperation=function(R){if(this.curOp&&this.session){if(R&&R.returnValue===!1){this.curOp=null;return}if(this._signal("beforeEndOperation"),!this.curOp)return;var I=this.curOp.command,D=I&&I.scrollIntoView;if(D){switch(D){case"center-animate":D="animate";case"center":this.renderer.scrollCursorIntoView(null,.5);break;case"animate":case"cursor":this.renderer.scrollCursorIntoView();break;case"selectionPart":var j=this.selection.getRange(),B=this.renderer.layerConfig;(j.start.row>=B.lastRow||j.end.row<=B.firstRow)&&this.renderer.scrollSelectionIntoView(this.selection.anchor,this.selection.lead);break}D=="animate"&&this.renderer.animateScrolling(this.curOp.scrollTop)}this.$lastSel=this.session.selection.toJSON(),this.prevOp=this.curOp,this.curOp=null}},M.prototype.$historyTracker=function(R){if(this.$mergeUndoDeltas){var I=this.prevOp,D=this.$mergeableCommands,j=I.command&&R.command.name==I.command.name;if(R.command.name=="insertstring"){var B=R.args;this.mergeNextCommand===void 0&&(this.mergeNextCommand=!0),j=j&&this.mergeNextCommand&&(!/\s/.test(B)||/\s/.test(I.args)),this.mergeNextCommand=!0}else j=j&&D.indexOf(R.command.name)!==-1;this.$mergeUndoDeltas!="always"&&Date.now()-this.sequenceStartTime>2e3&&(j=!1),j?this.session.mergeUndoDeltas=!0:D.indexOf(R.command.name)!==-1&&(this.sequenceStartTime=Date.now())}},M.prototype.setKeyboardHandler=function(R,I){if(R&&typeof R=="string"&&R!="ace"){this.$keybindingId=R;var D=this;E.loadModule(["keybinding",R],function(j){D.$keybindingId==R&&D.keyBinding.setKeyboardHandler(j&&j.handler),I&&I()})}else this.$keybindingId=null,this.keyBinding.setKeyboardHandler(R),I&&I()},M.prototype.getKeyboardHandler=function(){return this.keyBinding.getKeyboardHandler()},M.prototype.setSession=function(R){if(this.session!=R){this.curOp&&this.endOperation(),this.curOp={};var I=this.session;if(I){this.session.off("change",this.$onDocumentChange),this.session.off("changeMode",this.$onChangeMode),this.session.off("tokenizerUpdate",this.$onTokenizerUpdate),this.session.off("changeTabSize",this.$onChangeTabSize),this.session.off("changeWrapLimit",this.$onChangeWrapLimit),this.session.off("changeWrapMode",this.$onChangeWrapMode),this.session.off("changeFold",this.$onChangeFold),this.session.off("changeFrontMarker",this.$onChangeFrontMarker),this.session.off("changeBackMarker",this.$onChangeBackMarker),this.session.off("changeBreakpoint",this.$onChangeBreakpoint),this.session.off("changeAnnotation",this.$onChangeAnnotation),this.session.off("changeOverwrite",this.$onCursorChange),this.session.off("changeScrollTop",this.$onScrollTopChange),this.session.off("changeScrollLeft",this.$onScrollLeftChange),this.session.off("startOperation",this.$onStartOperation),this.session.off("endOperation",this.$onEndOperation);var D=this.session.getSelection();D.off("changeCursor",this.$onCursorChange),D.off("changeSelection",this.$onSelectionChange)}this.session=R,R?(this.$onDocumentChange=this.onDocumentChange.bind(this),R.on("change",this.$onDocumentChange),this.renderer.setSession(R),this.$onChangeMode=this.onChangeMode.bind(this),R.on("changeMode",this.$onChangeMode),this.$onTokenizerUpdate=this.onTokenizerUpdate.bind(this),R.on("tokenizerUpdate",this.$onTokenizerUpdate),this.$onChangeTabSize=this.renderer.onChangeTabSize.bind(this.renderer),R.on("changeTabSize",this.$onChangeTabSize),this.$onChangeWrapLimit=this.onChangeWrapLimit.bind(this),R.on("changeWrapLimit",this.$onChangeWrapLimit),this.$onChangeWrapMode=this.onChangeWrapMode.bind(this),R.on("changeWrapMode",this.$onChangeWrapMode),this.$onChangeFold=this.onChangeFold.bind(this),R.on("changeFold",this.$onChangeFold),this.$onChangeFrontMarker=this.onChangeFrontMarker.bind(this),this.session.on("changeFrontMarker",this.$onChangeFrontMarker),this.$onChangeBackMarker=this.onChangeBackMarker.bind(this),this.session.on("changeBackMarker",this.$onChangeBackMarker),this.$onChangeBreakpoint=this.onChangeBreakpoint.bind(this),this.session.on("changeBreakpoint",this.$onChangeBreakpoint),this.$onChangeAnnotation=this.onChangeAnnotation.bind(this),this.session.on("changeAnnotation",this.$onChangeAnnotation),this.$onCursorChange=this.onCursorChange.bind(this),this.session.on("changeOverwrite",this.$onCursorChange),this.$onScrollTopChange=this.onScrollTopChange.bind(this),this.session.on("changeScrollTop",this.$onScrollTopChange),this.$onScrollLeftChange=this.onScrollLeftChange.bind(this),this.session.on("changeScrollLeft",this.$onScrollLeftChange),this.selection=R.getSelection(),this.selection.on("changeCursor",this.$onCursorChange),this.$onSelectionChange=this.onSelectionChange.bind(this),this.selection.on("changeSelection",this.$onSelectionChange),this.$onStartOperation=this.onStartOperation.bind(this),this.session.on("startOperation",this.$onStartOperation),this.$onEndOperation=this.onEndOperation.bind(this),this.session.on("endOperation",this.$onEndOperation),this.onChangeMode(),this.onCursorChange(),this.onScrollTopChange(),this.onScrollLeftChange(),this.onSelectionChange(),this.onChangeFrontMarker(),this.onChangeBackMarker(),this.onChangeBreakpoint(),this.onChangeAnnotation(),this.session.getUseWrapMode()&&this.renderer.adjustWrapLimit(),this.renderer.updateFull()):(this.selection=null,this.renderer.setSession(R)),this._signal("changeSession",{session:R,oldSession:I}),this.curOp=null,I&&I._signal("changeEditor",{oldEditor:this}),I&&(I.$editor=null),R&&R._signal("changeEditor",{editor:this}),R&&(R.$editor=this),R&&!R.destroyed&&R.bgTokenizer.scheduleStart()}},M.prototype.getSession=function(){return this.session},M.prototype.setValue=function(R,I){return this.session.doc.setValue(R),I?I==1?this.navigateFileEnd():I==-1&&this.navigateFileStart():this.selectAll(),R},M.prototype.getValue=function(){return this.session.getValue()},M.prototype.getSelection=function(){return this.selection},M.prototype.resize=function(R){this.renderer.onResize(R)},M.prototype.setTheme=function(R,I){this.renderer.setTheme(R,I)},M.prototype.getTheme=function(){return this.renderer.getTheme()},M.prototype.setStyle=function(R,I){this.renderer.setStyle(R,I)},M.prototype.unsetStyle=function(R){this.renderer.unsetStyle(R)},M.prototype.getFontSize=function(){return this.getOption("fontSize")||m.computedStyle(this.container).fontSize},M.prototype.setFontSize=function(R){this.setOption("fontSize",R)},M.prototype.$highlightBrackets=function(){if(!this.$highlightPending){var R=this;this.$highlightPending=!0,setTimeout(function(){R.$highlightPending=!1;var I=R.session;if(!(!I||I.destroyed)){I.$bracketHighlight&&(I.$bracketHighlight.markerIds.forEach(function(G){I.removeMarker(G)}),I.$bracketHighlight=null);var D=R.getCursorPosition(),j=R.getKeyboardHandler(),B=j&&j.$getDirectionForHighlight&&j.$getDirectionForHighlight(R),V=I.getMatchingBracketRanges(D,B);if(!V){var H=new _(I,D.row,D.column),Y=H.getCurrentToken();if(Y&&/\b(?:tag-open|tag-name)/.test(Y.type)){var U=I.getMatchingTags(D);U&&(V=[U.openTagName.isEmpty()?U.openTag:U.openTagName,U.closeTagName.isEmpty()?U.closeTag:U.closeTagName])}}if(!V&&I.$mode.getMatching&&(V=I.$mode.getMatching(R.session)),!V){R.getHighlightIndentGuides()&&R.renderer.$textLayer.$highlightIndentGuide();return}var K="ace_bracket";Array.isArray(V)?V.length==1&&(K="ace_error_bracket"):V=[V],V.length==2&&(y.comparePoints(V[0].end,V[1].start)==0?V=[y.fromPoints(V[0].start,V[1].end)]:y.comparePoints(V[0].start,V[1].end)==0&&(V=[y.fromPoints(V[1].start,V[0].end)])),I.$bracketHighlight={ranges:V,markerIds:V.map(function(G){return I.addMarker(G,K,"text")})},R.getHighlightIndentGuides()&&R.renderer.$textLayer.$highlightIndentGuide()}},50)}},M.prototype.focus=function(){this.textInput.focus()},M.prototype.isFocused=function(){return this.textInput.isFocused()},M.prototype.blur=function(){this.textInput.blur()},M.prototype.onFocus=function(R){this.$isFocused||(this.$isFocused=!0,this.renderer.showCursor(),this.renderer.visualizeFocus(),this._emit("focus",R))},M.prototype.onBlur=function(R){this.$isFocused&&(this.$isFocused=!1,this.renderer.hideCursor(),this.renderer.visualizeBlur(),this._emit("blur",R))},M.prototype.$cursorChange=function(){this.renderer.updateCursor(),this.$highlightBrackets(),this.$updateHighlightActiveLine()},M.prototype.onDocumentChange=function(R){var I=this.session.$useWrapMode,D=R.start.row==R.end.row?R.end.row:1/0;this.renderer.updateLines(R.start.row,D,I),this._signal("change",R),this.$cursorChange()},M.prototype.onTokenizerUpdate=function(R){var I=R.data;this.renderer.updateLines(I.first,I.last)},M.prototype.onScrollTopChange=function(){this.renderer.scrollToY(this.session.getScrollTop())},M.prototype.onScrollLeftChange=function(){this.renderer.scrollToX(this.session.getScrollLeft())},M.prototype.onCursorChange=function(){this.$cursorChange(),this._signal("changeSelection")},M.prototype.$updateHighlightActiveLine=function(){var R=this.getSession(),I;if(this.$highlightActiveLine&&((this.$selectionStyle!="line"||!this.selection.isMultiLine())&&(I=this.getCursorPosition()),this.renderer.theme&&this.renderer.theme.$selectionColorConflict&&!this.selection.isEmpty()&&(I=!1),this.renderer.$maxLines&&this.session.getLength()===1&&!(this.renderer.$minLines>1)&&(I=!1)),R.$highlightLineMarker&&!I)R.removeMarker(R.$highlightLineMarker.id),R.$highlightLineMarker=null;else if(!R.$highlightLineMarker&&I){var D=new y(I.row,I.column,I.row,1/0);D.id=R.addMarker(D,"ace_active-line","screenLine"),R.$highlightLineMarker=D}else I&&(R.$highlightLineMarker.start.row=I.row,R.$highlightLineMarker.end.row=I.row,R.$highlightLineMarker.start.column=I.column,R._signal("changeBackMarker"))},M.prototype.onSelectionChange=function(R){var I=this.session;if(I.$selectionMarker&&I.removeMarker(I.$selectionMarker),I.$selectionMarker=null,this.selection.isEmpty())this.$updateHighlightActiveLine();else{var D=this.selection.getRange(),j=this.getSelectionStyle();I.$selectionMarker=I.addMarker(D,"ace_selection",j)}var B=this.$highlightSelectedWord&&this.$getSelectionHighLightRegexp();this.session.highlight(B),this._signal("changeSelection")},M.prototype.$getSelectionHighLightRegexp=function(){var R=this.session,I=this.getSelectionRange();if(!(I.isEmpty()||I.isMultiLine())){var D=I.start.column,j=I.end.column,B=R.getLine(I.start.row),V=B.substring(D,j);if(!(V.length>5e3||!/[\w\d]/.test(V))){var H=this.$search.$assembleRegExp({wholeWord:!0,caseSensitive:!0,needle:V}),Y=B.substring(D-1,j+1);if(H.test(Y))return H}}},M.prototype.onChangeFrontMarker=function(){this.renderer.updateFrontMarkers()},M.prototype.onChangeBackMarker=function(){this.renderer.updateBackMarkers()},M.prototype.onChangeBreakpoint=function(){this.renderer.updateBreakpoints()},M.prototype.onChangeAnnotation=function(){this.renderer.setAnnotations(this.session.getAnnotations())},M.prototype.onChangeMode=function(R){this.renderer.updateText(),this._emit("changeMode",R)},M.prototype.onChangeWrapLimit=function(){this.renderer.updateFull()},M.prototype.onChangeWrapMode=function(){this.renderer.onResize(!0)},M.prototype.onChangeFold=function(){this.$updateHighlightActiveLine(),this.renderer.updateFull()},M.prototype.getSelectedText=function(){return this.session.getTextRange(this.getSelectionRange())},M.prototype.getCopyText=function(){var R=this.getSelectedText(),I=this.session.doc.getNewLineCharacter(),D=!1;if(!R&&this.$copyWithEmptySelection){D=!0;for(var j=this.selection.getAllRanges(),B=0;BG.search(/\S|$/)){var Y=G.substr(B.column).search(/\S|$/);D.doc.removeInLine(B.row,B.column,B.column+Y)}}this.clearSelection();var U=B.column,K=D.getState(B.row),G=D.getLine(B.row),q=j.checkOutdent(K,G,R);if(D.insert(B,R),V&&V.selection&&(V.selection.length==2?this.selection.setSelectionRange(new y(B.row,U+V.selection[0],B.row,U+V.selection[1])):this.selection.setSelectionRange(new y(B.row+V.selection[0],V.selection[1],B.row+V.selection[2],V.selection[3]))),this.$enableAutoIndent){if(D.getDocument().isNewLine(R)){var Z=j.getNextLineIndent(K,G.slice(0,B.column),D.getTabString());D.insert({row:B.row+1,column:0},Z)}q&&j.autoOutdent(K,D,B.row)}},M.prototype.autoIndent=function(){for(var R=this.session,I=R.getMode(),D=this.selection.isEmpty()?[new y(0,0,R.doc.getLength()-1,0)]:this.selection.getAllRanges(),j="",B="",V="",H=R.getTabString(),Y=0;Y0&&(j=R.getState(G-1),B=R.getLine(G-1),V=I.getNextLineIndent(j,B,H));var q=R.getLine(G),Z=I.$getIndent(q);if(V!==Z){if(Z.length>0){var Q=new y(G,0,G,Z.length);R.remove(Q)}V.length>0&&R.insert({row:G,column:0},V)}I.autoOutdent(j,R,G)}},M.prototype.onTextInput=function(R,I){if(!I)return this.keyBinding.onTextInput(R);this.startOperation({command:{name:"insertstring"}});var D=this.applyComposition.bind(this,R,I);this.selection.rangeCount?this.forEachSelection(D):D(),this.endOperation()},M.prototype.applyComposition=function(R,I){if(I.extendLeft||I.extendRight){var D=this.selection.getRange();D.start.column-=I.extendLeft,D.end.column+=I.extendRight,D.start.column<0&&(D.start.row--,D.start.column+=this.session.getLine(D.start.row).length+1),this.selection.setRange(D),!R&&!D.isEmpty()&&this.remove()}if((R||!this.selection.isEmpty())&&this.insert(R,!0),I.restoreStart||I.restoreEnd){var D=this.selection.getRange();D.start.column-=I.restoreStart,D.end.column-=I.restoreEnd,this.selection.setRange(D)}},M.prototype.onCommandKey=function(R,I,D){return this.keyBinding.onCommandKey(R,I,D)},M.prototype.setOverwrite=function(R){this.session.setOverwrite(R)},M.prototype.getOverwrite=function(){return this.session.getOverwrite()},M.prototype.toggleOverwrite=function(){this.session.toggleOverwrite()},M.prototype.setScrollSpeed=function(R){this.setOption("scrollSpeed",R)},M.prototype.getScrollSpeed=function(){return this.getOption("scrollSpeed")},M.prototype.setDragDelay=function(R){this.setOption("dragDelay",R)},M.prototype.getDragDelay=function(){return this.getOption("dragDelay")},M.prototype.setSelectionStyle=function(R){this.setOption("selectionStyle",R)},M.prototype.getSelectionStyle=function(){return this.getOption("selectionStyle")},M.prototype.setHighlightActiveLine=function(R){this.setOption("highlightActiveLine",R)},M.prototype.getHighlightActiveLine=function(){return this.getOption("highlightActiveLine")},M.prototype.setHighlightGutterLine=function(R){this.setOption("highlightGutterLine",R)},M.prototype.getHighlightGutterLine=function(){return this.getOption("highlightGutterLine")},M.prototype.setHighlightSelectedWord=function(R){this.setOption("highlightSelectedWord",R)},M.prototype.getHighlightSelectedWord=function(){return this.$highlightSelectedWord},M.prototype.setAnimatedScroll=function(R){this.renderer.setAnimatedScroll(R)},M.prototype.getAnimatedScroll=function(){return this.renderer.getAnimatedScroll()},M.prototype.setShowInvisibles=function(R){this.renderer.setShowInvisibles(R)},M.prototype.getShowInvisibles=function(){return this.renderer.getShowInvisibles()},M.prototype.setDisplayIndentGuides=function(R){this.renderer.setDisplayIndentGuides(R)},M.prototype.getDisplayIndentGuides=function(){return this.renderer.getDisplayIndentGuides()},M.prototype.setHighlightIndentGuides=function(R){this.renderer.setHighlightIndentGuides(R)},M.prototype.getHighlightIndentGuides=function(){return this.renderer.getHighlightIndentGuides()},M.prototype.setShowPrintMargin=function(R){this.renderer.setShowPrintMargin(R)},M.prototype.getShowPrintMargin=function(){return this.renderer.getShowPrintMargin()},M.prototype.setPrintMarginColumn=function(R){this.renderer.setPrintMarginColumn(R)},M.prototype.getPrintMarginColumn=function(){return this.renderer.getPrintMarginColumn()},M.prototype.setReadOnly=function(R){this.setOption("readOnly",R)},M.prototype.getReadOnly=function(){return this.getOption("readOnly")},M.prototype.setBehavioursEnabled=function(R){this.setOption("behavioursEnabled",R)},M.prototype.getBehavioursEnabled=function(){return this.getOption("behavioursEnabled")},M.prototype.setWrapBehavioursEnabled=function(R){this.setOption("wrapBehavioursEnabled",R)},M.prototype.getWrapBehavioursEnabled=function(){return this.getOption("wrapBehavioursEnabled")},M.prototype.setShowFoldWidgets=function(R){this.setOption("showFoldWidgets",R)},M.prototype.getShowFoldWidgets=function(){return this.getOption("showFoldWidgets")},M.prototype.setFadeFoldWidgets=function(R){this.setOption("fadeFoldWidgets",R)},M.prototype.getFadeFoldWidgets=function(){return this.getOption("fadeFoldWidgets")},M.prototype.remove=function(R){this.selection.isEmpty()&&(R=="left"?this.selection.selectLeft():this.selection.selectRight());var I=this.getSelectionRange();if(this.getBehavioursEnabled()){var D=this.session,j=D.getState(I.start.row),B=D.getMode().transformAction(j,"deletion",this,D,I);if(I.end.column===0){var V=D.getTextRange(I);if(V[V.length-1]==` +`){var H=D.getLine(I.end.row);/^\s+$/.test(H)&&(I.end.column=H.length)}}B&&(I=B)}this.session.remove(I),this.clearSelection()},M.prototype.removeWordRight=function(){this.selection.isEmpty()&&this.selection.selectWordRight(),this.session.remove(this.getSelectionRange()),this.clearSelection()},M.prototype.removeWordLeft=function(){this.selection.isEmpty()&&this.selection.selectWordLeft(),this.session.remove(this.getSelectionRange()),this.clearSelection()},M.prototype.removeToLineStart=function(){this.selection.isEmpty()&&this.selection.selectLineStart(),this.selection.isEmpty()&&this.selection.selectLeft(),this.session.remove(this.getSelectionRange()),this.clearSelection()},M.prototype.removeToLineEnd=function(){this.selection.isEmpty()&&this.selection.selectLineEnd();var R=this.getSelectionRange();R.start.column==R.end.column&&R.start.row==R.end.row&&(R.end.column=0,R.end.row++),this.session.remove(R),this.clearSelection()},M.prototype.splitLine=function(){this.selection.isEmpty()||(this.session.remove(this.getSelectionRange()),this.clearSelection());var R=this.getCursorPosition();this.insert(` +`),this.moveCursorToPosition(R)},M.prototype.setGhostText=function(R,I){this.renderer.setGhostText(R,I)},M.prototype.removeGhostText=function(){this.renderer.removeGhostText()},M.prototype.transposeLetters=function(){if(this.selection.isEmpty()){var R=this.getCursorPosition(),I=R.column;if(I!==0){var D=this.session.getLine(R.row),j,B;IY.toLowerCase()?1:0});for(var B=new y(0,0,0,0),j=R.first;j<=R.last;j++){var V=I.getLine(j);B.start.row=j,B.end.row=j,B.end.column=V.length,I.replace(B,D[j-R.first])}},M.prototype.toggleCommentLines=function(){var R=this.session.getState(this.getCursorPosition().row),I=this.$getSelectedRows();this.session.getMode().toggleCommentLines(R,this.session,I.first,I.last)},M.prototype.toggleBlockComment=function(){var R=this.getCursorPosition(),I=this.session.getState(R.row),D=this.getSelectionRange();this.session.getMode().toggleBlockComment(I,this.session,D,R)},M.prototype.getNumberAt=function(R,I){var D=/[\-]?[0-9]+(?:\.[0-9]+)?/g;D.lastIndex=0;for(var j=this.session.getLine(R);D.lastIndex=I){var V={value:B[0],start:B.index,end:B.index+B[0].length};return V}}return null},M.prototype.modifyNumber=function(R){var I=this.selection.getCursor().row,D=this.selection.getCursor().column,j=new y(I,D-1,I,D),B=this.session.getTextRange(j);if(!isNaN(parseFloat(B))&&isFinite(B)){var V=this.getNumberAt(I,D);if(V){var H=V.value.indexOf(".")>=0?V.start+V.value.indexOf(".")+1:V.end,Y=V.start+V.value.length-H,U=parseFloat(V.value);U*=Math.pow(10,Y),H!==V.end&&D=H&&V<=Y&&(D=ae,U.selection.clearSelection(),U.moveCursorTo(R,H+j),U.selection.selectTo(R,Y+j)),H=Y});for(var K=this.$toggleWordPairs,G,q=0;q=Y&&H<=U&&Z.match(/((?:https?|ftp):\/\/[\S]+)/)){K=Z.replace(/[\s:.,'";}\]]+$/,"");break}Y=U}}catch(Q){D={error:Q}}finally{try{q&&!q.done&&(j=G.return)&&j.call(G)}finally{if(D)throw D.error}}return K},M.prototype.openLink=function(){var R=this.selection.getCursor(),I=this.findLinkAt(R.row,R.column);return I&&window.open(I,"_blank"),I!=null},M.prototype.removeLines=function(){var R=this.$getSelectedRows();this.session.removeFullLines(R.first,R.last),this.clearSelection()},M.prototype.duplicateSelection=function(){var R=this.selection,I=this.session,D=R.getRange(),j=R.isBackwards();if(D.isEmpty()){var B=D.start.row;I.duplicateLines(B,B)}else{var V=j?D.start:D.end,H=I.insert(V,I.getTextRange(D));D.start=V,D.end=H,R.setSelectionRange(D,j)}},M.prototype.moveLinesDown=function(){this.$moveLines(1,!1)},M.prototype.moveLinesUp=function(){this.$moveLines(-1,!1)},M.prototype.moveText=function(R,I,D){return this.session.moveText(R,I,D)},M.prototype.copyLinesUp=function(){this.$moveLines(-1,!0)},M.prototype.copyLinesDown=function(){this.$moveLines(1,!0)},M.prototype.$moveLines=function(R,I){var D,j,B=this.selection;if(!B.inMultiSelectMode||this.inVirtualSelectionMode){var V=B.toOrientedRange();D=this.$getSelectedRows(V),j=this.session.$moveLines(D.first,D.last,I?0:R),I&&R==-1&&(j=0),V.moveBy(j,0),B.fromOrientedRange(V)}else{var H=B.rangeList.ranges;B.rangeList.detach(this.session),this.inVirtualSelectionMode=!0;for(var Y=0,U=0,K=H.length,G=0;GQ+1)break;Q=J.last}for(G--,Y=this.session.$moveLines(Z,Q,I?0:R),I&&R==-1&&(q=G+1);q<=G;)H[q].moveBy(Y,0),q++;I||(Y=0),U+=Y}B.fromOrientedRange(B.ranges[0]),B.rangeList.attach(this.session),this.inVirtualSelectionMode=!1}},M.prototype.$getSelectedRows=function(R){return R=(R||this.getSelectionRange()).collapseRows(),{first:this.session.getRowFoldStart(R.start.row),last:this.session.getRowFoldEnd(R.end.row)}},M.prototype.onCompositionStart=function(R){this.renderer.showComposition(R)},M.prototype.onCompositionUpdate=function(R){this.renderer.setCompositionText(R)},M.prototype.onCompositionEnd=function(){this.renderer.hideComposition()},M.prototype.getFirstVisibleRow=function(){return this.renderer.getFirstVisibleRow()},M.prototype.getLastVisibleRow=function(){return this.renderer.getLastVisibleRow()},M.prototype.isRowVisible=function(R){return R>=this.getFirstVisibleRow()&&R<=this.getLastVisibleRow()},M.prototype.isRowFullyVisible=function(R){return R>=this.renderer.getFirstFullyVisibleRow()&&R<=this.renderer.getLastFullyVisibleRow()},M.prototype.$getVisibleRowCount=function(){return this.renderer.getScrollBottomRow()-this.renderer.getScrollTopRow()+1},M.prototype.$moveByPage=function(R,I){var D=this.renderer,j=this.renderer.layerConfig,B=R*Math.floor(j.height/j.lineHeight);I===!0?this.selection.$moveSelection(function(){this.moveCursorBy(B,0)}):I===!1&&(this.selection.moveCursorBy(B,0),this.selection.clearSelection());var V=D.scrollTop;D.scrollBy(0,B*j.lineHeight),I!=null&&D.scrollCursorIntoView(null,.5),D.animateScrolling(V)},M.prototype.selectPageDown=function(){this.$moveByPage(1,!0)},M.prototype.selectPageUp=function(){this.$moveByPage(-1,!0)},M.prototype.gotoPageDown=function(){this.$moveByPage(1,!1)},M.prototype.gotoPageUp=function(){this.$moveByPage(-1,!1)},M.prototype.scrollPageDown=function(){this.$moveByPage(1)},M.prototype.scrollPageUp=function(){this.$moveByPage(-1)},M.prototype.scrollToRow=function(R){this.renderer.scrollToRow(R)},M.prototype.scrollToLine=function(R,I,D,j){this.renderer.scrollToLine(R,I,D,j)},M.prototype.centerSelection=function(){var R=this.getSelectionRange(),I={row:Math.floor(R.start.row+(R.end.row-R.start.row)/2),column:Math.floor(R.start.column+(R.end.column-R.start.column)/2)};this.renderer.alignCursor(I,.5)},M.prototype.getCursorPosition=function(){return this.selection.getCursor()},M.prototype.getCursorPositionScreen=function(){return this.session.documentToScreenPosition(this.getCursorPosition())},M.prototype.getSelectionRange=function(){return this.selection.getRange()},M.prototype.selectAll=function(){this.selection.selectAll()},M.prototype.clearSelection=function(){this.selection.clearSelection()},M.prototype.moveCursorTo=function(R,I){this.selection.moveCursorTo(R,I)},M.prototype.moveCursorToPosition=function(R){this.selection.moveCursorToPosition(R)},M.prototype.jumpToMatching=function(R,I){var D=this.getCursorPosition(),j=new _(this.session,D.row,D.column),B=j.getCurrentToken(),V=0;B&&B.type.indexOf("tag-name")!==-1&&(B=j.stepBackward());var H=B||j.stepForward();if(H){var Y,U=!1,K={},G=D.column-H.start,q,Z={")":"(","(":"(","]":"[","[":"[","{":"{","}":"{"};do{if(H.value.match(/[{}()\[\]]/g)){for(;G1?K[H.value]++:B.value==="=0;--V)this.$tryReplace(D[V],R)&&j++;return this.selection.setSelectionRange(B),j},M.prototype.$tryReplace=function(R,I){var D=this.session.getTextRange(R);return I=this.$search.replace(D,I),I!==null?(R.end=this.session.replace(R,I),R):null},M.prototype.getLastSearchOptions=function(){return this.$search.getOptions()},M.prototype.find=function(R,I,D){I||(I={}),typeof R=="string"||R instanceof RegExp?I.needle=R:typeof R=="object"&&l.mixin(I,R);var j=this.selection.getRange();I.needle==null&&(R=this.session.getTextRange(j)||this.$search.$options.needle,R||(j=this.session.getWordRange(j.start.row,j.start.column),R=this.session.getTextRange(j)),this.$search.set({needle:R})),this.$search.set(I),I.start||this.$search.set({start:j});var B=this.$search.find(this.session);if(I.preventScroll)return B;if(B)return this.revealRange(B,D),B;I.backwards?j.start=j.end:j.end=j.start,this.selection.setRange(j)},M.prototype.findNext=function(R,I){this.find({skipCurrent:!0,backwards:!1},R,I)},M.prototype.findPrevious=function(R,I){this.find(R,{skipCurrent:!0,backwards:!0},I)},M.prototype.revealRange=function(R,I){this.session.unfold(R),this.selection.setSelectionRange(R);var D=this.renderer.scrollTop;this.renderer.scrollSelectionIntoView(R.start,R.end,.5),I!==!1&&this.renderer.animateScrolling(D)},M.prototype.undo=function(){this.session.getUndoManager().undo(this.session),this.renderer.scrollCursorIntoView(null,.5)},M.prototype.redo=function(){this.session.getUndoManager().redo(this.session),this.renderer.scrollCursorIntoView(null,.5)},M.prototype.destroy=function(){this.$toDestroy&&(this.$toDestroy.forEach(function(R){R.destroy()}),this.$toDestroy=null),this.$mouseHandler&&this.$mouseHandler.destroy(),this.renderer.destroy(),this._signal("destroy",this),this.session&&this.session.destroy(),this._$emitInputEvent&&this._$emitInputEvent.cancel(),this.removeAllListeners()},M.prototype.setAutoScrollEditorIntoView=function(R){if(R){var I,D=this,j=!1;this.$scrollAnchor||(this.$scrollAnchor=document.createElement("div"));var B=this.$scrollAnchor;B.style.cssText="position:absolute",this.container.insertBefore(B,this.container.firstChild);var V=this.on("changeSelection",function(){j=!0}),H=this.renderer.on("beforeRender",function(){j&&(I=D.renderer.container.getBoundingClientRect())}),Y=this.renderer.on("afterRender",function(){if(j&&I&&(D.isFocused()||D.searchBox&&D.searchBox.isFocused())){var U=D.renderer,K=U.$cursorLayer.$pixelPos,G=U.layerConfig,q=K.top-G.offset;K.top>=0&&q+I.top<0?j=!0:K.topwindow.innerHeight?j=!1:j=null,j!=null&&(B.style.top=q+"px",B.style.left=K.left+"px",B.style.height=G.lineHeight+"px",B.scrollIntoView(j)),j=I=null}});this.setAutoScrollEditorIntoView=function(U){U||(delete this.setAutoScrollEditorIntoView,this.off("changeSelection",V),this.renderer.off("afterRender",Y),this.renderer.off("beforeRender",H))}}},M.prototype.$resetCursorStyle=function(){var R=this.$cursorStyle||"ace",I=this.renderer.$cursorLayer;I&&(I.setSmoothBlinking(/smooth/.test(R)),I.isBlinking=!this.$readOnly&&R!="wide",m.setCssClass(I.element,"ace_slim-cursors",/slim/.test(R)))},M.prototype.prompt=function(R,I,D){var j=this;E.loadModule("ace/ext/prompt",function(B){B.prompt(j,R,I,D)})},M}();P.$uid=0,P.prototype.curOp=null,P.prototype.prevOp={},P.prototype.$mergeableCommands=["backspace","del","insertstring"],P.prototype.$toggleWordPairs=[["first","last"],["true","false"],["yes","no"],["width","height"],["top","bottom"],["right","left"],["on","off"],["x","y"],["get","set"],["max","min"],["horizontal","vertical"],["show","hide"],["add","remove"],["up","down"],["before","after"],["even","odd"],["in","out"],["inside","outside"],["next","previous"],["increase","decrease"],["attach","detach"],["&&","||"],["==","!="]],l.implement(P.prototype,b),E.defineOptions(P.prototype,"editor",{selectionStyle:{set:function(M){this.onSelectionChange(),this._signal("changeSelectionStyle",{data:M})},initialValue:"line"},highlightActiveLine:{set:function(){this.$updateHighlightActiveLine()},initialValue:!0},highlightSelectedWord:{set:function(M){this.$onSelectionChange()},initialValue:!0},readOnly:{set:function(M){var R=this;this.textInput.setReadOnly(M),this.$resetCursorStyle(),this.$readOnlyCallback||(this.$readOnlyCallback=function(D){var j=!1;if(D&&D.type=="keydown"){if(j=D&&D.key&&D.key.length==1&&!D.ctrlKey&&!D.metaKey,!j)return}else D&&D.type!=="exec"&&(j=!0);if(j){R.hoverTooltip||(R.hoverTooltip=new F);var B=m.createElement("div");B.textContent=O("editor.tooltip.disable-editing","Editing is disabled"),R.hoverTooltip.isOpen||R.hoverTooltip.showForRange(R,R.getSelectionRange(),B)}else R.hoverTooltip&&R.hoverTooltip.isOpen&&R.hoverTooltip.hide()});var I=this.textInput.getElement();M?(L.addListener(I,"keydown",this.$readOnlyCallback,this),this.commands.on("exec",this.$readOnlyCallback),this.commands.on("commandUnavailable",this.$readOnlyCallback)):(L.removeListener(I,"keydown",this.$readOnlyCallback),this.commands.off("exec",this.$readOnlyCallback),this.commands.off("commandUnavailable",this.$readOnlyCallback),this.hoverTooltip&&(this.hoverTooltip.destroy(),this.hoverTooltip=null))},initialValue:!1},copyWithEmptySelection:{set:function(M){this.textInput.setCopyWithEmptySelection(M)},initialValue:!1},cursorStyle:{set:function(M){this.$resetCursorStyle()},values:["ace","slim","smooth","wide"],initialValue:"ace"},mergeUndoDeltas:{values:[!1,!0,"always"],initialValue:!0},behavioursEnabled:{initialValue:!0},wrapBehavioursEnabled:{initialValue:!0},enableAutoIndent:{initialValue:!0},autoScrollEditorIntoView:{set:function(M){this.setAutoScrollEditorIntoView(M)}},keyboardHandler:{set:function(M){this.setKeyboardHandler(M)},get:function(){return this.$keybindingId},handlesSet:!0},value:{set:function(M){this.session.setValue(M)},get:function(){return this.getValue()},handlesSet:!0,hidden:!0},session:{set:function(M){this.setSession(M)},get:function(){return this.session},handlesSet:!0,hidden:!0},showLineNumbers:{set:function(M){this.renderer.$gutterLayer.setShowLineNumbers(M),this.renderer.$loop.schedule(this.renderer.CHANGE_GUTTER),M&&this.$relativeLineNumbers?A.attach(this):A.detach(this)},initialValue:!0},relativeLineNumbers:{set:function(M){this.$showLineNumbers&&M?A.attach(this):A.detach(this)}},placeholder:{set:function(M){this.$updatePlaceholder||(this.$updatePlaceholder=(function(){var R=this.session&&(this.renderer.$composition||this.session.getLength()>1||this.session.getLine(0).length>0);if(R&&this.renderer.placeholderNode)this.renderer.off("afterRender",this.$updatePlaceholder),m.removeCssClass(this.container,"ace_hasPlaceholder"),this.renderer.placeholderNode.remove(),this.renderer.placeholderNode=null;else if(!R&&!this.renderer.placeholderNode){this.renderer.on("afterRender",this.$updatePlaceholder),m.addCssClass(this.container,"ace_hasPlaceholder");var I=m.createElement("div");I.className="ace_placeholder",I.textContent=this.$placeholder||"",this.renderer.placeholderNode=I,this.renderer.content.appendChild(this.renderer.placeholderNode)}else!R&&this.renderer.placeholderNode&&(this.renderer.placeholderNode.textContent=this.$placeholder||"")}).bind(this),this.on("input",this.$updatePlaceholder)),this.$updatePlaceholder()}},enableKeyboardAccessibility:{set:function(M){var R={name:"blurTextInput",description:"Set focus to the editor content div to allow tabbing through the page",bindKey:"Esc",exec:function(j){j.blur(),j.renderer.scroller.focus()},readOnly:!0},I=function(j){if(j.target==this.renderer.scroller&&j.keyCode===k.enter){j.preventDefault();var B=this.getCursorPosition().row;this.isRowVisible(B)||this.scrollToLine(B,!0,!0),this.focus()}},D;M?(this.renderer.enableKeyboardAccessibility=!0,this.renderer.keyboardFocusClassName="ace_keyboard-focus",this.textInput.getElement().setAttribute("tabindex",-1),this.textInput.setNumberOfExtraLines(p.isWin?3:0),this.renderer.scroller.setAttribute("tabindex",0),this.renderer.scroller.setAttribute("role","group"),this.renderer.scroller.setAttribute("aria-roledescription",O("editor.scroller.aria-roledescription","editor")),this.renderer.scroller.classList.add(this.renderer.keyboardFocusClassName),this.renderer.scroller.setAttribute("aria-label",O("editor.scroller.aria-label","Editor content, press Enter to start editing, press Escape to exit")),this.renderer.scroller.addEventListener("keyup",I.bind(this)),this.commands.addCommand(R),this.renderer.$gutter.setAttribute("tabindex",0),this.renderer.$gutter.setAttribute("aria-hidden",!1),this.renderer.$gutter.setAttribute("role","group"),this.renderer.$gutter.setAttribute("aria-roledescription",O("editor.gutter.aria-roledescription","editor gutter")),this.renderer.$gutter.setAttribute("aria-label",O("editor.gutter.aria-label","Editor gutter, press Enter to interact with controls using arrow keys, press Escape to exit")),this.renderer.$gutter.classList.add(this.renderer.keyboardFocusClassName),this.renderer.content.setAttribute("aria-hidden",!0),D||(D=new $(this)),D.addListener(),this.textInput.setAriaOptions({setLabel:!0})):(this.renderer.enableKeyboardAccessibility=!1,this.textInput.getElement().setAttribute("tabindex",0),this.textInput.setNumberOfExtraLines(0),this.renderer.scroller.setAttribute("tabindex",-1),this.renderer.scroller.removeAttribute("role"),this.renderer.scroller.removeAttribute("aria-roledescription"),this.renderer.scroller.classList.remove(this.renderer.keyboardFocusClassName),this.renderer.scroller.removeAttribute("aria-label"),this.renderer.scroller.removeEventListener("keyup",I.bind(this)),this.commands.removeCommand(R),this.renderer.content.removeAttribute("aria-hidden"),this.renderer.$gutter.setAttribute("tabindex",-1),this.renderer.$gutter.setAttribute("aria-hidden",!0),this.renderer.$gutter.removeAttribute("role"),this.renderer.$gutter.removeAttribute("aria-roledescription"),this.renderer.$gutter.removeAttribute("aria-label"),this.renderer.$gutter.classList.remove(this.renderer.keyboardFocusClassName),D&&D.removeListener())},initialValue:!1},textInputAriaLabel:{set:function(M){this.$textInputAriaLabel=M},initialValue:""},enableMobileMenu:{set:function(M){this.$enableMobileMenu=M},initialValue:!0},customScrollbar:"renderer",hScrollBarAlwaysVisible:"renderer",vScrollBarAlwaysVisible:"renderer",highlightGutterLine:"renderer",animatedScroll:"renderer",showInvisibles:"renderer",showPrintMargin:"renderer",printMarginColumn:"renderer",printMargin:"renderer",fadeFoldWidgets:"renderer",showFoldWidgets:"renderer",displayIndentGuides:"renderer",highlightIndentGuides:"renderer",showGutter:"renderer",fontSize:"renderer",fontFamily:"renderer",maxLines:"renderer",minLines:"renderer",scrollPastEnd:"renderer",fixedWidthGutter:"renderer",theme:"renderer",hasCssTransforms:"renderer",maxPixelHeight:"renderer",useTextareaForIME:"renderer",useResizeObserver:"renderer",useSvgGutterIcons:"renderer",showFoldedAnnotations:"renderer",scrollSpeed:"$mouseHandler",dragDelay:"$mouseHandler",dragEnabled:"$mouseHandler",focusTimeout:"$mouseHandler",tooltipFollowsMouse:"$mouseHandler",firstLineNumber:"session",overwrite:"session",newLineMode:"session",useWorker:"session",useSoftTabs:"session",navigateWithinSoftTabs:"session",tabSize:"session",wrap:"session",indentedSoftWrap:"session",foldStyle:"session",mode:"session"});var A={getText:function(M,R){return(Math.abs(M.selection.lead.row-R)||R+1+(R<9?"·":""))+""},getWidth:function(M,R,I){return Math.max(R.toString().length,(I.lastRow+1).toString().length,2)*I.characterWidth},update:function(M,R){R.renderer.$loop.schedule(R.renderer.CHANGE_GUTTER)},attach:function(M){M.renderer.$gutterLayer.$renderer=this,M.on("changeSelection",this.update),this.update(null,M)},detach:function(M){M.renderer.$gutterLayer.$renderer==this&&(M.renderer.$gutterLayer.$renderer=null),M.off("changeSelection",this.update),this.update(null,M)}};r.Editor=P}),ace.define("ace/layer/lines",["require","exports","module","ace/lib/dom"],function(n,r,i){var o=n("../lib/dom"),l=function(){function m(u,p){this.element=u,this.canvasHeight=p||5e5,this.element.style.height=this.canvasHeight*2+"px",this.cells=[],this.cellCache=[],this.$offsetCoefficient=0}return m.prototype.moveContainer=function(u){o.translate(this.element,0,-(u.firstRowScreen*u.lineHeight%this.canvasHeight)-u.offset*this.$offsetCoefficient)},m.prototype.pageChanged=function(u,p){return Math.floor(u.firstRowScreen*u.lineHeight/this.canvasHeight)!==Math.floor(p.firstRowScreen*p.lineHeight/this.canvasHeight)},m.prototype.computeLineTop=function(u,p,s){var c=p.firstRowScreen*p.lineHeight,d=Math.floor(c/this.canvasHeight),h=s.documentToScreenRow(u,0)*p.lineHeight;return h-d*this.canvasHeight},m.prototype.computeLineHeight=function(u,p,s){return p.lineHeight*s.getRowLineCount(u)},m.prototype.getLength=function(){return this.cells.length},m.prototype.get=function(u){return this.cells[u]},m.prototype.shift=function(){this.$cacheCell(this.cells.shift())},m.prototype.pop=function(){this.$cacheCell(this.cells.pop())},m.prototype.push=function(u){if(Array.isArray(u)){this.cells.push.apply(this.cells,u);for(var p=o.createFragment(this.element),s=0;sx&&($=w.end.row+1,w=v.getNextFoldLine($,w),x=w?w.start.row:1/0),$>b){for(;this.$lines.getLength()>_+1;)this.$lines.pop();break}E=this.$lines.get(++_),E?E.row=$:(E=this.$lines.createCell($,f,this.session,d),this.$lines.push(E)),this.$renderCell(E,f,w,$),$++}this._signal("afterRender"),this.$updateGutterWidth(f)},h.prototype.$updateGutterWidth=function(f){var v=this.session,y=v.gutterRenderer||this.$renderer,b=v.$firstLineNumber,w=this.$lines.last()?this.$lines.last().text:"";(this.$fixedWidth||v.$useWrapMode)&&(w=v.getLength()+b-1);var x=y?y.getWidth(v,w,f):w.toString().length*f.characterWidth,E=this.$padding||this.$computePadding();x+=E.left+E.right,x!==this.gutterWidth&&!isNaN(x)&&(this.gutterWidth=x,this.element.parentNode.style.width=this.element.style.width=Math.ceil(this.gutterWidth)+"px",this._signal("changeGutterWidth",x))},h.prototype.$updateCursorRow=function(){if(this.$highlightGutterLine){var f=this.session.selection.getCursor();this.$cursorRow!==f.row&&(this.$cursorRow=f.row)}},h.prototype.updateLineHighlight=function(){if(this.$highlightGutterLine){var f=this.session.selection.cursor.row;if(this.$cursorRow=f,!(this.$cursorCell&&this.$cursorCell.row==f)){this.$cursorCell&&(this.$cursorCell.element.className=this.$cursorCell.element.className.replace("ace_gutter-active-line ",""));var v=this.$lines.cells;this.$cursorCell=null;for(var y=0;y=this.$cursorRow){if(b.row>this.$cursorRow){var w=this.session.getFoldLine(this.$cursorRow);if(y>0&&w&&w.start.row==v[y-1].row)b=v[y-1];else break}b.element.className="ace_gutter-active-line "+b.element.className,this.$cursorCell=b;break}}}}},h.prototype.scrollLines=function(f){var v=this.config;if(this.config=f,this.$updateCursorRow(),this.$lines.pageChanged(v,f))return this.update(f);this.$lines.moveContainer(f);var y=Math.min(f.lastRow+f.gutterOffset,this.session.getLength()-1),b=this.oldLastRow;if(this.oldLastRow=y,!v||b0;w--)this.$lines.shift();if(b>y)for(var w=this.session.getFoldedRowCount(y+1,b);w>0;w--)this.$lines.pop();f.firstRowb&&this.$lines.push(this.$renderLines(f,b+1,y)),this.updateLineHighlight(),this._signal("afterRender"),this.$updateGutterWidth(f)},h.prototype.$renderLines=function(f,v,y){for(var b=[],w=v,x=this.session.getNextFoldLine(w),E=x?x.start.row:1/0;w>E&&(w=x.end.row+1,x=this.session.getNextFoldLine(w,x),E=x?x.start.row:1/0),!(w>y);){var _=this.$lines.createCell(w,f,this.session,d);this.$renderCell(_,f,x,w),b.push(_),w++}return b},h.prototype.$renderCell=function(f,v,y,b){var w=f.element,x=this.session,E=w.childNodes[0],_=w.childNodes[1],$=w.childNodes[2],O=w.childNodes[3],N=$.firstChild,k=x.$firstLineNumber,L=x.$breakpoints,F=x.$decorations,P=x.gutterRenderer||this.$renderer,A=this.$showFoldWidgets&&x.foldWidgets,M=y?y.start.row:Number.MAX_VALUE,R=v.lineHeight+"px",I=this.$useSvgGutterIcons?"ace_gutter-cell_svg-icons ":"ace_gutter-cell ",D=this.$useSvgGutterIcons?"ace_icon_svg":"ace_icon",j=(P?P.getText(x,b):b+k).toString();if(this.$highlightGutterLine&&(b==this.$cursorRow||y&&b=M&&this.$cursorRow<=y.end.row)&&(I+="ace_gutter-active-line ",this.$cursorCell!=f&&(this.$cursorCell&&(this.$cursorCell.element.className=this.$cursorCell.element.className.replace("ace_gutter-active-line ","")),this.$cursorCell=f)),L[b]&&(I+=L[b]),F[b]&&(I+=F[b]),this.$annotations[b]&&b!==M&&(I+=this.$annotations[b].className),A){var B=A[b];B==null&&(B=A[b]=x.getFoldWidget(b))}if(B){var V="ace_fold-widget ace_"+B,H=B=="start"&&b==M&&by.right-v.right)return"foldWidgets"},h}();c.prototype.$fixedWidth=!1,c.prototype.$highlightGutterLine=!0,c.prototype.$renderer="",c.prototype.$showLineNumbers=!0,c.prototype.$showFoldWidgets=!0,l.implement(c.prototype,u);function d(h){var f=document.createTextNode("");h.appendChild(f);var v=o.createElement("span");h.appendChild(v);var y=o.createElement("span");h.appendChild(y);var b=o.createElement("span");return y.appendChild(b),h}r.Gutter=c}),ace.define("ace/layer/marker",["require","exports","module","ace/range","ace/lib/dom"],function(n,r,i){var o=n("../range").Range,l=n("../lib/dom"),m=function(){function p(s){this.element=l.createElement("div"),this.element.className="ace_layer ace_marker-layer",s.appendChild(this.element)}return p.prototype.setPadding=function(s){this.$padding=s},p.prototype.setSession=function(s){this.session=s},p.prototype.setMarkers=function(s){this.markers=s},p.prototype.elt=function(s,c){var d=this.i!=-1&&this.element.childNodes[this.i];d?this.i++:(d=document.createElement("div"),this.element.appendChild(d),this.i=-1),d.style.cssText=c,d.className=s},p.prototype.update=function(s){if(s){this.config=s,this.i=0;var c;for(var d in this.markers){var h=this.markers[d];if(!h.range){h.update(c,this,this.session,s);continue}var f=h.range.clipRows(s.firstRow,s.lastRow);if(!f.isEmpty())if(f=f.toScreenRange(this.session),h.renderer){var v=this.$getTop(f.start.row,s),y=this.$padding+f.start.column*s.characterWidth;h.renderer(c,f,y,v,s)}else h.type=="fullLine"?this.drawFullLineMarker(c,f,h.clazz,s):h.type=="screenLine"?this.drawScreenLineMarker(c,f,h.clazz,s):f.isMultiLine()?h.type=="text"?this.drawTextMarker(c,f,h.clazz,s):this.drawMultiLineMarker(c,f,h.clazz,s):this.drawSingleLineMarker(c,f,h.clazz+" ace_start ace_br15",s)}if(this.i!=-1)for(;this.i_,w==b),h,w==b?0:1,f)},p.prototype.drawMultiLineMarker=function(s,c,d,h,f){var v=this.$padding,y=h.lineHeight,b=this.$getTop(c.start.row,h),w=v+c.start.column*h.characterWidth;if(f=f||"",this.session.$bidiHandler.isBidiRow(c.start.row)){var x=c.clone();x.end.row=x.start.row,x.end.column=this.session.getLine(x.start.row).length,this.drawBidiSingleLineMarker(s,x,d+" ace_br1 ace_start",h,null,f)}else this.elt(d+" ace_br1 ace_start","height:"+y+"px;right:"+v+"px;top:"+b+"px;left:"+w+"px;"+(f||""));if(this.session.$bidiHandler.isBidiRow(c.end.row)){var x=c.clone();x.start.row=x.end.row,x.start.column=0,this.drawBidiSingleLineMarker(s,x,d+" ace_br12",h,null,f)}else{b=this.$getTop(c.end.row,h);var E=c.end.column*h.characterWidth;this.elt(d+" ace_br12","height:"+y+"px;width:"+E+"px;top:"+b+"px;left:"+v+"px;"+(f||""))}if(y=(c.end.row-c.start.row-1)*h.lineHeight,!(y<=0)){b=this.$getTop(c.start.row+1,h);var _=(c.start.column?1:0)|(c.end.column?0:8);this.elt(d+(_?" ace_br"+_:""),"height:"+y+"px;right:"+v+"px;top:"+b+"px;left:"+v+"px;"+(f||""))}},p.prototype.drawSingleLineMarker=function(s,c,d,h,f,v){if(this.session.$bidiHandler.isBidiRow(c.start.row))return this.drawBidiSingleLineMarker(s,c,d,h,f,v);var y=h.lineHeight,b=(c.end.column+(f||0)-c.start.column)*h.characterWidth,w=this.$getTop(c.start.row,h),x=this.$padding+c.start.column*h.characterWidth;this.elt(d,"height:"+y+"px;width:"+b+"px;top:"+w+"px;left:"+x+"px;"+(v||""))},p.prototype.drawBidiSingleLineMarker=function(s,c,d,h,f,v){var y=h.lineHeight,b=this.$getTop(c.start.row,h),w=this.$padding,x=this.session.$bidiHandler.getSelections(c.start.column,c.end.column);x.forEach(function(E){this.elt(d,"height:"+y+"px;width:"+(E.width+(f||0))+"px;top:"+b+"px;left:"+(w+E.left)+"px;"+(v||""))},this)},p.prototype.drawFullLineMarker=function(s,c,d,h,f){var v=this.$getTop(c.start.row,h),y=h.lineHeight;c.start.row!=c.end.row&&(y+=this.$getTop(c.end.row,h)-v),this.elt(d,"height:"+y+"px;top:"+v+"px;left:0;right:0;"+(f||""))},p.prototype.drawScreenLineMarker=function(s,c,d,h,f){var v=this.$getTop(c.start.row,h),y=h.lineHeight;this.elt(d,"height:"+y+"px;top:"+v+"px;left:0;right:0;"+(f||""))},p}();m.prototype.$padding=0;function u(p,s,c,d){return(p?1:0)|(s?2:0)|(c?4:0)|(d?8:0)}r.Marker=m}),ace.define("ace/layer/text_util",["require","exports","module"],function(n,r,i){var o=new Set(["text","rparen","lparen"]);r.isTextToken=function(l){return o.has(l)}}),ace.define("ace/layer/text",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/lang","ace/layer/lines","ace/lib/event_emitter","ace/config","ace/layer/text_util"],function(n,r,i){var o=n("../lib/oop"),l=n("../lib/dom"),m=n("../lib/lang"),u=n("./lines").Lines,p=n("../lib/event_emitter").EventEmitter,s=n("../config").nls,c=n("./text_util").isTextToken,d=function(){function h(f){this.dom=l,this.element=this.dom.createElement("div"),this.element.className="ace_layer ace_text-layer",f.appendChild(this.element),this.$updateEolChar=this.$updateEolChar.bind(this),this.$lines=new u(this.element)}return h.prototype.$updateEolChar=function(){var f=this.session.doc,v=f.getNewLineCharacter()==` +`&&f.getNewLineMode()!="windows",y=v?this.EOL_CHAR_LF:this.EOL_CHAR_CRLF;if(this.EOL_CHAR!=y)return this.EOL_CHAR=y,!0},h.prototype.setPadding=function(f){this.$padding=f,this.element.style.margin="0 "+f+"px"},h.prototype.getLineHeight=function(){return this.$fontMetrics.$characterSize.height||0},h.prototype.getCharacterWidth=function(){return this.$fontMetrics.$characterSize.width||0},h.prototype.$setFontMetrics=function(f){this.$fontMetrics=f,this.$fontMetrics.on("changeCharacterSize",(function(v){this._signal("changeCharacterSize",v)}).bind(this)),this.$pollSizeChanges()},h.prototype.checkForSizeChanges=function(){this.$fontMetrics.checkForSizeChanges()},h.prototype.$pollSizeChanges=function(){return this.$pollSizeChangesTimer=this.$fontMetrics.$pollSizeChanges()},h.prototype.setSession=function(f){this.session=f,f&&this.$computeTabString()},h.prototype.setShowInvisibles=function(f){return this.showInvisibles==f?!1:(this.showInvisibles=f,typeof f=="string"?(this.showSpaces=/tab/i.test(f),this.showTabs=/space/i.test(f),this.showEOL=/eol/i.test(f)):this.showSpaces=this.showTabs=this.showEOL=f,this.$computeTabString(),!0)},h.prototype.setDisplayIndentGuides=function(f){return this.displayIndentGuides==f?!1:(this.displayIndentGuides=f,this.$computeTabString(),!0)},h.prototype.setHighlightIndentGuides=function(f){return this.$highlightIndentGuides===f?!1:(this.$highlightIndentGuides=f,f)},h.prototype.$computeTabString=function(){var f=this.session.getTabSize();this.tabSize=f;for(var v=this.$tabStrings=[0],y=1;yN&&($=O.end.row+1,O=this.session.getNextFoldLine($,O),N=O?O.start.row:1/0),!($>w);){var k=x[E++];if(k){this.dom.removeChildren(k),this.$renderLine(k,$,$==N?O:!1),_&&(k.style.top=this.$lines.computeLineTop($,f,this.session)+"px");var L=f.lineHeight*this.session.getRowLength($)+"px";k.style.height!=L&&(_=!0,k.style.height=L)}$++}if(_)for(;E0;w--)this.$lines.shift();if(v.lastRow>f.lastRow)for(var w=this.session.getFoldedRowCount(f.lastRow+1,v.lastRow);w>0;w--)this.$lines.pop();f.firstRowv.lastRow&&this.$lines.push(this.$renderLinesFragment(f,v.lastRow+1,f.lastRow)),this.$highlightIndentGuide()},h.prototype.$renderLinesFragment=function(f,v,y){for(var b=[],w=v,x=this.session.getNextFoldLine(w),E=x?x.start.row:1/0;w>E&&(w=x.end.row+1,x=this.session.getNextFoldLine(w,x),E=x?x.start.row:1/0),!(w>y);){var _=this.$lines.createCell(w,f,this.session),$=_.element;this.dom.removeChildren($),l.setStyle($.style,"height",this.$lines.computeLineHeight(w,f,this.session)+"px"),l.setStyle($.style,"top",this.$lines.computeLineTop(w,f,this.session)+"px"),this.$renderLine($,w,w==E?x:!1),this.$useLineGroups()?$.className="ace_line_group":$.className="ace_line",b.push(_),w++}return b},h.prototype.update=function(f){this.$lines.moveContainer(f),this.config=f;for(var v=f.firstRow,y=f.lastRow,b=this.$lines;b.getLength();)b.pop();b.push(this.$renderLinesFragment(f,v,y))},h.prototype.$renderToken=function(f,v,y,b){for(var w=this,x=/(\t)|( +)|([\x00-\x1f\x80-\xa0\xad\u1680\u180E\u2000-\u200f\u2028\u2029\u202F\u205F\uFEFF\uFFF9-\uFFFC\u2066\u2067\u2068\u202A\u202B\u202D\u202E\u202C\u2069\u2060\u2061\u2062\u2063\u2064\u206A\u206B\u206B\u206C\u206D\u206E\u206F]+)|(\u3000)|([\u1100-\u115F\u11A3-\u11A7\u11FA-\u11FF\u2329-\u232A\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFB\u3001-\u303E\u3041-\u3096\u3099-\u30FF\u3105-\u312D\u3131-\u318E\u3190-\u31BA\u31C0-\u31E3\u31F0-\u321E\u3220-\u3247\u3250-\u32FE\u3300-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFAFF\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE66\uFE68-\uFE6B\uFF01-\uFF60\uFFE0-\uFFE6]|[\uD800-\uDBFF][\uDC00-\uDFFF])/g,E=this.dom.createFragment(this.element),_,$=0;_=x.exec(b);){var O=_[1],N=_[2],k=_[3],L=_[4],F=_[5];if(!(!w.showSpaces&&N)){var P=$!=_.index?b.slice($,_.index):"";if($=_.index+_[0].length,P&&E.appendChild(this.dom.createTextNode(P,this.element)),O){var A=w.session.getScreenTabSize(v+_.index);E.appendChild(w.$tabStrings[A].cloneNode(!0)),v+=A-1}else if(N)if(w.showSpaces){var M=this.dom.createElement("span");M.className="ace_invisible ace_invisible_space",M.textContent=m.stringRepeat(w.SPACE_CHAR,N.length),E.appendChild(M)}else E.appendChild(this.dom.createTextNode(N,this.element));else if(k){var M=this.dom.createElement("span");M.className="ace_invisible ace_invisible_space ace_invalid",M.textContent=m.stringRepeat(w.SPACE_CHAR,k.length),E.appendChild(M)}else if(L){v+=1;var M=this.dom.createElement("span");M.style.width=w.config.characterWidth*2+"px",M.className=w.showSpaces?"ace_cjk ace_invisible ace_invisible_space":"ace_cjk",M.textContent=w.showSpaces?w.SPACE_CHAR:L,E.appendChild(M)}else if(F){v+=1;var M=this.dom.createElement("span");M.style.width=w.config.characterWidth*2+"px",M.className="ace_cjk",M.textContent=F,E.appendChild(M)}}}if(E.appendChild(this.dom.createTextNode($?b.slice($):b,this.element)),c(y.type))f.appendChild(E);else{var R="ace_"+y.type.replace(/\./g," ace_"),M=this.dom.createElement("span");y.type=="fold"&&(M.style.width=y.value.length*this.config.characterWidth+"px",M.setAttribute("title",s("inline-fold.closed.title","Unfold code"))),M.className=R,M.appendChild(E),f.appendChild(M)}return v+b.length},h.prototype.renderIndentGuide=function(f,v,y){var b=v.search(this.$indentGuideRe);if(b<=0||b>=y)return v;if(v[0]==" "){b-=b%this.tabSize;for(var w=b/this.tabSize,x=0;xx[E].start.row?this.$highlightIndentGuideMarker.dir=-1:this.$highlightIndentGuideMarker.dir=1;break}}if(!this.$highlightIndentGuideMarker.end&&f[v.row]!==""&&v.column===f[v.row].length){this.$highlightIndentGuideMarker.dir=1;for(var E=v.row+1;E0)b=f.element.childNodes[0];else return;var w=b.childNodes;if(w){var x=w[v-1];x&&x.classList&&x.classList.contains("ace_indent-guide")&&x.classList.add("ace_indent-guide-active")}}},h.prototype.$renderHighlightIndentGuide=function(){if(this.$lines){var f=this.$lines.cells;this.$clearActiveIndentGuide();var v=this.$highlightIndentGuideMarker.indentLevel;if(v!==0)if(this.$highlightIndentGuideMarker.dir===1)for(var y=0;y=this.$highlightIndentGuideMarker.start+1){if(b.row>=this.$highlightIndentGuideMarker.end)break;this.$setIndentGuideActive(b,v)}}else for(var y=f.length-1;y>=0;y--){var b=f[y];if(this.$highlightIndentGuideMarker.end&&b.row=x;)E=this.$renderToken(_,E,O,N.substring(0,x-b)),N=N.substring(x-b),b=x,_=this.$createLineElement(),f.appendChild(_),_.appendChild(this.dom.createTextNode(m.stringRepeat(" ",y.indent),this.element)),w++,E=0,x=y[w]||Number.MAX_VALUE;N.length!=0&&(b+=N.length,E=this.$renderToken(_,E,O,N))}}y[y.length-1]>this.MAX_LINE_LENGTH&&this.$renderOverflowMessage(_,E,null,"",!0)},h.prototype.$renderSimpleLine=function(f,v){for(var y=0,b=0;bthis.MAX_LINE_LENGTH)return this.$renderOverflowMessage(f,y,w,x);y=this.$renderToken(f,y,w,x)}}},h.prototype.$renderOverflowMessage=function(f,v,y,b,w){y&&this.$renderToken(f,v,y,b.slice(0,this.MAX_LINE_LENGTH-v));var x=this.dom.createElement("span");x.className="ace_inline_button ace_keyword ace_toggle_wrap",x.textContent=w?"":"",f.appendChild(x)},h.prototype.$renderLine=function(f,v,y){if(!y&&y!=!1&&(y=this.session.getFoldLine(v)),y)var b=this.$getFoldLineTokens(v,y);else var b=this.session.getTokens(v);var w=f;if(b.length){var x=this.session.getRowSplitData(v);if(x&&x.length){this.$renderWrappedLine(f,b,x);var w=f.lastChild}else{var w=f;this.$useLineGroups()&&(w=this.$createLineElement(),f.appendChild(w)),this.$renderSimpleLine(w,b)}}else this.$useLineGroups()&&(w=this.$createLineElement(),f.appendChild(w));if(this.showEOL&&w){y&&(v=y.end.row);var E=this.dom.createElement("span");E.className="ace_invisible ace_invisible_eol",E.textContent=v==this.session.getLength()-1?this.EOF_CHAR:this.EOL_CHAR,w.appendChild(E)}},h.prototype.$getFoldLineTokens=function(f,v){var y=this.session,b=[];function w(E,_,$){for(var O=0,N=0;N+E[O].value.length<_;)if(N+=E[O].value.length,O++,O==E.length)return;if(N!=_){var k=E[O].value.substring(_-N);k.length>$-_&&(k=k.substring(0,$-_)),b.push({type:E[O].type,value:k}),N=_+k.length,O+=1}for(;N<$&&O$?b.push({type:E[O].type,value:k.substring(0,$-N)}):b.push(E[O]),N+=k.length,O+=1}}var x=y.getTokens(f);return v.walk(function(E,_,$,O,N){E!=null?b.push({type:"fold",value:E}):(N&&(x=y.getTokens(_)),x.length&&w(x,O,$))},v.end.row,this.session.getLine(v.end.row).length),b},h.prototype.$useLineGroups=function(){return this.session.getUseWrapMode()},h}();d.prototype.EOF_CHAR="¶",d.prototype.EOL_CHAR_LF="¬",d.prototype.EOL_CHAR_CRLF="¤",d.prototype.EOL_CHAR=d.prototype.EOL_CHAR_LF,d.prototype.TAB_CHAR="—",d.prototype.SPACE_CHAR="·",d.prototype.$padding=0,d.prototype.MAX_LINE_LENGTH=1e4,d.prototype.showInvisibles=!1,d.prototype.showSpaces=!1,d.prototype.showTabs=!1,d.prototype.showEOL=!1,d.prototype.displayIndentGuides=!0,d.prototype.$highlightIndentGuides=!0,d.prototype.$tabStrings=[],d.prototype.destroy={},d.prototype.onChangeTabSize=d.prototype.$computeTabString,o.implement(d.prototype,p),r.Text=d}),ace.define("ace/layer/cursor",["require","exports","module","ace/lib/dom"],function(n,r,i){var o=n("../lib/dom"),l=function(){function m(u){this.element=o.createElement("div"),this.element.className="ace_layer ace_cursor-layer",u.appendChild(this.element),this.isVisible=!1,this.isBlinking=!0,this.blinkInterval=1e3,this.smoothBlinking=!1,this.cursors=[],this.cursor=this.addCursor(),o.addCssClass(this.element,"ace_hidden-cursors"),this.$updateCursors=this.$updateOpacity.bind(this)}return m.prototype.$updateOpacity=function(u){for(var p=this.cursors,s=p.length;s--;)o.setStyle(p[s].style,"opacity",u?"":"0")},m.prototype.$startCssAnimation=function(){for(var u=this.cursors,p=u.length;p--;)u[p].style.animationDuration=this.blinkInterval+"ms";this.$isAnimating=!0,setTimeout((function(){this.$isAnimating&&o.addCssClass(this.element,"ace_animate-blinking")}).bind(this))},m.prototype.$stopCssAnimation=function(){this.$isAnimating=!1,o.removeCssClass(this.element,"ace_animate-blinking")},m.prototype.setPadding=function(u){this.$padding=u},m.prototype.setSession=function(u){this.session=u},m.prototype.setBlinking=function(u){u!=this.isBlinking&&(this.isBlinking=u,this.restartTimer())},m.prototype.setBlinkInterval=function(u){u!=this.blinkInterval&&(this.blinkInterval=u,this.restartTimer())},m.prototype.setSmoothBlinking=function(u){u!=this.smoothBlinking&&(this.smoothBlinking=u,o.setCssClass(this.element,"ace_smooth-blinking",u),this.$updateCursors(!0),this.restartTimer())},m.prototype.addCursor=function(){var u=o.createElement("div");return u.className="ace_cursor",this.element.appendChild(u),this.cursors.push(u),u},m.prototype.removeCursor=function(){if(this.cursors.length>1){var u=this.cursors.pop();return u.parentNode.removeChild(u),u}},m.prototype.hideCursor=function(){this.isVisible=!1,o.addCssClass(this.element,"ace_hidden-cursors"),this.restartTimer()},m.prototype.showCursor=function(){this.isVisible=!0,o.removeCssClass(this.element,"ace_hidden-cursors"),this.restartTimer()},m.prototype.restartTimer=function(){var u=this.$updateCursors;if(clearInterval(this.intervalId),clearTimeout(this.timeoutId),this.$stopCssAnimation(),this.smoothBlinking&&(this.$isSmoothBlinking=!1,o.removeCssClass(this.element,"ace_smooth-blinking")),u(!0),!this.isBlinking||!this.blinkInterval||!this.isVisible){this.$stopCssAnimation();return}if(this.smoothBlinking&&(this.$isSmoothBlinking=!0,setTimeout((function(){this.$isSmoothBlinking&&o.addCssClass(this.element,"ace_smooth-blinking")}).bind(this))),o.HAS_CSS_ANIMATION)this.$startCssAnimation();else{var p=(function(){this.timeoutId=setTimeout(function(){u(!1)},.6*this.blinkInterval)}).bind(this);this.intervalId=setInterval(function(){u(!0),p()},this.blinkInterval),p()}},m.prototype.getPixelPosition=function(u,p){if(!this.config||!this.session)return{left:0,top:0};u||(u=this.session.selection.getCursor());var s=this.session.documentToScreenPosition(u),c=this.$padding+(this.session.$bidiHandler.isBidiRow(s.row,u.row)?this.session.$bidiHandler.getPosLeft(s.column):s.column*this.config.characterWidth),d=(s.row-(p?this.config.firstRowScreen:0))*this.config.lineHeight;return{left:c,top:d}},m.prototype.isCursorInView=function(u,p){return u.top>=0&&u.topu.height+u.offset||h.top<0)&&s>1)){var f=this.cursors[c++]||this.addCursor(),v=f.style;this.drawCursor?this.drawCursor(f,h,u,p[s],this.session):this.isCursorInView(h,u)?(o.setStyle(v,"display","block"),o.translate(f,h.left,h.top),o.setStyle(v,"width",Math.round(u.characterWidth)+"px"),o.setStyle(v,"height",u.lineHeight+"px")):o.setStyle(v,"display","none")}}for(;this.cursors.length>c;)this.removeCursor();var y=this.session.getOverwrite();this.$setOverwrite(y),this.$pixelPos=h,this.restartTimer()},m.prototype.$setOverwrite=function(u){u!=this.overwrite&&(this.overwrite=u,u?o.addCssClass(this.element,"ace_overwrite-cursors"):o.removeCssClass(this.element,"ace_overwrite-cursors"))},m.prototype.destroy=function(){clearInterval(this.intervalId),clearTimeout(this.timeoutId)},m}();l.prototype.$padding=0,l.prototype.drawCursor=null,r.Cursor=l}),ace.define("ace/scrollbar",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/event","ace/lib/event_emitter"],function(n,r,i){var o=this&&this.__extends||function(){var f=function(v,y){return f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(b,w){b.__proto__=w}||function(b,w){for(var x in w)Object.prototype.hasOwnProperty.call(w,x)&&(b[x]=w[x])},f(v,y)};return function(v,y){if(typeof y!="function"&&y!==null)throw new TypeError("Class extends value "+String(y)+" is not a constructor or null");f(v,y);function b(){this.constructor=v}v.prototype=y===null?Object.create(y):(b.prototype=y.prototype,new b)}}(),l=n("./lib/oop"),m=n("./lib/dom"),u=n("./lib/event"),p=n("./lib/event_emitter").EventEmitter,s=32768,c=function(){function f(v,y){this.element=m.createElement("div"),this.element.className="ace_scrollbar ace_scrollbar"+y,this.inner=m.createElement("div"),this.inner.className="ace_scrollbar-inner",this.inner.textContent=" ",this.element.appendChild(this.inner),v.appendChild(this.element),this.setVisible(!1),this.skipEvent=!1,u.addListener(this.element,"scroll",this.onScroll.bind(this)),u.addListener(this.element,"mousedown",u.preventDefault)}return f.prototype.setVisible=function(v){this.element.style.display=v?"":"none",this.isVisible=v,this.coeff=1},f}();l.implement(c.prototype,p);var d=function(f){o(v,f);function v(y,b){var w=f.call(this,y,"-v")||this;return w.scrollTop=0,w.scrollHeight=0,b.$scrollbarWidth=w.width=m.scrollbarWidth(y.ownerDocument),w.inner.style.width=w.element.style.width=(w.width||15)+5+"px",w.$minWidth=0,w}return v.prototype.onScroll=function(){if(!this.skipEvent){if(this.scrollTop=this.element.scrollTop,this.coeff!=1){var y=this.element.clientHeight/this.scrollHeight;this.scrollTop=this.scrollTop*(1-y)/(this.coeff-y)}this._emit("scroll",{data:this.scrollTop})}this.skipEvent=!1},v.prototype.getWidth=function(){return Math.max(this.isVisible?this.width:0,this.$minWidth||0)},v.prototype.setHeight=function(y){this.element.style.height=y+"px"},v.prototype.setScrollHeight=function(y){this.scrollHeight=y,y>s?(this.coeff=s/y,y=s):this.coeff!=1&&(this.coeff=1),this.inner.style.height=y+"px"},v.prototype.setScrollTop=function(y){this.scrollTop!=y&&(this.skipEvent=!0,this.scrollTop=y,this.element.scrollTop=y*this.coeff)},v}(c);d.prototype.setInnerHeight=d.prototype.setScrollHeight;var h=function(f){o(v,f);function v(y,b){var w=f.call(this,y,"-h")||this;return w.scrollLeft=0,w.height=b.$scrollbarWidth,w.inner.style.height=w.element.style.height=(w.height||15)+5+"px",w}return v.prototype.onScroll=function(){this.skipEvent||(this.scrollLeft=this.element.scrollLeft,this._emit("scroll",{data:this.scrollLeft})),this.skipEvent=!1},v.prototype.getHeight=function(){return this.isVisible?this.height:0},v.prototype.setWidth=function(y){this.element.style.width=y+"px"},v.prototype.setInnerWidth=function(y){this.inner.style.width=y+"px"},v.prototype.setScrollWidth=function(y){this.inner.style.width=y+"px"},v.prototype.setScrollLeft=function(y){this.scrollLeft!=y&&(this.skipEvent=!0,this.scrollLeft=this.element.scrollLeft=y)},v}(c);r.ScrollBar=d,r.ScrollBarV=d,r.ScrollBarH=h,r.VScrollBar=d,r.HScrollBar=h}),ace.define("ace/scrollbar_custom",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/event","ace/lib/event_emitter"],function(n,r,i){var o=this&&this.__extends||function(){var h=function(f,v){return h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(y,b){y.__proto__=b}||function(y,b){for(var w in b)Object.prototype.hasOwnProperty.call(b,w)&&(y[w]=b[w])},h(f,v)};return function(f,v){if(typeof v!="function"&&v!==null)throw new TypeError("Class extends value "+String(v)+" is not a constructor or null");h(f,v);function y(){this.constructor=f}f.prototype=v===null?Object.create(v):(y.prototype=v.prototype,new y)}}(),l=n("./lib/oop"),m=n("./lib/dom"),u=n("./lib/event"),p=n("./lib/event_emitter").EventEmitter;m.importCssString(`.ace_editor>.ace_sb-v div, .ace_editor>.ace_sb-h div{ + position: absolute; + background: rgba(128, 128, 128, 0.6); + -moz-box-sizing: border-box; + box-sizing: border-box; + border: 1px solid #bbb; + border-radius: 2px; + z-index: 8; +} +.ace_editor>.ace_sb-v, .ace_editor>.ace_sb-h { + position: absolute; + z-index: 6; + background: none; + overflow: hidden!important; +} +.ace_editor>.ace_sb-v { + z-index: 6; + right: 0; + top: 0; + width: 12px; +} +.ace_editor>.ace_sb-v div { + z-index: 8; + right: 0; + width: 100%; +} +.ace_editor>.ace_sb-h { + bottom: 0; + left: 0; + height: 12px; +} +.ace_editor>.ace_sb-h div { + bottom: 0; + height: 100%; +} +.ace_editor>.ace_sb_grabbed { + z-index: 8; + background: #000; +}`,"ace_scrollbar.css",!1);var s=function(){function h(f,v){this.element=m.createElement("div"),this.element.className="ace_sb"+v,this.inner=m.createElement("div"),this.inner.className="",this.element.appendChild(this.inner),this.VScrollWidth=12,this.HScrollHeight=12,f.appendChild(this.element),this.setVisible(!1),this.skipEvent=!1,u.addMultiMouseDownListener(this.element,[500,300,300],this,"onMouseDown")}return h.prototype.setVisible=function(f){this.element.style.display=f?"":"none",this.isVisible=f,this.coeff=1},h}();l.implement(s.prototype,p);var c=function(h){o(f,h);function f(v,y){var b=h.call(this,v,"-v")||this;return b.scrollTop=0,b.scrollHeight=0,b.parent=v,b.width=b.VScrollWidth,b.renderer=y,b.inner.style.width=b.element.style.width=(b.width||15)+"px",b.$minWidth=0,b}return f.prototype.onMouseDown=function(v,y){if(v==="mousedown"&&!(u.getButton(y)!==0||y.detail===2)){if(y.target===this.inner){var b=this,w=y.clientY,x=function(L){w=L.clientY},E=function(){clearInterval(N)},_=y.clientY,$=this.thumbTop,O=function(){if(w!==void 0){var L=b.scrollTopFromThumbTop($+w-_);L!==b.scrollTop&&b._emit("scroll",{data:L})}};u.capture(this.inner,x,E);var N=setInterval(O,20);return u.preventDefault(y)}var k=y.clientY-this.element.getBoundingClientRect().top-this.thumbHeight/2;return this._emit("scroll",{data:this.scrollTopFromThumbTop(k)}),u.preventDefault(y)}},f.prototype.getHeight=function(){return this.height},f.prototype.scrollTopFromThumbTop=function(v){var y=v*(this.pageHeight-this.viewHeight)/(this.slideHeight-this.thumbHeight);return y=y>>0,y<0?y=0:y>this.pageHeight-this.viewHeight&&(y=this.pageHeight-this.viewHeight),y},f.prototype.getWidth=function(){return Math.max(this.isVisible?this.width:0,this.$minWidth||0)},f.prototype.setHeight=function(v){this.height=Math.max(0,v),this.slideHeight=this.height,this.viewHeight=this.height,this.setScrollHeight(this.pageHeight,!0)},f.prototype.setScrollHeight=function(v,y){this.pageHeight===v&&!y||(this.pageHeight=v,this.thumbHeight=this.slideHeight*this.viewHeight/this.pageHeight,this.thumbHeight>this.slideHeight&&(this.thumbHeight=this.slideHeight),this.thumbHeight<15&&(this.thumbHeight=15),this.inner.style.height=this.thumbHeight+"px",this.scrollTop>this.pageHeight-this.viewHeight&&(this.scrollTop=this.pageHeight-this.viewHeight,this.scrollTop<0&&(this.scrollTop=0),this._emit("scroll",{data:this.scrollTop})))},f.prototype.setScrollTop=function(v){this.scrollTop=v,v<0&&(v=0),this.thumbTop=v*(this.slideHeight-this.thumbHeight)/(this.pageHeight-this.viewHeight),this.inner.style.top=this.thumbTop+"px"},f}(s);c.prototype.setInnerHeight=c.prototype.setScrollHeight;var d=function(h){o(f,h);function f(v,y){var b=h.call(this,v,"-h")||this;return b.scrollLeft=0,b.scrollWidth=0,b.height=b.HScrollHeight,b.inner.style.height=b.element.style.height=(b.height||12)+"px",b.renderer=y,b}return f.prototype.onMouseDown=function(v,y){if(v==="mousedown"&&!(u.getButton(y)!==0||y.detail===2)){if(y.target===this.inner){var b=this,w=y.clientX,x=function(L){w=L.clientX},E=function(){clearInterval(N)},_=y.clientX,$=this.thumbLeft,O=function(){if(w!==void 0){var L=b.scrollLeftFromThumbLeft($+w-_);L!==b.scrollLeft&&b._emit("scroll",{data:L})}};u.capture(this.inner,x,E);var N=setInterval(O,20);return u.preventDefault(y)}var k=y.clientX-this.element.getBoundingClientRect().left-this.thumbWidth/2;return this._emit("scroll",{data:this.scrollLeftFromThumbLeft(k)}),u.preventDefault(y)}},f.prototype.getHeight=function(){return this.isVisible?this.height:0},f.prototype.scrollLeftFromThumbLeft=function(v){var y=v*(this.pageWidth-this.viewWidth)/(this.slideWidth-this.thumbWidth);return y=y>>0,y<0?y=0:y>this.pageWidth-this.viewWidth&&(y=this.pageWidth-this.viewWidth),y},f.prototype.setWidth=function(v){this.width=Math.max(0,v),this.element.style.width=this.width+"px",this.slideWidth=this.width,this.viewWidth=this.width,this.setScrollWidth(this.pageWidth,!0)},f.prototype.setScrollWidth=function(v,y){this.pageWidth===v&&!y||(this.pageWidth=v,this.thumbWidth=this.slideWidth*this.viewWidth/this.pageWidth,this.thumbWidth>this.slideWidth&&(this.thumbWidth=this.slideWidth),this.thumbWidth<15&&(this.thumbWidth=15),this.inner.style.width=this.thumbWidth+"px",this.scrollLeft>this.pageWidth-this.viewWidth&&(this.scrollLeft=this.pageWidth-this.viewWidth,this.scrollLeft<0&&(this.scrollLeft=0),this._emit("scroll",{data:this.scrollLeft})))},f.prototype.setScrollLeft=function(v){this.scrollLeft=v,v<0&&(v=0),this.thumbLeft=v*(this.slideWidth-this.thumbWidth)/(this.pageWidth-this.viewWidth),this.inner.style.left=this.thumbLeft+"px"},f}(s);d.prototype.setInnerWidth=d.prototype.setScrollWidth,r.ScrollBar=c,r.ScrollBarV=c,r.ScrollBarH=d,r.VScrollBar=c,r.HScrollBar=d}),ace.define("ace/renderloop",["require","exports","module","ace/lib/event"],function(n,r,i){var o=n("./lib/event"),l=function(){function m(u,p){this.onRender=u,this.pending=!1,this.changes=0,this.$recursionLimit=2,this.window=p||window;var s=this;this._flush=function(c){s.pending=!1;var d=s.changes;if(d&&(o.blockIdle(100),s.changes=0,s.onRender(d)),s.changes){if(s.$recursionLimit--<0)return;s.schedule()}else s.$recursionLimit=2}}return m.prototype.schedule=function(u){this.changes=this.changes|u,this.changes&&!this.pending&&(o.nextFrame(this._flush),this.pending=!0)},m.prototype.clear=function(u){var p=this.changes;return this.changes=0,p},m}();r.RenderLoop=l}),ace.define("ace/layer/font_metrics",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/lang","ace/lib/event","ace/lib/useragent","ace/lib/event_emitter"],function(n,r,i){var o=n("../lib/oop"),l=n("../lib/dom"),m=n("../lib/lang"),u=n("../lib/event"),p=n("../lib/useragent"),s=n("../lib/event_emitter").EventEmitter,c=512,d=typeof ResizeObserver=="function",h=200,f=function(){function v(y){this.el=l.createElement("div"),this.$setMeasureNodeStyles(this.el.style,!0),this.$main=l.createElement("div"),this.$setMeasureNodeStyles(this.$main.style),this.$measureNode=l.createElement("div"),this.$setMeasureNodeStyles(this.$measureNode.style),this.el.appendChild(this.$main),this.el.appendChild(this.$measureNode),y.appendChild(this.el),this.$measureNode.textContent=m.stringRepeat("X",c),this.$characterSize={width:0,height:0},d?this.$addObserver():this.checkForSizeChanges()}return v.prototype.$setMeasureNodeStyles=function(y,b){y.width=y.height="auto",y.left=y.top="0px",y.visibility="hidden",y.position="absolute",y.whiteSpace="pre",p.isIE<8?y["font-family"]="inherit":y.font="inherit",y.overflow=b?"hidden":"visible"},v.prototype.checkForSizeChanges=function(y){if(y===void 0&&(y=this.$measureSizes()),y&&(this.$characterSize.width!==y.width||this.$characterSize.height!==y.height)){this.$measureNode.style.fontWeight="bold";var b=this.$measureSizes();this.$measureNode.style.fontWeight="",this.$characterSize=y,this.charSizes=Object.create(null),this.allowBoldFonts=b&&b.width===y.width&&b.height===y.height,this._emit("changeCharacterSize",{data:y})}},v.prototype.$addObserver=function(){var y=this;this.$observer=new window.ResizeObserver(function(b){y.checkForSizeChanges()}),this.$observer.observe(this.$measureNode)},v.prototype.$pollSizeChanges=function(){if(this.$pollSizeChangesTimer||this.$observer)return this.$pollSizeChangesTimer;var y=this;return this.$pollSizeChangesTimer=u.onIdle(function b(){y.checkForSizeChanges(),u.onIdle(b,500)},500)},v.prototype.setPolling=function(y){y?this.$pollSizeChanges():this.$pollSizeChangesTimer&&(clearInterval(this.$pollSizeChangesTimer),this.$pollSizeChangesTimer=0)},v.prototype.$measureSizes=function(y){var b={height:(y||this.$measureNode).clientHeight,width:(y||this.$measureNode).clientWidth/c};return b.width===0||b.height===0?null:b},v.prototype.$measureCharWidth=function(y){this.$main.textContent=m.stringRepeat(y,c);var b=this.$main.getBoundingClientRect();return b.width/c},v.prototype.getCharacterWidth=function(y){var b=this.charSizes[y];return b===void 0&&(b=this.charSizes[y]=this.$measureCharWidth(y)/this.$characterSize.width),b},v.prototype.destroy=function(){clearInterval(this.$pollSizeChangesTimer),this.$observer&&this.$observer.disconnect(),this.el&&this.el.parentNode&&this.el.parentNode.removeChild(this.el)},v.prototype.$getZoom=function(y){return!y||!y.parentElement?1:(Number(window.getComputedStyle(y).zoom)||1)*this.$getZoom(y.parentElement)},v.prototype.$initTransformMeasureNodes=function(){var y=function(b,w){return["div",{style:"position: absolute;top:"+b+"px;left:"+w+"px;"}]};this.els=l.buildDom([y(0,0),y(h,0),y(0,h),y(h,h)],this.el)},v.prototype.transformCoordinates=function(y,b){if(y){var w=this.$getZoom(this.el);y=$(1/w,y)}function x(V,H,Y){var U=V[1]*H[0]-V[0]*H[1];return[(-H[1]*Y[0]+H[0]*Y[1])/U,(+V[1]*Y[0]-V[0]*Y[1])/U]}function E(V,H){return[V[0]-H[0],V[1]-H[1]]}function _(V,H){return[V[0]+H[0],V[1]+H[1]]}function $(V,H){return[V*H[0],V*H[1]]}this.els||this.$initTransformMeasureNodes();function O(V){var H=V.getBoundingClientRect();return[H.left,H.top]}var N=O(this.els[0]),k=O(this.els[1]),L=O(this.els[2]),F=O(this.els[3]),P=x(E(F,k),E(F,L),E(_(k,L),_(F,N))),A=$(1+P[0],E(k,N)),M=$(1+P[1],E(L,N));if(b){var R=b,I=P[0]*R[0]/h+P[1]*R[1]/h+1,D=_($(R[0],A),$(R[1],M));return _($(1/I/h,D),N)}var j=E(y,N),B=x(E(A,$(P[0],j)),E(M,$(P[1],j)),j);return $(h,B)},v}();f.prototype.$characterSize={width:0,height:0},o.implement(f.prototype,s),r.FontMetrics=f}),ace.define("ace/css/editor-css",["require","exports","module"],function(n,r,i){i.exports=` +.ace_br1 {border-top-left-radius : 3px;} +.ace_br2 {border-top-right-radius : 3px;} +.ace_br3 {border-top-left-radius : 3px; border-top-right-radius: 3px;} +.ace_br4 {border-bottom-right-radius: 3px;} +.ace_br5 {border-top-left-radius : 3px; border-bottom-right-radius: 3px;} +.ace_br6 {border-top-right-radius : 3px; border-bottom-right-radius: 3px;} +.ace_br7 {border-top-left-radius : 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px;} +.ace_br8 {border-bottom-left-radius : 3px;} +.ace_br9 {border-top-left-radius : 3px; border-bottom-left-radius: 3px;} +.ace_br10{border-top-right-radius : 3px; border-bottom-left-radius: 3px;} +.ace_br11{border-top-left-radius : 3px; border-top-right-radius: 3px; border-bottom-left-radius: 3px;} +.ace_br12{border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;} +.ace_br13{border-top-left-radius : 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;} +.ace_br14{border-top-right-radius : 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;} +.ace_br15{border-top-left-radius : 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;} + + +.ace_editor { + position: relative; + overflow: hidden; + padding: 0; + font: 12px/normal 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'Source Code Pro', 'source-code-pro', monospace; + direction: ltr; + text-align: left; + -webkit-tap-highlight-color: rgba(0, 0, 0, 0); + forced-color-adjust: none; +} + +.ace_scroller { + position: absolute; + overflow: hidden; + top: 0; + bottom: 0; + background-color: inherit; + -ms-user-select: none; + -moz-user-select: none; + -webkit-user-select: none; + user-select: none; + cursor: text; +} + +.ace_content { + position: absolute; + box-sizing: border-box; + min-width: 100%; + contain: style size layout; + font-variant-ligatures: no-common-ligatures; +} +.ace_invisible { + font-variant-ligatures: none; +} + +.ace_keyboard-focus:focus { + box-shadow: inset 0 0 0 2px #5E9ED6; + outline: none; +} + +.ace_dragging .ace_scroller:before{ + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + content: ''; + background: rgba(250, 250, 250, 0.01); + z-index: 1000; +} +.ace_dragging.ace_dark .ace_scroller:before{ + background: rgba(0, 0, 0, 0.01); +} + +.ace_gutter { + position: absolute; + overflow : hidden; + width: auto; + top: 0; + bottom: 0; + left: 0; + cursor: default; + z-index: 4; + -ms-user-select: none; + -moz-user-select: none; + -webkit-user-select: none; + user-select: none; + contain: style size layout; +} + +.ace_gutter-active-line { + position: absolute; + left: 0; + right: 0; +} + +.ace_scroller.ace_scroll-left:after { + content: ""; + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; + box-shadow: 17px 0 16px -16px rgba(0, 0, 0, 0.4) inset; + pointer-events: none; +} + +.ace_gutter-cell, .ace_gutter-cell_svg-icons { + position: absolute; + top: 0; + left: 0; + right: 0; + padding-left: 19px; + padding-right: 6px; + background-repeat: no-repeat; +} + +.ace_gutter-cell_svg-icons .ace_gutter_annotation { + margin-left: -14px; + float: left; +} + +.ace_gutter-cell .ace_gutter_annotation { + margin-left: -19px; + float: left; +} + +.ace_gutter-cell.ace_error, .ace_icon.ace_error, .ace_icon.ace_error_fold, .ace_gutter-cell.ace_security, .ace_icon.ace_security, .ace_icon.ace_security_fold { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAABOFBMVEX/////////QRswFAb/Ui4wFAYwFAYwFAaWGAfDRymzOSH/PxswFAb/SiUwFAYwFAbUPRvjQiDllog5HhHdRybsTi3/Tyv9Tir+Syj/UC3////XurebMBIwFAb/RSHbPx/gUzfdwL3kzMivKBAwFAbbvbnhPx66NhowFAYwFAaZJg8wFAaxKBDZurf/RB6mMxb/SCMwFAYwFAbxQB3+RB4wFAb/Qhy4Oh+4QifbNRcwFAYwFAYwFAb/QRzdNhgwFAYwFAbav7v/Uy7oaE68MBK5LxLewr/r2NXewLswFAaxJw4wFAbkPRy2PyYwFAaxKhLm1tMwFAazPiQwFAaUGAb/QBrfOx3bvrv/VC/maE4wFAbRPBq6MRO8Qynew8Dp2tjfwb0wFAbx6eju5+by6uns4uH9/f36+vr/GkHjAAAAYnRSTlMAGt+64rnWu/bo8eAA4InH3+DwoN7j4eLi4xP99Nfg4+b+/u9B/eDs1MD1mO7+4PHg2MXa347g7vDizMLN4eG+Pv7i5evs/v79yu7S3/DV7/498Yv24eH+4ufQ3Ozu/v7+y13sRqwAAADLSURBVHjaZc/XDsFgGIBhtDrshlitmk2IrbHFqL2pvXf/+78DPokj7+Fz9qpU/9UXJIlhmPaTaQ6QPaz0mm+5gwkgovcV6GZzd5JtCQwgsxoHOvJO15kleRLAnMgHFIESUEPmawB9ngmelTtipwwfASilxOLyiV5UVUyVAfbG0cCPHig+GBkzAENHS0AstVF6bacZIOzgLmxsHbt2OecNgJC83JERmePUYq8ARGkJx6XtFsdddBQgZE2nPR6CICZhawjA4Fb/chv+399kfR+MMMDGOQAAAABJRU5ErkJggg=="); + background-repeat: no-repeat; + background-position: 2px center; +} + +.ace_gutter-cell.ace_warning, .ace_icon.ace_warning, .ace_icon.ace_warning_fold { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAmVBMVEX///8AAAD///8AAAAAAABPSzb/5sAAAAB/blH/73z/ulkAAAAAAAD85pkAAAAAAAACAgP/vGz/rkDerGbGrV7/pkQICAf////e0IsAAAD/oED/qTvhrnUAAAD/yHD/njcAAADuv2r/nz//oTj/p064oGf/zHAAAAA9Nir/tFIAAAD/tlTiuWf/tkIAAACynXEAAAAAAAAtIRW7zBpBAAAAM3RSTlMAABR1m7RXO8Ln31Z36zT+neXe5OzooRDfn+TZ4p3h2hTf4t3k3ucyrN1K5+Xaks52Sfs9CXgrAAAAjklEQVR42o3PbQ+CIBQFYEwboPhSYgoYunIqqLn6/z8uYdH8Vmdnu9vz4WwXgN/xTPRD2+sgOcZjsge/whXZgUaYYvT8QnuJaUrjrHUQreGczuEafQCO/SJTufTbroWsPgsllVhq3wJEk2jUSzX3CUEDJC84707djRc5MTAQxoLgupWRwW6UB5fS++NV8AbOZgnsC7BpEAAAAABJRU5ErkJggg=="); + background-repeat: no-repeat; + background-position: 2px center; +} + +.ace_gutter-cell.ace_info, .ace_icon.ace_info, .ace_gutter-cell.ace_hint, .ace_icon.ace_hint { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAAAAAA6mKC9AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAJ0Uk5TAAB2k804AAAAPklEQVQY02NgIB68QuO3tiLznjAwpKTgNyDbMegwisCHZUETUZV0ZqOquBpXj2rtnpSJT1AEnnRmL2OgGgAAIKkRQap2htgAAAAASUVORK5CYII="); + background-repeat: no-repeat; + background-position: 2px center; +} + +.ace_dark .ace_gutter-cell.ace_info, .ace_dark .ace_icon.ace_info, .ace_dark .ace_gutter-cell.ace_hint, .ace_dark .ace_icon.ace_hint { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAJFBMVEUAAAChoaGAgIAqKiq+vr6tra1ZWVmUlJSbm5s8PDxubm56enrdgzg3AAAAAXRSTlMAQObYZgAAAClJREFUeNpjYMAPdsMYHegyJZFQBlsUlMFVCWUYKkAZMxZAGdxlDMQBAG+TBP4B6RyJAAAAAElFTkSuQmCC"); +} + +.ace_icon_svg.ace_error { + -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyMCAxNiI+CjxnIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlPSJyZWQiIHNoYXBlLXJlbmRlcmluZz0iZ2VvbWV0cmljUHJlY2lzaW9uIj4KPGNpcmNsZSBmaWxsPSJub25lIiBjeD0iOCIgY3k9IjgiIHI9IjciIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz4KPGxpbmUgeDE9IjExIiB5MT0iNSIgeDI9IjUiIHkyPSIxMSIvPgo8bGluZSB4MT0iMTEiIHkxPSIxMSIgeDI9IjUiIHkyPSI1Ii8+CjwvZz4KPC9zdmc+"); + background-color: crimson; +} +.ace_icon_svg.ace_security { + -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMjAgMTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgICA8ZyBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZT0iZGFya29yYW5nZSIgZmlsbD0ibm9uZSIgc2hhcGUtcmVuZGVyaW5nPSJnZW9tZXRyaWNQcmVjaXNpb24iPgogICAgICAgIDxwYXRoIGNsYXNzPSJzdHJva2UtbGluZWpvaW4tcm91bmQiIGQ9Ik04IDE0LjgzMDdDOCAxNC44MzA3IDIgMTIuOTA0NyAyIDguMDg5OTJWMy4yNjU0OEM1LjMxIDMuMjY1NDggNy45ODk5OSAxLjM0OTE4IDcuOTg5OTkgMS4zNDkxOEM3Ljk4OTk5IDEuMzQ5MTggMTAuNjkgMy4yNjU0OCAxNCAzLjI2NTQ4VjguMDg5OTJDMTQgMTIuOTA0NyA4IDE0LjgzMDcgOCAxNC44MzA3WiIvPgogICAgICAgIDxwYXRoIGQ9Ik0yIDguMDg5OTJWMy4yNjU0OEM1LjMxIDMuMjY1NDggNy45ODk5OSAxLjM0OTE4IDcuOTg5OTkgMS4zNDkxOCIvPgogICAgICAgIDxwYXRoIGQ9Ik0xMy45OSA4LjA4OTkyVjMuMjY1NDhDMTAuNjggMy4yNjU0OCA4IDEuMzQ5MTggOCAxLjM0OTE4Ii8+CiAgICAgICAgPHBhdGggY2xhc3M9InN0cm9rZS1saW5lam9pbi1yb3VuZCIgZD0iTTggNFY5Ii8+CiAgICAgICAgPHBhdGggY2xhc3M9InN0cm9rZS1saW5lam9pbi1yb3VuZCIgZD0iTTggMTBWMTIiLz4KICAgIDwvZz4KPC9zdmc+"); + background-color: crimson; +} +.ace_icon_svg.ace_warning { + -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyMCAxNiI+CjxnIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlPSJkYXJrb3JhbmdlIiBzaGFwZS1yZW5kZXJpbmc9Imdlb21ldHJpY1ByZWNpc2lvbiI+Cjxwb2x5Z29uIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGZpbGw9Im5vbmUiIHBvaW50cz0iOCAxIDE1IDE1IDEgMTUgOCAxIi8+CjxyZWN0IHg9IjgiIHk9IjEyIiB3aWR0aD0iMC4wMSIgaGVpZ2h0PSIwLjAxIi8+CjxsaW5lIHgxPSI4IiB5MT0iNiIgeDI9IjgiIHkyPSIxMCIvPgo8L2c+Cjwvc3ZnPg=="); + background-color: darkorange; +} +.ace_icon_svg.ace_info { + -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyMCAxNiI+CjxnIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlPSJibHVlIiBzaGFwZS1yZW5kZXJpbmc9Imdlb21ldHJpY1ByZWNpc2lvbiI+CjxjaXJjbGUgZmlsbD0ibm9uZSIgY3g9IjgiIGN5PSI4IiByPSI3IiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+Cjxwb2x5bGluZSBwb2ludHM9IjggMTEgOCA4Ii8+Cjxwb2x5bGluZSBwb2ludHM9IjkgOCA2IDgiLz4KPGxpbmUgeDE9IjEwIiB5MT0iMTEiIHgyPSI2IiB5Mj0iMTEiLz4KPHJlY3QgeD0iOCIgeT0iNSIgd2lkdGg9IjAuMDEiIGhlaWdodD0iMC4wMSIvPgo8L2c+Cjwvc3ZnPg=="); + background-color: royalblue; +} +.ace_icon_svg.ace_hint { + -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMjAgMTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgICA8ZyBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZT0ic2lsdmVyIiBmaWxsPSJub25lIiBzaGFwZS1yZW5kZXJpbmc9Imdlb21ldHJpY1ByZWNpc2lvbiI+CiAgICAgICAgPHBhdGggY2xhc3M9InN0cm9rZS1saW5lam9pbi1yb3VuZCIgZD0iTTYgMTRIMTAiLz4KICAgICAgICA8cGF0aCBkPSJNOCAxMUg5QzkgOS40NzAwMiAxMiA4LjU0MDAyIDEyIDUuNzYwMDJDMTIuMDIgNC40MDAwMiAxMS4zOSAzLjM2MDAyIDEwLjQzIDIuNjcwMDJDOSAxLjY0MDAyIDcuMDAwMDEgMS42NDAwMiA1LjU3MDAxIDIuNjcwMDJDNC42MTAwMSAzLjM2MDAyIDMuOTggNC40MDAwMiA0IDUuNzYwMDJDNCA4LjU0MDAyIDcuMDAwMDEgOS40NzAwMiA3LjAwMDAxIDExSDhaIi8+CiAgICA8L2c+Cjwvc3ZnPg=="); + background-color: silver; +} + +.ace_icon_svg.ace_error_fold { + -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyMCAxNiIgZmlsbD0ibm9uZSI+CiAgPHBhdGggZD0ibSAxOC45Mjk4NTEsNy44Mjk4MDc2IGMgMC4xNDYzNTMsNi4zMzc0NjA0IC02LjMyMzE0Nyw3Ljc3Nzg0NDQgLTcuNDc3OTEyLDcuNzc3ODQ0NCAtMi4xMDcyNzI2LC0wLjEyODc1IDUuMTE3Njc4LDAuMzU2MjQ5IDUuMDUxNjk4LC03Ljg3MDA2MTggLTAuNjA0NjcyLC04LjAwMzk3MzQ5IC03LjA3NzI3MDYsLTcuNTYzMTE4OSAtNC44NTczLC03LjQzMDM5NTU2IDEuNjA2LC0wLjExNTE0MjI1IDYuODk3NDg1LDEuMjYyNTQ1OTYgNy4yODM1MTQsNy41MjI2MTI5NiB6IiBmaWxsPSJjcmltc29uIiBzdHJva2Utd2lkdGg9IjIiLz4KICA8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0ibSA4LjExNDc1NjIsMi4wNTI5ODI4IGMgMy4zNDkxNjk4LDAgNi4wNjQxMzI4LDIuNjc2ODYyNyA2LjA2NDEzMjgsNS45Nzg5NTMgMCwzLjMwMjExMjIgLTIuNzE0OTYzLDUuOTc4OTIwMiAtNi4wNjQxMzI4LDUuOTc4OTIwMiAtMy4zNDkxNDczLDAgLTYuMDY0MTc3MiwtMi42NzY4MDggLTYuMDY0MTc3MiwtNS45Nzg5MjAyIDAuMDA1MzksLTMuMjk5ODg2MSAyLjcxNzI2NTYsLTUuOTczNjQwOCA2LjA2NDE3NzIsLTUuOTc4OTUzIHogbSAwLC0xLjczNTgyNzE5IGMgLTQuMzIxNDgzNiwwIC03LjgyNDc0MDM4LDMuNDU0MDE4NDkgLTcuODI0NzQwMzgsNy43MTQ3ODAxOSAwLDQuMjYwNzI4MiAzLjUwMzI1Njc4LDcuNzE0NzQ1MiA3LjgyNDc0MDM4LDcuNzE0NzQ1MiA0LjMyMTQ0OTgsMCA3LjgyNDY5OTgsLTMuNDU0MDE3IDcuODI0Njk5OCwtNy43MTQ3NDUyIDAsLTIuMDQ2MDkxNCAtMC44MjQzOTIsLTQuMDA4MzY3MiAtMi4yOTE3NTYsLTUuNDU1MTc0NiBDIDEyLjE4MDIyNSwxLjEyOTk2NDggMTAuMTkwMDEzLDAuMzE3MTU1NjEgOC4xMTQ3NTYyLDAuMzE3MTU1NjEgWiBNIDYuOTM3NDU2Myw4LjI0MDU5ODUgNC42NzE4Njg1LDEwLjQ4NTg1MiA2LjAwODY4MTQsMTEuODc2NzI4IDguMzE3MDAzNSw5LjYwMDc5MTEgMTAuNjI1MzM3LDExLjg3NjcyOCAxMS45NjIxMzgsMTAuNDg1ODUyIDkuNjk2NTUwOCw4LjI0MDU5ODUgMTEuOTYyMTM4LDYuMDA2ODA2NiAxMC41NzMyNDYsNC42Mzc0MzM1IDguMzE3MDAzNSw2Ljg3MzQyOTcgNi4wNjA3NjA3LDQuNjM3NDMzNSA0LjY3MTg2ODUsNi4wMDY4MDY2IFoiIGZpbGw9ImNyaW1zb24iIHN0cm9rZS13aWR0aD0iMiIvPgo8L3N2Zz4="); + background-color: crimson; +} +.ace_icon_svg.ace_security_fold { + -webkit-mask-image: url("data:image/svg+xml;base64,CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2aWV3Qm94PSIwIDAgMTcgMTQiIGZpbGw9Im5vbmUiPgogICAgPHBhdGggZD0iTTEwLjAwMDEgMTMuNjk5MkMxMC4wMDAxIDEzLjY5OTIgMTEuOTI0MSAxMy40NzYzIDEzIDEyLjY5OTJDMTQuNDEzOSAxMS42NzgxIDE2IDEwLjUgMTYuMTI1MSA2LjgxMTI2VjIuNTg5ODdDMTYuMTI1MSAyLjU0NzY4IDE2LjEyMjEgMi41MDYxOSAxNi4xMTY0IDIuNDY1NTlWMS43MTQ4NUgxNS4yNDE0TDE1LjIzMDcgMS43MTQ4NEwxNC42MjUxIDEuNjk5MjJWNi44MTEyM0MxNC42MjUxIDguNTEwNjEgMTQuNjI1MSA5LjQ2NDYxIDEyLjc4MjQgMTEuNzIxQzEyLjE1ODYgMTIuNDg0OCAxMC4wMDAxIDEzLjY5OTIgMTAuMDAwMSAxMy42OTkyWiIgZmlsbD0iY3JpbXNvbiIgc3Ryb2tlLXdpZHRoPSIyIi8+CiAgICA8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTcuMzM2MDkgMC4zNjc0NzVDNy4wMzIxNCAwLjE1MjY1MiA2LjYyNTQ4IDAuMTUzNjE0IDYuMzIyNTMgMC4zNjk5OTdMNi4zMDg2OSAwLjM3OTU1NEM2LjI5NTUzIDAuMzg4NTg4IDYuMjczODggMC40MDMyNjYgNi4yNDQxNyAwLjQyMjc4OUM2LjE4NDcxIDAuNDYxODYgNi4wOTMyMSAwLjUyMDE3MSA1Ljk3MzEzIDAuNTkxMzczQzUuNzMyNTEgMC43MzQwNTkgNS4zNzk5IDAuOTI2ODY0IDQuOTQyNzkgMS4xMjAwOUM0LjA2MTQ0IDEuNTA5NyAyLjg3NTQxIDEuODgzNzcgMS41ODk4NCAxLjg4Mzc3SDAuNzE0ODQ0VjIuNzU4NzdWNi45ODAxNUMwLjcxNDg0NCA5LjQ5Mzc0IDIuMjg4NjYgMTEuMTk3MyAzLjcwMjU0IDEyLjIxODVDNC40MTg0NSAxMi43MzU1IDUuMTI4NzQgMTMuMTA1MyA1LjY1NzMzIDEzLjM0NTdDNS45MjI4NCAxMy40NjY0IDYuMTQ1NjYgMTMuNTU1OSA2LjMwNDY1IDEzLjYxNjFDNi4zODQyMyAxMy42NDYyIDYuNDQ4MDUgMTMuNjY5IDYuNDkzNDkgMTMuNjg0OEM2LjUxNjIyIDEzLjY5MjcgNi41MzQzOCAxMy42OTg5IDYuNTQ3NjQgMTMuNzAzM0w2LjU2MzgyIDEzLjcwODdMNi41NjkwOCAxMy43MTA0TDYuNTcwOTkgMTMuNzExTDYuODM5ODQgMTMuNzUzM0w2LjU3MjQyIDEzLjcxMTVDNi43NDYzMyAxMy43NjczIDYuOTMzMzUgMTMuNzY3MyA3LjEwNzI3IDEzLjcxMTVMNy4xMDg3IDEzLjcxMUw3LjExMDYxIDEzLjcxMDRMNy4xMTU4NyAxMy43MDg3TDcuMTMyMDUgMTMuNzAzM0M3LjE0NTMxIDEzLjY5ODkgNy4xNjM0NiAxMy42OTI3IDcuMTg2MTkgMTMuNjg0OEM3LjIzMTY0IDEzLjY2OSA3LjI5NTQ2IDEzLjY0NjIgNy4zNzUwMyAxMy42MTYxQzcuNTM0MDMgMTMuNTU1OSA3Ljc1Njg1IDEzLjQ2NjQgOC4wMjIzNiAxMy4zNDU3QzguNTUwOTUgMTMuMTA1MyA5LjI2MTIzIDEyLjczNTUgOS45NzcxNSAxMi4yMTg1QzExLjM5MSAxMS4xOTczIDEyLjk2NDggOS40OTM3NyAxMi45NjQ4IDYuOTgwMThWMi43NTg4QzEyLjk2NDggMi43MTY2IDEyLjk2MTkgMi42NzUxMSAxMi45NTYxIDIuNjM0NTFWMS44ODM3N0gxMi4wODExQzEyLjA3NzUgMS44ODM3NyAxMi4wNzQgMS44ODM3NyAxMi4wNzA0IDEuODgzNzdDMTAuNzk3OSAxLjg4MDA0IDkuNjE5NjIgMS41MTEwMiA4LjczODk0IDEuMTI0ODZDOC43MzUzNCAxLjEyMzI3IDguNzMxNzQgMS4xMjE2OCA4LjcyODE0IDEuMTIwMDlDOC4yOTEwMyAwLjkyNjg2NCA3LjkzODQyIDAuNzM0MDU5IDcuNjk3NzkgMC41OTEzNzNDNy41Nzc3MiAwLjUyMDE3MSA3LjQ4NjIyIDAuNDYxODYgNy40MjY3NiAwLjQyMjc4OUM3LjM5NzA1IDAuNDAzMjY2IDcuMzc1MzkgMC4zODg1ODggNy4zNjIyNCAwLjM3OTU1NEw3LjM0ODk2IDAuMzcwMzVDNy4zNDg5NiAwLjM3MDM1IDcuMzQ4NDcgMC4zNzAwMiA3LjM0NTYzIDAuMzc0MDU0TDcuMzM3NzkgMC4zNjg2NTlMNy4zMzYwOSAwLjM2NzQ3NVpNOC4wMzQ3MSAyLjcyNjkxQzguODYwNCAzLjA5MDYzIDkuOTYwNjYgMy40NjMwOSAxMS4yMDYxIDMuNTg5MDdWNi45ODAxNUgxMS4yMTQ4QzExLjIxNDggOC42Nzk1MyAxMC4xNjM3IDkuOTI1MDcgOC45NTI1NCAxMC43OTk4QzguMzU1OTUgMTEuMjMwNiA3Ljc1Mzc0IDExLjU0NTQgNy4yOTc5NiAxMS43NTI3QzcuMTE2NzEgMTEuODM1MSA2Ljk2MDYyIDExLjg5OTYgNi44Mzk4NCAxMS45NDY5QzYuNzE5MDYgMTEuODk5NiA2LjU2Mjk3IDExLjgzNTEgNi4zODE3MyAxMS43NTI3QzUuOTI1OTUgMTEuNTQ1NCA1LjMyMzczIDExLjIzMDYgNC43MjcxNSAxMC43OTk4QzMuNTE2MDMgOS45MjUwNyAyLjQ2NDg0IDguNjc5NTUgMi40NjQ4NCA2Ljk4MDE4VjMuNTg5MDlDMy43MTczOCAzLjQ2MjM5IDQuODIzMDggMy4wODYzOSA1LjY1MDMzIDIuNzIwNzFDNi4xNDIyOCAyLjUwMzI0IDYuNTQ0ODUgMi4yODUzNyA2LjgzMjU0IDIuMTE2MjRDNy4xMjE4MSAyLjI4NTM1IDcuNTI3IDIuNTAzNTIgOC4wMjE5NiAyLjcyMTMxQzguMDI2MiAyLjcyMzE3IDguMDMwNDUgMi43MjUwNCA4LjAzNDcxIDIuNzI2OTFaTTUuOTY0ODQgMy40MDE0N1Y3Ljc3NjQ3SDcuNzE0ODRWMy40MDE0N0g1Ljk2NDg0Wk01Ljk2NDg0IDEwLjQwMTVWOC42NTE0N0g3LjcxNDg0VjEwLjQwMTVINS45NjQ4NFoiIGZpbGw9ImNyaW1zb24iIHN0cm9rZS13aWR0aD0iMiIvPgo8L3N2Zz4="); + background-color: crimson; +} +.ace_icon_svg.ace_warning_fold { + -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAyMCAxNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNC43NzY5IDE0LjczMzdMOC42NTE5MiAyLjQ4MzY5QzguMzI5NDYgMS44Mzg3NyA3LjQwOTEzIDEuODM4NzcgNy4wODY2NyAyLjQ4MzY5TDAuOTYxNjY5IDE0LjczMzdDMC42NzA3NzUgMTUuMzE1NSAxLjA5MzgzIDE2IDEuNzQ0MjkgMTZIMTMuOTk0M0MxNC42NDQ4IDE2IDE1LjA2NzggMTUuMzE1NSAxNC43NzY5IDE0LjczMzdaTTMuMTYwMDcgMTQuMjVMNy44NjkyOSA0LjgzMTU2TDEyLjU3ODUgMTQuMjVIMy4xNjAwN1pNOC43NDQyOSAxMS42MjVWMTMuMzc1SDYuOTk0MjlWMTEuNjI1SDguNzQ0MjlaTTYuOTk0MjkgMTAuNzVWNy4yNUg4Ljc0NDI5VjEwLjc1SDYuOTk0MjlaIiBmaWxsPSIjRUM3MjExIi8+CjxwYXRoIGQ9Ik0xMS4xOTkxIDIuOTUyMzhDMTAuODgwOSAyLjMxNDY3IDEwLjM1MzcgMS44MDUyNiA5LjcwNTUgMS41MDlMMTEuMDQxIDEuMDY5NzhDMTEuNjg4MyAwLjk0OTgxNCAxMi4zMzcgMS4yNzI2MyAxMi42MzE3IDEuODYxNDFMMTcuNjEzNiAxMS44MTYxQzE4LjM1MjcgMTMuMjkyOSAxNy41OTM4IDE1LjA4MDQgMTYuMDE4IDE1LjU3NDVDMTYuNDA0NCAxNC40NTA3IDE2LjMyMzEgMTMuMjE4OCAxNS43OTI0IDEyLjE1NTVMMTEuMTk5MSAyLjk1MjM4WiIgZmlsbD0iI0VDNzIxMSIvPgo8L3N2Zz4="); + background-color: darkorange; +} + +.ace_scrollbar { + contain: strict; + position: absolute; + right: 0; + bottom: 0; + z-index: 6; +} + +.ace_scrollbar-inner { + position: absolute; + cursor: text; + left: 0; + top: 0; +} + +.ace_scrollbar-v{ + overflow-x: hidden; + overflow-y: scroll; + top: 0; +} + +.ace_scrollbar-h { + overflow-x: scroll; + overflow-y: hidden; + left: 0; +} + +.ace_print-margin { + position: absolute; + height: 100%; +} + +.ace_text-input { + position: absolute; + z-index: 0; + width: 0.5em; + height: 1em; + opacity: 0; + background: transparent; + -moz-appearance: none; + appearance: none; + border: none; + resize: none; + outline: none; + overflow: hidden; + font: inherit; + padding: 0 1px; + margin: 0 -1px; + contain: strict; + -ms-user-select: text; + -moz-user-select: text; + -webkit-user-select: text; + user-select: text; + /*with \`pre-line\` chrome inserts   instead of space*/ + white-space: pre!important; +} +.ace_text-input.ace_composition { + background: transparent; + color: inherit; + z-index: 1000; + opacity: 1; +} +.ace_composition_placeholder { color: transparent } +.ace_composition_marker { + border-bottom: 1px solid; + position: absolute; + border-radius: 0; + margin-top: 1px; +} + +[ace_nocontext=true] { + transform: none!important; + filter: none!important; + clip-path: none!important; + mask : none!important; + contain: none!important; + perspective: none!important; + mix-blend-mode: initial!important; + z-index: auto; +} + +.ace_layer { + z-index: 1; + position: absolute; + overflow: hidden; + /* workaround for chrome bug https://github.com/ajaxorg/ace/issues/2312*/ + word-wrap: normal; + white-space: pre; + height: 100%; + width: 100%; + box-sizing: border-box; + /* setting pointer-events: auto; on node under the mouse, which changes + during scroll, will break mouse wheel scrolling in Safari */ + pointer-events: none; +} + +.ace_gutter-layer { + position: relative; + width: auto; + text-align: right; + pointer-events: auto; + height: 1000000px; + contain: style size layout; +} + +.ace_text-layer { + font: inherit !important; + position: absolute; + height: 1000000px; + width: 1000000px; + contain: style size layout; +} + +.ace_text-layer > .ace_line, .ace_text-layer > .ace_line_group { + contain: style size layout; + position: absolute; + top: 0; + left: 0; + right: 0; +} + +.ace_hidpi .ace_text-layer, +.ace_hidpi .ace_gutter-layer, +.ace_hidpi .ace_content, +.ace_hidpi .ace_gutter { + contain: strict; +} +.ace_hidpi .ace_text-layer > .ace_line, +.ace_hidpi .ace_text-layer > .ace_line_group { + contain: strict; +} + +.ace_cjk { + display: inline-block; + text-align: center; +} + +.ace_cursor-layer { + z-index: 4; +} + +.ace_cursor { + z-index: 4; + position: absolute; + box-sizing: border-box; + border-left: 2px solid; + /* workaround for smooth cursor repaintng whole screen in chrome */ + transform: translatez(0); +} + +.ace_multiselect .ace_cursor { + border-left-width: 1px; +} + +.ace_slim-cursors .ace_cursor { + border-left-width: 1px; +} + +.ace_overwrite-cursors .ace_cursor { + border-left-width: 0; + border-bottom: 1px solid; +} + +.ace_hidden-cursors .ace_cursor { + opacity: 0.2; +} + +.ace_hasPlaceholder .ace_hidden-cursors .ace_cursor { + opacity: 0; +} + +.ace_smooth-blinking .ace_cursor { + transition: opacity 0.18s; +} + +.ace_animate-blinking .ace_cursor { + animation-duration: 1000ms; + animation-timing-function: step-end; + animation-name: blink-ace-animate; + animation-iteration-count: infinite; +} + +.ace_animate-blinking.ace_smooth-blinking .ace_cursor { + animation-duration: 1000ms; + animation-timing-function: ease-in-out; + animation-name: blink-ace-animate-smooth; +} + +@keyframes blink-ace-animate { + from, to { opacity: 1; } + 60% { opacity: 0; } +} + +@keyframes blink-ace-animate-smooth { + from, to { opacity: 1; } + 45% { opacity: 1; } + 60% { opacity: 0; } + 85% { opacity: 0; } +} + +.ace_marker-layer .ace_step, .ace_marker-layer .ace_stack { + position: absolute; + z-index: 3; +} + +.ace_marker-layer .ace_selection { + position: absolute; + z-index: 5; +} + +.ace_marker-layer .ace_bracket { + position: absolute; + z-index: 6; +} + +.ace_marker-layer .ace_error_bracket { + position: absolute; + border-bottom: 1px solid #DE5555; + border-radius: 0; +} + +.ace_marker-layer .ace_active-line { + position: absolute; + z-index: 2; +} + +.ace_marker-layer .ace_selected-word { + position: absolute; + z-index: 4; + box-sizing: border-box; +} + +.ace_line .ace_fold { + box-sizing: border-box; + + display: inline-block; + height: 11px; + margin-top: -2px; + vertical-align: middle; + + background-image: + url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAJCAYAAADU6McMAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJpJREFUeNpi/P//PwOlgAXGYGRklAVSokD8GmjwY1wasKljQpYACtpCFeADcHVQfQyMQAwzwAZI3wJKvCLkfKBaMSClBlR7BOQikCFGQEErIH0VqkabiGCAqwUadAzZJRxQr/0gwiXIal8zQQPnNVTgJ1TdawL0T5gBIP1MUJNhBv2HKoQHHjqNrA4WO4zY0glyNKLT2KIfIMAAQsdgGiXvgnYAAAAASUVORK5CYII="), + url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAA3CAYAAADNNiA5AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAACJJREFUeNpi+P//fxgTAwPDBxDxD078RSX+YeEyDFMCIMAAI3INmXiwf2YAAAAASUVORK5CYII="); + background-repeat: no-repeat, repeat-x; + background-position: center center, top left; + color: transparent; + + border: 1px solid black; + border-radius: 2px; + + cursor: pointer; + pointer-events: auto; +} + +.ace_dark .ace_fold { +} + +.ace_fold:hover{ + background-image: + url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAJCAYAAADU6McMAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJpJREFUeNpi/P//PwOlgAXGYGRklAVSokD8GmjwY1wasKljQpYACtpCFeADcHVQfQyMQAwzwAZI3wJKvCLkfKBaMSClBlR7BOQikCFGQEErIH0VqkabiGCAqwUadAzZJRxQr/0gwiXIal8zQQPnNVTgJ1TdawL0T5gBIP1MUJNhBv2HKoQHHjqNrA4WO4zY0glyNKLT2KIfIMAAQsdgGiXvgnYAAAAASUVORK5CYII="), + url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAA3CAYAAADNNiA5AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAACBJREFUeNpi+P//fz4TAwPDZxDxD5X4i5fLMEwJgAADAEPVDbjNw87ZAAAAAElFTkSuQmCC"); +} + +.ace_tooltip { + background-color: #f5f5f5; + border: 1px solid gray; + border-radius: 1px; + box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); + color: black; + padding: 3px 4px; + position: fixed; + z-index: 999999; + box-sizing: border-box; + cursor: default; + white-space: pre-wrap; + word-wrap: break-word; + line-height: normal; + font-style: normal; + font-weight: normal; + letter-spacing: normal; + pointer-events: none; + overflow: auto; + max-width: min(33em, 66vw); + overscroll-behavior: contain; +} +.ace_tooltip pre { + white-space: pre-wrap; +} + +.ace_tooltip.ace_dark { + background-color: #636363; + color: #fff; +} + +.ace_tooltip:focus { + outline: 1px solid #5E9ED6; +} + +.ace_icon { + display: inline-block; + width: 18px; + vertical-align: top; +} + +.ace_icon_svg { + display: inline-block; + width: 12px; + vertical-align: top; + -webkit-mask-repeat: no-repeat; + -webkit-mask-size: 12px; + -webkit-mask-position: center; +} + +.ace_folding-enabled > .ace_gutter-cell, .ace_folding-enabled > .ace_gutter-cell_svg-icons { + padding-right: 13px; +} + +.ace_fold-widget, .ace_custom-widget { + box-sizing: border-box; + + margin: 0 -12px 0 1px; + display: none; + width: 11px; + vertical-align: top; + + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAANElEQVR42mWKsQ0AMAzC8ixLlrzQjzmBiEjp0A6WwBCSPgKAXoLkqSot7nN3yMwR7pZ32NzpKkVoDBUxKAAAAABJRU5ErkJggg=="); + background-repeat: no-repeat; + background-position: center; + + border-radius: 3px; + + border: 1px solid transparent; + cursor: pointer; +} + +.ace_custom-widget { + background: none; +} + +.ace_folding-enabled .ace_fold-widget { + display: inline-block; +} + +.ace_fold-widget.ace_end { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAANElEQVR42m3HwQkAMAhD0YzsRchFKI7sAikeWkrxwScEB0nh5e7KTPWimZki4tYfVbX+MNl4pyZXejUO1QAAAABJRU5ErkJggg=="); +} + +.ace_fold-widget.ace_closed { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAGCAYAAAAG5SQMAAAAOUlEQVR42jXKwQkAMAgDwKwqKD4EwQ26sSOkVWjgIIHAzPiCgaqiqnJHZnKICBERHN194O5b9vbLuAVRL+l0YWnZAAAAAElFTkSuQmCCXA=="); +} + +.ace_fold-widget:hover { + border: 1px solid rgba(0, 0, 0, 0.3); + background-color: rgba(255, 255, 255, 0.2); + box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7); +} + +.ace_fold-widget:active { + border: 1px solid rgba(0, 0, 0, 0.4); + background-color: rgba(0, 0, 0, 0.05); + box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8); +} +/** + * Dark version for fold widgets + */ +.ace_dark .ace_fold-widget { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHklEQVQIW2P4//8/AzoGEQ7oGCaLLAhWiSwB146BAQCSTPYocqT0AAAAAElFTkSuQmCC"); +} +.ace_dark .ace_fold-widget.ace_end { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAH0lEQVQIW2P4//8/AxQ7wNjIAjDMgC4AxjCVKBirIAAF0kz2rlhxpAAAAABJRU5ErkJggg=="); +} +.ace_dark .ace_fold-widget.ace_closed { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAFCAYAAACAcVaiAAAAHElEQVQIW2P4//+/AxAzgDADlOOAznHAKgPWAwARji8UIDTfQQAAAABJRU5ErkJggg=="); +} +.ace_dark .ace_fold-widget:hover { + box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2); + background-color: rgba(255, 255, 255, 0.1); +} +.ace_dark .ace_fold-widget:active { + box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2); +} + +.ace_inline_button { + border: 1px solid lightgray; + display: inline-block; + margin: -1px 8px; + padding: 0 5px; + pointer-events: auto; + cursor: pointer; +} +.ace_inline_button:hover { + border-color: gray; + background: rgba(200,200,200,0.2); + display: inline-block; + pointer-events: auto; +} + +.ace_fold-widget.ace_invalid { + background-color: #FFB4B4; + border-color: #DE5555; +} + +.ace_fade-fold-widgets .ace_fold-widget { + transition: opacity 0.4s ease 0.05s; + opacity: 0; +} + +.ace_fade-fold-widgets:hover .ace_fold-widget { + transition: opacity 0.05s ease 0.05s; + opacity:1; +} + +.ace_underline { + text-decoration: underline; +} + +.ace_bold { + font-weight: bold; +} + +.ace_nobold .ace_bold { + font-weight: normal; +} + +.ace_italic { + font-style: italic; +} + + +.ace_error-marker { + background-color: rgba(255, 0, 0,0.2); + position: absolute; + z-index: 9; +} + +.ace_highlight-marker { + background-color: rgba(255, 255, 0,0.2); + position: absolute; + z-index: 8; +} + +.ace_mobile-menu { + position: absolute; + line-height: 1.5; + border-radius: 4px; + -ms-user-select: none; + -moz-user-select: none; + -webkit-user-select: none; + user-select: none; + background: white; + box-shadow: 1px 3px 2px grey; + border: 1px solid #dcdcdc; + color: black; +} +.ace_dark > .ace_mobile-menu { + background: #333; + color: #ccc; + box-shadow: 1px 3px 2px grey; + border: 1px solid #444; + +} +.ace_mobile-button { + padding: 2px; + cursor: pointer; + overflow: hidden; +} +.ace_mobile-button:hover { + background-color: #eee; + opacity:1; +} +.ace_mobile-button:active { + background-color: #ddd; +} + +.ace_placeholder { + position: relative; + font-family: arial; + transform: scale(0.9); + transform-origin: left; + white-space: pre; + opacity: 0.7; + margin: 0 10px; + z-index: 1; +} + +.ace_ghost_text { + opacity: 0.5; + font-style: italic; +} + +.ace_ghost_text_container > div { + white-space: pre; +} + +.ghost_text_line_wrapped::after { + content: "↩"; + position: absolute; +} + +.ace_lineWidgetContainer.ace_ghost_text { + margin: 0px 4px +} + +.ace_screenreader-only { + position:absolute; + left:-10000px; + top:auto; + width:1px; + height:1px; + overflow:hidden; +} + +.ace_hidden_token { + display: none; +}`}),ace.define("ace/layer/decorators",["require","exports","module","ace/lib/dom","ace/lib/oop","ace/lib/event_emitter"],function(n,r,i){var o=n("../lib/dom"),l=n("../lib/oop"),m=n("../lib/event_emitter").EventEmitter,u=function(){function p(s,c){this.parentEl=s,this.canvas=o.createElement("canvas"),this.renderer=c,this.pixelRatio=1,this.maxHeight=c.layerConfig.maxHeight,this.lineHeight=c.layerConfig.lineHeight,this.minDecorationHeight=2*this.pixelRatio|0,this.halfMinDecorationHeight=this.minDecorationHeight/2|0,this.canvas.style.top="0px",this.canvas.style.right="0px",this.canvas.style.zIndex="7px",this.canvas.style.position="absolute",this.colors={},this.colors.dark={error:"rgba(255, 18, 18, 1)",warning:"rgba(18, 136, 18, 1)",info:"rgba(18, 18, 136, 1)"},this.colors.light={error:"rgb(255,51,51)",warning:"rgb(32,133,72)",info:"rgb(35,68,138)"},this.setDimensions(),s.element.appendChild(this.canvas)}return p.prototype.$updateDecorators=function(s){var c=this.renderer.theme.isDark===!0?this.colors.dark:this.colors.light;this.setDimensions(s);var d=this.canvas.getContext("2d");function h(k,L){return k.priorityL.priority?1:0}var f=this.renderer.session.$annotations;if(d.clearRect(0,0,this.canvas.width,this.canvas.height),f){var v={info:1,warning:2,error:3};f.forEach(function(k){k.priority=v[k.type]||null}),f=f.sort(h);for(var y=0;ythis.canvasHeight&&(O=this.canvasHeight-this.halfMinDecorationHeight),E=Math.round(O-this.halfMinDecorationHeight),_=Math.round(O+this.halfMinDecorationHeight)}d.fillStyle=c[f[y].type]||null,d.fillRect(0,x,this.canvasWidth,_-E)}}var N=this.renderer.session.selection.getCursor();if(N){var w=this.compensateFoldRows(N.row),x=Math.round((N.row-w)*this.lineHeight*this.heightRatio);d.fillStyle="rgba(0, 0, 0, 0.5)",d.fillRect(0,x,this.canvasWidth,2)}},p.prototype.compensateFoldRows=function(s){var c=this.renderer.session.$foldData,d=0;if(c&&c.length>0)for(var h=0;hc[h].start.row&&s=c[h].end.row&&(d+=c[h].end.row-c[h].start.row);return d},p.prototype.compensateLineWidgets=function(s){var c=this.renderer.session.widgetManager;if(c){var d=0;return c.lineWidgets.forEach(function(h,f){s>f&&(d+=h.rowCount||0)}),d-1}return 0},p.prototype.setDimensions=function(s){s?(this.maxHeight=s.maxHeight,this.lineHeight=s.lineHeight,this.canvasHeight=s.height,this.maxHeightL&&(this.$changedLines.firstRow=L),this.$changedLines.lastRowthis.layerConfig.lastRow||this.$loop.schedule(this.CHANGE_LINES)},k.prototype.onChangeNewLineMode=function(){this.$loop.schedule(this.CHANGE_TEXT),this.$textLayer.$updateEolChar(),this.session.$bidiHandler.setEolChar(this.$textLayer.EOL_CHAR)},k.prototype.onChangeTabSize=function(){this.$loop.schedule(this.CHANGE_TEXT|this.CHANGE_MARKER),this.$textLayer.onChangeTabSize()},k.prototype.updateText=function(){this.$loop.schedule(this.CHANGE_TEXT)},k.prototype.updateFull=function(L){L?this.$renderChanges(this.CHANGE_FULL,!0):this.$loop.schedule(this.CHANGE_FULL)},k.prototype.updateFontSize=function(){this.$textLayer.checkForSizeChanges()},k.prototype.$updateSizeAsync=function(){this.$loop.pending?this.$size.$dirty=!0:this.onResize()},k.prototype.onResize=function(L,F,P,A){if(!(this.resizing>2)){this.resizing>0?this.resizing++:this.resizing=L?1:0;var M=this.container;A||(A=M.clientHeight||M.scrollHeight),!A&&this.$maxLines&&this.lineHeight>1&&(!M.style.height||M.style.height=="0px")&&(M.style.height="1px",A=M.clientHeight||M.scrollHeight),P||(P=M.clientWidth||M.scrollWidth);var R=this.$updateCachedSize(L,F,P,A);if(this.$resizeTimer&&this.$resizeTimer.cancel(),!this.$size.scrollerHeight||!P&&!A)return this.resizing=0;L&&(this.$gutterLayer.$padding=null),L?this.$renderChanges(R|this.$changes,!0):this.$loop.schedule(R|this.$changes),this.resizing&&(this.resizing=0),this.scrollBarH.scrollLeft=this.scrollBarV.scrollTop=null,this.$customScrollbar&&this.$updateCustomScrollbar(!0)}},k.prototype.$updateCachedSize=function(L,F,P,A){A-=this.$extraHeight||0;var M=0,R=this.$size,I={width:R.width,height:R.height,scrollerHeight:R.scrollerHeight,scrollerWidth:R.scrollerWidth};if(A&&(L||R.height!=A)&&(R.height=A,M|=this.CHANGE_SIZE,R.scrollerHeight=R.height,this.$horizScroll&&(R.scrollerHeight-=this.scrollBarH.getHeight()),this.scrollBarV.setHeight(R.scrollerHeight),this.scrollBarV.element.style.bottom=this.scrollBarH.getHeight()+"px",M=M|this.CHANGE_SCROLL),P&&(L||R.width!=P)){M|=this.CHANGE_SIZE,R.width=P,F==null&&(F=this.$showGutter?this.$gutter.offsetWidth:0),this.gutterWidth=F,l.setStyle(this.scrollBarH.element.style,"left",F+"px"),l.setStyle(this.scroller.style,"left",F+this.margin.left+"px"),R.scrollerWidth=Math.max(0,P-F-this.scrollBarV.getWidth()-this.margin.h),l.setStyle(this.$gutter.style,"left",this.margin.left+"px");var D=this.scrollBarV.getWidth()+"px";l.setStyle(this.scrollBarH.element.style,"right",D),l.setStyle(this.scroller.style,"right",D),l.setStyle(this.scroller.style,"bottom",this.scrollBarH.getHeight()),this.scrollBarH.setWidth(R.scrollerWidth),(this.session&&this.session.getUseWrapMode()&&this.adjustWrapLimit()||L)&&(M|=this.CHANGE_FULL)}return R.$dirty=!P||!A,M&&this._signal("resize",I),M},k.prototype.onGutterResize=function(L){var F=this.$showGutter?L:0;F!=this.gutterWidth&&(this.$changes|=this.$updateCachedSize(!0,F,this.$size.width,this.$size.height)),this.session.getUseWrapMode()&&this.adjustWrapLimit()?this.$loop.schedule(this.CHANGE_FULL):this.$size.$dirty?this.$loop.schedule(this.CHANGE_FULL):this.$computeLayerConfig()},k.prototype.adjustWrapLimit=function(){var L=this.$size.scrollerWidth-this.$padding*2,F=Math.floor(L/this.characterWidth);return this.session.adjustWrapLimit(F,this.$showPrintMargin&&this.$printMarginColumn)},k.prototype.setAnimatedScroll=function(L){this.setOption("animatedScroll",L)},k.prototype.getAnimatedScroll=function(){return this.$animatedScroll},k.prototype.setShowInvisibles=function(L){this.setOption("showInvisibles",L),this.session.$bidiHandler.setShowInvisibles(L)},k.prototype.getShowInvisibles=function(){return this.getOption("showInvisibles")},k.prototype.getDisplayIndentGuides=function(){return this.getOption("displayIndentGuides")},k.prototype.setDisplayIndentGuides=function(L){this.setOption("displayIndentGuides",L)},k.prototype.getHighlightIndentGuides=function(){return this.getOption("highlightIndentGuides")},k.prototype.setHighlightIndentGuides=function(L){this.setOption("highlightIndentGuides",L)},k.prototype.setShowPrintMargin=function(L){this.setOption("showPrintMargin",L)},k.prototype.getShowPrintMargin=function(){return this.getOption("showPrintMargin")},k.prototype.setPrintMarginColumn=function(L){this.setOption("printMarginColumn",L)},k.prototype.getPrintMarginColumn=function(){return this.getOption("printMarginColumn")},k.prototype.getShowGutter=function(){return this.getOption("showGutter")},k.prototype.setShowGutter=function(L){return this.setOption("showGutter",L)},k.prototype.getFadeFoldWidgets=function(){return this.getOption("fadeFoldWidgets")},k.prototype.setFadeFoldWidgets=function(L){this.setOption("fadeFoldWidgets",L)},k.prototype.setHighlightGutterLine=function(L){this.setOption("highlightGutterLine",L)},k.prototype.getHighlightGutterLine=function(){return this.getOption("highlightGutterLine")},k.prototype.$updatePrintMargin=function(){if(!(!this.$showPrintMargin&&!this.$printMarginEl)){if(!this.$printMarginEl){var L=l.createElement("div");L.className="ace_layer ace_print-margin-layer",this.$printMarginEl=l.createElement("div"),this.$printMarginEl.className="ace_print-margin",L.appendChild(this.$printMarginEl),this.content.insertBefore(L,this.content.firstChild)}var F=this.$printMarginEl.style;F.left=Math.round(this.characterWidth*this.$printMarginColumn+this.$padding)+"px",F.visibility=this.$showPrintMargin?"visible":"hidden",this.session&&this.session.$wrap==-1&&this.adjustWrapLimit()}},k.prototype.getContainerElement=function(){return this.container},k.prototype.getMouseEventTarget=function(){return this.scroller},k.prototype.getTextAreaContainer=function(){return this.container},k.prototype.$moveTextAreaToCursor=function(){if(!this.$isMousePressed){var L=this.textarea.style,F=this.$composition;if(!this.$keepTextAreaAtCursor&&!F){l.translate(this.textarea,-100,0);return}var P=this.$cursorLayer.$pixelPos;if(P){F&&F.markerRange&&(P=this.$cursorLayer.getPixelPosition(F.markerRange.start,!0));var A=this.layerConfig,M=P.top,R=P.left;M-=A.offset;var I=F&&F.useTextareaForIME||$.isMobile?this.lineHeight:1;if(M<0||M>A.height-I){l.translate(this.textarea,0,0);return}var D=1,j=this.$size.height-I;if(!F)M+=this.lineHeight;else if(F.useTextareaForIME){var B=this.textarea.value;D=this.characterWidth*this.session.$getStringScreenWidth(B)[0]}else M+=this.lineHeight+2;R-=this.scrollLeft,R>this.$size.scrollerWidth-D&&(R=this.$size.scrollerWidth-D),R+=this.gutterWidth+this.margin.left,l.setStyle(L,"height",I+"px"),l.setStyle(L,"width",D+"px"),l.translate(this.textarea,Math.min(R,this.$size.scrollerWidth-D),Math.min(M,j))}}},k.prototype.getFirstVisibleRow=function(){return this.layerConfig.firstRow},k.prototype.getFirstFullyVisibleRow=function(){return this.layerConfig.firstRow+(this.layerConfig.offset===0?0:1)},k.prototype.getLastFullyVisibleRow=function(){var L=this.layerConfig,F=L.lastRow,P=this.session.documentToScreenRow(F,0)*L.lineHeight;return P-this.session.getScrollTop()>L.height-L.lineHeight?F-1:F},k.prototype.getLastVisibleRow=function(){return this.layerConfig.lastRow},k.prototype.setPadding=function(L){this.$padding=L,this.$textLayer.setPadding(L),this.$cursorLayer.setPadding(L),this.$markerFront.setPadding(L),this.$markerBack.setPadding(L),this.$loop.schedule(this.CHANGE_FULL),this.$updatePrintMargin()},k.prototype.setScrollMargin=function(L,F,P,A){var M=this.scrollMargin;M.top=L|0,M.bottom=F|0,M.right=A|0,M.left=P|0,M.v=M.top+M.bottom,M.h=M.left+M.right,M.top&&this.scrollTop<=0&&this.session&&this.session.setScrollTop(-M.top),this.updateFull()},k.prototype.setMargin=function(L,F,P,A){var M=this.margin;M.top=L|0,M.bottom=F|0,M.right=A|0,M.left=P|0,M.v=M.top+M.bottom,M.h=M.left+M.right,this.$updateCachedSize(!0,this.gutterWidth,this.$size.width,this.$size.height),this.updateFull()},k.prototype.getHScrollBarAlwaysVisible=function(){return this.$hScrollBarAlwaysVisible},k.prototype.setHScrollBarAlwaysVisible=function(L){this.setOption("hScrollBarAlwaysVisible",L)},k.prototype.getVScrollBarAlwaysVisible=function(){return this.$vScrollBarAlwaysVisible},k.prototype.setVScrollBarAlwaysVisible=function(L){this.setOption("vScrollBarAlwaysVisible",L)},k.prototype.$updateScrollBarV=function(){var L=this.layerConfig.maxHeight,F=this.$size.scrollerHeight;!this.$maxLines&&this.$scrollPastEnd&&(L-=(F-this.lineHeight)*this.$scrollPastEnd,this.scrollTop>L-F&&(L=this.scrollTop+F,this.scrollBarV.scrollTop=null)),this.scrollBarV.setScrollHeight(L+this.scrollMargin.v),this.scrollBarV.setScrollTop(this.scrollTop+this.scrollMargin.top)},k.prototype.$updateScrollBarH=function(){this.scrollBarH.setScrollWidth(this.layerConfig.width+2*this.$padding+this.scrollMargin.h),this.scrollBarH.setScrollLeft(this.scrollLeft+this.scrollMargin.left)},k.prototype.freeze=function(){this.$frozen=!0},k.prototype.unfreeze=function(){this.$frozen=!1},k.prototype.$renderChanges=function(L,F){if(this.$changes&&(L|=this.$changes,this.$changes=0),!this.session||!this.container.offsetWidth||this.$frozen||!L&&!F){this.$changes|=L;return}if(this.$size.$dirty)return this.$changes|=L,this.onResize(!0);this.lineHeight||this.$textLayer.checkForSizeChanges(),this._signal("beforeRender",L),this.session&&this.session.$bidiHandler&&this.session.$bidiHandler.updateCharacterWidths(this.$fontMetrics);var P=this.layerConfig;if(L&this.CHANGE_FULL||L&this.CHANGE_SIZE||L&this.CHANGE_TEXT||L&this.CHANGE_LINES||L&this.CHANGE_SCROLL||L&this.CHANGE_H_SCROLL){if(L|=this.$computeLayerConfig()|this.$loop.clear(),P.firstRow!=this.layerConfig.firstRow&&P.firstRowScreen==this.layerConfig.firstRowScreen){var A=this.scrollTop+(P.firstRow-Math.max(this.layerConfig.firstRow,0))*this.lineHeight;A>0&&(this.scrollTop=A,L=L|this.CHANGE_SCROLL,L|=this.$computeLayerConfig()|this.$loop.clear())}P=this.layerConfig,this.$updateScrollBarV(),L&this.CHANGE_H_SCROLL&&this.$updateScrollBarH(),l.translate(this.content,-this.scrollLeft,-P.offset);var M=P.width+2*this.$padding+"px",R=P.minHeight+"px";l.setStyle(this.content.style,"width",M),l.setStyle(this.content.style,"height",R)}if(L&this.CHANGE_H_SCROLL&&(l.translate(this.content,-this.scrollLeft,-P.offset),this.scroller.className=this.scrollLeft<=0?"ace_scroller ":"ace_scroller ace_scroll-left ",this.enableKeyboardAccessibility&&(this.scroller.className+=this.keyboardFocusClassName)),L&this.CHANGE_FULL){this.$changedLines=null,this.$textLayer.update(P),this.$showGutter&&this.$gutterLayer.update(P),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(P),this.$markerBack.update(P),this.$markerFront.update(P),this.$cursorLayer.update(P),this.$moveTextAreaToCursor(),this._signal("afterRender",L);return}if(L&this.CHANGE_SCROLL){this.$changedLines=null,L&this.CHANGE_TEXT||L&this.CHANGE_LINES?this.$textLayer.update(P):this.$textLayer.scrollLines(P),this.$showGutter&&(L&this.CHANGE_GUTTER||L&this.CHANGE_LINES?this.$gutterLayer.update(P):this.$gutterLayer.scrollLines(P)),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(P),this.$markerBack.update(P),this.$markerFront.update(P),this.$cursorLayer.update(P),this.$moveTextAreaToCursor(),this._signal("afterRender",L);return}L&this.CHANGE_TEXT?(this.$changedLines=null,this.$textLayer.update(P),this.$showGutter&&this.$gutterLayer.update(P),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(P)):L&this.CHANGE_LINES?((this.$updateLines()||L&this.CHANGE_GUTTER&&this.$showGutter)&&this.$gutterLayer.update(P),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(P)):L&this.CHANGE_TEXT||L&this.CHANGE_GUTTER?(this.$showGutter&&this.$gutterLayer.update(P),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(P)):L&this.CHANGE_CURSOR&&(this.$highlightGutterLine&&this.$gutterLayer.updateLineHighlight(P),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(P)),L&this.CHANGE_CURSOR&&(this.$cursorLayer.update(P),this.$moveTextAreaToCursor()),L&(this.CHANGE_MARKER|this.CHANGE_MARKER_FRONT)&&this.$markerFront.update(P),L&(this.CHANGE_MARKER|this.CHANGE_MARKER_BACK)&&this.$markerBack.update(P),this._signal("afterRender",L)},k.prototype.$autosize=function(){var L=this.session.getScreenLength()*this.lineHeight,F=this.$maxLines*this.lineHeight,P=Math.min(F,Math.max((this.$minLines||1)*this.lineHeight,L))+this.scrollMargin.v+(this.$extraHeight||0);this.$horizScroll&&(P+=this.scrollBarH.getHeight()),this.$maxPixelHeight&&P>this.$maxPixelHeight&&(P=this.$maxPixelHeight);var A=P<=2*this.lineHeight,M=!A&&L>F;if(P!=this.desiredHeight||this.$size.height!=this.desiredHeight||M!=this.$vScroll){M!=this.$vScroll&&(this.$vScroll=M,this.scrollBarV.setVisible(M));var R=this.container.clientWidth;this.container.style.height=P+"px",this.$updateCachedSize(!0,this.$gutterWidth,R,P),this.desiredHeight=P,this._signal("autosize")}},k.prototype.$computeLayerConfig=function(){var L=this.session,F=this.$size,P=F.height<=2*this.lineHeight,A=this.session.getScreenLength(),M=A*this.lineHeight,R=this.$getLongestLine(),I=!P&&(this.$hScrollBarAlwaysVisible||F.scrollerWidth-R-2*this.$padding<0),D=this.$horizScroll!==I;D&&(this.$horizScroll=I,this.scrollBarH.setVisible(I));var j=this.$vScroll;this.$maxLines&&this.lineHeight>1&&(this.$autosize(),P=F.height<=2*this.lineHeight);var B=F.scrollerHeight+this.lineHeight,V=!this.$maxLines&&this.$scrollPastEnd?(F.scrollerHeight-this.lineHeight)*this.$scrollPastEnd:0;M+=V;var H=this.scrollMargin;this.session.setScrollTop(Math.max(-H.top,Math.min(this.scrollTop,M-F.scrollerHeight+H.bottom))),this.session.setScrollLeft(Math.max(-H.left,Math.min(this.scrollLeft,R+2*this.$padding-F.scrollerWidth+H.right)));var Y=!P&&(this.$vScrollBarAlwaysVisible||F.scrollerHeight-M+V<0||this.scrollTop>H.top),U=j!==Y;U&&(this.$vScroll=Y,this.scrollBarV.setVisible(Y));var K=this.scrollTop%this.lineHeight,G=Math.ceil(B/this.lineHeight)-1,q=Math.max(0,Math.round((this.scrollTop-K)/this.lineHeight)),Z=q+G,Q,J,ie=this.lineHeight;q=L.screenToDocumentRow(q,0);var se=L.getFoldLine(q);se&&(q=se.start.row),Q=L.documentToScreenRow(q,0),J=L.getRowLength(q)*ie,Z=Math.min(L.screenToDocumentRow(Z,0),L.getLength()-1),B=F.scrollerHeight+L.getRowLength(Z)*ie+J,K=this.scrollTop-Q*ie;var ae=0;return(this.layerConfig.width!=R||D)&&(ae=this.CHANGE_H_SCROLL),(D||U)&&(ae|=this.$updateCachedSize(!0,this.gutterWidth,F.width,F.height),this._signal("scrollbarVisibilityChanged"),U&&(R=this.$getLongestLine())),this.layerConfig={width:R,padding:this.$padding,firstRow:q,firstRowScreen:Q,lastRow:Z,lineHeight:ie,characterWidth:this.characterWidth,minHeight:B,maxHeight:M,offset:K,gutterOffset:ie?Math.max(0,Math.ceil((K+F.height-F.scrollerHeight)/ie)):0,height:this.$size.scrollerHeight},this.session.$bidiHandler&&this.session.$bidiHandler.setContentWidth(R-this.$padding),ae},k.prototype.$updateLines=function(){if(this.$changedLines){var L=this.$changedLines.firstRow,F=this.$changedLines.lastRow;this.$changedLines=null;var P=this.layerConfig;if(!(L>P.lastRow+1)&&!(Fthis.$textLayer.MAX_LINE_LENGTH&&(L=this.$textLayer.MAX_LINE_LENGTH+30),Math.max(this.$size.scrollerWidth-2*this.$padding,Math.round(L*this.characterWidth))},k.prototype.updateFrontMarkers=function(){this.$markerFront.setMarkers(this.session.getMarkers(!0)),this.$loop.schedule(this.CHANGE_MARKER_FRONT)},k.prototype.updateBackMarkers=function(){this.$markerBack.setMarkers(this.session.getMarkers()),this.$loop.schedule(this.CHANGE_MARKER_BACK)},k.prototype.addGutterDecoration=function(L,F){this.$gutterLayer.addGutterDecoration(L,F)},k.prototype.removeGutterDecoration=function(L,F){this.$gutterLayer.removeGutterDecoration(L,F)},k.prototype.updateBreakpoints=function(L){this._rows=L,this.$loop.schedule(this.CHANGE_GUTTER)},k.prototype.setAnnotations=function(L){this.$gutterLayer.setAnnotations(L),this.$loop.schedule(this.CHANGE_GUTTER)},k.prototype.updateCursor=function(){this.$loop.schedule(this.CHANGE_CURSOR)},k.prototype.hideCursor=function(){this.$cursorLayer.hideCursor()},k.prototype.showCursor=function(){this.$cursorLayer.showCursor()},k.prototype.scrollSelectionIntoView=function(L,F,P){this.scrollCursorIntoView(L,P),this.scrollCursorIntoView(F,P)},k.prototype.scrollCursorIntoView=function(L,F,P){if(this.$size.scrollerHeight!==0){var A=this.$cursorLayer.getPixelPosition(L),M=A.left,R=A.top,I=P&&P.top||0,D=P&&P.bottom||0;this.$scrollAnimation&&(this.$stopAnimation=!0);var j=this.$scrollAnimation?this.session.getScrollTop():this.scrollTop;j+I>R?(F&&j+I>R+this.lineHeight&&(R-=F*this.$size.scrollerHeight),R===0&&(R=-this.scrollMargin.top),this.session.setScrollTop(R)):j+this.$size.scrollerHeight-D=1-this.scrollMargin.top||F>0&&this.session.getScrollTop()+this.$size.scrollerHeight-this.layerConfig.maxHeight<-1+this.scrollMargin.bottom||L<0&&this.session.getScrollLeft()>=1-this.scrollMargin.left||L>0&&this.session.getScrollLeft()+this.$size.scrollerWidth-this.layerConfig.width<-1+this.scrollMargin.right)return!0},k.prototype.pixelToScreenCoordinates=function(L,F){var P;if(this.$hasCssTransforms){P={top:0,left:0};var A=this.$fontMetrics.transformCoordinates([L,F]);L=A[1]-this.gutterWidth-this.margin.left,F=A[0]}else P=this.scroller.getBoundingClientRect();var M=L+this.scrollLeft-P.left-this.$padding,R=M/this.characterWidth,I=Math.floor((F+this.scrollTop-P.top)/this.lineHeight),D=this.$blockCursor?Math.floor(R):Math.round(R);return{row:I,column:D,side:R-D>0?1:-1,offsetX:M}},k.prototype.screenToTextCoordinates=function(L,F){var P;if(this.$hasCssTransforms){P={top:0,left:0};var A=this.$fontMetrics.transformCoordinates([L,F]);L=A[1]-this.gutterWidth-this.margin.left,F=A[0]}else P=this.scroller.getBoundingClientRect();var M=L+this.scrollLeft-P.left-this.$padding,R=M/this.characterWidth,I=this.$blockCursor?Math.floor(R):Math.round(R),D=Math.floor((F+this.scrollTop-P.top)/this.lineHeight);return this.session.screenToDocumentPosition(D,Math.max(I,0),M)},k.prototype.textToScreenCoordinates=function(L,F){var P=this.scroller.getBoundingClientRect(),A=this.session.documentToScreenPosition(L,F),M=this.$padding+(this.session.$bidiHandler.isBidiRow(A.row,L)?this.session.$bidiHandler.getPosLeft(A.column):Math.round(A.column*this.characterWidth)),R=A.row*this.lineHeight;return{pageX:P.left+M-this.scrollLeft,pageY:P.top+R-this.scrollTop}},k.prototype.visualizeFocus=function(){l.addCssClass(this.container,"ace_focus")},k.prototype.visualizeBlur=function(){l.removeCssClass(this.container,"ace_focus")},k.prototype.showComposition=function(L){this.$composition=L,L.cssText||(L.cssText=this.textarea.style.cssText),L.useTextareaForIME==null&&(L.useTextareaForIME=this.$useTextareaForIME),this.$useTextareaForIME?(l.addCssClass(this.textarea,"ace_composition"),this.textarea.style.cssText="",this.$moveTextAreaToCursor(),this.$cursorLayer.element.style.display="none"):L.markerId=this.session.addMarker(L.markerRange,"ace_composition_marker","text")},k.prototype.setCompositionText=function(L){var F=this.session.selection.cursor;this.addToken(L,"composition_placeholder",F.row,F.column),this.$moveTextAreaToCursor()},k.prototype.hideComposition=function(){if(this.$composition){this.$composition.markerId&&this.session.removeMarker(this.$composition.markerId),l.removeCssClass(this.textarea,"ace_composition"),this.textarea.style.cssText=this.$composition.cssText;var L=this.session.selection.cursor;this.removeExtraToken(L.row,L.column),this.$composition=null,this.$cursorLayer.element.style.display=""}},k.prototype.setGhostText=function(L,F){var P=this.session.selection.cursor,A=F||{row:P.row,column:P.column};this.removeGhostText();var M=this.$calculateWrappedTextChunks(L,A);this.addToken(M[0].text,"ghost_text",A.row,A.column),this.$ghostText={text:L,position:{row:A.row,column:A.column}};var R=l.createElement("div");if(M.length>1){var I=this.hideTokensAfterPosition(A.row,A.column),D;M.slice(1).forEach(function(U){var K=l.createElement("div"),G=l.createElement("span");G.className="ace_ghost_text",U.wrapped&&(K.className="ghost_text_line_wrapped"),U.text.length===0&&(U.text=" "),G.appendChild(l.createTextNode(U.text)),K.appendChild(G),R.appendChild(K),D=K}),I.forEach(function(U){var K=l.createElement("span");O(U.type)||(K.className="ace_"+U.type.replace(/\./g," ace_")),K.appendChild(l.createTextNode(U.value)),D.appendChild(K)}),this.$ghostTextWidget={el:R,row:A.row,column:A.column,className:"ace_ghost_text_container"},this.session.widgetManager.addLineWidget(this.$ghostTextWidget);var j=this.$cursorLayer.getPixelPosition(A,!0),B=this.container,V=B.getBoundingClientRect().height,H=M.length*this.lineHeight,Y=H0){var B=0;j.push(M[I].length);for(var V=0;V1||Math.abs(L.$size.height-A)>1?L.$resizeTimer.delay():L.$resizeTimer.cancel()}),this.$resizeObserver.observe(this.container)}},k}();N.prototype.CHANGE_CURSOR=1,N.prototype.CHANGE_MARKER=2,N.prototype.CHANGE_GUTTER=4,N.prototype.CHANGE_SCROLL=8,N.prototype.CHANGE_LINES=16,N.prototype.CHANGE_TEXT=32,N.prototype.CHANGE_SIZE=64,N.prototype.CHANGE_MARKER_BACK=128,N.prototype.CHANGE_MARKER_FRONT=256,N.prototype.CHANGE_FULL=512,N.prototype.CHANGE_H_SCROLL=1024,N.prototype.$changes=0,N.prototype.$padding=null,N.prototype.$frozen=!1,N.prototype.STEPS=8,o.implement(N.prototype,x),u.defineOptions(N.prototype,"renderer",{useResizeObserver:{set:function(k){!k&&this.$resizeObserver?(this.$resizeObserver.disconnect(),this.$resizeTimer.cancel(),this.$resizeTimer=this.$resizeObserver=null):k&&!this.$resizeObserver&&this.$addResizeObserver()}},animatedScroll:{initialValue:!1},showInvisibles:{set:function(k){this.$textLayer.setShowInvisibles(k)&&this.$loop.schedule(this.CHANGE_TEXT)},initialValue:!1},showPrintMargin:{set:function(){this.$updatePrintMargin()},initialValue:!0},printMarginColumn:{set:function(){this.$updatePrintMargin()},initialValue:80},printMargin:{set:function(k){typeof k=="number"&&(this.$printMarginColumn=k),this.$showPrintMargin=!!k,this.$updatePrintMargin()},get:function(){return this.$showPrintMargin&&this.$printMarginColumn}},showGutter:{set:function(k){this.$gutter.style.display=k?"block":"none",this.$loop.schedule(this.CHANGE_FULL),this.onGutterResize()},initialValue:!0},useSvgGutterIcons:{set:function(k){this.$gutterLayer.$useSvgGutterIcons=k},initialValue:!1},showFoldedAnnotations:{set:function(k){this.$gutterLayer.$showFoldedAnnotations=k},initialValue:!1},fadeFoldWidgets:{set:function(k){l.setCssClass(this.$gutter,"ace_fade-fold-widgets",k)},initialValue:!1},showFoldWidgets:{set:function(k){this.$gutterLayer.setShowFoldWidgets(k),this.$loop.schedule(this.CHANGE_GUTTER)},initialValue:!0},displayIndentGuides:{set:function(k){this.$textLayer.setDisplayIndentGuides(k)&&this.$loop.schedule(this.CHANGE_TEXT)},initialValue:!0},highlightIndentGuides:{set:function(k){this.$textLayer.setHighlightIndentGuides(k)==!0?this.$textLayer.$highlightIndentGuide():this.$textLayer.$clearActiveIndentGuide(this.$textLayer.$lines.cells)},initialValue:!0},highlightGutterLine:{set:function(k){this.$gutterLayer.setHighlightGutterLine(k),this.$loop.schedule(this.CHANGE_GUTTER)},initialValue:!0},hScrollBarAlwaysVisible:{set:function(k){(!this.$hScrollBarAlwaysVisible||!this.$horizScroll)&&this.$loop.schedule(this.CHANGE_SCROLL)},initialValue:!1},vScrollBarAlwaysVisible:{set:function(k){(!this.$vScrollBarAlwaysVisible||!this.$vScroll)&&this.$loop.schedule(this.CHANGE_SCROLL)},initialValue:!1},fontSize:{set:function(k){typeof k=="number"&&(k=k+"px"),this.container.style.fontSize=k,this.updateFontSize()},initialValue:12},fontFamily:{set:function(k){this.container.style.fontFamily=k,this.updateFontSize()}},maxLines:{set:function(k){this.updateFull()}},minLines:{set:function(k){this.$minLines<562949953421311||(this.$minLines=0),this.updateFull()}},maxPixelHeight:{set:function(k){this.updateFull()},initialValue:0},scrollPastEnd:{set:function(k){k=+k||0,this.$scrollPastEnd!=k&&(this.$scrollPastEnd=k,this.$loop.schedule(this.CHANGE_SCROLL))},initialValue:0,handlesSet:!0},fixedWidthGutter:{set:function(k){this.$gutterLayer.$fixedWidth=!!k,this.$loop.schedule(this.CHANGE_GUTTER)}},customScrollbar:{set:function(k){this.$updateCustomScrollbar(k)},initialValue:!1},theme:{set:function(k){this.setTheme(k)},get:function(){return this.$themeId||this.theme},initialValue:"./theme/textmate",handlesSet:!0},hasCssTransforms:{},useTextareaForIME:{initialValue:!$.isMobile&&!$.isIE}}),r.VirtualRenderer=N}),ace.define("ace/worker/worker_client",["require","exports","module","ace/lib/oop","ace/lib/net","ace/lib/event_emitter","ace/config"],function(n,r,i){var o=n("../lib/oop"),l=n("../lib/net"),m=n("../lib/event_emitter").EventEmitter,u=n("../config");function p(h){var f="importScripts('"+l.qualifyURL(h)+"');";try{return new Blob([f],{type:"application/javascript"})}catch{var v=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder,y=new v;return y.append(f),y.getBlob("application/javascript")}}function s(h){if(typeof Worker>"u")return{postMessage:function(){},terminate:function(){}};if(u.get("loadWorkerFromBlob")){var f=p(h),v=window.URL||window.webkitURL,y=v.createObjectURL(f);return new Worker(y)}return new Worker(h)}var c=function(h){h.postMessage||(h=this.$createWorkerFromOldConfig.apply(this,arguments)),this.$worker=h,this.$sendDeltaQueue=this.$sendDeltaQueue.bind(this),this.changeListener=this.changeListener.bind(this),this.onMessage=this.onMessage.bind(this),this.callbackId=1,this.callbacks={},this.$worker.onmessage=this.onMessage};(function(){o.implement(this,m),this.$createWorkerFromOldConfig=function(h,f,v,y,b){if(n.nameToUrl&&!n.toUrl&&(n.toUrl=n.nameToUrl),u.get("packaged")||!n.toUrl)y=y||u.moduleUrl(f,"worker");else{var w=this.$normalizePath;y=y||w(n.toUrl("ace/worker/worker.js",null,"_"));var x={};h.forEach(function(E){x[E]=w(n.toUrl(E,null,"_").replace(/(\.js)?(\?.*)?$/,""))})}return this.$worker=s(y),b&&this.send("importScripts",b),this.$worker.postMessage({init:!0,tlns:x,module:f,classname:v}),this.$worker},this.onMessage=function(h){var f=h.data;switch(f.type){case"event":this._signal(f.name,{data:f.data});break;case"call":var v=this.callbacks[f.id];v&&(v(f.data),delete this.callbacks[f.id]);break;case"error":this.reportError(f.data);break;case"log":window.console&&console.log&&console.log.apply(console,f.data);break}},this.reportError=function(h){window.console&&console.error&&console.error(h)},this.$normalizePath=function(h){return l.qualifyURL(h)},this.terminate=function(){this._signal("terminate",{}),this.deltaQueue=null,this.$worker.terminate(),this.$worker.onerror=function(h){h.preventDefault()},this.$worker=null,this.$doc&&this.$doc.off("change",this.changeListener),this.$doc=null},this.send=function(h,f){this.$worker.postMessage({command:h,args:f})},this.call=function(h,f,v){if(v){var y=this.callbackId++;this.callbacks[y]=v,f.push(y)}this.send(h,f)},this.emit=function(h,f){try{f.data&&f.data.err&&(f.data.err={message:f.data.err.message,stack:f.data.err.stack,code:f.data.err.code}),this.$worker&&this.$worker.postMessage({event:h,data:{data:f.data}})}catch(v){console.error(v.stack)}},this.attachToDocument=function(h){this.$doc&&this.terminate(),this.$doc=h,this.call("setValue",[h.getValue()]),h.on("change",this.changeListener,!0)},this.changeListener=function(h){this.deltaQueue||(this.deltaQueue=[],setTimeout(this.$sendDeltaQueue,0)),h.action=="insert"?this.deltaQueue.push(h.start,h.lines):this.deltaQueue.push(h.start,h.end)},this.$sendDeltaQueue=function(){var h=this.deltaQueue;h&&(this.deltaQueue=null,h.length>50&&h.length>this.$doc.getLength()>>1?this.call("setValue",[this.$doc.getValue()]):this.emit("change",{data:h}))}}).call(c.prototype);var d=function(h,f,v){var y=null,b=!1,w=Object.create(m),x=[],E=new c({messageBuffer:x,terminate:function(){},postMessage:function($){x.push($),y&&(b?setTimeout(_):_())}});E.setEmitSync=function($){b=$};var _=function(){var $=x.shift();$.command?y[$.command].apply(y,$.args):$.event&&w._signal($.event,$.data)};return w.postMessage=function($){E.onMessage({data:$})},w.callback=function($,O){this.postMessage({type:"call",id:O,data:$})},w.emit=function($,O){this.postMessage({type:"event",name:$,data:O})},u.loadModule(["worker",f],function($){for(y=new $[v](w);x.length;)_()}),E};r.UIWorkerClient=d,r.WorkerClient=c,r.createWorker=s}),ace.define("ace/placeholder",["require","exports","module","ace/range","ace/lib/event_emitter","ace/lib/oop"],function(n,r,i){var o=n("./range").Range,l=n("./lib/event_emitter").EventEmitter,m=n("./lib/oop"),u=function(){function p(s,c,d,h,f,v){var y=this;this.length=c,this.session=s,this.doc=s.getDocument(),this.mainClass=f,this.othersClass=v,this.$onUpdate=this.onUpdate.bind(this),this.doc.on("change",this.$onUpdate,!0),this.$others=h,this.$onCursorChange=function(){setTimeout(function(){y.onCursorChange()})},this.$pos=d;var b=s.getUndoManager().$undoStack||s.getUndoManager().$undostack||{length:-1};this.$undoStackDepth=b.length,this.setup(),s.selection.on("changeCursor",this.$onCursorChange)}return p.prototype.setup=function(){var s=this,c=this.doc,d=this.session;this.selectionBefore=d.selection.toJSON(),d.selection.inMultiSelectMode&&d.selection.toSingleRange(),this.pos=c.createAnchor(this.$pos.row,this.$pos.column);var h=this.pos;h.$insertRight=!0,h.detach(),h.markerId=d.addMarker(new o(h.row,h.column,h.row,h.column+this.length),this.mainClass,null,!1),this.others=[],this.$others.forEach(function(f){var v=c.createAnchor(f.row,f.column);v.$insertRight=!0,v.detach(),s.others.push(v)}),d.setUndoSelect(!1)},p.prototype.showOtherMarkers=function(){if(!this.othersActive){var s=this.session,c=this;this.othersActive=!0,this.others.forEach(function(d){d.markerId=s.addMarker(new o(d.row,d.column,d.row,d.column+c.length),c.othersClass,null,!1)})}},p.prototype.hideOtherMarkers=function(){if(this.othersActive){this.othersActive=!1;for(var s=0;s=this.pos.column&&c.start.column<=this.pos.column+this.length+1,f=c.start.column-this.pos.column;if(this.updateAnchors(s),h&&(this.length+=d),h&&!this.session.$fromUndo){if(s.action==="insert")for(var v=this.others.length-1;v>=0;v--){var y=this.others[v],b={row:y.row,column:y.column+f};this.doc.insertMergedLines(b,s.lines)}else if(s.action==="remove")for(var v=this.others.length-1;v>=0;v--){var y=this.others[v],b={row:y.row,column:y.column+f};this.doc.remove(new o(b.row,b.column,b.row,b.column-d))}}this.$updating=!1,this.updateMarkers()}},p.prototype.updateAnchors=function(s){this.pos.onChange(s);for(var c=this.others.length;c--;)this.others[c].onChange(s);this.updateMarkers()},p.prototype.updateMarkers=function(){if(!this.$updating){var s=this,c=this.session,d=function(f,v){c.removeMarker(f.markerId),f.markerId=c.addMarker(new o(f.row,f.column,f.row,f.column+s.length),v,null,!1)};d(this.pos,this.mainClass);for(var h=this.others.length;h--;)d(this.others[h],this.othersClass)}},p.prototype.onCursorChange=function(s){if(!(this.$updating||!this.session)){var c=this.session.selection.getCursor();c.row===this.pos.row&&c.column>=this.pos.column&&c.column<=this.pos.column+this.length?(this.showOtherMarkers(),this._emit("cursorEnter",s)):(this.hideOtherMarkers(),this._emit("cursorLeave",s))}},p.prototype.detach=function(){this.session.removeMarker(this.pos&&this.pos.markerId),this.hideOtherMarkers(),this.doc.off("change",this.$onUpdate),this.session.selection.off("changeCursor",this.$onCursorChange),this.session.setUndoSelect(!0),this.session=null},p.prototype.cancel=function(){if(this.$undoStackDepth!==-1){for(var s=this.session.getUndoManager(),c=(s.$undoStack||s.$undostack).length-this.$undoStackDepth,d=0;d1?l.multiSelect.joinSelections():l.multiSelect.splitIntoLines()},bindKey:{win:"Ctrl-Alt-L",mac:"Ctrl-Alt-L"},readOnly:!0},{name:"splitSelectionIntoLines",description:"Split into lines",exec:function(l){l.multiSelect.splitIntoLines()},readOnly:!0},{name:"alignCursors",description:"Align cursors",exec:function(l){l.alignCursors()},bindKey:{win:"Ctrl-Alt-A",mac:"Ctrl-Alt-A"},scrollIntoView:"cursor"},{name:"findAll",description:"Find all",exec:function(l){l.findAll()},bindKey:{win:"Ctrl-Alt-K",mac:"Ctrl-Alt-G"},scrollIntoView:"cursor",readOnly:!0}],r.multiSelectCommands=[{name:"singleSelection",description:"Single selection",bindKey:"esc",exec:function(l){l.exitMultiSelectMode()},scrollIntoView:"cursor",readOnly:!0,isAvailable:function(l){return l&&l.inMultiSelectMode}}];var o=n("../keyboard/hash_handler").HashHandler;r.keyboardHandler=new o(r.multiSelectCommands)}),ace.define("ace/multi_select",["require","exports","module","ace/range_list","ace/range","ace/selection","ace/mouse/multi_select_handler","ace/lib/event","ace/lib/lang","ace/commands/multi_select_commands","ace/search","ace/edit_session","ace/editor","ace/config"],function(n,r,i){var o=n("./range_list").RangeList,l=n("./range").Range,m=n("./selection").Selection,u=n("./mouse/multi_select_handler").onMouseDown,p=n("./lib/event"),s=n("./lib/lang"),c=n("./commands/multi_select_commands");r.commands=c.defaultCommands.concat(c.multiSelectCommands);var d=n("./search").Search,h=new d;function f(E,_,$){return h.$options.wrap=!0,h.$options.needle=_,h.$options.backwards=$==-1,h.find(E)}var v=n("./edit_session").EditSession;(function(){this.getSelectionMarkers=function(){return this.$selectionMarkers}}).call(v.prototype),(function(){this.ranges=null,this.rangeList=null,this.addRange=function(E,_){if(E){if(!this.inMultiSelectMode&&this.rangeCount===0){var $=this.toOrientedRange();if(this.rangeList.add($),this.rangeList.add(E),this.rangeList.ranges.length!=2)return this.rangeList.removeAll(),_||this.fromOrientedRange(E);this.rangeList.removeAll(),this.rangeList.add($),this.$onAddRange($)}E.cursor||(E.cursor=E.end);var O=this.rangeList.add(E);return this.$onAddRange(E),O.length&&this.$onRemoveRange(O),this.rangeCount>1&&!this.inMultiSelectMode&&(this._signal("multiSelect"),this.inMultiSelectMode=!0,this.session.$undoSelect=!1,this.rangeList.attach(this.session)),_||this.fromOrientedRange(E)}},this.toSingleRange=function(E){E=E||this.ranges[0];var _=this.rangeList.removeAll();_.length&&this.$onRemoveRange(_),E&&this.fromOrientedRange(E)},this.substractPoint=function(E){var _=this.rangeList.substractPoint(E);if(_)return this.$onRemoveRange(_),_[0]},this.mergeOverlappingRanges=function(){var E=this.rangeList.merge();E.length&&this.$onRemoveRange(E)},this.$onAddRange=function(E){this.rangeCount=this.rangeList.ranges.length,this.ranges.unshift(E),this._signal("addRange",{range:E})},this.$onRemoveRange=function(E){if(this.rangeCount=this.rangeList.ranges.length,this.rangeCount==1&&this.inMultiSelectMode){var _=this.rangeList.ranges.pop();E.push(_),this.rangeCount=0}for(var $=E.length;$--;){var O=this.ranges.indexOf(E[$]);this.ranges.splice(O,1)}this._signal("removeRange",{ranges:E}),this.rangeCount===0&&this.inMultiSelectMode&&(this.inMultiSelectMode=!1,this._signal("singleSelect"),this.session.$undoSelect=!0,this.rangeList.detach(this.session)),_=_||this.ranges[0],_&&!_.isEqual(this.getRange())&&this.fromOrientedRange(_)},this.$initRangeList=function(){this.rangeList||(this.rangeList=new o,this.ranges=[],this.rangeCount=0)},this.getAllRanges=function(){return this.rangeCount?this.rangeList.ranges.concat():[this.getRange()]},this.splitIntoLines=function(){for(var E=this.ranges.length?this.ranges:[this.getRange()],_=[],$=0;$1){var E=this.rangeList.ranges,_=E[E.length-1],$=l.fromPoints(E[0].start,_.end);this.toSingleRange(),this.setSelectionRange($,_.cursor==_.start)}else{var O=this.session.documentToScreenPosition(this.cursor),N=this.session.documentToScreenPosition(this.anchor),k=this.rectangularRangeBlock(O,N);k.forEach(this.addRange,this)}},this.rectangularRangeBlock=function(E,_,$){var O=[],N=E.column<_.column;if(N)var k=E.column,L=_.column,F=E.offsetX,P=_.offsetX;else var k=_.column,L=E.column,F=_.offsetX,P=E.offsetX;var A=E.row<_.row;if(A)var M=E.row,R=_.row;else var M=_.row,R=E.row;k<0&&(k=0),M<0&&(M=0),M==R&&($=!0);for(var I,D=M;D<=R;D++){var j=l.fromPoints(this.session.screenToDocumentPosition(D,k,F),this.session.screenToDocumentPosition(D,L,P));if(j.isEmpty()){if(I&&b(j.end,I))break;I=j.end}j.cursor=N?j.start:j.end,O.push(j)}if(A&&O.reverse(),!$){for(var B=O.length-1;O[B].isEmpty()&&B>0;)B--;if(B>0)for(var V=0;O[V].isEmpty();)V++;for(var H=B;H>=V;H--)O[H].isEmpty()&&O.splice(H,1)}return O}}).call(m.prototype);var y=n("./editor").Editor;(function(){this.updateSelectionMarkers=function(){this.renderer.updateCursor(),this.renderer.updateBackMarkers()},this.addSelectionMarker=function(E){E.cursor||(E.cursor=E.end);var _=this.getSelectionStyle();return E.marker=this.session.addMarker(E,"ace_selection",_),this.session.$selectionMarkers.push(E),this.session.selectionMarkerCount=this.session.$selectionMarkers.length,E},this.removeSelectionMarker=function(E){if(E.marker){this.session.removeMarker(E.marker);var _=this.session.$selectionMarkers.indexOf(E);_!=-1&&this.session.$selectionMarkers.splice(_,1),this.session.selectionMarkerCount=this.session.$selectionMarkers.length}},this.removeSelectionMarkers=function(E){for(var _=this.session.$selectionMarkers,$=E.length;$--;){var O=E[$];if(O.marker){this.session.removeMarker(O.marker);var N=_.indexOf(O);N!=-1&&_.splice(N,1)}}this.session.selectionMarkerCount=_.length},this.$onAddRange=function(E){this.addSelectionMarker(E.range),this.renderer.updateCursor(),this.renderer.updateBackMarkers()},this.$onRemoveRange=function(E){this.removeSelectionMarkers(E.ranges),this.renderer.updateCursor(),this.renderer.updateBackMarkers()},this.$onMultiSelect=function(E){this.inMultiSelectMode||(this.inMultiSelectMode=!0,this.setStyle("ace_multiselect"),this.keyBinding.addKeyboardHandler(c.keyboardHandler),this.commands.setDefaultHandler("exec",this.$onMultiSelectExec),this.renderer.updateCursor(),this.renderer.updateBackMarkers())},this.$onSingleSelect=function(E){this.session.multiSelect.inVirtualMode||(this.inMultiSelectMode=!1,this.unsetStyle("ace_multiselect"),this.keyBinding.removeKeyboardHandler(c.keyboardHandler),this.commands.removeDefaultHandler("exec",this.$onMultiSelectExec),this.renderer.updateCursor(),this.renderer.updateBackMarkers(),this._emit("changeSelection"))},this.$onMultiSelectExec=function(E){var _=E.command,$=E.editor;if($.multiSelect){if(_.multiSelectAction)_.multiSelectAction=="forEach"?O=$.forEachSelection(_,E.args):_.multiSelectAction=="forEachLine"?O=$.forEachSelection(_,E.args,!0):_.multiSelectAction=="single"?($.exitMultiSelectMode(),O=_.exec($,E.args||{})):O=_.multiSelectAction($,E.args||{});else{var O=_.exec($,E.args||{});$.multiSelect.addRange($.multiSelect.toOrientedRange()),$.multiSelect.mergeOverlappingRanges()}return O}},this.forEachSelection=function(E,_,$){if(!this.inVirtualSelectionMode){var O=$&&$.keepOrder,N=$==!0||$&&$.$byLines,k=this.session,L=this.selection,F=L.rangeList,P=(O?L:F).ranges,A;if(!P.length)return E.exec?E.exec(this,_||{}):E(this,_||{});var M=L._eventRegistry;L._eventRegistry={};var R=new m(k);this.inVirtualSelectionMode=!0;for(var I=P.length;I--;){if(N)for(;I>0&&P[I].start.row==P[I-1].end.row;)I--;R.fromOrientedRange(P[I]),R.index=I,this.selection=k.selection=R;var D=E.exec?E.exec(this,_||{}):E(this,_||{});!A&&D!==void 0&&(A=D),R.toOrientedRange(P[I])}R.detach(),this.selection=k.selection=L,this.inVirtualSelectionMode=!1,L._eventRegistry=M,L.mergeOverlappingRanges(),L.ranges[0]&&L.fromOrientedRange(L.ranges[0]);var j=this.renderer.$scrollAnimation;return this.onCursorChange(),this.onSelectionChange(),j&&j.from==j.to&&this.renderer.animateScrolling(j.from),A}},this.exitMultiSelectMode=function(){!this.inMultiSelectMode||this.inVirtualSelectionMode||this.multiSelect.toSingleRange()},this.getSelectedText=function(){var E="";if(this.inMultiSelectMode&&!this.inVirtualSelectionMode){for(var _=this.multiSelect.rangeList.ranges,$=[],O=0;O<_.length;O++)$.push(this.session.getTextRange(_[O]));var N=this.session.getDocument().getNewLineCharacter();E=$.join(N),E.length==($.length-1)*N.length&&(E="")}else this.selection.isEmpty()||(E=this.session.getTextRange(this.getSelectionRange()));return E},this.$checkMultiselectChange=function(E,_){if(this.inMultiSelectMode&&!this.inVirtualSelectionMode){var $=this.multiSelect.ranges[0];if(this.multiSelect.isEmpty()&&_==this.multiSelect.anchor)return;var O=_==this.multiSelect.anchor?$.cursor==$.start?$.end:$.start:$.cursor;O.row!=_.row||this.session.$clipPositionToDocument(O.row,O.column).column!=_.column?this.multiSelect.toSingleRange(this.multiSelect.toOrientedRange()):this.multiSelect.mergeOverlappingRanges()}},this.findAll=function(E,_,$){if(_=_||{},_.needle=E||_.needle,_.needle==null){var O=this.selection.isEmpty()?this.selection.getWordRange():this.selection.getRange();_.needle=this.session.getTextRange(O)}this.$search.set(_);var N=this.$search.findAll(this.session);if(!N.length)return 0;var k=this.multiSelect;$||k.toSingleRange(N[0]);for(var L=N.length;L--;)k.addRange(N[L],!0);return O&&k.rangeList.rangeAtPoint(O.start)&&k.addRange(O,!0),N.length},this.selectMoreLines=function(E,_){var $=this.selection.toOrientedRange(),O=$.cursor==$.end,N=this.session.documentToScreenPosition($.cursor);this.selection.$desiredColumn&&(N.column=this.selection.$desiredColumn);var k=this.session.screenToDocumentPosition(N.row+E,N.column);if($.isEmpty())var F=k;else var L=this.session.documentToScreenPosition(O?$.end:$.start),F=this.session.screenToDocumentPosition(L.row+E,L.column);if(O){var P=l.fromPoints(k,F);P.cursor=P.start}else{var P=l.fromPoints(F,k);P.cursor=P.end}if(P.desiredColumn=N.column,!this.selection.inMultiSelectMode)this.selection.addRange($);else if(_)var A=$.cursor;this.selection.addRange(P),A&&this.selection.substractPoint(A)},this.transposeSelections=function(E){for(var _=this.session,$=_.multiSelect,O=$.ranges,N=O.length;N--;){var k=O[N];if(k.isEmpty()){var L=_.getWordRange(k.start.row,k.start.column);k.start.row=L.start.row,k.start.column=L.start.column,k.end.row=L.end.row,k.end.column=L.end.column}}$.mergeOverlappingRanges();for(var F=[],N=O.length;N--;){var k=O[N];F.unshift(_.getTextRange(k))}E<0?F.unshift(F.pop()):F.push(F.shift());for(var N=O.length;N--;){var k=O[N],P=k.clone();_.replace(k,F[N]),k.start.row=P.start.row,k.start.column=P.start.column}$.fromOrientedRange($.ranges[0])},this.selectMore=function(E,_,$){var O=this.session,N=O.multiSelect,k=N.toOrientedRange();if(!(k.isEmpty()&&(k=O.getWordRange(k.start.row,k.start.column),k.cursor=E==-1?k.start:k.end,this.multiSelect.addRange(k),$))){var L=O.getTextRange(k),F=f(O,L,E);F&&(F.cursor=E==-1?F.start:F.end,this.session.unfold(F),this.multiSelect.addRange(F),this.renderer.scrollCursorIntoView(null,.5)),_&&this.multiSelect.substractPoint(k.cursor)}},this.alignCursors=function(){var E=this.session,_=E.multiSelect,$=_.ranges,O=-1,N=$.filter(function(B){if(B.cursor.row==O)return!0;O=B.cursor.row});if(!$.length||N.length==$.length-1){var k=this.selection.getRange(),L=k.start.row,F=k.end.row,P=L==F;if(P){var A=this.session.getLength(),M;do M=this.session.getLine(F);while(/[=:]/.test(M)&&++F0);L<0&&(L=0),F>=A&&(F=A-1)}var R=this.session.removeFullLines(L,F);R=this.$reAlignText(R,P),this.session.insert({row:L,column:0},R.join(` +`)+` +`),P||(k.start.column=0,k.end.column=R[R.length-1].length),this.selection.setRange(k)}else{N.forEach(function(B){_.substractPoint(B.cursor)});var I=0,D=1/0,j=$.map(function(B){var V=B.cursor,H=E.getLine(V.row),Y=H.substr(V.column).search(/\S/g);return Y==-1&&(Y=0),V.column>I&&(I=V.column),YU?E.insert(H,s.stringRepeat(" ",Y-U)):E.remove(new l(H.row,H.column,H.row,H.column-Y+U)),B.start.column=B.end.column=I,B.start.row=B.end.row=H.row,B.cursor=B.end}),_.fromOrientedRange($[0]),this.renderer.updateCursor(),this.renderer.updateBackMarkers()}},this.$reAlignText=function(E,_){var $=!0,O=!0,N,k,L;return E.map(function(R){var I=R.match(/(\s*)(.*?)(\s*)([=:].*)/);return I?N==null?(N=I[1].length,k=I[2].length,L=I[3].length,I):(N+k+L!=I[1].length+I[2].length+I[3].length&&(O=!1),N!=I[1].length&&($=!1),N>I[1].length&&(N=I[1].length),kI[3].length&&(L=I[3].length),I):[R]}).map(_?P:$?O?A:P:M);function F(R){return s.stringRepeat(" ",R)}function P(R){return R[2]?F(N)+R[2]+F(k-R[2].length+L)+R[4].replace(/^([=:])\s+/,"$1 "):R[0]}function A(R){return R[2]?F(N+k-R[2].length)+R[2]+F(L)+R[4].replace(/^([=:])\s+/,"$1 "):R[0]}function M(R){return R[2]?F(N)+R[2]+F(L)+R[4].replace(/^([=:])\s+/,"$1 "):R[0]}}}).call(y.prototype);function b(E,_){return E.row==_.row&&E.column==_.column}r.onSessionChange=function(E){var _=E.session;_&&!_.multiSelect&&(_.$selectionMarkers=[],_.selection.$initRangeList(),_.multiSelect=_.selection),this.multiSelect=_&&_.multiSelect;var $=E.oldSession;$&&($.multiSelect.off("addRange",this.$onAddRange),$.multiSelect.off("removeRange",this.$onRemoveRange),$.multiSelect.off("multiSelect",this.$onMultiSelect),$.multiSelect.off("singleSelect",this.$onSingleSelect),$.multiSelect.lead.off("change",this.$checkMultiselectChange),$.multiSelect.anchor.off("change",this.$checkMultiselectChange)),_&&(_.multiSelect.on("addRange",this.$onAddRange),_.multiSelect.on("removeRange",this.$onRemoveRange),_.multiSelect.on("multiSelect",this.$onMultiSelect),_.multiSelect.on("singleSelect",this.$onSingleSelect),_.multiSelect.lead.on("change",this.$checkMultiselectChange),_.multiSelect.anchor.on("change",this.$checkMultiselectChange)),_&&this.inMultiSelectMode!=_.selection.inMultiSelectMode&&(_.selection.inMultiSelectMode?this.$onMultiSelect():this.$onSingleSelect())};function w(E){E.$multiselectOnSessionChange||(E.$onAddRange=E.$onAddRange.bind(E),E.$onRemoveRange=E.$onRemoveRange.bind(E),E.$onMultiSelect=E.$onMultiSelect.bind(E),E.$onSingleSelect=E.$onSingleSelect.bind(E),E.$multiselectOnSessionChange=r.onSessionChange.bind(E),E.$checkMultiselectChange=E.$checkMultiselectChange.bind(E),E.$multiselectOnSessionChange(E),E.on("changeSession",E.$multiselectOnSessionChange),E.on("mousedown",u),E.commands.addCommands(c.defaultCommands),x(E))}function x(E){if(!E.textInput)return;var _=E.textInput.getElement(),$=!1;p.addListener(_,"keydown",function(N){var k=N.keyCode==18&&!(N.ctrlKey||N.shiftKey||N.metaKey);E.$blockSelectEnabled&&k?$||(E.renderer.setMouseCursor("crosshair"),$=!0):$&&O()},E),p.addListener(_,"keyup",O,E),p.addListener(_,"blur",O,E);function O(N){$&&(E.renderer.setMouseCursor(""),$=!1)}}r.MultiSelect=w,n("./config").defineOptions(y.prototype,"editor",{enableMultiselect:{set:function(E){w(this),E?this.on("mousedown",u):this.off("mousedown",u)},value:!0},enableBlockSelect:{set:function(E){this.$blockSelectEnabled=E},value:!0}})}),ace.define("ace/mode/folding/fold_mode",["require","exports","module","ace/range"],function(n,r,i){var o=n("../../range").Range,l=r.FoldMode=function(){};(function(){this.foldingStartMarker=null,this.foldingStopMarker=null,this.getFoldWidget=function(m,u,p){var s=m.getLine(p);return this.foldingStartMarker.test(s)?"start":u=="markbeginend"&&this.foldingStopMarker&&this.foldingStopMarker.test(s)?"end":""},this.getFoldWidgetRange=function(m,u,p){return null},this.indentationBlock=function(m,u,p){var s=/\S/,c=m.getLine(u),d=c.search(s);if(d!=-1){for(var h=p||c.length,f=m.getLength(),v=u,y=u;++uv){var x=m.getLine(y).length;return new o(v,h,y,x)}}},this.openingBracketBlock=function(m,u,p,s,c){var d={row:p,column:s+1},h=m.$findClosingBracket(u,d,c);if(h){var f=m.foldWidgets[h.row];return f==null&&(f=m.getFoldWidget(h.row)),f=="start"&&h.row>d.row&&(h.row--,h.column=m.getLine(h.row).length),o.fromPoints(d,h)}},this.closingBracketBlock=function(m,u,p,s,c){var d={row:p,column:s},h=m.$findOpeningBracket(u,d);if(h)return h.column++,d.column--,o.fromPoints(h,d)}}).call(l.prototype)}),ace.define("ace/ext/error_marker",["require","exports","module","ace/lib/dom","ace/range","ace/config"],function(n,r,i){var o=n("../lib/dom"),l=n("../range").Range,m=n("../config").nls;function u(s,c,d){for(var h=0,f=s.length-1;h<=f;){var v=h+f>>1,y=d(c,s[v]);if(y>0)h=v+1;else if(y<0)f=v-1;else return v}return-(h+1)}function p(s,c,d){var h=s.getAnnotations().sort(l.comparePoints);if(h.length){var f=u(h,{row:c,column:-1},l.comparePoints);f<0&&(f=-f-1),f>=h.length?f=d>0?0:h.length-1:f===0&&d<0&&(f=h.length-1);var v=h[f];if(!(!v||!d)){if(v.row===c){do v=h[f+=d];while(v&&v.row===c);if(!v)return h.slice()}var y=[];c=v.row;do y[d<0?"unshift":"push"](v),v=h[f+=d];while(v&&v.row==c);return y.length&&y}}}r.showErrorMarker=function(s,c){var d=s.session,h=s.getCursorPosition(),f=h.row,v=d.widgetManager.getWidgetsAtRow(f).filter(function(N){return N.type=="errorMarker"})[0];v?v.destroy():f-=c;var y=p(d,f,c),b;if(y){var w=y[0];h.column=(w.pos&&typeof w.column!="number"?w.pos.sc:w.column)||0,h.row=w.row,b=s.renderer.$gutterLayer.$annotations[h.row]}else{if(v)return;b={displayText:[m("error-marker.good-state","Looks good!")],className:"ace_ok"}}s.session.unfold(h.row),s.selection.moveToPosition(h);var x={row:h.row,fixedWidth:!0,coverGutter:!0,el:o.createElement("div"),type:"errorMarker"},E=x.el.appendChild(o.createElement("div")),_=x.el.appendChild(o.createElement("div"));_.className="error_widget_arrow "+b.className;var $=s.renderer.$cursorLayer.getPixelPosition(h).left;_.style.left=$+s.renderer.gutterWidth-5+"px",x.el.className="error_widget_wrapper",E.className="error_widget "+b.className,b.displayText.forEach(function(N,k){E.appendChild(o.createTextNode(N)),k-1}function Kt(ee,he){var Fe=this.__data__,gt=_r(Fe,ee);return gt<0?(++this.size,Fe.push([ee,he])):Fe[gt][1]=he,this}Ht.prototype.clear=yn,Ht.prototype.delete=Cn,Ht.prototype.get=Rn,Ht.prototype.has=cn,Ht.prototype.set=Kt;function Xe(ee){var he=-1,Fe=ee==null?0:ee.length;for(this.clear();++heQn))return!1;var Mn=Pt.get(ee);if(Mn&&Pt.get(he))return Mn==he;var vr=-1,Jr=!0,Zn=Fe&o?new en:void 0;for(Pt.set(ee,he),Pt.set(he,ee);++vr-1&&ee%1==0&&ee-1&&ee%1==0&&ee<=l}function _n(ee){var he=typeof ee;return ee!=null&&(he=="object"||he=="function")}function sn(ee){return ee!=null&&typeof ee=="object"}var ro=me?Pe(me):Xt;function ma(ee){return Ur(ee)?qn(ee):Zt(ee)}function io(){return[]}function Ci(){return!1}e.exports=pt}(Gl,Gl.exports)),Gl.exports}var Ui={},wC;function h_(){if(wC)return Ui;wC=1,Object.defineProperty(Ui,"__esModule",{value:!0}),Ui.getAceInstance=Ui.debounce=Ui.editorEvents=Ui.editorOptions=void 0;var e=["minLines","maxLines","readOnly","highlightActiveLine","tabSize","enableBasicAutocompletion","enableLiveAutocompletion","enableSnippets"];Ui.editorOptions=e;var t=["onChange","onFocus","onInput","onBlur","onCopy","onPaste","onSelectionChange","onCursorChange","onScroll","handleOptions","updateRef"];Ui.editorEvents=t;var n=function(){var i;return typeof window>"u"?(ho.window={},i=jd(),delete ho.window):window.ace?(i=window.ace,i.acequire=window.ace.require||window.ace.acequire):i=jd(),i};Ui.getAceInstance=n;var r=function(i,o){var l=null;return function(){var m=this,u=arguments;clearTimeout(l),l=setTimeout(function(){i.apply(m,u)},o)}};return Ui.debounce=r,Ui}var SC;function tH(){if(SC)return ta;SC=1;var e=ta&&ta.__extends||function(){var p=function(s,c){return p=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,h){d.__proto__=h}||function(d,h){for(var f in h)Object.prototype.hasOwnProperty.call(h,f)&&(d[f]=h[f])},p(s,c)};return function(s,c){if(typeof c!="function"&&c!==null)throw new TypeError("Class extends value "+String(c)+" is not a constructor or null");p(s,c);function d(){this.constructor=s}s.prototype=c===null?Object.create(c):(d.prototype=c.prototype,new d)}}(),t=ta&&ta.__assign||function(){return t=Object.assign||function(p){for(var s,c=1,d=arguments.length;c0&&this.handleMarkers(I);var V=this.editor.$options;l.editorOptions.forEach(function(H){V.hasOwnProperty(H)?c.editor.setOption(H,c.props[H]):c.props[H]&&console.warn("ReactAce: editor option ".concat(H," was activated but not found. Did you need to import a related tool or did you possibly mispell the option?"))}),this.handleOptions(this.props),Array.isArray(M)&&M.forEach(function(H){typeof H.exec=="string"?c.editor.commands.bindKey(H.bindKey,H.exec):c.editor.commands.addCommand(H)}),P&&this.editor.setKeyboardHandler("ace/keyboard/"+P),h&&(this.refEditor.className+=" "+h),A&&A(this.editor),this.editor.resize(),b&&this.editor.focus()},s.prototype.componentDidUpdate=function(c){for(var d=c,h=this.props,f=0;f 0!";if(c!=this.$splits){if(c>this.$splits){for(;this.$splitsc;)d=this.$editors[this.$splits-1],this.$container.removeChild(d.container),this.$splits--;this.resize()}},this.getSplits=function(){return this.$splits},this.getEditor=function(c){return this.$editors[c]},this.getCurrentEditor=function(){return this.$cEditor},this.focus=function(){this.$cEditor.focus()},this.blur=function(){this.$cEditor.blur()},this.setTheme=function(c){this.$editors.forEach(function(d){d.setTheme(c)})},this.setKeyboardHandler=function(c){this.$editors.forEach(function(d){d.setKeyboardHandler(c)})},this.forEach=function(c,d){this.$editors.forEach(c,d)},this.$fontSize="",this.setFontSize=function(c){this.$fontSize=c,this.forEach(function(d){d.setFontSize(c)})},this.$cloneSession=function(c){var d=new p(c.getDocument(),c.getMode()),h=c.getUndoManager();return d.setUndoManager(h),d.setTabSize(c.getTabSize()),d.setUseSoftTabs(c.getUseSoftTabs()),d.setOverwrite(c.getOverwrite()),d.setBreakpoints(c.getBreakpoints()),d.setUseWrapMode(c.getUseWrapMode()),d.setUseWorker(c.getUseWorker()),d.setWrapLimitRange(c.$wrapLimitRange.min,c.$wrapLimitRange.max),d.$foldData=c.$cloneFoldData(),d},this.setSession=function(c,d){var h;d==null?h=this.$cEditor:h=this.$editors[d];var f=this.$editors.some(function(v){return v.session===c});return f&&(c=this.$cloneSession(c)),h.setSession(c),c},this.getOrientation=function(){return this.$orientation},this.setOrientation=function(c){this.$orientation!=c&&(this.$orientation=c,this.resize())},this.resize=function(){var c=this.$container.clientWidth,d=this.$container.clientHeight,h;if(this.$orientation==this.BESIDE)for(var f=c/this.$splits,v=0;v-1}function Z(te,fe){var je=this.__data__,ct=me(je,te);return ct<0?je.push([te,fe]):je[ct][1]=fe,this}Y.prototype.clear=U,Y.prototype.delete=K,Y.prototype.get=G,Y.prototype.has=q,Y.prototype.set=Z;function Q(te){var fe=-1,je=te?te.length:0;for(this.clear();++fe0&&h.handleMarkers(J,U);for(var G=0;G"u"&&(this.Diff_Timeout<=0?u=Number.MAX_VALUE:u=new Date().getTime()+this.Diff_Timeout*1e3);var p=u;if(o==null||l==null)throw new Error("Null input. (diff_main)");if(o==l)return o?[new t.Diff(i,o)]:[];typeof m>"u"&&(m=!0);var s=m,c=this.diff_commonPrefix(o,l),d=o.substring(0,c);o=o.substring(c),l=l.substring(c),c=this.diff_commonSuffix(o,l);var h=o.substring(o.length-c);o=o.substring(0,o.length-c),l=l.substring(0,l.length-c);var f=this.diff_compute_(o,l,s,p);return d&&f.unshift(new t.Diff(i,d)),h&&f.push(new t.Diff(i,h)),this.diff_cleanupMerge(f),f},t.prototype.diff_compute_=function(o,l,m,u){var p;if(!o)return[new t.Diff(r,l)];if(!l)return[new t.Diff(n,o)];var s=o.length>l.length?o:l,c=o.length>l.length?l:o,d=s.indexOf(c);if(d!=-1)return p=[new t.Diff(r,s.substring(0,d)),new t.Diff(i,c),new t.Diff(r,s.substring(d+c.length))],o.length>l.length&&(p[0][0]=p[2][0]=n),p;if(c.length==1)return[new t.Diff(n,o),new t.Diff(r,l)];var h=this.diff_halfMatch_(o,l);if(h){var f=h[0],v=h[1],y=h[2],b=h[3],w=h[4],x=this.diff_main(f,y,m,u),E=this.diff_main(v,b,m,u);return x.concat([new t.Diff(i,w)],E)}return m&&o.length>100&&l.length>100?this.diff_lineMode_(o,l,u):this.diff_bisect_(o,l,u)},t.prototype.diff_lineMode_=function(o,l,m){var u=this.diff_linesToChars_(o,l);o=u.chars1,l=u.chars2;var p=u.lineArray,s=this.diff_main(o,l,!1,m);this.diff_charsToLines_(s,p),this.diff_cleanupSemantic(s),s.push(new t.Diff(i,""));for(var c=0,d=0,h=0,f="",v="";c=1&&h>=1){s.splice(c-d-h,d+h),c=c-d-h;for(var y=this.diff_main(f,v,!1,m),b=y.length-1;b>=0;b--)s.splice(c,0,y[b]);c=c+y.length}h=0,d=0,f="",v="";break}c++}return s.pop(),s},t.prototype.diff_bisect_=function(o,l,m){for(var u=o.length,p=l.length,s=Math.ceil((u+p)/2),c=s,d=2*s,h=new Array(d),f=new Array(d),v=0;vm);$++){for(var O=-$+w;O<=$-x;O+=2){var N=c+O,k;O==-$||O!=$&&h[N-1]u)x+=2;else if(L>p)w+=2;else if(b){var F=c+y-O;if(F>=0&&F=P)return this.diff_bisectSplit_(o,l,k,L,m)}}}for(var A=-$+E;A<=$-_;A+=2){var F=c+A,P;A==-$||A!=$&&f[F-1]u)_+=2;else if(M>p)E+=2;else if(!b){var N=c+y-A;if(N>=0&&N=P)return this.diff_bisectSplit_(o,l,k,L,m)}}}}return[new t.Diff(n,o),new t.Diff(r,l)]},t.prototype.diff_bisectSplit_=function(o,l,m,u,p){var s=o.substring(0,m),c=l.substring(0,u),d=o.substring(m),h=l.substring(u),f=this.diff_main(s,c,!1,p),v=this.diff_main(d,h,!1,p);return f.concat(v)},t.prototype.diff_linesToChars_=function(o,l){var m=[],u={};m[0]="";function p(h){for(var f="",v=0,y=-1,b=m.length;yu?o=o.substring(m-u):ml.length?o:l,u=o.length>l.length?l:o;if(m.length<4||u.length*2=x.length?[k,L,F,P,N]:null}var c=s(m,u,Math.ceil(m.length/4)),d=s(m,u,Math.ceil(m.length/2)),h;if(!c&&!d)return null;d?c?h=c[4].length>d[4].length?c:d:h=d:h=c;var f,v,y,b;o.length>l.length?(f=h[0],v=h[1],y=h[2],b=h[3]):(y=h[0],b=h[1],f=h[2],v=h[3]);var w=h[4];return[f,v,y,b,w]},t.prototype.diff_cleanupSemantic=function(o){for(var l=!1,m=[],u=0,p=null,s=0,c=0,d=0,h=0,f=0;s0?m[u-1]:-1,c=0,d=0,h=0,f=0,p=null,l=!0)),s++;for(l&&this.diff_cleanupMerge(o),this.diff_cleanupSemanticLossless(o),s=1;s=w?(b>=v.length/2||b>=y.length/2)&&(o.splice(s,0,new t.Diff(i,y.substring(0,b))),o[s-1][1]=v.substring(0,v.length-b),o[s+1][1]=y.substring(b),s++):(w>=v.length/2||w>=y.length/2)&&(o.splice(s,0,new t.Diff(i,v.substring(0,w))),o[s-1][0]=r,o[s-1][1]=y.substring(0,y.length-w),o[s+1][0]=n,o[s+1][1]=v.substring(w),s++),s++}s++}},t.prototype.diff_cleanupSemanticLossless=function(o){function l(w,x){if(!w||!x)return 6;var E=w.charAt(w.length-1),_=x.charAt(0),$=E.match(t.nonAlphaNumericRegex_),O=_.match(t.nonAlphaNumericRegex_),N=$&&E.match(t.whitespaceRegex_),k=O&&_.match(t.whitespaceRegex_),L=N&&E.match(t.linebreakRegex_),F=k&&_.match(t.linebreakRegex_),P=L&&w.match(t.blanklineEndRegex_),A=F&&x.match(t.blanklineStartRegex_);return P||A?5:L||F?4:$&&!N&&k?3:N||k?2:$||O?1:0}for(var m=1;m=y&&(y=b,h=u,f=p,v=s)}o[m-1][1]!=h&&(h?o[m-1][1]=h:(o.splice(m-1,1),m--),o[m][1]=f,v?o[m+1][1]=v:(o.splice(m+1,1),m--))}m++}},t.nonAlphaNumericRegex_=/[^a-zA-Z0-9]/,t.whitespaceRegex_=/\s/,t.linebreakRegex_=/[\r\n]/,t.blanklineEndRegex_=/\n\r?\n$/,t.blanklineStartRegex_=/^\r?\n\r?\n/,t.prototype.diff_cleanupEfficiency=function(o){for(var l=!1,m=[],u=0,p=null,s=0,c=!1,d=!1,h=!1,f=!1;s0?m[u-1]:-1,h=f=!1),l=!0)),s++;l&&this.diff_cleanupMerge(o)},t.prototype.diff_cleanupMerge=function(o){o.push(new t.Diff(i,""));for(var l=0,m=0,u=0,p="",s="",c;l1?(m!==0&&u!==0&&(c=this.diff_commonPrefix(s,p),c!==0&&(l-m-u>0&&o[l-m-u-1][0]==i?o[l-m-u-1][1]+=s.substring(0,c):(o.splice(0,0,new t.Diff(i,s.substring(0,c))),l++),s=s.substring(c),p=p.substring(c)),c=this.diff_commonSuffix(s,p),c!==0&&(o[l][1]=s.substring(s.length-c)+o[l][1],s=s.substring(0,s.length-c),p=p.substring(0,p.length-c))),l-=m+u,o.splice(l,m+u),p.length&&(o.splice(l,0,new t.Diff(n,p)),l++),s.length&&(o.splice(l,0,new t.Diff(r,s)),l++),l++):l!==0&&o[l-1][0]==i?(o[l-1][1]+=o[l][1],o.splice(l,1)):l++,u=0,m=0,p="",s="";break}o[o.length-1][1]===""&&o.pop();var d=!1;for(l=1;ll));c++)p=m,s=u;return o.length!=c&&o[c][0]===n?s:s+(l-p)},t.prototype.diff_prettyHtml=function(o){for(var l=[],m=/&/g,u=//g,s=/\n/g,c=0;c");switch(d){case r:l[c]=''+f+"";break;case n:l[c]=''+f+"";break;case i:l[c]=""+f+"";break}}return l.join("")},t.prototype.diff_text1=function(o){for(var l=[],m=0;mthis.Match_MaxBits)throw new Error("Pattern too long for this browser.");var u=this.match_alphabet_(l),p=this;function s(k,L){var F=k/l.length,P=Math.abs(m-L);return p.Match_Distance?F+P/p.Match_Distance:P?1:F}var c=this.Match_Threshold,d=o.indexOf(l,m);d!=-1&&(c=Math.min(s(0,d),c),d=o.lastIndexOf(l,m+l.length),d!=-1&&(c=Math.min(s(0,d),c)));var h=1<=x;$--){var O=u[o.charAt($-1)];if(w===0?_[$]=(_[$+1]<<1|1)&O:_[$]=(_[$+1]<<1|1)&O|((b[$+1]|b[$])<<1|1)|b[$+1],_[$]&h){var N=s(w,$-1);if(N<=c)if(c=N,d=$-1,d>m)x=Math.max(1,2*m-d);else break}}if(s(w+1,m)>c)break;b=_}return d},t.prototype.match_alphabet_=function(o){for(var l={},m=0;m"u")u=o,p=this.diff_main(u,l,!0),p.length>2&&(this.diff_cleanupSemantic(p),this.diff_cleanupEfficiency(p));else if(o&&typeof o=="object"&&typeof l>"u"&&typeof m>"u")p=o,u=this.diff_text1(p);else if(typeof o=="string"&&l&&typeof l=="object"&&typeof m>"u")u=o,p=l;else if(typeof o=="string"&&typeof l=="string"&&m&&typeof m=="object")u=o,p=m;else throw new Error("Unknown call format to patch_make.");if(p.length===0)return[];for(var s=[],c=new t.patch_obj,d=0,h=0,f=0,v=u,y=u,b=0;b=2*this.Patch_Margin&&d&&(this.patch_addContext_(c,v),s.push(c),c=new t.patch_obj,d=0,v=y,h=f);break}w!==r&&(h+=x.length),w!==n&&(f+=x.length)}return d&&(this.patch_addContext_(c,v),s.push(c)),s},t.prototype.patch_deepCopy=function(o){for(var l=[],m=0;mthis.Match_MaxBits?(h=this.match_main(l,d.substring(0,this.Match_MaxBits),c),h!=-1&&(f=this.match_main(l,d.substring(d.length-this.Match_MaxBits),c+d.length-this.Match_MaxBits),(f==-1||h>=f)&&(h=-1))):h=this.match_main(l,d,c),h==-1)p[s]=!1,u-=o[s].length2-o[s].length1;else{p[s]=!0,u=h-c;var v;if(f==-1?v=l.substring(h,h+d.length):v=l.substring(h,f+this.Match_MaxBits),d==v)l=l.substring(0,h)+this.diff_text2(o[s].diffs)+l.substring(h+d.length);else{var y=this.diff_main(d,v,!1);if(d.length>this.Match_MaxBits&&this.diff_levenshtein(y)/d.length>this.Patch_DeleteThreshold)p[s]=!1;else{this.diff_cleanupSemanticLossless(y);for(var b=0,w,x=0;xs[0][1].length){var c=l-s[0][1].length;s[0][1]=m.substring(s[0][1].length)+s[0][1],p.start1-=c,p.start2-=c,p.length1+=c,p.length2+=c}if(p=o[o.length-1],s=p.diffs,s.length==0||s[s.length-1][0]!=i)s.push(new t.Diff(i,m)),p.length1+=l,p.length2+=l;else if(l>s[s.length-1][1].length){var c=l-s[s.length-1][1].length;s[s.length-1][1]+=m.substring(0,c),p.length1+=c,p.length2+=c}return m},t.prototype.patch_splitMax=function(o){for(var l=this.Match_MaxBits,m=0;m2*l?(d.length1+=v.length,p+=v.length,h=!1,d.diffs.push(new t.Diff(f,v)),u.diffs.shift()):(v=v.substring(0,l-d.length1-this.Patch_Margin),d.length1+=v.length,p+=v.length,f===i?(d.length2+=v.length,s+=v.length):h=!1,d.diffs.push(new t.Diff(f,v)),v==u.diffs[0][1]?u.diffs.shift():u.diffs[0][1]=u.diffs[0][1].substring(v.length))}c=this.diff_text2(d.diffs),c=c.substring(c.length-this.Patch_Margin);var y=this.diff_text1(u.diffs).substring(0,this.Patch_Margin);y!==""&&(d.length1+=y.length,d.length2+=y.length,d.diffs.length!==0&&d.diffs[d.diffs.length-1][0]===i?d.diffs[d.diffs.length-1][1]+=y:d.diffs.push(new t.Diff(i,y))),h||o.splice(++m,0,d)}}},t.prototype.patch_toText=function(o){for(var l=[],m=0;mb)break;var w=this.getFoldWidgetRange(p,"all",s);if(w){if(w.start.row<=h)break;if(w.isMultiLine())s=w.end.row;else if(d==b)break}v=s}}return new l(h,f,v,p.getLine(v).length)},this.getCommentRegionBlock=function(p,s,c){for(var d=s.search(/\s*$/),h=p.getLength(),f=c,v=/^\s*(?:\/\*|\/\/|--)#?(end)?region\b/,y=1;++cf)return new l(f,d,w,s.length)}}).call(u.prototype)}),ace.define("ace/mode/json",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/json_highlight_rules","ace/mode/matching_brace_outdent","ace/mode/folding/cstyle","ace/worker/worker_client"],function(n,r,i){var o=n("../lib/oop"),l=n("./text").Mode,m=n("./json_highlight_rules").JsonHighlightRules,u=n("./matching_brace_outdent").MatchingBraceOutdent,p=n("./folding/cstyle").FoldMode,s=n("../worker/worker_client").WorkerClient,c=function(){this.HighlightRules=m,this.$outdent=new u,this.$behaviour=this.$defaultBehaviour,this.foldingRules=new p};o.inherits(c,l),(function(){this.lineCommentStart="//",this.blockComment={start:"/*",end:"*/"},this.getNextLineIndent=function(d,h,f){var v=this.$getIndent(h);if(d=="start"){var y=h.match(/^.*[\{\(\[]\s*$/);y&&(v+=f)}return v},this.checkOutdent=function(d,h,f){return this.$outdent.checkOutdent(h,f)},this.autoOutdent=function(d,h,f){this.$outdent.autoOutdent(h,f)},this.createWorker=function(d){var h=new s(["ace"],"ace/mode/json_worker","JsonWorker");return h.attachToDocument(d.getDocument()),h.on("annotate",function(f){d.setAnnotations(f.data)}),h.on("terminate",function(){d.clearAnnotations()}),h},this.$id="ace/mode/json"}).call(c.prototype),r.Mode=c}),function(){ace.require(["ace/mode/json"],function(n){e&&(e.exports=n)})}()}(dg)),dg.exports}cH();var fg={exports:{}},OC;function uH(){return OC||(OC=1,function(e,t){ace.define("ace/theme/tomorrow-css",["require","exports","module"],function(n,r,i){i.exports=`.ace-tomorrow .ace_gutter { + background: #f6f6f6; + color: #4D4D4C +} + +.ace-tomorrow .ace_print-margin { + width: 1px; + background: #f6f6f6 +} + +.ace-tomorrow { + background-color: #FFFFFF; + color: #4D4D4C +} + +.ace-tomorrow .ace_cursor { + color: #AEAFAD +} + +.ace-tomorrow .ace_marker-layer .ace_selection { + background: #D6D6D6 +} + +.ace-tomorrow.ace_multiselect .ace_selection.ace_start { + box-shadow: 0 0 3px 0px #FFFFFF; +} + +.ace-tomorrow .ace_marker-layer .ace_step { + background: rgb(255, 255, 0) +} + +.ace-tomorrow .ace_marker-layer .ace_bracket { + margin: -1px 0 0 -1px; + border: 1px solid #D1D1D1 +} + +.ace-tomorrow .ace_marker-layer .ace_active-line { + background: #EFEFEF +} + +.ace-tomorrow .ace_gutter-active-line { + background-color : #dcdcdc +} + +.ace-tomorrow .ace_marker-layer .ace_selected-word { + border: 1px solid #D6D6D6 +} + +.ace-tomorrow .ace_invisible { + color: #D1D1D1 +} + +.ace-tomorrow .ace_keyword, +.ace-tomorrow .ace_meta, +.ace-tomorrow .ace_storage, +.ace-tomorrow .ace_storage.ace_type, +.ace-tomorrow .ace_support.ace_type { + color: #8959A8 +} + +.ace-tomorrow .ace_keyword.ace_operator { + color: #3E999F +} + +.ace-tomorrow .ace_constant.ace_character, +.ace-tomorrow .ace_constant.ace_language, +.ace-tomorrow .ace_constant.ace_numeric, +.ace-tomorrow .ace_keyword.ace_other.ace_unit, +.ace-tomorrow .ace_support.ace_constant, +.ace-tomorrow .ace_variable.ace_parameter { + color: #F5871F +} + +.ace-tomorrow .ace_constant.ace_other { + color: #666969 +} + +.ace-tomorrow .ace_invalid { + color: #FFFFFF; + background-color: #C82829 +} + +.ace-tomorrow .ace_invalid.ace_deprecated { + color: #FFFFFF; + background-color: #8959A8 +} + +.ace-tomorrow .ace_fold { + background-color: #4271AE; + border-color: #4D4D4C +} + +.ace-tomorrow .ace_entity.ace_name.ace_function, +.ace-tomorrow .ace_support.ace_function, +.ace-tomorrow .ace_variable { + color: #4271AE +} + +.ace-tomorrow .ace_support.ace_class, +.ace-tomorrow .ace_support.ace_type { + color: #C99E00 +} + +.ace-tomorrow .ace_heading, +.ace-tomorrow .ace_markup.ace_heading, +.ace-tomorrow .ace_string { + color: #718C00 +} + +.ace-tomorrow .ace_entity.ace_name.ace_tag, +.ace-tomorrow .ace_entity.ace_other.ace_attribute-name, +.ace-tomorrow .ace_meta.ace_tag, +.ace-tomorrow .ace_string.ace_regexp, +.ace-tomorrow .ace_variable { + color: #C82829 +} + +.ace-tomorrow .ace_comment { + color: #8E908C +} + +.ace-tomorrow .ace_indent-guide { + background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bdu3f/BwAlfgctduB85QAAAABJRU5ErkJggg==) right repeat-y +} + +.ace-tomorrow .ace_indent-guide-active { + background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAAAZSURBVHjaYvj///9/hivKyv8BAAAA//8DACLqBhbvk+/eAAAAAElFTkSuQmCC") right repeat-y; +} +`}),ace.define("ace/theme/tomorrow",["require","exports","module","ace/theme/tomorrow-css","ace/lib/dom"],function(n,r,i){r.isDark=!1,r.cssClass="ace-tomorrow",r.cssText=n("./tomorrow-css");var o=n("../lib/dom");o.importCssString(r.cssText,r.cssClass,!1)}),function(){ace.require(["ace/theme/tomorrow"],function(n){e&&(e.exports=n)})}()}(fg)),fg.exports}uH();const g_=C.createContext({}),dH={aliceblue:"9ehhb",antiquewhite:"9sgk7",aqua:"1ekf",aquamarine:"4zsno",azure:"9eiv3",beige:"9lhp8",bisque:"9zg04",black:"0",blanchedalmond:"9zhe5",blue:"73",blueviolet:"5e31e",brown:"6g016",burlywood:"8ouiv",cadetblue:"3qba8",chartreuse:"4zshs",chocolate:"87k0u",coral:"9yvyo",cornflowerblue:"3xael",cornsilk:"9zjz0",crimson:"8l4xo",cyan:"1ekf",darkblue:"3v",darkcyan:"rkb",darkgoldenrod:"776yz",darkgray:"6mbhl",darkgreen:"jr4",darkgrey:"6mbhl",darkkhaki:"7ehkb",darkmagenta:"5f91n",darkolivegreen:"3bzfz",darkorange:"9yygw",darkorchid:"5z6x8",darkred:"5f8xs",darksalmon:"9441m",darkseagreen:"5lwgf",darkslateblue:"2th1n",darkslategray:"1ugcv",darkslategrey:"1ugcv",darkturquoise:"14up",darkviolet:"5rw7n",deeppink:"9yavn",deepskyblue:"11xb",dimgray:"442g9",dimgrey:"442g9",dodgerblue:"16xof",firebrick:"6y7tu",floralwhite:"9zkds",forestgreen:"1cisi",fuchsia:"9y70f",gainsboro:"8m8kc",ghostwhite:"9pq0v",goldenrod:"8j4f4",gold:"9zda8",gray:"50i2o",green:"pa8",greenyellow:"6senj",grey:"50i2o",honeydew:"9eiuo",hotpink:"9yrp0",indianred:"80gnw",indigo:"2xcoy",ivory:"9zldc",khaki:"9edu4",lavenderblush:"9ziet",lavender:"90c8q",lawngreen:"4vk74",lemonchiffon:"9zkct",lightblue:"6s73a",lightcoral:"9dtog",lightcyan:"8s1rz",lightgoldenrodyellow:"9sjiq",lightgray:"89jo3",lightgreen:"5nkwg",lightgrey:"89jo3",lightpink:"9z6wx",lightsalmon:"9z2ii",lightseagreen:"19xgq",lightskyblue:"5arju",lightslategray:"4nwk9",lightslategrey:"4nwk9",lightsteelblue:"6wau6",lightyellow:"9zlcw",lime:"1edc",limegreen:"1zcxe",linen:"9shk6",magenta:"9y70f",maroon:"4zsow",mediumaquamarine:"40eju",mediumblue:"5p",mediumorchid:"79qkz",mediumpurple:"5r3rv",mediumseagreen:"2d9ip",mediumslateblue:"4tcku",mediumspringgreen:"1di2",mediumturquoise:"2uabw",mediumvioletred:"7rn9h",midnightblue:"z980",mintcream:"9ljp6",mistyrose:"9zg0x",moccasin:"9zfzp",navajowhite:"9zest",navy:"3k",oldlace:"9wq92",olive:"50hz4",olivedrab:"472ub",orange:"9z3eo",orangered:"9ykg0",orchid:"8iu3a",palegoldenrod:"9bl4a",palegreen:"5yw0o",paleturquoise:"6v4ku",palevioletred:"8k8lv",papayawhip:"9zi6t",peachpuff:"9ze0p",peru:"80oqn",pink:"9z8wb",plum:"8nba5",powderblue:"6wgdi",purple:"4zssg",rebeccapurple:"3zk49",red:"9y6tc",rosybrown:"7cv4f",royalblue:"2jvtt",saddlebrown:"5fmkz",salmon:"9rvci",sandybrown:"9jn1c",seagreen:"1tdnb",seashell:"9zje6",sienna:"6973h",silver:"7ir40",skyblue:"5arjf",slateblue:"45e4t",slategray:"4e100",slategrey:"4e100",snow:"9zke2",springgreen:"1egv",steelblue:"2r1kk",tan:"87yx8",teal:"pds",thistle:"8ggk8",tomato:"9yqfb",turquoise:"2j4r4",violet:"9b10u",wheat:"9ld4j",white:"9zldr",whitesmoke:"9lhpx",yellow:"9zl6o",yellowgreen:"61fzm"},$r=Math.round;function hg(e,t){const n=e.replace(/^[^(]*\((.*)/,"$1").replace(/\).*/,"").match(/\d*\.?\d+%?/g)||[],r=n.map(i=>parseFloat(i));for(let i=0;i<3;i+=1)r[i]=t(r[i]||0,n[i]||"",i);return n[3]?r[3]=n[3].includes("%")?r[3]/100:r[3]:r[3]=1,r}const AC=(e,t,n)=>n===0?e:e/100;function jl(e,t){const n=t||255;return e>n?n:e<0?0:e}class Ps{constructor(t){hi(this,"isValid",!0);hi(this,"r",0);hi(this,"g",0);hi(this,"b",0);hi(this,"a",1);hi(this,"_h");hi(this,"_s");hi(this,"_l");hi(this,"_v");hi(this,"_max");hi(this,"_min");hi(this,"_brightness");function n(i){return i[0]in t&&i[1]in t&&i[2]in t}if(t)if(typeof t=="string"){let o=function(l){return i.startsWith(l)};var r=o;const i=t.trim();if(/^#?[A-F\d]{3,8}$/i.test(i))this.fromHexString(i);else if(o("rgb"))this.fromRgbString(i);else if(o("hsl"))this.fromHslString(i);else if(o("hsv")||o("hsb"))this.fromHsvString(i);else{const l=dH[i.toLowerCase()];l&&this.fromHexString(parseInt(l,36).toString(16).padStart(6,"0"))}}else if(t instanceof Ps)this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this._h=t._h,this._s=t._s,this._l=t._l,this._v=t._v;else if(n("rgb"))this.r=jl(t.r),this.g=jl(t.g),this.b=jl(t.b),this.a=typeof t.a=="number"?jl(t.a,1):1;else if(n("hsl"))this.fromHsl(t);else if(n("hsv"))this.fromHsv(t);else throw new Error("@ant-design/fast-color: unsupported input "+JSON.stringify(t))}setR(t){return this._sc("r",t)}setG(t){return this._sc("g",t)}setB(t){return this._sc("b",t)}setA(t){return this._sc("a",t,1)}setHue(t){const n=this.toHsv();return n.h=t,this._c(n)}getLuminance(){function t(o){const l=o/255;return l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4)}const n=t(this.r),r=t(this.g),i=t(this.b);return .2126*n+.7152*r+.0722*i}getHue(){if(typeof this._h>"u"){const t=this.getMax()-this.getMin();t===0?this._h=0:this._h=$r(60*(this.r===this.getMax()?(this.g-this.b)/t+(this.g"u"){const t=this.getMax()-this.getMin();t===0?this._s=0:this._s=t/this.getMax()}return this._s}getLightness(){return typeof this._l>"u"&&(this._l=(this.getMax()+this.getMin())/510),this._l}getValue(){return typeof this._v>"u"&&(this._v=this.getMax()/255),this._v}getBrightness(){return typeof this._brightness>"u"&&(this._brightness=(this.r*299+this.g*587+this.b*114)/1e3),this._brightness}darken(t=10){const n=this.getHue(),r=this.getSaturation();let i=this.getLightness()-t/100;return i<0&&(i=0),this._c({h:n,s:r,l:i,a:this.a})}lighten(t=10){const n=this.getHue(),r=this.getSaturation();let i=this.getLightness()+t/100;return i>1&&(i=1),this._c({h:n,s:r,l:i,a:this.a})}mix(t,n=50){const r=this._c(t),i=n/100,o=m=>(r[m]-this[m])*i+this[m],l={r:$r(o("r")),g:$r(o("g")),b:$r(o("b")),a:$r(o("a")*100)/100};return this._c(l)}tint(t=10){return this.mix({r:255,g:255,b:255,a:1},t)}shade(t=10){return this.mix({r:0,g:0,b:0,a:1},t)}onBackground(t){const n=this._c(t),r=this.a+n.a*(1-this.a),i=o=>$r((this[o]*this.a+n[o]*n.a*(1-this.a))/r);return this._c({r:i("r"),g:i("g"),b:i("b"),a:r})}isDark(){return this.getBrightness()<128}isLight(){return this.getBrightness()>=128}equals(t){return this.r===t.r&&this.g===t.g&&this.b===t.b&&this.a===t.a}clone(){return this._c(this)}toHexString(){let t="#";const n=(this.r||0).toString(16);t+=n.length===2?n:"0"+n;const r=(this.g||0).toString(16);t+=r.length===2?r:"0"+r;const i=(this.b||0).toString(16);if(t+=i.length===2?i:"0"+i,typeof this.a=="number"&&this.a>=0&&this.a<1){const o=$r(this.a*255).toString(16);t+=o.length===2?o:"0"+o}return t}toHsl(){return{h:this.getHue(),s:this.getSaturation(),l:this.getLightness(),a:this.a}}toHslString(){const t=this.getHue(),n=$r(this.getSaturation()*100),r=$r(this.getLightness()*100);return this.a!==1?`hsla(${t},${n}%,${r}%,${this.a})`:`hsl(${t},${n}%,${r}%)`}toHsv(){return{h:this.getHue(),s:this.getSaturation(),v:this.getValue(),a:this.a}}toRgb(){return{r:this.r,g:this.g,b:this.b,a:this.a}}toRgbString(){return this.a!==1?`rgba(${this.r},${this.g},${this.b},${this.a})`:`rgb(${this.r},${this.g},${this.b})`}toString(){return this.toRgbString()}_sc(t,n,r){const i=this.clone();return i[t]=jl(n,r),i}_c(t){return new this.constructor(t)}getMax(){return typeof this._max>"u"&&(this._max=Math.max(this.r,this.g,this.b)),this._max}getMin(){return typeof this._min>"u"&&(this._min=Math.min(this.r,this.g,this.b)),this._min}fromHexString(t){const n=t.replace("#","");function r(i,o){return parseInt(n[i]+n[o||i],16)}n.length<6?(this.r=r(0),this.g=r(1),this.b=r(2),this.a=n[3]?r(3)/255:1):(this.r=r(0,1),this.g=r(2,3),this.b=r(4,5),this.a=n[6]?r(6,7)/255:1)}fromHsl({h:t,s:n,l:r,a:i}){if(this._h=t%360,this._s=n,this._l=r,this.a=typeof i=="number"?i:1,n<=0){const d=$r(r*255);this.r=d,this.g=d,this.b=d}let o=0,l=0,m=0;const u=t/60,p=(1-Math.abs(2*r-1))*n,s=p*(1-Math.abs(u%2-1));u>=0&&u<1?(o=p,l=s):u>=1&&u<2?(o=s,l=p):u>=2&&u<3?(l=p,m=s):u>=3&&u<4?(l=s,m=p):u>=4&&u<5?(o=s,m=p):u>=5&&u<6&&(o=p,m=s);const c=r-p/2;this.r=$r((o+c)*255),this.g=$r((l+c)*255),this.b=$r((m+c)*255)}fromHsv({h:t,s:n,v:r,a:i}){this._h=t%360,this._s=n,this._v=r,this.a=typeof i=="number"?i:1;const o=$r(r*255);if(this.r=o,this.g=o,this.b=o,n<=0)return;const l=t/60,m=Math.floor(l),u=l-m,p=$r(r*(1-n)*255),s=$r(r*(1-n*u)*255),c=$r(r*(1-n*(1-u))*255);switch(m){case 0:this.g=c,this.b=p;break;case 1:this.r=s,this.b=p;break;case 2:this.r=p,this.b=c;break;case 3:this.r=p,this.g=s;break;case 4:this.r=c,this.g=p;break;case 5:default:this.g=p,this.b=s;break}}fromHsvString(t){const n=hg(t,AC);this.fromHsv({h:n[0],s:n[1],v:n[2],a:n[3]})}fromHslString(t){const n=hg(t,AC);this.fromHsl({h:n[0],s:n[1],l:n[2],a:n[3]})}fromRgbString(t){const n=hg(t,(r,i)=>i.includes("%")?$r(r/100*255):r);this.r=n[0],this.g=n[1],this.b=n[2],this.a=n[3]}}const Ju=2,TC=.16,fH=.05,hH=.05,pH=.15,m_=5,v_=4,gH=[{index:7,amount:15},{index:6,amount:25},{index:5,amount:30},{index:5,amount:45},{index:5,amount:65},{index:5,amount:85},{index:4,amount:90},{index:3,amount:95},{index:2,amount:97},{index:1,amount:98}];function IC(e,t,n){let r;return Math.round(e.h)>=60&&Math.round(e.h)<=240?r=n?Math.round(e.h)-Ju*t:Math.round(e.h)+Ju*t:r=n?Math.round(e.h)+Ju*t:Math.round(e.h)-Ju*t,r<0?r+=360:r>=360&&(r-=360),r}function LC(e,t,n){if(e.h===0&&e.s===0)return e.s;let r;return n?r=e.s-TC*t:t===v_?r=e.s+TC:r=e.s+fH*t,r>1&&(r=1),n&&t===m_&&r>.1&&(r=.1),r<.06&&(r=.06),Math.round(r*100)/100}function PC(e,t,n){let r;return n?r=e.v+hH*t:r=e.v-pH*t,r=Math.max(0,Math.min(1,r)),Math.round(r*100)/100}function mH(e,t={}){const n=[],r=new Ps(e),i=r.toHsv();for(let o=m_;o>0;o-=1){const l=new Ps({h:IC(i,o,!0),s:LC(i,o,!0),v:PC(i,o,!0)});n.push(l)}n.push(r);for(let o=1;o<=v_;o+=1){const l=new Ps({h:IC(i,o),s:LC(i,o),v:PC(i,o)});n.push(l)}return t.theme==="dark"?gH.map(({index:o,amount:l})=>new Ps(t.backgroundColor||"#141414").mix(n[o],l).toHexString()):n.map(o=>o.toHexString())}const Lm=["#e6f4ff","#bae0ff","#91caff","#69b1ff","#4096ff","#1677ff","#0958d9","#003eb3","#002c8c","#001d66"];Lm.primary=Lm[5];function vH(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}function yH(e,t){if(!e)return!1;if(e.contains)return e.contains(t);let n=t;for(;n;){if(n===e)return!0;n=n.parentNode}return!1}const kC="data-rc-order",NC="data-rc-priority",bH="rc-util-key",Pm=new Map;function y_({mark:e}={}){return e?e.startsWith("data-")?e:`data-${e}`:bH}function qv(e){return e.attachTo?e.attachTo:document.querySelector("head")||document.body}function wH(e){return e==="queue"?"prependQueue":e?"prepend":"append"}function Qv(e){return Array.from((Pm.get(e)||e).children).filter(t=>t.tagName==="STYLE")}function b_(e,t={}){if(!vH())return null;const{csp:n,prepend:r,priority:i=0}=t,o=wH(r),l=o==="prependQueue",m=document.createElement("style");m.setAttribute(kC,o),l&&i&&m.setAttribute(NC,`${i}`),n!=null&&n.nonce&&(m.nonce=n==null?void 0:n.nonce),m.innerHTML=e;const u=qv(t),{firstChild:p}=u;if(r){if(l){const s=(t.styles||Qv(u)).filter(c=>{if(!["prepend","prependQueue"].includes(c.getAttribute(kC)))return!1;const d=Number(c.getAttribute(NC)||0);return i>=d});if(s.length)return u.insertBefore(m,s[s.length-1].nextSibling),m}u.insertBefore(m,p)}else u.appendChild(m);return m}function SH(e,t={}){let{styles:n}=t;return n||(n=Qv(qv(t))),n.find(r=>r.getAttribute(y_(t))===e)}function CH(e,t){const n=Pm.get(e);if(!n||!yH(document,n)){const r=b_("",t),{parentNode:i}=r;Pm.set(e,i),e.removeChild(r)}}function $H(e,t,n={}){var u,p,s;const r=qv(n),i=Qv(r),o={...n,styles:i};CH(r,o);const l=SH(t,o);if(l)return(u=o.csp)!=null&&u.nonce&&l.nonce!==((p=o.csp)==null?void 0:p.nonce)&&(l.nonce=(s=o.csp)==null?void 0:s.nonce),l.innerHTML!==e&&(l.innerHTML=e),l;const m=b_(e,o);return m.setAttribute(y_(o),t),m}function w_(e){var t;return(t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e)}function xH(e){return w_(e)instanceof ShadowRoot}function EH(e){return xH(e)?w_(e):null}let km={};const _H=e=>{};function MH(e,t){}function RH(e,t){}function OH(){km={}}function S_(e,t,n){!t&&!km[n]&&(e(!1,n),km[n]=!0)}function _f(e,t){S_(MH,e,t)}function AH(e,t){S_(RH,e,t)}_f.preMessage=_H;_f.resetWarned=OH;_f.noteOnce=AH;function TH(e){return e.replace(/-(.)/g,(t,n)=>n.toUpperCase())}function IH(e,t){_f(e,`[@ant-design/icons] ${t}`)}function DC(e){return typeof e=="object"&&typeof e.name=="string"&&typeof e.theme=="string"&&(typeof e.icon=="object"||typeof e.icon=="function")}function FC(e={}){return Object.keys(e).reduce((t,n)=>{const r=e[n];switch(n){case"class":t.className=r,delete t.class;break;default:delete t[n],t[TH(n)]=r}return t},{})}function Nm(e,t,n){return n?be.createElement(e.tag,{key:t,...FC(e.attrs),...n},(e.children||[]).map((r,i)=>Nm(r,`${t}-${e.tag}-${i}`))):be.createElement(e.tag,{key:t,...FC(e.attrs)},(e.children||[]).map((r,i)=>Nm(r,`${t}-${e.tag}-${i}`)))}function C_(e){return mH(e)[0]}function $_(e){return e?Array.isArray(e)?e:[e]:[]}const LH=` +.anticon { + display: inline-flex; + align-items: center; + color: inherit; + font-style: normal; + line-height: 0; + text-align: center; + text-transform: none; + vertical-align: -0.125em; + text-rendering: optimizeLegibility; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +.anticon > * { + line-height: 1; +} + +.anticon svg { + display: inline-block; +} + +.anticon::before { + display: none; +} + +.anticon .anticon-icon { + display: block; +} + +.anticon[tabindex] { + cursor: pointer; +} + +.anticon-spin::before, +.anticon-spin { + display: inline-block; + -webkit-animation: loadingCircle 1s infinite linear; + animation: loadingCircle 1s infinite linear; +} + +@-webkit-keyframes loadingCircle { + 100% { + -webkit-transform: rotate(360deg); + transform: rotate(360deg); + } +} + +@keyframes loadingCircle { + 100% { + -webkit-transform: rotate(360deg); + transform: rotate(360deg); + } +} +`,PH=e=>{const{csp:t,prefixCls:n,layer:r}=C.useContext(g_);let i=LH;n&&(i=i.replace(/anticon/g,n)),r&&(i=`@layer ${r} { +${i} +}`),C.useEffect(()=>{const o=e.current,l=EH(o);$H(i,"@ant-design-icons",{prepend:!r,csp:t,attachTo:l})},[])},ec={primaryColor:"#333",secondaryColor:"#E6E6E6",calculated:!1};function kH({primaryColor:e,secondaryColor:t}){ec.primaryColor=e,ec.secondaryColor=t||C_(e),ec.calculated=!!t}function NH(){return{...ec}}const rl=e=>{const{icon:t,className:n,onClick:r,style:i,primaryColor:o,secondaryColor:l,...m}=e,u=C.useRef();let p=ec;if(o&&(p={primaryColor:o,secondaryColor:l||C_(o)}),PH(u),IH(DC(t),`icon should be icon definiton, but got ${t}`),!DC(t))return null;let s=t;return s&&typeof s.icon=="function"&&(s={...s,icon:s.icon(p.primaryColor,p.secondaryColor)}),Nm(s.icon,`svg-${s.name}`,{className:n,onClick:r,style:i,"data-icon":s.name,width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",...m,ref:u})};rl.displayName="IconReact";rl.getTwoToneColors=NH;rl.setTwoToneColors=kH;function x_(e){const[t,n]=$_(e);return rl.setTwoToneColors({primaryColor:t,secondaryColor:n})}function DH(){const e=rl.getTwoToneColors();return e.calculated?[e.primaryColor,e.secondaryColor]:e.primaryColor}function Dm(){return Dm=Object.assign?Object.assign.bind():function(e){for(var t=1;t{const{className:n,icon:r,spin:i,rotate:o,tabIndex:l,onClick:m,twoToneColor:u,...p}=e,{prefixCls:s="anticon",rootClassName:c}=C.useContext(g_),d=ve(c,s,{[`${s}-${r.name}`]:!!r.name,[`${s}-spin`]:!!i||r.name==="loading"},n);let h=l;h===void 0&&m&&(h=-1);const f=o?{msTransform:`rotate(${o}deg)`,transform:`rotate(${o}deg)`}:void 0,[v,y]=$_(u);return C.createElement("span",Dm({role:"img","aria-label":r.name},p,{ref:t,tabIndex:h,onClick:m,className:d}),C.createElement(rl,{icon:r,primaryColor:v,secondaryColor:y,style:f}))});pa.displayName="AntdIcon";pa.getTwoToneColor=DH;pa.setTwoToneColor=x_;function Fm(){return Fm=Object.assign?Object.assign.bind():function(e){for(var t=1;tC.createElement(pa,Fm({},e,{ref:t,icon:c_})),zH=C.forwardRef(FH);function zm(){return zm=Object.assign?Object.assign.bind():function(e){for(var t=1;tC.createElement(pa,zm({},e,{ref:t,icon:_3})),BH=C.forwardRef(jH);function jm(){return jm=Object.assign?Object.assign.bind():function(e){for(var t=1;tC.createElement(pa,jm({},e,{ref:t,icon:J$})),WH=C.forwardRef(HH);function Bm(){return Bm=Object.assign?Object.assign.bind():function(e){for(var t=1;tC.createElement(pa,Bm({},e,{ref:t,icon:u5})),UH=C.forwardRef(VH);function Hm(){return Hm=Object.assign?Object.assign.bind():function(e){for(var t=1;tC.createElement(pa,Hm({},e,{ref:t,icon:d5})),KH=C.forwardRef(GH),{Panel:YH}=wx,zC=Bn.div` + height: calc(100vh - 180px); + overflow-y: auto; + padding: 1rem; + background-color: var(--color-white); + `,XH=Bn.h3` + margin-bottom: 1rem; + color: var(--color-primary); +`,qH=Bn.div` + margin-top: 12px; + display: flex +; + + align-items: center; + justify-content: end; + gap: 12px; +`,QH=Bn(wx)` + background: var(--color-white); + + .ant-collapse-header { + font-weight: 500; + color: var(--color-primary) !important; + } +`,jC=Bn(Pc)` + background-color: var(--color-primary); + color:var(--color-white); + &:hover{ + background-color: var(--color-white) !important; + border-color:var(--color-primary) !important; + color:var(--color-primary) !important; + } + + + +`,ZH=Bn.div` + width: 100%; + // border: 1px solid #d9d9d9; + border-radius: 4px; +`,JH=({selectedFlow:e,onPayloadChange:t})=>{const[n,r]=C.useState({}),[i,o]=C.useState([]),[l,m]=C.useState({});C.useEffect(()=>{if(e&&Jl[e]){o(Jl[e]);const p={};Jl[e].forEach(s=>{const c=Os[s];p[c]=p[c]||`{ + +}`}),r(p)}else o([]),r({})},[e]);const u=(p,s)=>{const c=Os[s],d={...n,[c]:p};r(d);try{const h={};Object.entries(d).forEach(([f,v])=>{v.trim()!==""&&(h[f]=JSON.parse(v))}),t(h),m(f=>{const{[c]:v,...y}=f;return y})}catch(h){m(f=>({...f,[c]:`Invalid JSON: ${h instanceof Error?h.message:String(h)}`})),console.warn(`Invalid JSON in step "${s}"`,h)}r(d)};return!e||i.length===0?qe.jsx(zC,{children:qe.jsx(aa,{description:"Select a flow to see available API calls"})}):qe.jsxs(zC,{children:[qe.jsx(XH,{children:"API Call Payloads"}),qe.jsx(QH,{accordion:!0,children:i.map(p=>qe.jsx(YH,{header:`${Os[p]}`,children:qe.jsxs(ZH,{children:[qe.jsx(lH,{mode:"json",theme:"tomorrow",name:`editor-${p}`,value:n[Os[p]]||`{ + +}`,onChange:s=>u(s,p),width:"100%",height:"250px",fontSize:14,showPrintMargin:!1,showGutter:!0,highlightActiveLine:!0,setOptions:{enableBasicAutocompletion:!0,enableLiveAutocompletion:!0,enableSnippets:!0,showLineNumbers:!0,tabSize:2}}),l[p]&&qe.jsx("div",{style:{color:"red",marginTop:"8px",fontSize:"0.9rem"},children:l[p]}),qe.jsxs(qH,{style:{marginTop:"12px"},children:[qe.jsx("input",{type:"file",accept:".json,application/json",style:{display:"none"},id:`file-upload-${p}`,onChange:s=>{var d;const c=(d=s.target.files)==null?void 0:d[0];if(c){const h=new FileReader;h.onload=f=>{var v;try{const y=JSON.parse((v=f==null?void 0:f.target)==null?void 0:v.result);u(JSON.stringify(y,null,2),p)}catch{alert("Invalid JSON file.")}},h.readAsText(c)}s.target.value=""}}),qe.jsx(jC,{onClick:()=>{var s;return(s=document.getElementById(`file-upload-${p}`))==null?void 0:s.click()},icon:qe.jsx(UH,{}),children:"Upload JSON"}),qe.jsx(jC,{icon:qe.jsx(zH,{}),onClick:()=>{const s=n[Os[p]]||"{}";navigator.clipboard.writeText(s).then(()=>{s_.success("Copied to clipboard!")})}})]})]})},p))})]})};function E_(e,t){return function(){return e.apply(t,arguments)}}const{toString:e6}=Object.prototype,{getPrototypeOf:Zv}=Object,{iterator:Mf,toStringTag:__}=Symbol,Rf=(e=>t=>{const n=e6.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),no=e=>(e=e.toLowerCase(),t=>Rf(t)===e),Of=e=>t=>typeof t===e,{isArray:il}=Array,Sc=Of("undefined");function t6(e){return e!==null&&!Sc(e)&&e.constructor!==null&&!Sc(e.constructor)&&ai(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const M_=no("ArrayBuffer");function n6(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&M_(e.buffer),t}const r6=Of("string"),ai=Of("function"),R_=Of("number"),Af=e=>e!==null&&typeof e=="object",i6=e=>e===!0||e===!1,yd=e=>{if(Rf(e)!=="object")return!1;const t=Zv(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(__ in e)&&!(Mf in e)},o6=no("Date"),a6=no("File"),s6=no("Blob"),l6=no("FileList"),c6=e=>Af(e)&&ai(e.pipe),u6=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||ai(e.append)&&((t=Rf(e))==="formdata"||t==="object"&&ai(e.toString)&&e.toString()==="[object FormData]"))},d6=no("URLSearchParams"),[f6,h6,p6,g6]=["ReadableStream","Request","Response","Headers"].map(no),m6=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function jc(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,i;if(typeof e!="object"&&(e=[e]),il(e))for(r=0,i=e.length;r0;)if(i=n[r],t===i.toLowerCase())return i;return null}const ka=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,A_=e=>!Sc(e)&&e!==ka;function Wm(){const{caseless:e}=A_(this)&&this||{},t={},n=(r,i)=>{const o=e&&O_(t,i)||i;yd(t[o])&&yd(r)?t[o]=Wm(t[o],r):yd(r)?t[o]=Wm({},r):il(r)?t[o]=r.slice():t[o]=r};for(let r=0,i=arguments.length;r(jc(t,(i,o)=>{n&&ai(i)?e[o]=E_(i,n):e[o]=i},{allOwnKeys:r}),e),y6=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),b6=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},w6=(e,t,n,r)=>{let i,o,l;const m={};if(t=t||{},e==null)return t;do{for(i=Object.getOwnPropertyNames(e),o=i.length;o-- >0;)l=i[o],(!r||r(l,e,t))&&!m[l]&&(t[l]=e[l],m[l]=!0);e=n!==!1&&Zv(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},S6=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},C6=e=>{if(!e)return null;if(il(e))return e;let t=e.length;if(!R_(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},$6=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Zv(Uint8Array)),x6=(e,t)=>{const r=(e&&e[Mf]).call(e);let i;for(;(i=r.next())&&!i.done;){const o=i.value;t.call(e,o[0],o[1])}},E6=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},_6=no("HTMLFormElement"),M6=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,i){return r.toUpperCase()+i}),BC=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),R6=no("RegExp"),T_=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};jc(n,(i,o)=>{let l;(l=t(i,o,e))!==!1&&(r[o]=l||i)}),Object.defineProperties(e,r)},O6=e=>{T_(e,(t,n)=>{if(ai(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(ai(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},A6=(e,t)=>{const n={},r=i=>{i.forEach(o=>{n[o]=!0})};return il(e)?r(e):r(String(e).split(t)),n},T6=()=>{},I6=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function L6(e){return!!(e&&ai(e.append)&&e[__]==="FormData"&&e[Mf])}const P6=e=>{const t=new Array(10),n=(r,i)=>{if(Af(r)){if(t.indexOf(r)>=0)return;if(!("toJSON"in r)){t[i]=r;const o=il(r)?[]:{};return jc(r,(l,m)=>{const u=n(l,i+1);!Sc(u)&&(o[m]=u)}),t[i]=void 0,o}}return r};return n(e,0)},k6=no("AsyncFunction"),N6=e=>e&&(Af(e)||ai(e))&&ai(e.then)&&ai(e.catch),I_=((e,t)=>e?setImmediate:t?((n,r)=>(ka.addEventListener("message",({source:i,data:o})=>{i===ka&&o===n&&r.length&&r.shift()()},!1),i=>{r.push(i),ka.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",ai(ka.postMessage)),D6=typeof queueMicrotask<"u"?queueMicrotask.bind(ka):typeof process<"u"&&process.nextTick||I_,F6=e=>e!=null&&ai(e[Mf]),_e={isArray:il,isArrayBuffer:M_,isBuffer:t6,isFormData:u6,isArrayBufferView:n6,isString:r6,isNumber:R_,isBoolean:i6,isObject:Af,isPlainObject:yd,isReadableStream:f6,isRequest:h6,isResponse:p6,isHeaders:g6,isUndefined:Sc,isDate:o6,isFile:a6,isBlob:s6,isRegExp:R6,isFunction:ai,isStream:c6,isURLSearchParams:d6,isTypedArray:$6,isFileList:l6,forEach:jc,merge:Wm,extend:v6,trim:m6,stripBOM:y6,inherits:b6,toFlatObject:w6,kindOf:Rf,kindOfTest:no,endsWith:S6,toArray:C6,forEachEntry:x6,matchAll:E6,isHTMLForm:_6,hasOwnProperty:BC,hasOwnProp:BC,reduceDescriptors:T_,freezeMethods:O6,toObjectSet:A6,toCamelCase:M6,noop:T6,toFiniteNumber:I6,findKey:O_,global:ka,isContextDefined:A_,isSpecCompliantForm:L6,toJSONObject:P6,isAsyncFn:k6,isThenable:N6,setImmediate:I_,asap:D6,isIterable:F6};function jt(e,t,n,r,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),i&&(this.response=i,this.status=i.status?i.status:null)}_e.inherits(jt,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:_e.toJSONObject(this.config),code:this.code,status:this.status}}});const L_=jt.prototype,P_={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{P_[e]={value:e}});Object.defineProperties(jt,P_);Object.defineProperty(L_,"isAxiosError",{value:!0});jt.from=(e,t,n,r,i,o)=>{const l=Object.create(L_);return _e.toFlatObject(e,l,function(u){return u!==Error.prototype},m=>m!=="isAxiosError"),jt.call(l,e.message,t,n,r,i),l.cause=e,l.name=e.name,o&&Object.assign(l,o),l};const z6=null;function Vm(e){return _e.isPlainObject(e)||_e.isArray(e)}function k_(e){return _e.endsWith(e,"[]")?e.slice(0,-2):e}function HC(e,t,n){return e?e.concat(t).map(function(i,o){return i=k_(i),!n&&o?"["+i+"]":i}).join(n?".":""):t}function j6(e){return _e.isArray(e)&&!e.some(Vm)}const B6=_e.toFlatObject(_e,{},null,function(t){return/^is[A-Z]/.test(t)});function Tf(e,t,n){if(!_e.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=_e.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(v,y){return!_e.isUndefined(y[v])});const r=n.metaTokens,i=n.visitor||s,o=n.dots,l=n.indexes,u=(n.Blob||typeof Blob<"u"&&Blob)&&_e.isSpecCompliantForm(t);if(!_e.isFunction(i))throw new TypeError("visitor must be a function");function p(f){if(f===null)return"";if(_e.isDate(f))return f.toISOString();if(!u&&_e.isBlob(f))throw new jt("Blob is not supported. Use a Buffer instead.");return _e.isArrayBuffer(f)||_e.isTypedArray(f)?u&&typeof Blob=="function"?new Blob([f]):Buffer.from(f):f}function s(f,v,y){let b=f;if(f&&!y&&typeof f=="object"){if(_e.endsWith(v,"{}"))v=r?v:v.slice(0,-2),f=JSON.stringify(f);else if(_e.isArray(f)&&j6(f)||(_e.isFileList(f)||_e.endsWith(v,"[]"))&&(b=_e.toArray(f)))return v=k_(v),b.forEach(function(x,E){!(_e.isUndefined(x)||x===null)&&t.append(l===!0?HC([v],E,o):l===null?v:v+"[]",p(x))}),!1}return Vm(f)?!0:(t.append(HC(y,v,o),p(f)),!1)}const c=[],d=Object.assign(B6,{defaultVisitor:s,convertValue:p,isVisitable:Vm});function h(f,v){if(!_e.isUndefined(f)){if(c.indexOf(f)!==-1)throw Error("Circular reference detected in "+v.join("."));c.push(f),_e.forEach(f,function(b,w){(!(_e.isUndefined(b)||b===null)&&i.call(t,b,_e.isString(w)?w.trim():w,v,d))===!0&&h(b,v?v.concat(w):[w])}),c.pop()}}if(!_e.isObject(e))throw new TypeError("data must be an object");return h(e),t}function WC(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function Jv(e,t){this._pairs=[],e&&Tf(e,this,t)}const N_=Jv.prototype;N_.append=function(t,n){this._pairs.push([t,n])};N_.toString=function(t){const n=t?function(r){return t.call(this,r,WC)}:WC;return this._pairs.map(function(i){return n(i[0])+"="+n(i[1])},"").join("&")};function H6(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function D_(e,t,n){if(!t)return e;const r=n&&n.encode||H6;_e.isFunction(n)&&(n={serialize:n});const i=n&&n.serialize;let o;if(i?o=i(t,n):o=_e.isURLSearchParams(t)?t.toString():new Jv(t,n).toString(r),o){const l=e.indexOf("#");l!==-1&&(e=e.slice(0,l)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class VC{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){_e.forEach(this.handlers,function(r){r!==null&&t(r)})}}const F_={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},W6=typeof URLSearchParams<"u"?URLSearchParams:Jv,V6=typeof FormData<"u"?FormData:null,U6=typeof Blob<"u"?Blob:null,G6={isBrowser:!0,classes:{URLSearchParams:W6,FormData:V6,Blob:U6},protocols:["http","https","file","blob","url","data"]},ey=typeof window<"u"&&typeof document<"u",Um=typeof navigator=="object"&&navigator||void 0,K6=ey&&(!Um||["ReactNative","NativeScript","NS"].indexOf(Um.product)<0),Y6=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",X6=ey&&window.location.href||"http://localhost",q6=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:ey,hasStandardBrowserEnv:K6,hasStandardBrowserWebWorkerEnv:Y6,navigator:Um,origin:X6},Symbol.toStringTag,{value:"Module"})),Br={...q6,...G6};function Q6(e,t){return Tf(e,new Br.classes.URLSearchParams,Object.assign({visitor:function(n,r,i,o){return Br.isNode&&_e.isBuffer(n)?(this.append(r,n.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)}},t))}function Z6(e){return _e.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function J6(e){const t={},n=Object.keys(e);let r;const i=n.length;let o;for(r=0;r=n.length;return l=!l&&_e.isArray(i)?i.length:l,u?(_e.hasOwnProp(i,l)?i[l]=[i[l],r]:i[l]=r,!m):((!i[l]||!_e.isObject(i[l]))&&(i[l]=[]),t(n,r,i[l],o)&&_e.isArray(i[l])&&(i[l]=J6(i[l])),!m)}if(_e.isFormData(e)&&_e.isFunction(e.entries)){const n={};return _e.forEachEntry(e,(r,i)=>{t(Z6(r),i,n,0)}),n}return null}function eW(e,t,n){if(_e.isString(e))try{return(t||JSON.parse)(e),_e.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const Bc={transitional:F_,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",i=r.indexOf("application/json")>-1,o=_e.isObject(t);if(o&&_e.isHTMLForm(t)&&(t=new FormData(t)),_e.isFormData(t))return i?JSON.stringify(z_(t)):t;if(_e.isArrayBuffer(t)||_e.isBuffer(t)||_e.isStream(t)||_e.isFile(t)||_e.isBlob(t)||_e.isReadableStream(t))return t;if(_e.isArrayBufferView(t))return t.buffer;if(_e.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let m;if(o){if(r.indexOf("application/x-www-form-urlencoded")>-1)return Q6(t,this.formSerializer).toString();if((m=_e.isFileList(t))||r.indexOf("multipart/form-data")>-1){const u=this.env&&this.env.FormData;return Tf(m?{"files[]":t}:t,u&&new u,this.formSerializer)}}return o||i?(n.setContentType("application/json",!1),eW(t)):t}],transformResponse:[function(t){const n=this.transitional||Bc.transitional,r=n&&n.forcedJSONParsing,i=this.responseType==="json";if(_e.isResponse(t)||_e.isReadableStream(t))return t;if(t&&_e.isString(t)&&(r&&!this.responseType||i)){const l=!(n&&n.silentJSONParsing)&&i;try{return JSON.parse(t)}catch(m){if(l)throw m.name==="SyntaxError"?jt.from(m,jt.ERR_BAD_RESPONSE,this,null,this.response):m}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Br.classes.FormData,Blob:Br.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};_e.forEach(["delete","get","head","post","put","patch"],e=>{Bc.headers[e]={}});const tW=_e.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),nW=e=>{const t={};let n,r,i;return e&&e.split(` +`).forEach(function(l){i=l.indexOf(":"),n=l.substring(0,i).trim().toLowerCase(),r=l.substring(i+1).trim(),!(!n||t[n]&&tW[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t},UC=Symbol("internals");function Bl(e){return e&&String(e).trim().toLowerCase()}function bd(e){return e===!1||e==null?e:_e.isArray(e)?e.map(bd):String(e)}function rW(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}const iW=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function pg(e,t,n,r,i){if(_e.isFunction(r))return r.call(this,t,n);if(i&&(t=n),!!_e.isString(t)){if(_e.isString(r))return t.indexOf(r)!==-1;if(_e.isRegExp(r))return r.test(t)}}function oW(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function aW(e,t){const n=_e.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(i,o,l){return this[r].call(this,t,i,o,l)},configurable:!0})})}let si=class{constructor(t){t&&this.set(t)}set(t,n,r){const i=this;function o(m,u,p){const s=Bl(u);if(!s)throw new Error("header name must be a non-empty string");const c=_e.findKey(i,s);(!c||i[c]===void 0||p===!0||p===void 0&&i[c]!==!1)&&(i[c||u]=bd(m))}const l=(m,u)=>_e.forEach(m,(p,s)=>o(p,s,u));if(_e.isPlainObject(t)||t instanceof this.constructor)l(t,n);else if(_e.isString(t)&&(t=t.trim())&&!iW(t))l(nW(t),n);else if(_e.isObject(t)&&_e.isIterable(t)){let m={},u,p;for(const s of t){if(!_e.isArray(s))throw TypeError("Object iterator must return a key-value pair");m[p=s[0]]=(u=m[p])?_e.isArray(u)?[...u,s[1]]:[u,s[1]]:s[1]}l(m,n)}else t!=null&&o(n,t,r);return this}get(t,n){if(t=Bl(t),t){const r=_e.findKey(this,t);if(r){const i=this[r];if(!n)return i;if(n===!0)return rW(i);if(_e.isFunction(n))return n.call(this,i,r);if(_e.isRegExp(n))return n.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=Bl(t),t){const r=_e.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||pg(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let i=!1;function o(l){if(l=Bl(l),l){const m=_e.findKey(r,l);m&&(!n||pg(r,r[m],m,n))&&(delete r[m],i=!0)}}return _e.isArray(t)?t.forEach(o):o(t),i}clear(t){const n=Object.keys(this);let r=n.length,i=!1;for(;r--;){const o=n[r];(!t||pg(this,this[o],o,t,!0))&&(delete this[o],i=!0)}return i}normalize(t){const n=this,r={};return _e.forEach(this,(i,o)=>{const l=_e.findKey(r,o);if(l){n[l]=bd(i),delete n[o];return}const m=t?oW(o):String(o).trim();m!==o&&delete n[o],n[m]=bd(i),r[m]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return _e.forEach(this,(r,i)=>{r!=null&&r!==!1&&(n[i]=t&&_e.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(` +`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(i=>r.set(i)),r}static accessor(t){const r=(this[UC]=this[UC]={accessors:{}}).accessors,i=this.prototype;function o(l){const m=Bl(l);r[m]||(aW(i,l),r[m]=!0)}return _e.isArray(t)?t.forEach(o):o(t),this}};si.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);_e.reduceDescriptors(si.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});_e.freezeMethods(si);function gg(e,t){const n=this||Bc,r=t||n,i=si.from(r.headers);let o=r.data;return _e.forEach(e,function(m){o=m.call(n,o,i.normalize(),t?t.status:void 0)}),i.normalize(),o}function j_(e){return!!(e&&e.__CANCEL__)}function ol(e,t,n){jt.call(this,e??"canceled",jt.ERR_CANCELED,t,n),this.name="CanceledError"}_e.inherits(ol,jt,{__CANCEL__:!0});function B_(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new jt("Request failed with status code "+n.status,[jt.ERR_BAD_REQUEST,jt.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function sW(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function lW(e,t){e=e||10;const n=new Array(e),r=new Array(e);let i=0,o=0,l;return t=t!==void 0?t:1e3,function(u){const p=Date.now(),s=r[o];l||(l=p),n[i]=u,r[i]=p;let c=o,d=0;for(;c!==i;)d+=n[c++],c=c%e;if(i=(i+1)%e,i===o&&(o=(o+1)%e),p-l{n=s,i=null,o&&(clearTimeout(o),o=null),e.apply(null,p)};return[(...p)=>{const s=Date.now(),c=s-n;c>=r?l(p,s):(i=p,o||(o=setTimeout(()=>{o=null,l(i)},r-c)))},()=>i&&l(i)]}const Bd=(e,t,n=3)=>{let r=0;const i=lW(50,250);return cW(o=>{const l=o.loaded,m=o.lengthComputable?o.total:void 0,u=l-r,p=i(u),s=l<=m;r=l;const c={loaded:l,total:m,progress:m?l/m:void 0,bytes:u,rate:p||void 0,estimated:p&&m&&s?(m-l)/p:void 0,event:o,lengthComputable:m!=null,[t?"download":"upload"]:!0};e(c)},n)},GC=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},KC=e=>(...t)=>_e.asap(()=>e(...t)),uW=Br.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,Br.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(Br.origin),Br.navigator&&/(msie|trident)/i.test(Br.navigator.userAgent)):()=>!0,dW=Br.hasStandardBrowserEnv?{write(e,t,n,r,i,o){const l=[e+"="+encodeURIComponent(t)];_e.isNumber(n)&&l.push("expires="+new Date(n).toGMTString()),_e.isString(r)&&l.push("path="+r),_e.isString(i)&&l.push("domain="+i),o===!0&&l.push("secure"),document.cookie=l.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function fW(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function hW(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function H_(e,t,n){let r=!fW(t);return e&&(r||n==!1)?hW(e,t):t}const YC=e=>e instanceof si?{...e}:e;function Ua(e,t){t=t||{};const n={};function r(p,s,c,d){return _e.isPlainObject(p)&&_e.isPlainObject(s)?_e.merge.call({caseless:d},p,s):_e.isPlainObject(s)?_e.merge({},s):_e.isArray(s)?s.slice():s}function i(p,s,c,d){if(_e.isUndefined(s)){if(!_e.isUndefined(p))return r(void 0,p,c,d)}else return r(p,s,c,d)}function o(p,s){if(!_e.isUndefined(s))return r(void 0,s)}function l(p,s){if(_e.isUndefined(s)){if(!_e.isUndefined(p))return r(void 0,p)}else return r(void 0,s)}function m(p,s,c){if(c in t)return r(p,s);if(c in e)return r(void 0,p)}const u={url:o,method:o,data:o,baseURL:l,transformRequest:l,transformResponse:l,paramsSerializer:l,timeout:l,timeoutMessage:l,withCredentials:l,withXSRFToken:l,adapter:l,responseType:l,xsrfCookieName:l,xsrfHeaderName:l,onUploadProgress:l,onDownloadProgress:l,decompress:l,maxContentLength:l,maxBodyLength:l,beforeRedirect:l,transport:l,httpAgent:l,httpsAgent:l,cancelToken:l,socketPath:l,responseEncoding:l,validateStatus:m,headers:(p,s,c)=>i(YC(p),YC(s),c,!0)};return _e.forEach(Object.keys(Object.assign({},e,t)),function(s){const c=u[s]||i,d=c(e[s],t[s],s);_e.isUndefined(d)&&c!==m||(n[s]=d)}),n}const W_=e=>{const t=Ua({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:i,xsrfCookieName:o,headers:l,auth:m}=t;t.headers=l=si.from(l),t.url=D_(H_(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),m&&l.set("Authorization","Basic "+btoa((m.username||"")+":"+(m.password?unescape(encodeURIComponent(m.password)):"")));let u;if(_e.isFormData(n)){if(Br.hasStandardBrowserEnv||Br.hasStandardBrowserWebWorkerEnv)l.setContentType(void 0);else if((u=l.getContentType())!==!1){const[p,...s]=u?u.split(";").map(c=>c.trim()).filter(Boolean):[];l.setContentType([p||"multipart/form-data",...s].join("; "))}}if(Br.hasStandardBrowserEnv&&(r&&_e.isFunction(r)&&(r=r(t)),r||r!==!1&&uW(t.url))){const p=i&&o&&dW.read(o);p&&l.set(i,p)}return t},pW=typeof XMLHttpRequest<"u",gW=pW&&function(e){return new Promise(function(n,r){const i=W_(e);let o=i.data;const l=si.from(i.headers).normalize();let{responseType:m,onUploadProgress:u,onDownloadProgress:p}=i,s,c,d,h,f;function v(){h&&h(),f&&f(),i.cancelToken&&i.cancelToken.unsubscribe(s),i.signal&&i.signal.removeEventListener("abort",s)}let y=new XMLHttpRequest;y.open(i.method.toUpperCase(),i.url,!0),y.timeout=i.timeout;function b(){if(!y)return;const x=si.from("getAllResponseHeaders"in y&&y.getAllResponseHeaders()),_={data:!m||m==="text"||m==="json"?y.responseText:y.response,status:y.status,statusText:y.statusText,headers:x,config:e,request:y};B_(function(O){n(O),v()},function(O){r(O),v()},_),y=null}"onloadend"in y?y.onloadend=b:y.onreadystatechange=function(){!y||y.readyState!==4||y.status===0&&!(y.responseURL&&y.responseURL.indexOf("file:")===0)||setTimeout(b)},y.onabort=function(){y&&(r(new jt("Request aborted",jt.ECONNABORTED,e,y)),y=null)},y.onerror=function(){r(new jt("Network Error",jt.ERR_NETWORK,e,y)),y=null},y.ontimeout=function(){let E=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const _=i.transitional||F_;i.timeoutErrorMessage&&(E=i.timeoutErrorMessage),r(new jt(E,_.clarifyTimeoutError?jt.ETIMEDOUT:jt.ECONNABORTED,e,y)),y=null},o===void 0&&l.setContentType(null),"setRequestHeader"in y&&_e.forEach(l.toJSON(),function(E,_){y.setRequestHeader(_,E)}),_e.isUndefined(i.withCredentials)||(y.withCredentials=!!i.withCredentials),m&&m!=="json"&&(y.responseType=i.responseType),p&&([d,f]=Bd(p,!0),y.addEventListener("progress",d)),u&&y.upload&&([c,h]=Bd(u),y.upload.addEventListener("progress",c),y.upload.addEventListener("loadend",h)),(i.cancelToken||i.signal)&&(s=x=>{y&&(r(!x||x.type?new ol(null,e,y):x),y.abort(),y=null)},i.cancelToken&&i.cancelToken.subscribe(s),i.signal&&(i.signal.aborted?s():i.signal.addEventListener("abort",s)));const w=sW(i.url);if(w&&Br.protocols.indexOf(w)===-1){r(new jt("Unsupported protocol "+w+":",jt.ERR_BAD_REQUEST,e));return}y.send(o||null)})},mW=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,i;const o=function(p){if(!i){i=!0,m();const s=p instanceof Error?p:this.reason;r.abort(s instanceof jt?s:new ol(s instanceof Error?s.message:s))}};let l=t&&setTimeout(()=>{l=null,o(new jt(`timeout ${t} of ms exceeded`,jt.ETIMEDOUT))},t);const m=()=>{e&&(l&&clearTimeout(l),l=null,e.forEach(p=>{p.unsubscribe?p.unsubscribe(o):p.removeEventListener("abort",o)}),e=null)};e.forEach(p=>p.addEventListener("abort",o));const{signal:u}=r;return u.unsubscribe=()=>_e.asap(m),u}},vW=function*(e,t){let n=e.byteLength;if(n{const i=yW(e,t);let o=0,l,m=u=>{l||(l=!0,r&&r(u))};return new ReadableStream({async pull(u){try{const{done:p,value:s}=await i.next();if(p){m(),u.close();return}let c=s.byteLength;if(n){let d=o+=c;n(d)}u.enqueue(new Uint8Array(s))}catch(p){throw m(p),p}},cancel(u){return m(u),i.return()}},{highWaterMark:2})},If=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",V_=If&&typeof ReadableStream=="function",wW=If&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),U_=(e,...t)=>{try{return!!e(...t)}catch{return!1}},SW=V_&&U_(()=>{let e=!1;const t=new Request(Br.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),qC=64*1024,Gm=V_&&U_(()=>_e.isReadableStream(new Response("").body)),Hd={stream:Gm&&(e=>e.body)};If&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!Hd[t]&&(Hd[t]=_e.isFunction(e[t])?n=>n[t]():(n,r)=>{throw new jt(`Response type '${t}' is not supported`,jt.ERR_NOT_SUPPORT,r)})})})(new Response);const CW=async e=>{if(e==null)return 0;if(_e.isBlob(e))return e.size;if(_e.isSpecCompliantForm(e))return(await new Request(Br.origin,{method:"POST",body:e}).arrayBuffer()).byteLength;if(_e.isArrayBufferView(e)||_e.isArrayBuffer(e))return e.byteLength;if(_e.isURLSearchParams(e)&&(e=e+""),_e.isString(e))return(await wW(e)).byteLength},$W=async(e,t)=>{const n=_e.toFiniteNumber(e.getContentLength());return n??CW(t)},xW=If&&(async e=>{let{url:t,method:n,data:r,signal:i,cancelToken:o,timeout:l,onDownloadProgress:m,onUploadProgress:u,responseType:p,headers:s,withCredentials:c="same-origin",fetchOptions:d}=W_(e);p=p?(p+"").toLowerCase():"text";let h=mW([i,o&&o.toAbortSignal()],l),f;const v=h&&h.unsubscribe&&(()=>{h.unsubscribe()});let y;try{if(u&&SW&&n!=="get"&&n!=="head"&&(y=await $W(s,r))!==0){let _=new Request(t,{method:"POST",body:r,duplex:"half"}),$;if(_e.isFormData(r)&&($=_.headers.get("content-type"))&&s.setContentType($),_.body){const[O,N]=GC(y,Bd(KC(u)));r=XC(_.body,qC,O,N)}}_e.isString(c)||(c=c?"include":"omit");const b="credentials"in Request.prototype;f=new Request(t,{...d,signal:h,method:n.toUpperCase(),headers:s.normalize().toJSON(),body:r,duplex:"half",credentials:b?c:void 0});let w=await fetch(f);const x=Gm&&(p==="stream"||p==="response");if(Gm&&(m||x&&v)){const _={};["status","statusText","headers"].forEach(k=>{_[k]=w[k]});const $=_e.toFiniteNumber(w.headers.get("content-length")),[O,N]=m&&GC($,Bd(KC(m),!0))||[];w=new Response(XC(w.body,qC,O,()=>{N&&N(),v&&v()}),_)}p=p||"text";let E=await Hd[_e.findKey(Hd,p)||"text"](w,e);return!x&&v&&v(),await new Promise((_,$)=>{B_(_,$,{data:E,headers:si.from(w.headers),status:w.status,statusText:w.statusText,config:e,request:f})})}catch(b){throw v&&v(),b&&b.name==="TypeError"&&/Load failed|fetch/i.test(b.message)?Object.assign(new jt("Network Error",jt.ERR_NETWORK,e,f),{cause:b.cause||b}):jt.from(b,b&&b.code,e,f)}}),Km={http:z6,xhr:gW,fetch:xW};_e.forEach(Km,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const QC=e=>`- ${e}`,EW=e=>_e.isFunction(e)||e===null||e===!1,G_={getAdapter:e=>{e=_e.isArray(e)?e:[e];const{length:t}=e;let n,r;const i={};for(let o=0;o`adapter ${m} `+(u===!1?"is not supported by the environment":"is not available in the build"));let l=t?o.length>1?`since : +`+o.map(QC).join(` +`):" "+QC(o[0]):"as no adapter specified";throw new jt("There is no suitable adapter to dispatch the request "+l,"ERR_NOT_SUPPORT")}return r},adapters:Km};function mg(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new ol(null,e)}function ZC(e){return mg(e),e.headers=si.from(e.headers),e.data=gg.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),G_.getAdapter(e.adapter||Bc.adapter)(e).then(function(r){return mg(e),r.data=gg.call(e,e.transformResponse,r),r.headers=si.from(r.headers),r},function(r){return j_(r)||(mg(e),r&&r.response&&(r.response.data=gg.call(e,e.transformResponse,r.response),r.response.headers=si.from(r.response.headers))),Promise.reject(r)})}const K_="1.9.0",Lf={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Lf[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const JC={};Lf.transitional=function(t,n,r){function i(o,l){return"[Axios v"+K_+"] Transitional option '"+o+"'"+l+(r?". "+r:"")}return(o,l,m)=>{if(t===!1)throw new jt(i(l," has been removed"+(n?" in "+n:"")),jt.ERR_DEPRECATED);return n&&!JC[l]&&(JC[l]=!0,console.warn(i(l," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(o,l,m):!0}};Lf.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function _W(e,t,n){if(typeof e!="object")throw new jt("options must be an object",jt.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let i=r.length;for(;i-- >0;){const o=r[i],l=t[o];if(l){const m=e[o],u=m===void 0||l(m,o,e);if(u!==!0)throw new jt("option "+o+" must be "+u,jt.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new jt("Unknown option "+o,jt.ERR_BAD_OPTION)}}const wd={assertOptions:_W,validators:Lf},co=wd.validators;let Fa=class{constructor(t){this.defaults=t||{},this.interceptors={request:new VC,response:new VC}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;const o=i.stack?i.stack.replace(/^.+\n/,""):"";try{r.stack?o&&!String(r.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(r.stack+=` +`+o):r.stack=o}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Ua(this.defaults,n);const{transitional:r,paramsSerializer:i,headers:o}=n;r!==void 0&&wd.assertOptions(r,{silentJSONParsing:co.transitional(co.boolean),forcedJSONParsing:co.transitional(co.boolean),clarifyTimeoutError:co.transitional(co.boolean)},!1),i!=null&&(_e.isFunction(i)?n.paramsSerializer={serialize:i}:wd.assertOptions(i,{encode:co.function,serialize:co.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),wd.assertOptions(n,{baseUrl:co.spelling("baseURL"),withXsrfToken:co.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let l=o&&_e.merge(o.common,o[n.method]);o&&_e.forEach(["delete","get","head","post","put","patch","common"],f=>{delete o[f]}),n.headers=si.concat(l,o);const m=[];let u=!0;this.interceptors.request.forEach(function(v){typeof v.runWhen=="function"&&v.runWhen(n)===!1||(u=u&&v.synchronous,m.unshift(v.fulfilled,v.rejected))});const p=[];this.interceptors.response.forEach(function(v){p.push(v.fulfilled,v.rejected)});let s,c=0,d;if(!u){const f=[ZC.bind(this),void 0];for(f.unshift.apply(f,m),f.push.apply(f,p),d=f.length,s=Promise.resolve(n);c{if(!r._listeners)return;let o=r._listeners.length;for(;o-- >0;)r._listeners[o](i);r._listeners=null}),this.promise.then=i=>{let o;const l=new Promise(m=>{r.subscribe(m),o=m}).then(i);return l.cancel=function(){r.unsubscribe(o)},l},t(function(o,l,m){r.reason||(r.reason=new ol(o,l,m),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new Y_(function(i){t=i}),cancel:t}}};function RW(e){return function(n){return e.apply(null,n)}}function OW(e){return _e.isObject(e)&&e.isAxiosError===!0}const Ym={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Ym).forEach(([e,t])=>{Ym[t]=e});function X_(e){const t=new Fa(e),n=E_(Fa.prototype.request,t);return _e.extend(n,Fa.prototype,t,{allOwnKeys:!0}),_e.extend(n,t,null,{allOwnKeys:!0}),n.create=function(i){return X_(Ua(e,i))},n}const nr=X_(Bc);nr.Axios=Fa;nr.CanceledError=ol;nr.CancelToken=MW;nr.isCancel=j_;nr.VERSION=K_;nr.toFormData=Tf;nr.AxiosError=jt;nr.Cancel=nr.CanceledError;nr.all=function(t){return Promise.all(t)};nr.spread=RW;nr.isAxiosError=OW;nr.mergeConfig=Ua;nr.AxiosHeaders=si;nr.formToJSON=e=>z_(_e.isHTMLForm(e)?new FormData(e):e);nr.getAdapter=G_.getAdapter;nr.HttpStatusCode=Ym;nr.default=nr;const{Axios:UW,AxiosError:GW,CanceledError:KW,isCancel:YW,CancelToken:XW,VERSION:qW,all:QW,Cancel:ZW,isAxiosError:JW,spread:e8,toFormData:t8,AxiosHeaders:n8,HttpStatusCode:r8,formToJSON:i8,getAdapter:o8,mergeConfig:a8}=nr,{Title:AW}=zc,TW=Bn.div` + padding: 1.5rem; + background-color: var(--color-white); + height: calc(100vh - 180px); + overflow-y: auto; + display: flex; + flex-direction: column; + +`,vg=Bn(Vv)` + margin-bottom: 1rem; + +`,IW=Bn.div` + display: flex; + justify-content: space-between; + align-items: center; + margin-bottom: 1.5rem; +`,LW=Bn.div` + display: flex; + gap: 1rem; +`,e1=Bn(Pc)` + background-color: var(--color-primary); + color:var(--color-white); + &:hover{ + background-color: var(--color-white) !important; + border-color:var(--color-primary) !important; + color:var(--color-primary) !important; + } + + + +`,PW=({formData:e,payloads:t})=>{const[n,r]=C.useState({}),[i,o]=C.useState(!1),{domain:l,version:m,bppId:u,bapId:p,flowName:s}=e,c=(b,w="info")=>{Kv[w]({message:b,description:"",placement:"topRight"})},d=C.useMemo(()=>{const{domain:b,version:w,bppId:x,bapId:E,flowName:_}=e;return b&&w&&x&&E&&_},[e]),h=C.useMemo(()=>{const{flowName:b}=e;if(!b||!Jl[b])return!1;const w=Jl[b];return Object.keys(t).length===0?!1:w.every(x=>{const E=Os[x],_=t[E],$=JSON.stringify(_).trim()==="{}"||JSON.stringify(_).trim()===`{ + +}`;return!(!_||$)})},[e,t]),f=!d||!h,v=async()=>{var E,_,$,O;o(!0);const b={};for(const N in t)try{const k=t[N];b[N]=typeof k=="string"?JSON.parse(k):k}catch{b[N]=t[N]}const w={domain:l,version:m,bpp_id:u,bap_id:p,flow:s,generatedAt:new Date().toISOString(),payload:b},x="https://log-validation.ondc.org";try{const N=await nr.post(x+"/api/validate",w,{headers:{"Content-Type":"application/json"}});r((_=(E=N.data)==null?void 0:E.response)==null?void 0:_.report),c("Report Generated Successfully","success"),(O=($=N.data)==null?void 0:$.response)!=null&&O.report&&o(!1)}catch{o(!1),c("Something went wrong","error")}},y=()=>{const b=JSON.stringify(n,null,2),w="data:application/json;charset=utf-8,"+encodeURIComponent(b),x=`ondc-flow-${s}-report-${new Date().toISOString().split("T")[0]}.json`,E=document.createElement("a");E.setAttribute("href",w),E.setAttribute("download",x),E.click()};return qe.jsxs(TW,{children:[qe.jsxs(IW,{children:[qe.jsx(AW,{level:4,style:{margin:0,color:"var(--color-primary)"},children:"Report Generator"}),qe.jsxs(LW,{children:[qe.jsx(nl,{color:"var(--color-gray)",title:d?h?"Generate Report":"Please provide payloads for all API calls":"Please fill in all form fields",children:qe.jsx(e1,{icon:i?qe.jsx(WH,{style:{color:"var(--color-primary)"},spin:!0}):qe.jsx(BH,{}),onClick:v,disabled:f,children:"Generate Report"})}),qe.jsx(e1,{icon:qe.jsx(KH,{}),onClick:()=>y(),disabled:f,children:"Download Report"})]})]}),e&&qe.jsxs(vg,{title:"Configuration Summary",children:[qe.jsxs("p",{children:[qe.jsx("strong",{children:"Domain:"})," ",e.domain||"Not specified"]}),qe.jsxs("p",{children:[qe.jsx("strong",{children:"Version:"})," ",e.version||"Not specified"]}),qe.jsxs("p",{children:[qe.jsx("strong",{children:"BPP ID:"})," ",e.bppId||"Not specified"]}),qe.jsxs("p",{children:[qe.jsx("strong",{children:"BAP ID:"})," ",e.bapId||"Not specified"]}),qe.jsxs("p",{children:[qe.jsx("strong",{children:"Flow:"})," Flow ",e.flowName||"Not specified"]})]}),t&&qe.jsx(vg,{title:"Flow Status",children:qe.jsx(Im,{direction:"vertical",style:{width:"100%"},children:Object.keys(t).length>0?Object.keys(t).map(b=>qe.jsx("div",{children:qe.jsxs("p",{children:[qe.jsxs("strong",{children:[`${b}`,":"]})," ",t[b]?"✅ Payload provided":"❌ Payload missing"]})},b)):qe.jsx("p",{children:"No payload data available. Please select a flow and provide payloads."})})}),n?qe.jsx(vg,{title:"Report",children:qe.jsx(Im,{direction:"vertical",style:{width:"100%"},children:qe.jsx("div",{children:Object.keys(n).length>0?Object.entries(n).map(([b,w],x)=>qe.jsxs("div",{style:{marginBottom:"1rem"},children:[qe.jsx("h3",{style:{marginBottom:"0.5rem"},children:b}),w&&typeof w=="object"?Object.entries(w).map(([E,_],$)=>qe.jsxs("div",{style:{marginLeft:"1rem",marginBottom:"0.3rem"},children:[qe.jsxs("strong",{children:[E,":"]})," ",qe.jsx("span",{children:_})]},$)):qe.jsx("p",{children:"No error details found."})]},x)):qe.jsx("p",{children:"No report data available. Please generate report."})})})}):""]})},kW=Bn.div` + min-height: 100vh; + display: flex; + flex-direction: column; + width: 100%; +`,NW=Bn.div` + flex: 1; + display: flex; + flex-direction: column; + width: 100%; +`,DW=Bn.div` + display: flex; + flex: 1; + width: 100%; + @media (max-width: 768px) { + flex-direction: column; + + } +`,FW=Bn.div` + flex: 1; + border-right: 1px solid var(--color-light); + +`,zW=Bn.div` + flex: 1; +`;function jW(){const[e,t]=C.useState({domain:"",version:"",bppId:"",bapId:"",flowName:""}),[n,r]=C.useState({}),i=l=>{t(l)},o=l=>{r(l)};return Kv.config({placement:"topRight",duration:3}),qe.jsxs(kW,{children:[qe.jsx(LO,{}),qe.jsx(FO,{}),qe.jsxs(NW,{children:[qe.jsx(Z5,{onFormChange:i}),qe.jsxs(DW,{children:[qe.jsx(FW,{children:qe.jsx(JH,{selectedFlow:(e==null?void 0:e.flowName)||"",onPayloadChange:o})}),qe.jsx(zW,{children:qe.jsx(PW,{formData:e,payloads:n})})]})]})]})}TR.createRoot(document.getElementById("root")).render(qe.jsx(C.StrictMode,{children:qe.jsx(jW,{})})); diff --git a/ui/assets/index-Cm92dBtq.css b/ui/assets/index-Cm92dBtq.css new file mode 100644 index 00000000..634e5fa5 --- /dev/null +++ b/ui/assets/index-Cm92dBtq.css @@ -0,0 +1 @@ +:root{font-family:Segoe UI,Tahoma,Geneva,Verdana,sans-serif;line-height:1.5;font-weight:400;color-scheme:light;color:var(--color-text);background-color:var(--color-background);font-synthesis:none;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}*{margin:0;padding:0;box-sizing:border-box}body{min-width:320px;min-height:100vh;width:100%;margin:0;padding:0;display:flex;justify-content:center}#root{width:100%;max-width:100%;display:flex;justify-content:center}a{font-weight:500;color:var(--color-secondary);text-decoration:inherit}h1{font-size:3.2em;line-height:1.1}a{cursor:pointer}button{border-radius:8px;border:1px solid transparent;padding:.6em 1.2em;font-size:1em;font-weight:500;font-family:inherit;background-color:#1a1a1a;cursor:pointer;transition:border-color .25s}@media (prefers-color-scheme: light){:root{color:#213547;background-color:#fff}button{background-color:#f9f9f9}} diff --git a/ui/index.html b/ui/index.html new file mode 100644 index 00000000..4233a445 --- /dev/null +++ b/ui/index.html @@ -0,0 +1,14 @@ + + + + + + + ONDC Log Validation Tool + + + + +
+ + diff --git a/ui/ondc.svg b/ui/ondc.svg new file mode 100644 index 00000000..7e811c73 --- /dev/null +++ b/ui/ondc.svg @@ -0,0 +1,22 @@ + + + + + + + + + + + + diff --git a/utils/Retail_.1.2.5/Confirm/onConfirm.ts b/utils/Retail_.1.2.5/Confirm/onConfirm.ts new file mode 100644 index 00000000..bce0ea97 --- /dev/null +++ b/utils/Retail_.1.2.5/Confirm/onConfirm.ts @@ -0,0 +1,855 @@ +/* eslint-disable no-prototype-builtins */ +import _ from 'lodash' +import constants, { ApiSequence, PAYMENT_STATUS } from '../../../constants' +import { logger } from '../../../shared/logger' +import { + validateSchemaRetailV2, + isObjectEmpty, + checkContext, + timeDiff as timeDifference, + compareCoordinates, + checkItemTag, + checkBppIdOrBapId, + areGSTNumbersMatching, + compareObjects, + sumQuoteBreakUp, + payment_status, + compareQuoteObjects, + compareLists, + isoDurToSec, + getProviderId, + deepCompare, + compareFinanceTermsTags, + validateFinanceTxnTag, +} from '../..' +import { FLOW, OFFERSFLOW } from '../../enum' +import { getValue, setValue } from '../../../shared/dao' +export const checkOnConfirm = (data: any, fulfillmentsItemsSet: any, flow: string) => { + const onCnfrmObj: any = {} + try { + if (!data || isObjectEmpty(data)) { + return { [ApiSequence.ON_CONFIRM]: 'JSON cannot be empty' } + } + + const { message, context }: any = data + if (!message || !context || !message.order || isObjectEmpty(message) || isObjectEmpty(message.order)) { + return { missingFields: '/context, /message, /order or /message/order is missing or empty' } + } + + try { + logger.info(`Comparing Message Ids of /${constants.CONFIRM} and /${constants.ON_CONFIRM}`) + if (!_.isEqual(getValue(`${ApiSequence.CONFIRM}_msgId`), context.message_id)) { + onCnfrmObj[`${ApiSequence.ON_CONFIRM}_msgId`] = + `Message Ids for /${constants.CONFIRM} and /${constants.ON_CONFIRM} api should be same` + } + } catch (error: any) { + logger.error(`!!Error while checking message id for /${constants.ON_SEARCHINC}, ${error.stack}`) + } + + const searchContext: any = getValue(`${ApiSequence.SEARCH}_context`) + const parentItemIdSet: any = getValue(`parentItemIdSet`) + const select_customIdArray: any = getValue(`select_customIdArray`) + + const schemaValidation = validateSchemaRetailV2(context.domain.split(':')[1], constants.ON_CONFIRM, data) + + const contextRes: any = checkContext(context, constants.ON_CONFIRM) + + const checkBap = checkBppIdOrBapId(context.bap_id) + const checkBpp = checkBppIdOrBapId(context.bpp_id) + + if (checkBap) Object.assign(onCnfrmObj, { bap_id: 'context/bap_id should not be a url' }) + if (checkBpp) Object.assign(onCnfrmObj, { bpp_id: 'context/bpp_id should not be a url' }) + + if (schemaValidation !== 'error') { + Object.assign(onCnfrmObj, schemaValidation) + } + + if (!contextRes?.valid) { + Object.assign(onCnfrmObj, contextRes.ERRORS) + } + if (!_.isEqual(data.context.domain.split(':')[1], getValue(`domain`))) { + onCnfrmObj[`Domain[${data.context.action}]`] = `Domain should be same in each action` + } + + setValue(`${ApiSequence.ON_CONFIRM}`, data) + + try { + logger.info(`Comparing city of /${constants.SEARCH} and /${constants.ON_CONFIRM}`) + if (!_.isEqual(searchContext.city, context.city)) { + onCnfrmObj.city = `City code mismatch in /${constants.SEARCH} and /${constants.ON_CONFIRM}` + } + } catch (error: any) { + logger.info(`Error while comparing city in /${constants.SEARCH} and /${constants.ON_CONFIRM}, ${error.stack}`) + } + + try { + logger.info(`Comparing timestamp of /${constants.CONFIRM} and /${constants.ON_CONFIRM}`) + const tmpstmp = getValue('tmpstmp') + if (_.gte(tmpstmp, context.timestamp)) { + onCnfrmObj.tmpstmp = `Timestamp for /${constants.CONFIRM} api cannot be greater than or equal to /${constants.ON_CONFIRM} api` + } else { + const timeDiff = timeDifference(context.timestamp, tmpstmp) + logger.info(timeDiff) + if (timeDiff > 5000) { + onCnfrmObj.tmpstmp = `context/timestamp difference between /${constants.ON_CONFIRM} and /${constants.CONFIRM} should be less than 5 sec` + } + } + setValue('tmpstmp', context.timestamp) + setValue('onCnfrmtmpstmp', context.timestamp) + } catch (error: any) { + logger.info( + `Error while comparing timestamp for /${constants.CONFIRM} and /${constants.ON_CONFIRM} api, ${error.stack}`, + ) + } + + try { + logger.info(`Comparing transaction Ids of /${constants.SELECT} and /${constants.ON_CONFIRM}`) + if (!_.isEqual(getValue('txnId'), context.transaction_id)) { + onCnfrmObj.txnId = `Transaction Id should be same from /${constants.SELECT} onwards` + } + } catch (error: any) { + logger.error( + `!!Error while comparing transaction ids for /${constants.SELECT} and /${constants.ON_CONFIRM} api, ${error.stack}`, + ) + } + + const on_confirm = message.order + + try { + logger.info(`Checking Cancellation terms for /${constants.ON_CONFIRM}`) + if (message.order.cancellation_terms && message.order.cancellation_terms.length > 0) { + onCnfrmObj[`message.order`] = + `'cancellation_terms' in /message/order should not be provided as those are not enabled yet` + } + } catch (error: any) { + logger.error(`!!Error while checking Cancellation terms for /${constants.ON_CONFIRM}, ${error.stack}`) + } + try { + logger.info(`Checking fulfillment ids for /${constants.ON_CONFIRM}`) + message.order.fulfillments.forEach((fulfillment: any) => { + if (!fulfillment['@ondc/org/TAT']) { + onCnfrmObj[`message.order.fulfillments[${fulfillment.id}]`] = + `'TAT' must be provided in message/order/fulfillments` + } + const on_select_fulfillment_tat_obj: any = getValue('fulfillment_tat_obj') + const fulfillment_id = fulfillment.id + + logger.info(`Checking TAT Mistatch between /${constants.ON_CONFIRM} & /${constants.ON_SELECT}`) + if ( + on_select_fulfillment_tat_obj !== null && + on_select_fulfillment_tat_obj[fulfillment_id] !== isoDurToSec(fulfillment['@ondc/org/TAT']) + ) { + onCnfrmObj[`TAT_Mismatch`] = + `TAT Mistatch between /${constants.ON_CONFIRM} i.e ${isoDurToSec(fulfillment['@ondc/org/TAT'])} seconds & /${constants.ON_SELECT} i.e ${on_select_fulfillment_tat_obj[fulfillment_id]} seconds` + } + }) + } catch (error: any) { + logger.error(`!!Error while Checking fulfillment ids for /${constants.ON_CONFIRM}, ${error.stack}`) + } + + try { + logger.info(`Comparing order ids in /${constants.CONFIRM} and /${constants.ON_CONFIRM}`) + if (getValue('cnfrmOrdrId') != on_confirm.id) { + onCnfrmObj.orderID = `Order Id mismatches in /${constants.CONFIRM} and /${constants.ON_CONFIRM}` + } + } catch (error: any) { + logger.error(`!!Error while trying to fetch order ids in /${constants.ON_CONFIRM}, ${error.stack}`) + } + + try { + logger.info(`checking created_at and updated_at timestamp in /${constants.ON_CONFIRM}`) + const cnfrmOrdrCrtd = getValue('ordrCrtd') + const cnfrmOrdrUpdtd = getValue('ordrUpdtd') + if (!_.isEmpty(on_confirm?.state)) setValue('orderState', on_confirm.state) + setValue('onCnfrmState', on_confirm.state) + if (on_confirm.state === 'Created' || on_confirm.state === 'Accepted') { + if (cnfrmOrdrCrtd && (!on_confirm.created_at || on_confirm.created_at != cnfrmOrdrCrtd)) { + onCnfrmObj.crtdtmstmp = `order.created_at timestamp mismatches in /${constants.CONFIRM} and /${constants.ON_CONFIRM}` + } + + if (on_confirm.updated_at) { + setValue('PreviousUpdatedTimestamp', on_confirm.updated_at) + } + if ( + cnfrmOrdrUpdtd && + (!on_confirm.updated_at || + _.gte(cnfrmOrdrUpdtd, on_confirm.updated_at) || + on_confirm.updated_at != getValue('tmpstmp')) + ) { + onCnfrmObj.updtdtmstmp = `order.updated_at timestamp should be updated as per the context.timestamp (since default fulfillment state is added)` + } + } + } catch (error: any) { + logger.error(`!!Error while checking order timestamps in /${constants.ON_CONFIRM}, ${error.stack}`) + } + + try { + logger.info(`Checking provider id and location in /${constants.ON_CONFIRM}`) + if (on_confirm.provider.id != getValue('providerId')) { + onCnfrmObj.prvdrId = `Provider Id mismatches in /${constants.ON_SEARCH} and /${constants.ON_CONFIRM}` + } + + if (on_confirm.provider.locations[0].id != getValue('providerLoc')) { + onCnfrmObj.prvdrLoc = `provider.locations[0].id mismatches in /${constants.ON_SEARCH} and /${constants.ON_CONFIRM}` + } + } catch (error: any) { + logger.error(`!!Error while checking provider id and location in /${constants.ON_CONFIRM}, ${error.stack}`) + } + + try { + logger.info(`Comparing item Ids and fulfillment ids in /${constants.ON_SELECT} and /${constants.ON_CONFIRM}`) + const itemFlfllmnts: any = getValue('itemFlfllmnts') + const itemsIdList: any = getValue('itemsIdList') + let i = 0 + const len = on_confirm.items.length + + while (i < len) { + const itemId = on_confirm.items[i].id + const item = on_confirm.items[i] + + if (checkItemTag(item, select_customIdArray)) { + const itemkey = `item${i}tags.parent_id` + onCnfrmObj[itemkey] = + `items[${i}].tags.parent_id mismatches for Item ${itemId} in /${constants.SELECT} and /${constants.INIT}` + } + + if (parentItemIdSet && item.parent_item_id && !parentItemIdSet.includes(item.parent_item_id)) { + const itemkey = `item_PrntItmId${i}` + onCnfrmObj[itemkey] = + `items[${i}].parent_item_id mismatches for Item ${itemId} in /${constants.ON_SEARCH} and /${constants.ON_INIT}` + } + + if (itemId in itemFlfllmnts) { + if (on_confirm.items[i].fulfillment_id != itemFlfllmnts[itemId]) { + const itemkey = `item_FFErr${i}` + onCnfrmObj[itemkey] = + `items[${i}].fulfillment_id mismatches for Item ${itemId} in /${constants.ON_SELECT} and /${constants.ON_CONFIRM}` + } + } else { + const itemkey = `item_FFErr${i}` + onCnfrmObj[itemkey] = `Item Id ${itemId} does not exist in /${constants.ON_SELECT}` + } + + if (itemId in itemsIdList) { + if (on_confirm.items[i].quantity.count != itemsIdList[itemId]) { + onCnfrmObj.countErr = `Warning: items[${i}].quantity.count for item ${itemId} mismatches with the items quantity selected in /${constants.SELECT}` + } + } + + i++ + } + } catch (error: any) { + logger.error( + `!!Error while comparing Item and Fulfillment Id in /${constants.ON_SELECT} and /${constants.CONFIRM}, ${error.stack}`, + ) + } + + try { + logger.info(`Storing delivery fulfillment if provided in ${constants.ON_CONFIRM}`) + const deliveryFulfillment = on_confirm.fulfillments.filter((fulfillment: any) => fulfillment.type === 'Delivery') + + const { start, end } = deliveryFulfillment[0] + const startRange = start.time?.range + const endRange = end.time?.range + if (startRange && endRange) { + setValue('deliveryFulfillment', deliveryFulfillment[0]) + setValue('deliveryFulfillmentAction', ApiSequence.ON_CONFIRM) + } + } catch (error: any) { + logger.error(`Error while Storing delivery fulfillment, ${error.stack}`) + } + + if (on_confirm.state === 'Accepted') { + try { + // For Delivery Object + const fulfillments = on_confirm.fulfillments + if (fulfillments) { + const deliveryFulfillment = fulfillments.find((f: any) => f.type === 'Delivery') + if (!deliveryFulfillment.hasOwnProperty('provider_id')) { + const key = `missingFulfillments` + onCnfrmObj[key] = `provider_id must be present in ${ApiSequence.ON_CONFIRM} as order is accepted` + } + + const id = getProviderId(deliveryFulfillment) + setValue('fulfillmentProviderId', id) + } + if (!fulfillments.length) { + const key = `missingFulfillments` + onCnfrmObj[key] = `missingFulfillments is mandatory for ${ApiSequence.ON_CONFIRM}` + } else { + const deliveryObjArr = _.filter(fulfillments, { type: 'Delivery' }) + if (!deliveryObjArr.length) { + onCnfrmObj[`message/order.fulfillments/`] = + `Delivery fullfillment must be present in ${ApiSequence.ON_CONFIRM} if the Order.state is 'Accepted'` + } else { + const deliverObj = deliveryObjArr[0] + delete deliverObj?.state + delete deliverObj?.tags + delete deliverObj?.start?.instructions + delete deliverObj?.end?.instructions + fulfillmentsItemsSet.add(deliverObj) + } + } + } catch (error: any) { + logger.error(`Error while checking Fulfillments Delivery Obj in /${ApiSequence.ON_CONFIRM}, ${error.stack}`) + } + } + //Vehicle registeration for (Self-Pickup) Kerbside + const fulfillments = on_confirm.fulfillments + if (Array.isArray(fulfillments)) { + fulfillments.forEach((fulfillment, index) => { + const type = fulfillment.type + const category = fulfillment['@ondc/org/category'] + const vehicle = fulfillment.vehicle + const SELF_PICKUP = 'Self-Pickup' + const KERBSIDE = 'Kerbside' + + if (type === SELF_PICKUP && category === KERBSIDE) { + if (!vehicle) { + onCnfrmObj[`fulfillment${index}_vehicle`] = + `Vehicle is required for fulfillment ${index} with type ${SELF_PICKUP} and category ${KERBSIDE} in /${constants.CONFIRM}` + } else if (!vehicle.registration) { + onCnfrmObj[`fulfillment${index}_vehicle_registration`] = + `Vehicle registration is required for fulfillment ${index} with type ${SELF_PICKUP} and category ${KERBSIDE} in /${constants.CONFIRM}` + } + } else if (vehicle) { + onCnfrmObj[`fulfillment${index}_vehicle`] = + `Vehicle should not be present in fulfillment ${index} with type ${type} and category ${category} in /${constants.CONFIRM}` + } + }) + } + + try { + logger.info(`Checking for valid pan_id in provider_tax_number and tax_number in /on_confirm`) + const bpp_terms_obj: any = message.order.tags.filter((item: any) => { + return item?.code == 'bpp_terms' + })[0] + const list = bpp_terms_obj.list + const np_type_arr = list.filter((item: any) => item.code === 'np_type') + const accept_bap_terms = list.filter((item: any) => item.code === 'accept_bap_terms') + const np_type_on_search = getValue(`${ApiSequence.ON_SEARCH}np_type`) + let np_type = '' + + if (np_type_arr.length > 0) { + np_type = np_type_arr[0].value + } else { + const key = 'message.order.tags[0].list' + onCnfrmObj[key] = `np_type not found in on_confirm` + } + + if (accept_bap_terms.length > 0) { + const key = 'message.order.tags[0].list' + onCnfrmObj[key] = `accept_bap_terms is not required for now!` + } + + if (np_type && np_type != np_type_on_search) { + const key = 'message.order.tags[0].list' + onCnfrmObj[key] = `np_type of on_search is not same to np_type of on_confirm` + } + + if (!_.isEmpty(bpp_terms_obj)) { + let tax_number = '' + let provider_tax_number = '' + list.map((item: any) => { + if (item.code == 'tax_number') { + if (item.value.length != 15) { + const key = `message.order.tags[0].list` + onCnfrmObj[key] = `Number of digits in tax number in message.order.tags[0].list should be 15` + } else { + tax_number = item.value + } + } + + if (item.code == 'provider_tax_number') { + if (item.value.length != 10) { + const key = `message.order.tags[0].list` + onCnfrmObj[key] = `Number of digits in provider tax number in message.order.tags[0].list should be 10` + } else { + provider_tax_number = item.value + } + } + }) + + if (tax_number.length == 0) { + logger.error(`tax_number must present in ${constants.ON_CONFIRM}`) + onCnfrmObj['tax_number'] = `tax_number must be present for ${constants.ON_CONFIRM}` + } else { + const taxNumberPattern = new RegExp('^[0-9]{2}[A-Z]{5}[0-9]{4}[A-Z]{1}[1-9A-Z]{1}Z[0-9A-Z]{1}$') + if (!taxNumberPattern.test(tax_number)) { + logger.error(`Invalid format for tax_number in ${constants.ON_INIT}`) + onCnfrmObj.tax_number = `Invalid format for tax_number in ${constants.ON_CONFIRM}` + } + } + + if (provider_tax_number.length == 0) { + logger.error(`tax_number must present in ${constants.ON_CONFIRM}`) + onCnfrmObj['provider_tax_number'] = `provider_tax_number must be present for ${constants.ON_CONFIRM}` + } else { + const taxNumberPattern = new RegExp('^[A-Z]{5}[0-9]{4}[A-Z]{1}$') + if (!taxNumberPattern.test(provider_tax_number)) { + logger.error(`Invalid format for provider_tax_number in ${constants.ON_INIT}`) + onCnfrmObj.provider_tax_number = `Invalid format for provider_tax_number in ${constants.ON_CONFIRM}` + } + } + + if (tax_number.length == 15 && provider_tax_number.length == 10) { + const pan_id = tax_number.slice(2, 12) + if (pan_id != provider_tax_number && np_type_on_search == 'ISN') { + onCnfrmObj[`message.order.tags[0].list`] = + `Pan_id is different in tax_number and provider_tax_number in message.order.tags[0].list` + logger.error( + 'onCnfrmObj[`message.order.tags[0].list`] = `Pan_id is different in tax_number and provider_tax_number in message.order.tags[0].list`', + ) + } else if (pan_id == provider_tax_number && np_type_on_search === 'MSN') { + onCnfrmObj[`message.order.tags[0].list`] = + `Pan_id shouldn't be same in tax_number and provider_tax_number in message.order.tags[0].list` + logger.error( + "onCnfrmObj[`message.order.tags[0].list`] = `Pan_id shoudn't be same in tax_number and provider_tax_number in message.order.tags[0].list`", + ) + } + } + } + } catch (error: any) { + logger.error(`Error while comparing valid pan_id in tax_number and provider_tax_number`) + } + + try { + logger.info(`Comparing timestamp of context and updatedAt for /${constants.ON_CONFIRM}`) + if (!_.isEqual(context.timestamp, on_confirm.updated_at)) { + const key = `invldUpdtdTmstp` + onCnfrmObj[key] = `updated_at timestamp should be equal to context timestamp for /${constants.ON_CONFIRM}` + logger.error(`updated_at timestamp should be equal to context timestamp for /${constants.ON_CONFIRM}`) + } + } catch (error: any) { + logger.error(`!!Error while compairing updated_at timestamp with context timestamp for ${constants.ON_CONFIRM}`) + } + + try { + logger.info(`Comparing billing object in ${constants.CONFIRM} and /${constants.ON_CONFIRM}`) + const billing = getValue('billing') + + const billingErrors = compareObjects(billing, on_confirm.billing) + + if (billingErrors) { + let i = 0 + const len = billingErrors.length + while (i < len) { + const key = `billingErr${i}` + onCnfrmObj[key] = `${billingErrors[i]} when compared with init billing object` + i++ + } + } + } catch (error: any) { + logger.info(`!Error while comparing billing object in /${constants.CONFIRM} and /${constants.ON_CONFIRM}`) + } + + try { + logger.info(`Checking fulfillments objects in /${constants.ON_CONFIRM}`) + const itemFlfllmnts: any = getValue('itemFlfllmnts') + let i = 0 + const len = on_confirm.fulfillments.length + while (i < len) { + //Comparing fulfillment Ids + if (on_confirm.fulfillments[i].id) { + const id = on_confirm.fulfillments[i].id + if (!Object.values(itemFlfllmnts).includes(id)) { + const key = `ffID${id}` + //MM->Mismatch + onCnfrmObj[key] = `fulfillment id ${id} does not exist in /${constants.ON_SELECT}` + } + } else { + onCnfrmObj.ffId = `fulfillments[${i}].id is missing in /${constants.ON_CONFIRM}` + } + + if (!on_confirm.fulfillments[i].type) { + const key = `ffID type` + onCnfrmObj[key] = `fulfillment type does not exist in /${constants.ON_SELECT}` + } + + const ffId = on_confirm.fulfillments[i].id || '' + if (getValue(`${ffId}_tracking`)) { + if (on_confirm.fulfillments[i].tracking === false || on_confirm.fulfillments[i].tracking === true) { + if (getValue(`${ffId}_tracking`) != on_confirm.fulfillments[i].tracking) { + logger.info(`Fulfillment Tracking mismatch with the ${constants.ON_SELECT} call`) + onCnfrmObj['ffTracking'] = `Fulfillment Tracking mismatch with the ${constants.ON_SELECT} call` + } + } else { + logger.info(`Tracking must be present for fulfillment ID: ${ffId} in boolean form`) + onCnfrmObj['ffTracking'] = `Tracking must be present for fulfillment ID: ${ffId} in boolean form` + } + } + + logger.info('Checking the fulfillments state') + + const ffDesc = on_confirm.fulfillments[i].state.descriptor + + const ffStateCheck = ffDesc.hasOwnProperty('code') ? ffDesc.code === 'Pending' : false + setValue(`ffIdPrecancel`, ffDesc?.code) + if (!ffStateCheck) { + const key = `ffState${i}` + onCnfrmObj[key] = `default fulfillments state is missing in /${constants.ON_CONFIRM}` + } + + if (!on_confirm.fulfillments[i].start || !on_confirm.fulfillments[i].end) { + onCnfrmObj.ffstartend = `fulfillments[${i}] start and end locations are mandatory` + } + + try { + if (!compareCoordinates(on_confirm.fulfillments[i].start.location.gps, getValue('providerGps'))) { + onCnfrmObj.sellerGpsErr = `store gps location /fulfillments[${i}]/start/location/gps can't change` + } + } catch (error: any) { + logger.error(`!!Error while checking store location in /${constants.ON_CONFIRM}, ${error.stack}`) + } + + try { + if (!getValue('providerName')) { + onCnfrmObj.sellerNameErr = `Invalid store name inside fulfillments in /${constants.ON_CONFIRM}` + } else if (!_.isEqual(on_confirm.fulfillments[i].start.location.descriptor.name, getValue('providerName'))) { + onCnfrmObj.sellerNameErr = `store name /fulfillments[${i}]/start/location/descriptor/name can't change` + } + } catch (error: any) { + logger.error(`!!Error while checking store name in /${constants.ON_CONFIRM}`) + } + + if (!_.isEqual(on_confirm.fulfillments[i].end.location.gps, getValue('buyerGps'))) { + onCnfrmObj.buyerGpsErr = `fulfillments[${i}].end.location gps is not matching with gps in /select` + } + + if (!_.isEqual(on_confirm.fulfillments[i].end.location.address.area_code, getValue('buyerAddr'))) { + onCnfrmObj.gpsErr = `fulfillments[${i}].end.location.address.area_code is not matching with area_code in /select` + } + + i++ + } + } catch (error: any) { + logger.error(`!!Error while checking fulfillments object in /${constants.ON_CONFIRM}, ${error.stack}`) + } + + try { + logger.info(`Comparing /${constants.ON_CONFIRM} quoted Price and Payment Params amount`) + setValue('quotePrice', on_confirm.quote.price.value) + if (parseFloat(on_confirm.payment.params.amount) != parseFloat(on_confirm.quote.price.value)) { + onCnfrmObj.onConfirmedAmount = `Quoted price (/${constants.ON_CONFIRM}) doesn't match with the amount in payment.params` + } + } catch (error: any) { + logger.error( + `!!Error while Comparing /${constants.ON_CONFIRM} quoted Price and Payment Params amount, ${error.stack}`, + ) + } + + try { + logger.info(`Checking quote breakup prices for /${constants.ON_CONFIRM}`) + if (!sumQuoteBreakUp(on_confirm.quote)) { + const key = `invldPrices` + onCnfrmObj[key] = `item quote breakup prices for ${constants.ON_CONFIRM} should be equal to the total price.` + logger.error(`item quote breakup prices for ${constants.ON_CONFIRM} should be equal to the total price`) + } + const collect_payment = getValue('collect_payment') + if (flow === FLOW.FLOW0099 || collect_payment === 'N' || flow === OFFERSFLOW.FLOW0098) { + let offers = on_confirm.quote.breakup.filter((item: any) => item['@ondc/org/title_type'] === 'offer') + if (offers.length === 0) { + onCnfrmObj['offer-not-found'] = `Offer is required for the flow: ${flow}` + } else if (offers.length > 0) { + const providerOffers: any = getValue(`${ApiSequence.ON_SEARCH}_offers`) + offers.forEach((offer: any, index: number) => { + const providerOffer = providerOffers?.find( + (providedOffer: any) => providedOffer?.id.toLowerCase() === offer['@ondc/org/item_id'].toLowerCase(), + ) + console.log('providerOffer in select call', JSON.stringify(providerOffer)) + + if (!providerOffer) { + onCnfrmObj[`offer[${index}]`] = `Offer with id ${offer.id} is not available for the provider.` + return + } + const offerType = providerOffer.descriptor.code + if (offerType === 'financing') { + const finance_tags = offer.item.tags.find((tag: any) => tag.code === 'finance_terms') + const finance_txn = offer.item.tags.find((tag: any) => tag.code === 'finance_txn') + if (finance_tags) { + const on_init_finance_tags = getValue(`finance_terms${constants.ON_INIT}`) + const financeTagsError = compareFinanceTermsTags(on_init_finance_tags,finance_tags) + if (financeTagsError) { + let i = 0 + const len = financeTagsError.length + while (i < len) { + const key = `financeTagsError${i}` + onCnfrmObj[key] = `${financeTagsError[i]}` + i++ + } + } + } + if(finance_txn){ + const financeTxnError = validateFinanceTxnTag(finance_txn) + if (financeTxnError) { + let i = 0 + const len = financeTxnError.length + while (i < len) { + const key = `financeTagsError${i}` + onCnfrmObj[key] = `${financeTxnError[i]}` + i++ + } + } + } + } + }) + } + } + } catch (error: any) { + logger.error(`!!Error while Comparing Quote object for /${constants.ON_CONFIRM}`) + } + + try { + logger.info(`Comparing Quote object for /${constants.ON_SELECT} and /${constants.ON_CONFIRM}`) + + const on_select_quote: any = getValue('quoteObj') + if (flow !== FLOW.FLOW0099 && flow != OFFERSFLOW.FLOW0098) { + const quoteErrors = compareQuoteObjects( + on_select_quote, + on_confirm.quote, + constants.ON_CONFIRM, + constants.ON_SELECT, + ) + + const hasItemWithQuantity = _.some(on_confirm.quote.breakup, (item) => _.has(item, 'item.quantity')) + if (hasItemWithQuantity) { + const key = `quantErr` + onCnfrmObj[key] = + `Extra attribute Quantity provided in quote object i.e not supposed to be provided after on_select so invalid quote object` + } else if (quoteErrors) { + let i = 0 + const len = quoteErrors.length + while (i < len) { + const key = `quoteErr${i}` + onCnfrmObj[key] = `${quoteErrors[i]}` + i++ + } + } + } + } catch (error: any) { + logger.error(`!!Error while comparing quote in /${constants.ON_SELECT} and /${constants.ON_CONFIRM}`) + } + + try { + logger.info(`Comparing order price value in /${constants.ON_INIT} and /${constants.CONFIRM}`) + const oninitQuotePrice: any = getValue('initQuotePrice') + const onConfirmQuotePrice = parseFloat(on_confirm.quote.price.value) + setValue(`${constants.ON_CONFIRM}/quote`,on_confirm.quote) + + logger.info(`Comparing quote prices of /${constants.ON_INIT} and /${constants.CONFIRM}`) + if (oninitQuotePrice != onConfirmQuotePrice) { + logger.info( + `order quote price in /${constants.CONFIRM} is not equal to the quoted price in /${constants.ON_INIT}`, + ) + onCnfrmObj.quoteErr = `Quoted Price in /${constants.CONFIRM} INR ${onConfirmQuotePrice} does not match with the quoted price in /${constants.ON_INIT} INR ${oninitQuotePrice}` + } + setValue('quotePrice', onConfirmQuotePrice) + } catch (error: any) { + logger.error(`!!Error while comparing order price value in /${constants.ON_INIT} and /${constants.CONFIRM}`) + } + + try { + logger.info(`Comparing payment object in /${constants.CONFIRM} & /${constants.ON_CONFIRM}`) + + if (!_.isEqual(getValue('cnfrmpymnt'), on_confirm.payment)) { + onCnfrmObj.pymntObj = `payment object mismatches in /${constants.CONFIRM} & /${constants.ON_CONFIRM}` + } + } catch (error: any) { + logger.error( + `!!Error while comparing payment object in /${constants.CONFIRM} & /${constants.ON_CONFIRM}, ${error.stack}`, + ) + } + + try { + logger.info(`Checking Buyer App finder fee amount in /${constants.ON_CONFIRM}`) + const buyerFF: any = getValue(`${ApiSequence.SEARCH}_buyerFF`) + if ( + on_confirm.payment['@ondc/org/buyer_app_finder_fee_amount'] && + parseFloat(on_confirm.payment['@ondc/org/buyer_app_finder_fee_amount']) != buyerFF + ) { + onCnfrmObj.buyerFF = `Buyer app finder fee can't change in /${constants.ON_CONFIRM}` + logger.info(`Buyer app finder fee can't change in /${constants.ON_CONFIRM}`) + } + } catch (error: any) { + logger.info(`!Error while comparing buyer app finder fee in /${constants.ON_CONFIRM}, ${error.stack}`) + } + + const list_ON_INIT: any = getValue('list_ON_INIT') + let ON_INIT_val: string + list_ON_INIT.map((data: any) => { + if (data.code == 'tax_number') { + ON_INIT_val = data.value + } + }) + + try { + logger.info(`Checking if tax_number in bpp_terms in ON_CONFIRM and ON_INIT is same`) + let list_ON_CONFIRM: any + message.order.tags.forEach((data: any) => { + if (data.code == 'bpp_terms') { + list_ON_CONFIRM = data.list + } + }) + if (!list_ON_CONFIRM.some((data: any) => data.code == 'np_type')) { + onCnfrmObj['message/order/tags/bpp_terms/np_type'] = + `np_type is missing in message/order/tags/bpp_terms for ON_CONFIRM` + } + list_ON_CONFIRM.map((data: any) => { + if (data.code == 'tax_number') { + if (data.value != ON_INIT_val) { + onCnfrmObj['message/order/tags/bpp_terms'] = + `Value of tax Number mismatched in message/order/tags/bpp_terms for ON_INIT and ON_CONFIRM` + } + } + }) + } catch (error: any) { + logger.error(`Error while matching the tax_number in ON_CONFIRM and ON_INIT`) + } + + try { + logger.info(`Comparing tags in /${constants.CONFIRM} and /${constants.ON_CONFIRM}`) + const confirm_tags: any[] | any = getValue('confirm_tags') + if (on_confirm.tags) { + const bap_terms = areGSTNumbersMatching(confirm_tags, on_confirm.tags, 'bap_terms') + + if (bap_terms === false) { + onCnfrmObj.tags_bap_terms = `Tags should have same and valid gst_number as passed in /${constants.CONFIRM}` + } + + const bpp_terms = areGSTNumbersMatching(confirm_tags, on_confirm.tags, 'bpp_terms') + if (bpp_terms === false) { + onCnfrmObj.tags_bpp_terms = `Tags should have same and valid gst_number as passed in /${constants.CONFIRM}` + } + } + } catch (error: any) { + logger.error( + `!!Error while Comparing tags in /${constants.CONFIRM} and /${constants.ON_CONFIRM} + ${error.stack}`, + ) + } + + try { + logger.info(`Checking if transaction_id is present in message.order.payment`) + const payment = on_confirm.payment + const status = payment_status(payment, flow) + if (!status) { + onCnfrmObj['message/order/transaction_id'] = `Transaction_id missing in message/order/payment` + } + } catch (err: any) { + logger.error(`Error while checking transaction is in message.order.payment`) + } + try { + if (flow === FLOW.FLOW012) { + logger.info('Payment status check in on confirm call') + const payment = on_confirm.payment + const confirmPaymentStatus = getValue('confirmPaymentStatus') + if (payment.status !== confirmPaymentStatus) { + const key = `missmatchStatus` + onCnfrmObj[key] = `payment status in /${constants.ON_CONFIRM} must be same as in /${constants.CONFIRM} ` + } + if (payment.status !== PAYMENT_STATUS.NOT_PAID) { + logger.error( + `Payment status should be ${PAYMENT_STATUS.NOT_PAID} for ${FLOW.FLOW012} flow (Cash on Delivery)`, + ) + onCnfrmObj.pymntstatus = `Payment status should be ${PAYMENT_STATUS.NOT_PAID} for ${FLOW.FLOW012} flow (Cash on Delivery)` + } + } + } catch (err: any) { + logger.error('Error while checking payment in message/order/payment: ' + err.message) + } + + try { + logger.info(`Checking if list provided in bpp_terms is same as provided in ${constants.ON_INIT} `) + const tags = on_confirm.tags + + for (const tag of tags) { + if (tag.code === 'bpp_terms') { + const result = compareLists(tag.list, list_ON_INIT) + if (result.length > 0) { + onCnfrmObj['message/order/tags/bpp_terms'] = + `List of bpp_terms mismatched in message/order/tags/bpp_terms for ${constants.ON_INIT} and ${constants.ON_CONFIRM} here ${result}` + } + } + } + } catch (err: any) { + logger.error( + `Error while Checking if list provided in bpp_terms is same as provided in ${constants.ON_INIT}, ${err.stack} `, + ) + } + + try { + logger.info(`Checking if bap_terms is present in ${constants.ON_CONFIRM} `) + const tags = on_confirm.tags + + for (const tag of tags) { + if (tag.code === 'bap_terms') { + const hasStaticTerms = tag.list.some((item: { code: string }) => item.code === 'static_terms') + if (hasStaticTerms) { + onCnfrmObj['message/order/tags/bap_terms/static_terms'] = + `static_terms is not required for now! in ${constants.ON_CONFIRM}` + } + } + } + } catch (err: any) { + logger.error(`Error while Checking bap_terms in ${constants.ON_CONFIRM}, ${err.stack} `) + } + + if (flow === FLOW.FLOW003) { + const fulfillmentId = getValue('fulfillmentId') + const slot = getValue('fulfillmentSlots') + const ele = on_confirm.fulfillments.find((ele: { id: any }): any => ele.id === fulfillmentId) + const item = slot.find((ele: { id: any }): any => ele.id === fulfillmentId) + if (!ele || !item) { + const key = `fulfillments missing` + onCnfrmObj[key] = `fulfillments must be same as in /${constants.ON_INIT}` + } + if (item?.end?.time?.range && ele?.end?.time?.range) { + const itemRange = item.end.time.range + const eleRange = ele.end.time.range + + if (itemRange.start !== eleRange.start && itemRange.end !== eleRange.end) { + const key = `slotsMismatch` + onCnfrmObj[key] = `slots in fulfillments must be same as in /${constants.ON_INIT}` + } + } + } + + try { + const credsWithProviderId = getValue('credsWithProviderId') + const providerId = on_confirm?.provider?.id + const confirmCreds = on_confirm?.provider?.creds + const found = credsWithProviderId.find((ele: { providerId: any }) => ele.providerId === providerId) + + const expectedCreds = found?.creds + if (flow === FLOW.FLOW017) { + if (!expectedCreds || !credsWithProviderId || !confirmCreds) { + onCnfrmObj['MissingCreds'] = `creds must be present in /${constants.ON_SEARCH}` + } else if (!deepCompare(expectedCreds, confirmCreds)) { + onCnfrmObj['MissingCreds'] = `creds must be present and same as in /${constants.ON_SEARCH}` + } + } + if (credsWithProviderId && confirmCreds) { + if (expectedCreds) { + if (!deepCompare(expectedCreds, confirmCreds)) { + onCnfrmObj['MissingCreds'] = `Mismatch found in creds, it must be same as in /${constants.ON_SEARCH}` + } + } + } + } catch (err: any) { + logger.error(`Error while Checking creds in ${constants.ON_CONFIRM}, ${err.stack} `) + } + + if (flow === FLOW.FLOW01F) { + const bppTerms = getValue('bppTerms'); + const list = message.order.tags?.find((item: any) => item?.code === 'bpp_terms')?.list; + if (!deepCompare(list, bppTerms)) { + onCnfrmObj['missingbppTerms'] = `bppTerms must be same as provided in /${constants.ON_SEARCH} call`; + } +} + + + return onCnfrmObj + } catch (err: any) { + logger.error(`!!Some error occurred while checking /${constants.ON_CONFIRM} API`, JSON.stringify(err.stack)) + } +} diff --git a/utils/Retail_.1.2.5/RET11_onSearch/onSearch.ts b/utils/Retail_.1.2.5/RET11_onSearch/onSearch.ts new file mode 100644 index 00000000..c132897d --- /dev/null +++ b/utils/Retail_.1.2.5/RET11_onSearch/onSearch.ts @@ -0,0 +1,2383 @@ +/* eslint-disable no-case-declarations */ +/* eslint-disable no-prototype-builtins */ +import { logger } from '../../../shared/logger' +import { setValue, getValue } from '../../../shared/dao' +import constants, { ApiSequence } from '../../../constants' +import { + validateSchemaRetailV2, + isObjectEmpty, + checkContext, + // timeDiff as timeDifference, + checkGpsPrecision, + emailRegex, + checkBppIdOrBapId, + checkServiceabilityType, + validateLocations, + // isSequenceValid, + isValidPhoneNumber, + compareSTDwithArea, + areTimestampsLessThanOrEqualTo, + validateObjectString, + validateBapUri, + validateBppUri, + validateMetaTags, +} from '../..' +import _, { isEmpty } from 'lodash' +import { + calculateDefaultSelectionPrice, + extractCustomGroups, + mapCustomItemToTreeNode, + mapCustomizationsToBaseItems, + mapItemToTreeNode, +} from './fb_calculation/default_selection/utils' +// import { MenuTreeBuilder } from './fb_calculation/lower_upper_range/builder' +// import { CatalogParser } from './fb_calculation/lower_upper_range/parser' + +export const checkOnsearchFullCatalogRefresh = (data: any) => { + if (!data || isObjectEmpty(data)) { + return { [ApiSequence.ON_SEARCH]: 'JSON cannot be empty' } + } + + const { message, context } = data + if (!message || !context || !message.catalog || isObjectEmpty(message) || isObjectEmpty(message.catalog)) { + return { missingFields: '/context, /message, /catalog or /message/catalog is missing or empty' } + } + + const schemaValidation = validateSchemaRetailV2('RET11', constants.ON_SEARCH, data) + + const contextRes: any = checkContext(context, constants.ON_SEARCH) + setValue(`${ApiSequence.ON_SEARCH}_context`, context) + setValue(`${ApiSequence.ON_SEARCH}_message`, message) + let errorObj: any = {} + + if (schemaValidation !== 'error') { + Object.assign(errorObj, schemaValidation) + } + + try { + logger.info(`Comparing Message Ids of /${constants.SEARCH} and /${constants.ON_SEARCH}`) + if (!_.isEqual(getValue(`${ApiSequence.SEARCH}_msgId`), context.message_id)) { + errorObj[`${ApiSequence.ON_SEARCH}_msgId`] = + `Message Ids for /${constants.SEARCH} and /${constants.ON_SEARCH} api should be same` + } + } catch (error: any) { + logger.error(`!!Error while checking message id for /${constants.ON_SEARCH}, ${error.stack}`) + } + + if (!_.isEqual(data.context.domain.split(':')[1], getValue(`domain`))) { + errorObj[`Domain[${data.context.action}]`] = `Domain should be same in each action` + } + + const checkBap = checkBppIdOrBapId(context.bap_id) + const checkBpp = checkBppIdOrBapId(context.bpp_id) + + if (checkBap) Object.assign(errorObj, { bap_id: 'context/bap_id should not be a url' }) + if (checkBpp) Object.assign(errorObj, { bpp_id: 'context/bpp_id should not be a url' }) + if (!contextRes?.valid) { + Object.assign(errorObj, contextRes.ERRORS) + } + + validateBapUri(context.bap_uri, context.bap_id, errorObj) + validateBppUri(context.bpp_uri, context.bpp_id, errorObj) + + if (context.transaction_id == context.message_id) { + errorObj['on_search_full_catalog_refresh'] = + `Context transaction_id (${context.transaction_id}) and message_id (${context.message_id}) can't be the same.` + } + + setValue(`${ApiSequence.ON_SEARCH}`, data) + + const searchContext: any = getValue(`${ApiSequence.SEARCH}_context`) + + try { + logger.info(`Storing BAP_ID and BPP_ID in /${constants.ON_SEARCH}`) + setValue('bapId', context.bap_id) + setValue('bppId', context.bpp_id) + } catch (error: any) { + logger.error(`!!Error while storing BAP and BPP Ids in /${constants.ON_SEARCH}, ${error.stack}`) + } + + try { + logger.info(`Comparing timestamp of /${ApiSequence.SEARCH} /${constants.ON_SEARCH}`) + + if (searchContext.timestamp == context.timestamp) { + errorObj.tmstmp = `context/timestamp of /${constants.SEARCH} and /${constants.ON_SEARCH} api cannot be same` + } + } catch (error: any) { + logger.error(`!!Error while Comparing timestamp of /${ApiSequence.SEARCH} /${constants.ON_SEARCH}, ${error.stack}`) + } + + try { + logger.info(`Comparing transaction Ids of /${constants.SEARCH} and /${constants.ON_SEARCH}`) + if (!_.isEqual(searchContext.transaction_id, context.transaction_id)) { + errorObj.transaction_id = `Transaction Id for /${constants.SEARCH} and /${constants.ON_SEARCH} api should be same` + } + } catch (error: any) { + logger.info( + `Error while comparing transaction ids for /${constants.SEARCH} and /${constants.ON_SEARCH} api, ${error.stack}`, + ) + } + try { + logger.info(`Checking customizations based on config.min and config.max values...`) + + const items = getValue('items') // Retrieve items from the catalog or message + + _.filter(items, (item) => { + const customGroup = item.custom_group // Assuming custom_group holds the configuration data + + // Check for minimum customizations + if (customGroup?.config?.min === 1) { + logger.info(`Checking min value for item id: ${item.id}`) + + const defaultCustomizations = _.filter(item.customizations, (customization) => { + return customization.is_default // Check for default customizations + }) + + if (defaultCustomizations.length < 1) { + const key = `item${item.id}CustomGroup/min` + errorObj[key] = + `Item with id: ${item.id} must have at least one default customization as config.min is set to 1.` + } + } + + // Check for maximum customizations + if (customGroup?.config?.max === 2) { + logger.info(`Checking max value for item id: ${item.id}`) + + const customizationsCount = item.customizations.length + + if (customizationsCount > 2) { + const key = `item${item.id}CustomGroup/max` + errorObj[key] = `Item with id: ${item.id} can have at most 2 customizations as config.max is set to 2.` + } + } + }) + } catch (error: any) { + logger.error(`Error while checking customizations for items, ${error.stack}`) + } + + // removed timestamp difference check + // try { + // logger.info(`Comparing timestamp of /${constants.SEARCH} and /${constants.ON_SEARCH}`) + // const tmpstmp = searchContext?.timestamp + // if (_.gte(tmpstmp, context.timestamp)) { + // errorObj.tmpstmp = `Timestamp for /${constants.SEARCH} api cannot be greater than or equal to /${constants.ON_SEARCH} api` + // } else { + // const timeDiff = timeDifference(context.timestamp, tmpstmp) + // logger.info(timeDiff) + // if (timeDiff > 5000) { + // errorObj.tmpstmp = `context/timestamp difference between /${constants.ON_SEARCH} and /${constants.SEARCH} should be less than 5 sec` + // } + // } + // } catch (error: any) { + // logger.info( + // `Error while comparing timestamp for /${constants.SEARCH} and /${constants.ON_SEARCH} api, ${error.stack}`, + // ) + // } + + try { + logger.info(`Comparing Message Ids of /${constants.SEARCH} and /${constants.ON_SEARCH}`) + if (!_.isEqual(searchContext.message_id, context.message_id)) { + errorObj.message_id = `Message Id for /${constants.SEARCH} and /${constants.ON_SEARCH} api should be same` + } + } catch (error: any) { + logger.info( + `Error while comparing message ids for /${constants.SEARCH} and /${constants.ON_SEARCH} api, ${error.stack}`, + ) + } + + const onSearchCatalog: any = message.catalog + const onSearchFFIdsArray: any = [] + const prvdrsId = new Set() + const prvdrLocId = new Set() + const onSearchFFTypeSet = new Set() + const itemsId = new Set() + let customMenuIds: any = [] + let customMenu = false + // Storing static fulfillment ids in onSearchFFIdsArray, OnSearchFFTypeSet + try { + logger.info(`Saving static fulfillment ids in /${constants.ON_SEARCH}`) + + onSearchCatalog['bpp/providers'].forEach((provider: any) => { + const onSearchFFIds = new Set() + const bppFF = provider.fulfillments + const len = bppFF.length + + let i = 0 + while (i < len) { + onSearchFFTypeSet.add(bppFF[i].type) + onSearchFFIds.add(bppFF[i].id) + i++ + } + onSearchFFIdsArray.push(onSearchFFIds) + }) + + setValue('onSearchFFIdsArray', onSearchFFIdsArray) + } catch (error: any) { + logger.info(`Error while saving static fulfillment ids in /${constants.ON_SEARCH}, ${error.stack}`) + } + + try { + logger.info(`Checking for upcoming holidays`) + const location = onSearchCatalog['bpp/providers'][0]['locations'] + if (!location) { + logger.error('No location detected ') + } + + const scheduleObject = location[0].time.schedule.holidays + const timestamp = context.timestamp + const [currentDate] = timestamp.split('T') + + scheduleObject.map((date: string) => { + const dateObj = new Date(date) + const currentDateObj = new Date(currentDate) + if (dateObj.getTime() < currentDateObj.getTime()) { + const key = `/message/catalog/bpp/providers/loc${0}/time/schedule/holidays` + errorObj[key] = `Holidays cannot be past ${currentDate}` + } + }) + } catch (e) { + logger.error('No Holiday', e) + } + + try { + logger.info(`Mapping items with thier respective providers`) + const itemProviderMap: any = {} + const providers = onSearchCatalog['bpp/providers'] + providers.forEach((provider: any) => { + const items = provider.items + const itemArray: any = [] + items.forEach((item: any) => { + itemArray.push(item.id) + }) + itemProviderMap[provider.id] = itemArray + }) + + setValue('itemProviderMap', itemProviderMap) + } catch (e: any) { + logger.error(`Error while mapping items with thier respective providers ${e.stack}`) + } + + try { + logger.info(`Storing Item IDs in /${constants.ON_SEARCH}`) + const providers = onSearchCatalog['bpp/providers'] + providers.forEach((provider: any, index: number) => { + const items = provider.items + items.forEach((item: any, j: number) => { + if (itemsId.has(item.id)) { + const key = `DuplicateItem[${j}]` + errorObj[key] = `duplicate item id: ${item.id} in bpp/providers[${index}]` + } else { + itemsId.add(item.id) + } + }) + }) + } catch (error: any) { + logger.error(`Error while storing Item IDs in /${constants.ON_SEARCH}, ${error.stack}`) + } + + try { + logger.info(`Checking for np_type in bpp/descriptor`) + const descriptor = onSearchCatalog['bpp/descriptor'] + descriptor?.tags.map((tag: { code: any; list: any[] }) => { + if (tag.code === 'bpp_terms') { + const npType = tag.list.find((item) => item.code === 'np_type') + if (!npType) { + errorObj['bpp/descriptor'] = `Missing np_type in bpp/descriptor` + setValue(`${ApiSequence.ON_SEARCH}np_type`, '') + } else { + setValue(`${ApiSequence.ON_SEARCH}np_type`, npType.value) + const npTypeValue = npType.value + if (npTypeValue !== 'ISN' && npTypeValue !== 'MSN') { + errorObj['bpp/descriptor/np_type'] = + `Invalid value '${npType.value}' for np_type. It should be either 'ISN' or 'MSN' in uppercase.` + } + } + + const accept_bap_terms = tag.list.find((item) => item.code === 'accept_bap_terms') + if (accept_bap_terms) { + errorObj['bpp/descriptor/accept_bap_terms'] = + `remove accept_bap_terms block in /bpp/descriptor/tags; should be enabled once BNP send their static terms in /search and are later accepted by SNP` + } + + const collect_payment = tag.list.find((item) => item.code === 'collect_payment') + if (collect_payment) { + errorObj['bpp/descriptor/collect_payment'] = `collect_payment is not required in bpp/descriptor/tags ` + } + } + }) + } catch (error: any) { + logger.error(`Error while checking np_type in bpp/descriptor for /${constants.ON_SEARCH}, ${error.stack}`) + } + + try { + logger.info(`Checking Providers info (bpp/providers) in /${constants.ON_SEARCH}`) + let i = 0 + const bppPrvdrs = onSearchCatalog['bpp/providers'] + const len = bppPrvdrs.length + const tmpstmp = context.timestamp + let itemIdList: any = [] + let itemsArray = [] + while (i < len) { + const categoriesId = new Set() + const customGrpId = new Set() + const seqSet = new Set() + const itemCategory_id = new Set() + const categoryRankSet = new Set() + const prvdrLocationIds = new Set() + + logger.info(`Validating uniqueness for provider id in bpp/providers[${i}]...`) + const prvdr = bppPrvdrs[i] + const categories = prvdr?.['categories'] + const items = prvdr?.['items'] + + if (prvdrsId.has(prvdr.id)) { + const key = `prvdr${i}id` + errorObj[key] = `duplicate provider id: ${prvdr.id} in bpp/providers` + } else { + prvdrsId.add(prvdr.id) + } + + logger.info(`Checking store enable/disable timestamp in bpp/providers[${i}]`) + const providerTime = new Date(prvdr.time.timestamp).getTime() + const contextTimestamp = new Date(tmpstmp).getTime() + setValue('tmpstmp', context.timestamp) + + if (providerTime > contextTimestamp) { + errorObj.StoreEnableDisable = `store enable/disable timestamp (/bpp/providers/time/timestamp) should be less then or equal to context.timestamp` + } + + try { + const customGroupCategory = extractCustomGroups(categories) + + const baseTreeNodes = mapItemToTreeNode(items) + + const customItems = mapCustomItemToTreeNode(items, customGroupCategory) + + const mapItems = mapCustomizationsToBaseItems(baseTreeNodes, customItems) + + const default_selection = calculateDefaultSelectionPrice(mapItems) + + default_selection.forEach(({ base_item, default_selection_calculated, default_selection_actual }) => { + if ( + !default_selection_calculated || + !default_selection_actual || + default_selection_calculated.min === undefined || + default_selection_actual.min === undefined || + default_selection_calculated.max === undefined || + default_selection_actual.max === undefined + ) { + const errorMessage = `Missing or invalid default_selection values for base_item ${base_item}. + Calculated: ${JSON.stringify(default_selection_calculated)}, + Actual: ${JSON.stringify(default_selection_actual)}.` + + logger.error(`Error in base_item ${base_item}: ${errorMessage}`) + errorObj[`providers[${i}][${base_item}]`] = errorMessage + return + } + if ( + default_selection_calculated.min !== default_selection_actual.min || + default_selection_calculated.max !== default_selection_actual.max + ) { + const errorMessage = `Provided default_selection calculated incorrectly, + Calculated: min=${default_selection_calculated.min}, max=${default_selection_calculated.max}. + Given: min=${default_selection_actual.min}, max=${default_selection_actual.max}.` + + logger.error(`Error in base_item ${base_item}: ${errorMessage}`) + + // Store error in errorObj with base_item as key + errorObj[`providers[${i}][${base_item}]`] = errorMessage + } else { + logger.info(`Base item ${base_item} values match. No error.`) + } + }) + } catch (error: any) { + errorObj[`providers[${i}_default_selection`] = + `Error while Calculating Default Selection in /${constants.ON_SEARCH}, ${error.stack}` + logger.info(`Error while Calculating Default Selection in /${constants.ON_SEARCH}, ${error.stack}`) + } + // commented price range calculation + // try { + // // Parse raw data + // const parsedCategories = CatalogParser.parseCategories(categories) + // const menuItems = CatalogParser.parseMenuItems(items) + // const customizations = CatalogParser.parseCustomizations(items) + + // // Build menu trees with price calculations + // const treeBuilder = new MenuTreeBuilder(menuItems, parsedCategories, customizations) + // const itemsWithPricesAndLogs = treeBuilder.buildTrees() + + // itemsWithPricesAndLogs.items.forEach((item: any) => { + // console.log("itemOkay", item) + // const calculatedPriceRange = item.priceRange + // const givenPriceRange = item.priceRangeGiven + + // if ( + // calculatedPriceRange.lower !== givenPriceRange.lower || + // calculatedPriceRange.upper !== givenPriceRange.upper + // ) { + // const itemLog = CatalogParser.extractLogsForItem(itemsWithPricesAndLogs.logs, item.id) + + // errorObj[`providers[${i}][lower_upper_range-(${item.id})`] = + // `Provided price range calculated incorrectly for ${item.id}, + // Calculated: lower=${calculatedPriceRange.lower}, upper=${calculatedPriceRange.upper}. + // Given: lower=${givenPriceRange.lower}, upper=${givenPriceRange.upper}. + // Calculation: ${itemLog}` + // } + // }) + // } catch (error: any) { + // errorObj[`providers[${i}][lower_upper_range`] = + // `Error while Calculating Lower Upper Range in /${constants.ON_SEARCH}, ${error.stack}` + // logger.info(`Error while Calculating Lower Upper Range in /${constants.ON_SEARCH}, ${error.stack}`) + // } + + try { + logger.info(`Checking length of strings provided in descriptor /${constants.ON_SEARCH}`) + const descriptor = prvdr['descriptor'] + const result = validateObjectString(descriptor) + if (typeof result == 'string' && result.length) { + const key = `prvdr${i}descriptor` + errorObj[key] = result + } + } catch (error: any) { + logger.info( + `Error while Checking length of strings provided in descriptor /${constants.ON_SEARCH}, ${error.stack}`, + ) + } + + try { + logger.info(`Checking for empty list arrays in tags`) + const categories = prvdr['categories'] + categories.forEach( + (category: { id: string; parent_category_id: string; descriptor: { name: string }; tags: any[] }) => { + if (category.parent_category_id === category.id) { + errorObj[`categories[${category.id}].prnt_ctgry_id`] = + `/message/catalog/bpp/providers/categories/parent_category_id should not be the same as id in category '${category.descriptor.name}'` + } + category.tags.forEach((tag: { code: string; list: any[] }, index: number) => { + if (tag.list.length === 0) { + errorObj[`provider[${i}].categories[${category.id}].tags[${index}]`] = + `Empty list array provided for tag '${tag.code}' in category '${category.descriptor.name}'` + } + if (tag.code === 'display') { + tag.list.forEach((item: { code: string; value: string }) => { + if (item.code === 'rank' && parseInt(item.value) === 0) { + errorObj[`provider[${i}].categories[${category.id}].tags[${index}].list[${item.code}]`] = + `display rank provided in /message/catalog/bpp/providers/categories (category:'${category?.descriptor?.name}) should not be zero ("0"), it should start from one ('1') '` + } + }) + } + if (tag.code === 'config') { + tag.list.forEach((item: { code: string; value: string }) => { + if (item.code === 'seq' && parseInt(item.value) === 0) { + errorObj[`categories[${category.id}].tags[${index}].list[${item.code}]`] = + `Seq value should start from 1 and not 0 in category '${category.descriptor.name}'` + } + }) + } + if (tag.code === 'type') { + tag.list.forEach((item: { code: string; value: string }) => { + if (item.code === 'type') { + if ( + (category.parent_category_id == '' || category.parent_category_id) && + item.value == 'custom_group' + ) { + if (category.parent_category_id) { + errorObj[`categories[${category.id}].tags[${index}].list[${item.code}]`] = + `parent_category_id should not have any value while type is ${item.value}` + } + errorObj[`categories[${category.id}].tags[${index}].list[${item.code}]`] = + `parent_category_id should not be present while type is ${item.value}` + } else if ( + category.parent_category_id != '' && + (item.value == 'custom_menu' || item.value == 'variant_group') + ) { + if (category.parent_category_id) { + errorObj[`categories[${category.id}].tags[${index}].list[${item.code}]`] = + `parent_category_id should be empty string while type is ${item.value}` + } + errorObj[`categories[${category.id}].tags[${index}].list[${item.code}]`] = + `parent_category_id should be present while type is ${item.value}` + } else if ( + category.parent_category_id && + (item.value == 'custom_menu' || item.value == 'variant_group') + ) { + if (category.parent_category_id) { + errorObj[`categories[${category.id}].tags[${index}].list[${item.code}]`] = + `parent_category_id should be empty string while type is ${item.value}` + } + } + } + }) + } + }) + }, + ) + } catch (error: any) { + logger.error(`Error while checking empty list arrays in tags for /${constants.ON_SEARCH}, ${error.stack}`) + } + + try { + // Adding items in a list + const items = prvdr.items + itemsArray.push(items) + items.forEach((item: any) => { + itemIdList.push(item.id) + }) + setValue('ItemList', itemIdList) + } catch (error: any) { + logger.error(`Error while adding items in a list, ${error.stack}`) + } + + logger.info(`Checking store timings in bpp/providers[${i}]`) + + prvdr.locations.forEach((loc: any, iter: any) => { + try { + logger.info(`Checking gps precision of store location in /bpp/providers[${i}]/locations[${iter}]`) + const has = Object.prototype.hasOwnProperty + if (has.call(loc, 'gps')) { + if (!checkGpsPrecision(loc.gps)) { + errorObj.gpsPrecision = `/bpp/providers[${i}]/locations[${iter}]/gps coordinates must be specified with at least 4 decimal places of precision.` + } + } + } catch (error) { + logger.error( + `!!Error while checking gps precision of store location in /bpp/providers[${i}]/locations[${iter}]`, + error, + ) + } + + if (prvdrLocId.has(loc.id)) { + const key = `prvdr${i}${loc.id}${iter}` + errorObj[key] = `duplicate location id: ${loc.id} in /bpp/providers[${i}]/locations[${iter}]` + } else { + prvdrLocId.add(loc.id) + } + prvdrLocationIds.add(loc?.id) + logger.info('Checking store days...') + const days = loc.time.days.split(',') + days.forEach((day: any) => { + day = parseInt(day) + if (isNaN(day) || day < 1 || day > 7) { + const key = `prvdr${i}locdays${iter}` + errorObj[key] = + `store days (bpp/providers[${i}]/locations[${iter}]/time/days) should be in the format ("1,2,3,4,5,6,7") where 1- Monday and 7- Sunday` + } + }) + + logger.info('Checking fixed or split timings') + //scenario 1: range =1 freq/times =1 + if (loc.time.range && (loc.time.schedule?.frequency || loc.time.schedule?.times)) { + const key = `prvdr${i}loctime${iter}` + errorObj[key] = + `Either one of fixed (range) or split (frequency and times) timings should be provided in /bpp/providers[${i}]/locations[${iter}]/time` + } + + // scenario 2: range=0 freq || times =1 + if (!loc.time.range && (!loc.time.schedule.frequency || !loc.time.schedule.times)) { + const key = `prvdr${i}loctime${iter}` + errorObj[key] = + `Either one of fixed timings (range) or split timings (both frequency and times) should be provided in /bpp/providers[${i}]/locations[${iter}]/time` + } + + //scenario 3: range=1 (start and end not compliant) frequency=0; + if ('range' in loc.time) { + logger.info('checking range (fixed timings) start and end') + const startTime: any = 'start' in loc.time.range ? parseInt(loc.time.range.start) : '' + const endTime: any = 'end' in loc.time.range ? parseInt(loc.time.range.end) : '' + if (isNaN(startTime) || isNaN(endTime) || startTime > endTime || endTime > 2359) { + errorObj.startEndTime = `end time must be greater than start time in fixed timings /locations/time/range (fixed store timings)` + } + } + }) + + try { + // Adding items in a list + const items = prvdr.items + items.forEach((item: any) => { + itemIdList.push(item.id) + }) + setValue('ItemList', itemIdList) + } catch (error: any) { + logger.error(`Error while adding items in a list, ${error.stack}`) + } + + try { + logger.info(`Checking categories for provider (${prvdr.id}) in bpp/providers[${i}]`) + let j = 0 + const categories = onSearchCatalog['bpp/providers'][i]['categories'] + if (!categories || !categories.length) { + const key = `prvdr${i}categories` + errorObj[key] = `Support for variants is mandatory, categories must be present in bpp/providers[${i}]` + } + const iLen = categories.length + while (j < iLen) { + logger.info(`Validating uniqueness for categories id in bpp/providers[${i}].items[${j}]...`) + const category = categories[j] + + const fulfillments = onSearchCatalog['bpp/providers'][i]['fulfillments'] + const phoneNumber = fulfillments[i].contact.phone + + if (!isValidPhoneNumber(phoneNumber)) { + const key = `bpp/providers${i}fulfillments${i}` + errorObj[key] = + `Please enter a valid phone number consisting of 10 or 11 digits without any spaces or special characters. ` + } + + if (categoriesId.has(category.id)) { + const key = `prvdr${i}category${j}` + errorObj[key] = `duplicate category id: ${category.id} in bpp/providers[${i}]` + } else { + categoriesId.add(category.id) + } + + try { + category.tags.map((tag: { code: any; list: any[] }, index: number) => { + switch (tag.code) { + case 'type': + const codeList = tag.list.find((item) => item.code === 'type') + if ( + !( + codeList.value === 'custom_menu' || + codeList.value === 'custom_group' || + codeList.value === 'variant_group' + ) + ) { + const key = `prvdr${i}category${j}tags${index}` + errorObj[key] = + `list.code == type then value should be one of 'custom_menu','custom_group' and 'variant_group' in bpp/providers[${i}]` + } + + if (codeList.value === 'custom_group') { + customGrpId.add(category.id) + } + + break + case 'timing': + for (const item of tag.list) { + switch (item.code) { + case 'day_from': + case 'day_to': + const dayValue = parseInt(item.value) + if (isNaN(dayValue) || dayValue < 1 || dayValue > 7 || !/^-?\d+(\.\d+)?$/.test(item.value)) { + errorObj.custom_menu_timing_tag = `Invalid value for '${item.code}': ${item.value}` + } + + break + case 'time_from': + case 'time_to': + if (!/^([01]\d|2[0-3])[0-5]\d$/.test(item.value)) { + errorObj.time_to = `Invalid time format for '${item.code}': ${item.value}` + } + + break + default: + errorObj.Tagtiming = `Invalid list.code for 'timing': ${item.code}` + } + } + + const dayFromItem = tag.list.find((item: any) => item.code === 'day_from') + const dayToItem = tag.list.find((item: any) => item.code === 'day_to') + const timeFromItem = tag.list.find((item: any) => item.code === 'time_from') + const timeToItem = tag.list.find((item: any) => item.code === 'time_to') + + if (dayFromItem && dayToItem && timeFromItem && timeToItem) { + const dayFrom = parseInt(dayFromItem.value, 10) + const dayTo = parseInt(dayToItem.value, 10) + const timeFrom = parseInt(timeFromItem.value, 10) + const timeTo = parseInt(timeToItem.value, 10) + + if (dayTo < dayFrom) { + errorObj.day_from = "'day_to' must be greater than or equal to 'day_from'" + } + + if (timeTo <= timeFrom) { + errorObj.time_from = "'time_to' must be greater than 'time_from'" + } + } + + break + case 'display': + for (const item of tag.list) { + if (item.code !== 'rank' || !/^-?\d+(\.\d+)?$/.test(item.value)) { + errorObj.rank = `Invalid value for 'display': ${item.value}` + } else { + if (categoryRankSet.has(category.id)) { + const key = `prvdr${i}category${j}rank` + errorObj[key] = `duplicate rank in category id: ${category.id} in bpp/providers[${i}]` + } else { + categoryRankSet.add(category.id) + } + } + } + + break + case 'config': + const minItem: any = tag.list.find((item: { code: string }) => item.code === 'min') + const maxItem: any = tag.list.find((item: { code: string }) => item.code === 'max') + const inputItem: any = tag.list.find((item: { code: string }) => item.code === 'input') + const seqItem: any = tag.list.find((item: { code: string }) => item.code === 'seq') + + if (!minItem || !maxItem) { + errorObj[`customization_config_${j}`] = + `Both 'min' and 'max' values are required in 'config' at index: ${j}` + } + + if (!/^-?\d+(\.\d+)?$/.test(minItem.value)) { + errorObj[`customization_config_min_${j}`] = + `Invalid value for ${minItem.code}: ${minItem.value} at index: ${j}` + } + + if (!/^-?\d+(\.\d+)?$/.test(maxItem.value)) { + errorObj[`customization_config_max_${j}`] = + `Invalid value for ${maxItem.code}: ${maxItem.value}at index: ${j}` + } + + if (!/^-?\d+(\.\d+)?$/.test(seqItem.value)) { + errorObj[`config_seq_${j}`] = `Invalid value for ${seqItem.code}: ${seqItem.value} at index: ${j}` + } + + const inputEnum = ['select', 'text'] + if (!inputEnum.includes(inputItem.value)) { + errorObj[`config_input_${j}`] = + `Invalid value for 'input': ${inputItem.value}, it should be one of ${inputEnum} at index: ${j}` + } + + break + } + }) + logger.info(`Category '${category.descriptor.name}' is valid.`) + } catch (error: any) { + logger.error(`Validation error for category '${category.descriptor.name}': ${error.message}`) + } + + j++ + } + } catch (error: any) { + logger.error(`!!Errors while checking categories in bpp/providers[${i}], ${error.stack}`) + } + + try { + logger.info(`Checking items for provider (${prvdr.id}) in bpp/providers[${i}]`) + let j = 0 + const items = onSearchCatalog['bpp/providers'][i]['items'] + const iLen = items.length + while (j < iLen) { + logger.info(`Validating uniqueness for item id in bpp/providers[${i}].items[${j}]...`) + const item = items[j] + + if ('category_id' in item) { + itemCategory_id.add(item.category_id) + } + + if ('category_ids' in item) { + item[`category_ids`].map((category: string, index: number) => { + const categoryId = category.split(':')[0] + const seq = category.split(':')[1] + + // Check if seq exists in category_ids + const seqExists = item[`category_ids`].some((cat: any) => cat.seq === seq) + + if (seqExists) { + const key = `prvdr${i}item${j}ctgryseq${index}` + errorObj[key] = `duplicate seq : ${seq} in category_ids in prvdr${i}item${j}` + } else { + seqSet.add(seq) + } + + if (!categoriesId.has(categoryId)) { + const key = `prvdr${i}item${j}ctgryId${index}` + errorObj[key] = `item${j} should have category_ids one of the Catalog/categories/id` + } + }) + } + + let lower_and_upper_not_present: boolean = true + let default_selection_not_present: boolean = true + try { + logger.info(`Checking selling price and maximum price for item id: ${item.id}`) + + if ('price' in item) { + const sPrice = parseFloat(item.price.value) + const maxPrice = parseFloat(item.price.maximum_value) + + const lower = parseFloat(item.price?.tags?.[0].list[0]?.value) + const upper = parseFloat(item.price?.tags?.[0].list[1]?.value) + + if (lower >= 0 && upper >= 0) { + lower_and_upper_not_present = false + } + + const default_selection_value = parseFloat(item.price?.tags?.[1].list[0]?.value) + const default_selection_max_value = parseFloat(item.price?.tags?.[1].list[1]?.value) + + if (default_selection_value >= 0 && default_selection_max_value >= 0) { + default_selection_not_present = false + } + + if (sPrice > maxPrice) { + const key = `prvdr${i}item${j}Price` + errorObj[key] = + `selling price of item /price/value with id: (${item.id}) can't be greater than the maximum price /price/maximum_value in /bpp/providers[${i}]/items[${j}]/` + } + + if (upper < lower) { + const key = `prvdr${i}item${j}price/tags/` + errorObj[key] = + `selling lower range: ${lower} of code: range with id: (${item.id}) can't be greater than the upper range : ${upper} ` + } + + if (default_selection_max_value < default_selection_value) { + const key = `prvdr${i}item${j}Price/tags` + errorObj[key] = + `value : ${default_selection_value} of code: default_selection with id: (${item.id}) can't be greater than the maximum_value : ${default_selection_max_value} ` + } + } + } catch (e: any) { + logger.error(`Error while checking selling price and maximum price for item id: ${item.id}, ${e.stack}`) + } + + try { + logger.info(`Checking fulfillment_id for item id: ${item.id}`) + if (item.fulfillment_id && !onSearchFFIdsArray[i].has(item.fulfillment_id)) { + const key = `prvdr${i}item${j}ff` + errorObj[key] = + `fulfillment_id in /bpp/providers[${i}]/items[${j}] should map to one of the fulfillments id in bpp/prvdr${i}/fulfillments ` + } + } catch (e: any) { + logger.error(`Error while checking fulfillment_id for item id: ${item.id}, ${e.stack}`) + } + + try { + logger.info(`Checking location_id for item id: ${item.id}`) + + if (item.location_id && !prvdrLocId.has(item.location_id)) { + const key = `prvdr${i}item${j}loc` + errorObj[key] = + `location_id in /bpp/providers[${i}]/items[${j}] should be one of the locations id in /bpp/providers[${i}]/locations` + } + } catch (e: any) { + logger.error(`Error while checking location_id for item id: ${item.id}, ${e.stack}`) + } + + try { + logger.info(`Checking consumer care details for item id: ${item.id}`) + if ('@ondc/org/contact_details_consumer_care' in item) { + let consCare = item['@ondc/org/contact_details_consumer_care'] + consCare = consCare.split(',') + if (consCare.length < 3) { + const key = `prvdr${i}consCare` + errorObj[key] = + `@ondc/org/contact_details_consumer_care should be in the format "name,email,contactno" in /bpp/providers[${i}]/items` + } else { + const checkEmail: boolean = emailRegex(consCare[1].trim()) + if (isNaN(consCare[2].trim()) || !checkEmail) { + const key = `prvdr${i}consCare` + errorObj[key] = + `@ondc/org/contact_details_consumer_care should be in the format "name,email,contactno" in /bpp/providers[${i}]/items` + } + } + } + } catch (e: any) { + logger.error(`Error while checking consumer care details for item id: ${item.id}, ${e.stack}`) + } + + try { + item.tags.map((tag: { code: any; list: any[] }, index: number) => { + switch (tag.code) { + case 'type': + if ( + tag.list && + Array.isArray(tag.list) && + tag.list.some( + (listItem: { code: string; value: string }) => + listItem.code === 'type' && listItem.value === 'item', + ) + ) { + if (!item.time) { + const key = `prvdr${i}item${j}time` + errorObj[key] = `item_id: ${item.id} should contain time object in bpp/providers[${i}]` + } + + if (!item.category_ids) { + const key = `prvdr${i}item${j}ctgry_ids` + errorObj[key] = `item_id: ${item.id} should contain category_ids in bpp/providers[${i}]` + } + } + break + + case 'custom_group': + tag.list.map((it: { code: string; value: string }, index: number) => { + if (!customGrpId.has(it.value)) { + const key = `prvdr${i}item${j}tag${index}cstmgrp_id` + errorObj[key] = + `item_id: ${item.id} should have custom_group_id one of the ids passed in categories bpp/providers[${i}]` + } + }) + + break + + case 'config': + const idList: any = tag.list.find((item: { code: string }) => item.code === 'id') + const minList: any = tag.list.find((item: { code: string }) => item.code === 'min') + const maxList: any = tag.list.find((item: { code: string }) => item.code === 'max') + const seqList: any = tag.list.find((item: { code: string }) => item.code === 'seq') + + if (!categoriesId.has(idList.value)) { + const key = `prvdr${i}item${j}tags${index}config_list` + errorObj[key] = + `value in catalog/items${j}/tags${index}/config/list/ should be one of the catalog/category/ids` + } + + if (!/^-?\d+(\.\d+)?$/.test(minList.value)) { + const key = `prvdr${i}item${j}tags${index}config_min` + errorObj[key] = `Invalid value for ${minList.code}: ${minList.value}` + } + + if (!/^-?\d+(\.\d+)?$/.test(maxList.value)) { + const key = `prvdr${i}item${j}tags${index}config_max` + errorObj[key] = `Invalid value for ${maxList.code}: ${maxList.value}` + } + + if (!/^-?\d+(\.\d+)?$/.test(seqList.value)) { + const key = `prvdr${i}item${j}tags${index}config_seq` + errorObj[key] = `Invalid value for ${seqList.code}: ${seqList.value}` + } + + break + + case 'timing': + for (const item of tag.list) { + switch (item.code) { + case 'day_from': + case 'day_to': + const dayValue = parseInt(item.value) + if (isNaN(dayValue) || dayValue < 1 || dayValue > 5 || !/^-?\d+(\.\d+)?$/.test(item.value)) { + const key = `prvdr${i}item${j}tags${index}timing_day` + errorObj[key] = `Invalid value for '${item.code}': ${item.value}` + } + + break + case 'time_from': + case 'time_to': + if (!/^([01]\d|2[0-3])[0-5]\d$/.test(item.value)) { + const key = `prvdr${i}item${j}tags${index}timing_time` + errorObj[key] = `Invalid time format for '${item.code}': ${item.value}` + } + + break + default: + errorObj.Tagtiming = `Invalid list.code for 'timing': ${item.code}` + } + } + + const dayFromItem = tag.list.find((item: any) => item.code === 'day_from') + const dayToItem = tag.list.find((item: any) => item.code === 'day_to') + const timeFromItem = tag.list.find((item: any) => item.code === 'time_from') + const timeToItem = tag.list.find((item: any) => item.code === 'time_to') + + if (dayFromItem && dayToItem && timeFromItem && timeToItem) { + const dayFrom = parseInt(dayFromItem.value, 10) + const dayTo = parseInt(dayToItem.value, 10) + const timeFrom = parseInt(timeFromItem.value, 10) + const timeTo = parseInt(timeToItem.value, 10) + + if (dayTo < dayFrom) { + const key = `prvdr${i}item${j}tags${index}timing_dayfrom` + errorObj[key] = "'day_to' must be greater than or equal to 'day_from'" + } + + if (timeTo <= timeFrom) { + const key = `prvdr${i}item${j}tags${index}timing_timefrom` + errorObj[key] = "'time_to' must be greater than 'time_from'" + } + } + + break + + case 'veg_nonveg': + const allowedCodes = ['veg', 'non_veg', 'egg'] + + for (const it of tag.list) { + if (it.code && !allowedCodes.includes(it.code)) { + const key = `prvdr${i}item${j}tag${index}veg_nonveg` + errorObj[key] = + `item_id: ${item.id} should have veg_nonveg one of the 'veg', 'non_veg'or 'egg' in bpp/providers[${i}]` + } + } + + break + } + }) + } catch (e: any) { + logger.error(`Error while checking tags for item id: ${item.id}, ${e.stack}`) + } + //Validating Offers + try { + logger.info(`Checking offers.tags under bpp/providers`) + + // Iterate through bpp/providers + for (let i in onSearchCatalog['bpp/providers']) { + const offers = onSearchCatalog['bpp/providers'][i]?.offers ?? null + if (!offers) { + offers.forEach((offer: any, offerIndex: number) => { + const tags = offer.tags + + // Ensure tags exist + if (!tags || !Array.isArray(tags)) { + const key = `bpp/providers[${i}]/offers[${offerIndex}]/tags` + errorObj[key] = + `Tags must be provided for offers[${offerIndex}] with descriptor code '${offer.descriptor?.code}'` + logger.error( + `Tags must be provided for offers[${offerIndex}] with descriptor code '${offer.descriptor?.code}'`, + ) + return + } + const metaTagsError = validateMetaTags(tags); + if (metaTagsError) { + let i = 0 + const len = metaTagsError.length + while (i < len) { + const key = `fulfilmntRngErr${i}` + errorObj[key] = `${metaTagsError[i]}` + i++ + } + } + + // Validate based on offer type + switch (offer.descriptor?.code) { + case 'discount': + // Validate 'qualifier' + const qualifierDiscount = tags.find((tag: any) => tag.code === 'qualifier') + if ( + !qualifierDiscount || + !qualifierDiscount.list.some((item: any) => item.code === 'min_value') + ) { + const key = `bpp/providers[${i}]/offers[${offerIndex}]/tags[qualifier]` + errorObj[key] = + `'qualifier' tag must include 'min_value' for offers[${offerIndex}] when offer.descriptor.code = ${offer.descriptor.code}` + logger.error(`'qualifier' tag must include 'min_value' for offers[${offerIndex}]`) + } + + // Validate 'benefit' + const benefitDiscount = tags.find((tag: any) => tag.code === 'benefit') + if ( + !benefitDiscount || + !benefitDiscount.list.some((item: any) => item.code === 'value') || + !benefitDiscount.list.some((item: any) => item.code === 'value_type') + ) { + const key = `bpp/providers[${i}]/offers[${offerIndex}]/tags[benefit]` + errorObj[key] = + `'benefit' tag must include both 'value' and 'value_type' for offers[${offerIndex}] when offer.descriptor.code = ${offer.descriptor.code}` + logger.error( + `'benefit' tag must include both 'value' and 'value_type' for offers[${offerIndex}]`, + ) + } + break + + case 'buyXgetY': + // Validate 'qualifier' + const qualifierBuyXgetY = tags.find((tag: any) => tag.code === 'qualifier') + if ( + !qualifierBuyXgetY || + !qualifierBuyXgetY.list.some((item: any) => item.code === 'min_value') || + !qualifierBuyXgetY.list.some((item: any) => item.code === 'item_count') + ) { + const key = `bpp/providers[${i}]/offers[${offerIndex}]/tags[qualifier]` + errorObj[key] = + `'qualifier' tag must include 'min_value' and 'item_count' for offers[${offerIndex}] when offer.descriptor.code = ${offer.descriptor.code}` + logger.error( + `'qualifier' tag must include 'min_value' and 'item_count' for offers[${offerIndex}]`, + ) + } + + // Validate 'benefit' + const benefitBuyXgetY = tags.find((tag: any) => tag.code === 'benefit') + if (!benefitBuyXgetY || !benefitBuyXgetY.list.some((item: any) => item.code === 'item_count')) { + const key = `bpp/providers[${i}]/offers[${offerIndex}]/tags[benefit]` + errorObj[key] = + `'benefit' tag must include 'item_count' for offers[${offerIndex}] when offer.descriptor.code = ${offer.descriptor.code}` + logger.error(`'benefit' tag must include 'item_count' for offers[${offerIndex}]`) + } + break + + case 'freebie': + // Validate 'qualifier' + const qualifierFreebie = tags.find((tag: any) => tag.code === 'qualifier') + if (!qualifierFreebie || !qualifierFreebie.list.some((item: any) => item.code === 'min_value')) { + const key = `bpp/providers[${i}]/offers[${offerIndex}]/tags[qualifier]` + errorObj[key] = + `'qualifier' tag must include 'min_value' for offers[${offerIndex}] when offer.descriptor.code = ${offer.descriptor.code}` + logger.error(`'qualifier' tag must include 'min_value' for offers[${offerIndex}]`) + } + + // Validate 'benefit' + const benefitFreebie = tags.find((tag: any) => tag.code === 'benefit') + if ( + !benefitFreebie || + !benefitFreebie.list.some((item: any) => item.code === 'item_count') || + !benefitFreebie.list.some((item: any) => item.code === 'item_id') || + !benefitFreebie.list.some((item: any) => item.code === 'item_value') + ) { + const key = `bpp/providers[${i}]/offers[${offerIndex}]/tags[benefit]` + errorObj[key] = + `'benefit' tag must include 'item_count', 'item_id', and 'item_value' for offers[${offerIndex}] when offer.descriptor.code = ${offer.descriptor.code}` + logger.error( + `'benefit' tag must include 'item_count', 'item_id', and 'item_value' for offers[${offerIndex}]`, + ) + } + break + + case 'slab': + // Validate 'qualifier' + const qualifierSlab = tags.find((tag: any) => tag.code === 'qualifier') + if (!qualifierSlab || !qualifierSlab.list.some((item: any) => item.code === 'min_value')) { + const key = `bpp/providers[${i}]/offers[${offerIndex}]/tags[qualifier]` + errorObj[key] = + `'qualifier' tag must include 'min_value' for offers[${offerIndex}] when offer.descriptor.code = ${offer.descriptor.code}` + logger.error(`'qualifier' tag must include 'min_value' for offers[${offerIndex}]`) + } + + // Validate 'benefit' + const benefitSlab = tags.find((tag: any) => tag.code === 'benefit') + if ( + !benefitSlab || + !benefitSlab.list.some((item: any) => item.code === 'value') || + !benefitSlab.list.some((item: any) => item.code === 'value_type') || + !benefitSlab.list.some((item: any) => item.code === 'value_cap') + ) { + const key = `bpp/providers[${i}]/offers[${offerIndex}]/tags[benefit]` + errorObj[key] = + `'benefit' tag must include 'value', 'value_type', and 'value_cap' for offers[${offerIndex}] when offer.descriptor.code = ${offer.descriptor.code}` + logger.error( + `'benefit' tag must include 'value', 'value_type', and 'value_cap' for offers[${offerIndex}]`, + ) + } + break + + case 'combo': + // Validate 'qualifier' + const qualifierCombo = tags.find((tag: any) => tag.code === 'qualifier') + if ( + !qualifierCombo || + !qualifierCombo.list.some((item: any) => item.code === 'min_value') || + !qualifierCombo.list.some((item: any) => item.code === 'item_id') + ) { + const key = `bpp/providers[${i}]/offers[${offerIndex}]/tags[qualifier]` + errorObj[key] = + `'qualifier' tag must include 'min_value' and 'item_id' for offers[${offerIndex}] when offer.descriptor.code = ${offer.descriptor.code}` + logger.error(`'qualifier' tag must include 'min_value' and 'item_id' for offers[${offerIndex}]`) + } + + // Validate 'benefit' + const benefitCombo = tags.find((tag: any) => tag.code === 'benefit') + if ( + !benefitCombo || + !benefitCombo.list.some((item: any) => item.code === 'value') || + !benefitCombo.list.some((item: any) => item.code === 'value_type') || + !benefitCombo.list.some((item: any) => item.code === 'value_cap') + ) { + const key = `bpp/providers[${i}]/offers[${offerIndex}]/tags[benefit]` + errorObj[key] = + `'benefit' tag must include 'value', 'value_type', and 'value_cap' for offers[${offerIndex}] when offer.descriptor.code = ${offer.descriptor.code}` + logger.error( + `'benefit' tag must include 'value', 'value_type', and 'value_cap' for offers[${offerIndex}]`, + ) + } + break + + case 'delivery': + // Validate 'qualifier' + const qualifierDelivery = tags.find((tag: any) => tag.code === 'qualifier') + if ( + !qualifierDelivery || + !qualifierDelivery.list.some((item: any) => item.code === 'min_value') + ) { + const key = `bpp/providers[${i}]/offers[${offerIndex}]/tags[qualifier]` + errorObj[key] = + `'qualifier' tag must include 'min_value' for offers[${offerIndex}] when offer.descriptor.code = ${offer.descriptor.code}` + logger.error(`'qualifier' tag must include 'min_value' for offers[${offerIndex}]`) + } + + // Validate 'benefit' + const benefitDelivery = tags.find((tag: any) => tag.code === 'benefit') + if ( + !benefitDelivery || + !benefitDelivery.list.some((item: any) => item.code === 'value') || + !benefitDelivery.list.some((item: any) => item.code === 'value_type') || + !benefitDelivery.list.some((item: any) => item.code === 'value_cap') + ) { + const key = `bpp/providers[${i}]/offers[${offerIndex}]/tags[benefit]` + errorObj[key] = + `'benefit' tag must include 'value', 'value_type', and 'value_cap' for offers[${offerIndex}] when offer.descriptor.code = ${offer.descriptor.code}` + logger.error( + `'benefit' tag must include 'value', 'value_type', and 'value_cap' for offers[${offerIndex}]`, + ) + } + break + + // case 'exchange': + case 'financing': + // Validate 'qualifier' + // const qualifierExchangeFinancing = tags.find((tag: any) => tag.code === 'qualifier'); + // if (!qualifierExchangeFinancing || !qualifierExchangeFinancing.list.some((item: any) => item.code === 'min_value')) { + // const key = `bpp/providers[${i}]/offers[${offerIndex}]/tags[qualifier]`; + // errorObj[key] = `'qualifier' tag must include 'min_value' for offers[${offerIndex}] when offer.descriptor.code = ${offer.descriptor.code}`; + // logger.error(`'qualifier' tag must include 'min_value' for offers[${offerIndex}]`); + // } + + // // Validate that benefits should not exist or should be empty + // const benefitExchangeFinancing = tags.find((tag: any) => tag.code === 'benefit'); + // if (benefitExchangeFinancing && benefitExchangeFinancing.list.length > 0) { + // const key = `bpp/providers[${i}]/offers[${offerIndex}]/tags[benefit]`; + // errorObj[key] = `'benefit' tag must not include any values for offers[${offerIndex}] when offer.descriptor.code = ${offer.descriptor.code}`; + // logger.error(`'benefit' tag must not include any values for offers[${offerIndex}]`); + // } + break; + + // No validation for benefits as it is not required + // break; + + default: + logger.info(`No specific validation required for offer type: ${offer.descriptor?.code}`) + } + }) + } + } + } catch (error: any) { + logger.error(`Error while checking offers.tags under bpp/providers: ${error.stack}`) + } + + // false error coming from here + try { + logger.info(`Validating item tags`) + const itemTypeTag = item.tags.find((tag: { code: string }) => tag.code === 'type') + const customGroupTag = item.tags.find((tag: { code: string }) => tag.code === 'custom_group') + if (itemTypeTag && itemTypeTag.list.length > 0 && itemTypeTag.list[0].value === 'item' && !customGroupTag) { + errorObj[`items[${item.id}]`] = + `/message/catalog/bpp/providers/items/tags/'type' is optional for non-customizable (standalone) SKUs` + } else if ( + itemTypeTag && + itemTypeTag.list.length > 0 && + itemTypeTag.list[0].value === 'item' && + customGroupTag + ) { + if (default_selection_not_present) { + errorObj[`items[${item.id}]/price/tags/default_selection`] = + `/message/catalog/bpp/providers/items must have default_selection price for customizable items` + } + if (lower_and_upper_not_present) { + errorObj[`items[${item.id}]/price/tags/lower_and_upper_range`] = + `/message/catalog/bpp/providers/items must have lower/upper range for customizable items` + } + } + } catch (error: any) { + logger.error(`Error while validating item, ${error.stack}`) + } + + try { + logger.info(`Validating default customizations`) + const itemTypeTag = item.tags.find( + (tag: any) => + tag.code === 'type' && + tag.list.some((item: any) => item.code === 'type' && item.value === 'customization'), + ) + if (itemTypeTag) { + const parentTag = item.tags.find((tag: any) => tag.code === 'parent') + if (parentTag) { + const categoryId = parentTag.list.find((item: any) => item.code === 'id')?.value + if (categoryId) { + const category = categories.find((category: any) => category.id === categoryId) + if (category) { + const configTag = category.tags.find((tag: any) => tag.code === 'config') + if (configTag) { + const minSelection = configTag.list.find((item: any) => item.code === 'min')?.value + if (minSelection === '0') { + const defaultTag = parentTag.list.find((item: any) => item.code === 'default') + if (defaultTag && defaultTag.value === 'yes') { + errorObj[`items[${item.id}]category[${categoryId}]`] = + `Default customization should not be set true for a custom_group where min selection is 0` + } + } + } + } + } + } + } + } catch (error: any) { + logger.error(`Error while validating default customizations, ${error.stack}`) + } + + j++ + } + } catch (error: any) { + logger.error(`!!Errors while checking items in bpp/providers[${i}], ${error.stack}`) + } + + try { + const providers = data.message.catalog['bpp/providers'] + const address = providers[0].locations[0].address + + if (address) { + const area_code = Number.parseInt(address.area_code) + const std = context.city.split(':')[1] + + logger.info(`Comparing area_code and STD Code for /${constants.ON_SEARCH}`) + const areaWithSTD = compareSTDwithArea(area_code, std) + if (!areaWithSTD) { + logger.error(`STD code does not match with correct area_code on /${constants.ON_SEARCH}`) + errorObj.invldAreaCode = `STD code does not match with correct area_code on /${constants.ON_SEARCH}` + } + } + } catch (error: any) { + logger.error( + `Error while matching area_code and std code for /${constants.SEARCH} and /${constants.ON_SEARCH} api, ${error.stack}`, + ) + } + + // Compairing valid timestamp in context.timestamp and bpp/providers/items/time/timestamp + try { + logger.info(`Compairing valid timestamp in context.timestamp and bpp/providers/items/time/timestamp`) + const timestamp = context.timestamp + for (let i in onSearchCatalog['bpp/providers']) { + const items = onSearchCatalog['bpp/providers'][i].items + items.forEach((item: any, index: number) => { + if (item?.time) { + const itemTimeStamp = item.time.timestamp + const op = areTimestampsLessThanOrEqualTo(itemTimeStamp, timestamp) + if (!op) { + const key = `bpp/providers/items/time/timestamp[${index}]` + errorObj[key] = `Timestamp for item[${index}] can't be greater than context.timestamp` + logger.error(`Timestamp for item[${index}] can't be greater than context.timestamp`) + } + } + }) + } + } catch (error: any) { + logger.error( + `!!Errors while checking timestamp in context.timestamp and bpp/providers/items/time/timestamp, ${error.stack}`, + ) + } + + try { + logger.info(`Checking for tags array in message/catalog/bpp/providers[0]/categories[0]/tags`) + const categories = message.catalog['bpp/providers'][i].categories + categories.forEach((item: any) => { + const tags = item.tags + if (tags.length < 1) { + const key = `message/catalog/bpp/providers/categories` + errorObj[key] = `/message/catalog/bpp/providers[${i}]/categories cannot have tags as an empty array` + } + }) + } catch (error: any) { + logger.error(`Error while checking tags array in message/catalog/bpp/providers[${i}]/categories`) + } + + try { + let customMenus = [] + customMenus = categories.filter((category: any) => + category.tags.some( + (tag: any) => tag.code === 'type' && tag.list.some((type: any) => type.value === 'custom_menu'), + ), + ) + + if (customMenus.length > 0) { + customMenu = true + + const ranks = customMenus.map((cstmMenu: any) => + parseInt( + cstmMenu.tags + .find((tag: any) => tag.code === 'display') + .list.find((display: any) => display.code === 'rank').value, + ), + ) + + // Check for duplicates and missing ranks + const hasDuplicates = ranks.length !== new Set(ranks).size + const missingRanks = [...Array(Math.max(...ranks)).keys()] + .map((i) => i + 1) + .filter((rank) => !ranks.includes(rank)) + + if (hasDuplicates) { + const key = `message/catalog/bpp/providers${i}/categories/ranks` + errorObj[key] = `Duplicate ranks found, ${ranks} in providers${i}/categories` + logger.error(`Duplicate ranks found, ${ranks} in providers${i}/categories`) + } else if (missingRanks.length > 0) { + const key = `message/catalog/bpp/providers${i}/categories/ranks` + errorObj[key] = `Missing ranks:, ${missingRanks} in providers${i}/categories` + logger.error(`Missing ranks:, ${missingRanks} in providers${i}/categories`) + } else { + // Sort customMenus by rank + const sortedCustomMenus = customMenus.sort((a: any, b: any) => { + const rankA = parseInt( + a.tags.find((tag: any) => tag.code === 'display').list.find((display: any) => display.code === 'rank') + .value, + ) + const rankB = parseInt( + b.tags.find((tag: any) => tag.code === 'display').list.find((display: any) => display.code === 'rank') + .value, + ) + return rankA - rankB + }) + + // Extract IDs + customMenuIds = sortedCustomMenus.map((item: any) => item.id) + } + } + } catch (error: any) { + logger.error(`!!Errors while checking rank in bpp/providers[${i}].category.tags, ${error.stack}`) + } + if (customMenu) { + try { + const categoryMap: Record = {} + onSearchCatalog['bpp/providers'][i]['items'].forEach((item: any) => { + if (item?.category_ids) { + item?.category_ids?.forEach((category_id: any) => { + const [category, sequence] = category_id.split(':').map(Number) + if (!categoryMap[category]) { + categoryMap[category] = [] + } + categoryMap[category].push(sequence) + }) + + // Sort the sequences for each category + Object.keys(categoryMap).forEach((category) => { + categoryMap[category].sort((a, b) => a - b) + }) + } + }) + let countSeq = 0 + + customMenuIds.map((category_id: any) => { + const categoryArray = categoryMap[`${category_id}`] + if (!categoryArray) { + const key = `message/catalog/bpp/providers${i}/categories/items` + errorObj[key] = `No items are mapped with the given category_id ${category_id} in providers${i}/items` + logger.error(`No items are mapped with the given category_id ${category_id} in providers${i}/items`) + } else { + let i = 0 + while (i < categoryArray.length) { + countSeq++ + const exist = categoryArray.includes(countSeq) + if (!exist) { + const key = `providers${i}/categories/items/${countSeq}` + errorObj[key] = + `The given sequence ${countSeq} doesn't exist with with the given category_id ${category_id} in providers${i}/items according to the rank` + logger.error( + `The given sequence ${countSeq} doesn't exist with with the given category_id ${category_id} in providers${i}/items according to the rank`, + ) + } + i++ + } + } + }) + } catch (error: any) { + logger.error(`!!Errors while category_ids in the items, ${error.stack}`) + } + } + + // Checking image array for bpp/providers/[]/categories/[]/descriptor/images[] + try { + logger.info(`Checking image array for bpp/provider/categories/descriptor/images[]`) + for (let i in onSearchCatalog['bpp/providers']) { + const categories = onSearchCatalog['bpp/providers'][i].categories + categories.forEach((item: any, index: number) => { + if (item.descriptor.images && item.descriptor.images.length < 1) { + const key = `bpp/providers[${i}]/categories[${index}]/descriptor` + errorObj[key] = `Images should not be provided as empty array for categories[${index}]/descriptor` + logger.error(`Images should not be provided as empty array for categories[${index}]/descriptor`) + } + }) + } + } catch (error: any) { + logger.error( + `!!Errors while checking image array for bpp/providers/[]/categories/[]/descriptor/images[], ${error.stack}`, + ) + } + + // Checking for same parent_item_id + // try { + // logger.info(`Checking for duplicate varient in bpp/providers/items for on_search`) + // for (let i in onSearchCatalog['bpp/providers']) { + // const items = onSearchCatalog['bpp/providers'][i].items + // const map = checkDuplicateParentIdItems(items) + // for (let key in map) { + // if (map[key].length > 1) { + // const measures = map[key].map((item: any) => { + // const unit = item.quantity.unitized.measure.unit + // const value = parseInt(item.quantity.unitized.measure.value) + // return { unit, value } + // }) + // checkForDuplicates(measures, errorObj) + // } + // } + // } + // } catch (error: any) { + // logger.error( + // `!!Errors while checking parent_item_id in bpp/providers/[]/items/[]/parent_item_id/, ${error.stack}`, + // ) + // } + + // servicability Construct + try { + logger.info(`Checking serviceability construct for bpp/providers[${i}]`) + + const tags = onSearchCatalog['bpp/providers'][i]['tags'] + if (!tags || !tags.length) { + const key = `prvdr${i}tags` + errorObj[key] = `tags must be present in bpp/providers[${i}]` + } + if (tags) { + const circleRequired = checkServiceabilityType(tags) + if (circleRequired) { + const errors = validateLocations(message.catalog['bpp/providers'][i].locations, tags) + errorObj = { ...errorObj, ...errors } + } + } + + //checking for each serviceability construct and matching serviceability constructs with the previous ones + const serviceabilitySet = new Set() + const timingSet = new Set() + tags.forEach((sc: any, t: any) => { + if (sc.code === 'serviceability') { + if (serviceabilitySet.has(JSON.stringify(sc))) { + const key = `prvdr${i}tags${t}` + errorObj[key] = + `serviceability construct /bpp/providers[${i}]/tags[${t}] should not be same with the previous serviceability constructs` + } + + serviceabilitySet.add(JSON.stringify(sc)) + if ('list' in sc) { + if (sc.list.length < 5) { + const key = `prvdr${i}tags${t}` + errorObj[key] = + `serviceability construct /bpp/providers[${i}]/tags[${t}] should be defined as per the API contract` + } + + //checking location + const loc = sc.list.find((elem: any) => elem.code === 'location') || '' + if (!loc) { + const key = `prvdr${i}tags${t}loc` + errorObj[key] = + `serviceability construct /bpp/providers[${i}]/tags[${t}] should be defined as per the API contract (location is missing)` + } else { + if ('value' in loc) { + if (!prvdrLocId.has(loc.value)) { + const key = `prvdr${i}tags${t}loc` + errorObj[key] = + `location in serviceability construct should be one of the location ids bpp/providers[${i}]/locations` + } + } else { + const key = `prvdr${i}tags${t}loc` + errorObj[key] = + `serviceability construct /bpp/providers[${i}]/tags[${t}] should be defined as per the API contract (location is missing)` + } + } + + //checking category + const ctgry = sc.list.find((elem: any) => elem.code === 'category') || '' + if (!ctgry) { + const key = `prvdr${i}tags${t}ctgry` + errorObj[key] = + `serviceability construct /bpp/providers[${i}]/tags[${t}] should be defined as per the API contract (category is missing)` + } else { + if ('value' in ctgry) { + if (!itemCategory_id.has(ctgry.value)) { + const key = `prvdr${i}tags${t}ctgry` + errorObj[key] = + `category in serviceability construct should be one of the category ids bpp/providers[${i}]/items/category_id` + } + } else { + const key = `prvdr${i}tags${t}ctgry` + errorObj[key] = + `serviceability construct /bpp/providers[${i}]/tags[${t}] should be defined as per the API contract (category is missing)` + } + } + + //checking type (hyperlocal, intercity or PAN India) + const type = sc.list.find((elem: any) => elem.code === 'type') || '' + if (!type) { + const key = `prvdr${i}tags${t}type` + errorObj[key] = + `serviceability construct /bpp/providers[${i}]/tags[${t}] should be defined as per the API contract (type is missing)` + } else { + if ('value' in type) { + switch (type.value) { + case '10': + { + //For hyperlocal + + //checking value + const val = sc.list.find((elem: any) => elem.code === 'val') || '' + if ('value' in val) { + if (isNaN(val.value)) { + const key = `prvdr${i}tags${t}valvalue` + errorObj[key] = + `value should be a number (code:"val") for type 10 (hyperlocal) in /bpp/providers[${i}]/tags[${t}]` + } + } else { + const key = `prvdr${i}tags${t}val` + errorObj[key] = + `serviceability construct /bpp/providers[${i}]/tags[${t}] should be defined as per the API contract (value is missing for code "val")` + } + + //checking unit + const unit = sc.list.find((elem: any) => elem.code === 'unit') || '' + if ('value' in unit) { + if (unit.value != 'km') { + const key = `prvdr${i}tags${t}unitvalue` + errorObj[key] = + `value should be "km" (code:"unit") for type 10 (hyperlocal) in /bpp/providers[${i}]/tags[${t}]` + } + } else { + const key = `prvdr${i}tags${t}unit` + errorObj[key] = + `serviceability construct /bpp/providers[${i}]/tags[${t}] should be defined as per the API contract (value is missing for code "unit")` + } + } + + break + case '11': + { + //intercity + + //checking value + const val = sc.list.find((elem: any) => elem.code === 'val') || '' + if ('value' in val) { + const pincodes = val.value.split(/,|-/) + pincodes.forEach((pincode: any) => { + if (isNaN(pincode) || pincode.length != 6) { + const key = `prvdr${i}tags${t}valvalue` + errorObj[key] = + `value should be a valid range of pincodes (code:"val") for type 11 (intercity) in /bpp/providers[${i}]/tags[${t}]` + } + }) + } else { + const key = `prvdr${i}tags${t}val` + errorObj[key] = + `serviceability construct /bpp/providers[${i}]/tags[${t}] should be defined as per the API contract (value is missing for code "val")` + } + + //checking unit + const unit = sc.list.find((elem: any) => elem.code === 'unit') || '' + if ('value' in unit) { + if (unit.value != 'pincode') { + const key = `prvdr${i}tags${t}unitvalue` + errorObj[key] = + `value should be "pincode" (code:"unit") for type 11 (intercity) in /bpp/providers[${i}]/tags[${t}]` + } + } else { + const key = `prvdr${i}tags${t}unit` + errorObj[key] = + `serviceability construct /bpp/providers[${i}]/tags[${t}] should be defined as per the API contract (value is missing for code "unit")` + } + } + + break + case '12': + { + //PAN India + + //checking value + const val = sc.list.find((elem: any) => elem.code === 'val') || '' + if ('value' in val) { + if (val.value != 'IND') { + const key = `prvdr${i}tags${t}valvalue` + errorObj[key] = + `value should be "IND" (code:"val") for type 12 (PAN India) in /bpp/providers[${i}]tags[${t}]` + } + } else { + const key = `prvdr${i}tags${t}val` + errorObj[key] = + `serviceability construct /bpp/providers[${i}]/tags[${t}] should be defined as per the API contract (value is missing for code "val")` + } + + //checking unit + const unit = sc.list.find((elem: any) => elem.code === 'unit') || '' + if ('value' in unit) { + if (unit.value != 'country') { + const key = `prvdr${i}tags${t}unitvalue` + errorObj[key] = + `value should be "country" (code:"unit") for type 12 (PAN India) in /bpp/providers[${i}]tags[${t}]` + } + } else { + const key = `prvdr${i}tags${t}unit` + errorObj[key] = + `serviceability construct /bpp/providers[${i}]/tags[${t}] should be defined as per the API contract (value is missing for code "unit")` + } + } + break + case '13': { + // Polygon-based serviceability + + // Validate 'val' (GeoJSON) + const val = sc.list.find((elem: any) => elem.code === 'val') || '' + if ('value' in val) { + let geojson + try { + geojson = JSON.parse(val.value) + + const isFeatureCollection = + geojson.type === 'FeatureCollection' && Array.isArray(geojson.features) + if (!isFeatureCollection) { + throw new Error('Invalid GeoJSON type or missing features array') + } + + for (const feature of geojson.features) { + const geom = feature.geometry + if (!geom || !geom.type || !Array.isArray(geom.coordinates)) { + throw new Error('Invalid feature geometry') + } + + const checkCoordinates = (coords: any) => { + for (const polygon of coords) { + if (!Array.isArray(polygon)) throw new Error('Invalid coordinate set') + const [first, last] = [polygon[0], polygon[polygon.length - 1]] + + // Check closure + if (JSON.stringify(first) !== JSON.stringify(last)) { + throw new Error('Polygon is not closed') + } + + // Check precision + for (const [lng, lat] of polygon) { + if (typeof lng !== 'number' || typeof lat !== 'number') { + throw new Error('Coordinates must be numbers') + } + + const getDecimalPlaces = (num: number) => { + const parts = num.toString().split('.') + return parts[1]?.length || 0 + } + + if (getDecimalPlaces(lng) < 4 || getDecimalPlaces(lat) < 4) { + throw new Error('Coordinates must have at least 4 decimal places') + } + } + } + } + + if (geom.type === 'Polygon') { + checkCoordinates(geom.coordinates) + } else if (geom.type === 'MultiPolygon') { + for (const coords of geom.coordinates) { + checkCoordinates(coords) + } + } else { + throw new Error('Unsupported geometry type') + } + } + } catch (e) { + const key = `prvdr${i}tags${t}valvalue` + if (e instanceof Error) { + errorObj[key] = + `value should be a valid GeoJSON (code:"val") for type 13 (polygon) in /bpp/providers[${i}]/tags[${t}]. Error: ${e.message}` + } else { + errorObj[key] = + `value should be a valid GeoJSON (code:"val") for type 13 (polygon) in /bpp/providers[${i}]/tags[${t}]. Unknown error occurred.` + } + } + } else { + const key = `prvdr${i}tags${t}val` + errorObj[key] = + `value is missing for code "val" in type 13 (polygon) at /bpp/providers[${i}]/tags[${t}]` + } + + // Validate 'unit' + const unit = sc.list.find((elem: any) => elem.code === 'unit') || '' + if ('value' in unit) { + if (unit.value !== 'geojson') { + const key = `prvdr${i}tags${t}unitvalue` + errorObj[key] = + `value should be "geojson" (code:"unit") for type 13 (polygon) in /bpp/providers[${i}]/tags[${t}]` + } + } else { + const key = `prvdr${i}tags${t}unit` + errorObj[key] = + `value is missing for code "unit" in type 13 (polygon) at /bpp/providers[${i}]/tags[${t}]` + } + + break + } + default: { + const key = `prvdr${i}tags${t}type` + errorObj[key] = + `serviceability construct /bpp/providers[${i}]/tags[${t}] should be defined as per the API contract (invalid type "${type.value}")` + } + } + } else { + const key = `prvdr${i}tags${t}type` + errorObj[key] = + `serviceability construct /bpp/providers[${i}]/tags[${t}] should be defined as per the API contract (type is missing)` + } + } + } + } + if (sc.code === 'timing') { + if (timingSet.has(JSON.stringify(sc))) { + const key = `prvdr${i}tags${t}` + errorObj[key] = + `timing construct /bpp/providers[${i}]/tags[${t}] should not be same with the previous timing constructs` + } + + timingSet.add(JSON.stringify(sc)) + const fulfillments = prvdr['fulfillments'] + const fulfillmentTypes = fulfillments.map((fulfillment: any) => fulfillment.type) + + let isOrderPresent = false + const typeCode = sc?.list.find((item: any) => item.code === 'type') + if (typeCode) { + const timingType = typeCode.value + if ( + timingType === 'Order' || + timingType === 'Delivery' || + timingType === 'Self-Pickup' || + timingType === 'All' + ) { + isOrderPresent = true + } else if (!fulfillmentTypes.includes(timingType)) { + errorObj[`provider[${i}].timing`] = + `The type '${timingType}' in timing tags should match with types in fulfillments array, along with 'Order'` + } + } + + if (!isOrderPresent) { + errorObj[`provider[${i}].tags.timing`] = `'Order' type must be present in timing tags` + } + } + }) + if (isEmpty(serviceabilitySet)) { + const key = `prvdr${i}tags/serviceability` + errorObj[key] = `serviceability construct is mandatory in /bpp/providers[${i}]/tags` + } else if (serviceabilitySet.size != itemCategory_id.size) { + const key = `prvdr${i}/serviceability` + errorObj[key] = + `The number of unique category_id should be equal to count of serviceability in /bpp/providers[${i}]` + } + if (isEmpty(timingSet)) { + const key = `prvdr${i}tags/timing` + errorObj[key] = `timing construct is mandatory in /bpp/providers[${i}]/tags` + } else { + const timingsPayloadArr = new Array(...timingSet).map((item: any) => JSON.parse(item)) + const timingsAll = _.chain(timingsPayloadArr) + .filter((payload) => _.some(payload.list, { code: 'type', value: 'All' })) + .value() + + // Getting timings object for 'Delivery', 'Self-Pickup' and 'Order' + const timingsOther = _.chain(timingsPayloadArr) + .filter( + (payload) => + _.some(payload.list, { code: 'type', value: 'Order' }) || + _.some(payload.list, { code: 'type', value: 'Delivery' }) || + _.some(payload.list, { code: 'type', value: 'Self-Pickup' }), + ) + .value() + + if (timingsAll.length > 0 && timingsOther.length > 0) { + errorObj[`prvdr${i}tags/timing`] = + `If the timings of type 'All' is provided then timings construct for 'Order'/'Delivery'/'Self-Pickup' is not required` + } + + const arrTimingTypes = new Set() + + function checkTimingTag(tag: any) { + const typeObject = tag.list.find((item: { code: string }) => item.code === 'type') + const typeValue = typeObject ? typeObject.value : null + arrTimingTypes.add(typeValue) + for (const item of tag.list) { + switch (item.code) { + case 'day_from': + case 'day_to': + const dayValue = parseInt(item.value) + if (isNaN(dayValue) || dayValue < 1 || dayValue > 7 || !/^-?\d+(\.\d+)?$/.test(item.value)) { + errorObj[`prvdr${i}/day_to$/${typeValue}`] = `Invalid value for '${item.code}': ${item.value}` + } + + break + case 'time_from': + case 'time_to': + if (!/^([01]\d|2[0-3])[0-5]\d$/.test(item.value)) { + errorObj[`prvdr${i}/tags/time_to/${typeValue}`] = + `Invalid time format for '${item.code}': ${item.value}` + } + break + case 'location': + if (!prvdrLocationIds.has(item.value)) { + errorObj[`prvdr${i}/tags/location/${typeValue}`] = + `Invalid location value as it's unavailable in location/ids` + } + break + case 'type': + break + default: + errorObj[`prvdr${i}/tags/tag_timings/${typeValue}`] = `Invalid list.code for 'timing': ${item.code}` + } + } + + const dayFromItem = tag.list.find((item: any) => item.code === 'day_from') + const dayToItem = tag.list.find((item: any) => item.code === 'day_to') + const timeFromItem = tag.list.find((item: any) => item.code === 'time_from') + const timeToItem = tag.list.find((item: any) => item.code === 'time_to') + + if (dayFromItem && dayToItem && timeFromItem && timeToItem) { + const dayFrom = parseInt(dayFromItem.value, 10) + const dayTo = parseInt(dayToItem.value, 10) + const timeFrom = parseInt(timeFromItem.value, 10) + const timeTo = parseInt(timeToItem.value, 10) + + if (dayTo < dayFrom) { + errorObj[`prvdr${i}/tags/day_from/${typeValue}`] = + "'day_to' must be greater than or equal to 'day_from'" + } + + if (timeTo <= timeFrom) { + errorObj[`prvdr${i}/tags/time_from/${typeValue}`] = "'time_to' must be greater than 'time_from'" + } + } + } + + if (timingsAll.length > 0) { + if (timingsAll.length > 1) { + errorObj[`prvdr${i}tags/timing/All`] = `The timings object for 'All' should be provided once!` + } + checkTimingTag(timingsAll[0]) + } + + if (timingsOther.length > 0) { + timingsOther.forEach((tagTimings: any) => { + checkTimingTag(tagTimings) + }) + onSearchFFTypeSet.forEach((type: any) => { + if (!arrTimingTypes.has(type)) { + errorObj[`prvdr${i}/tags/timing/${type}`] = `The timings object must be present for ${type} in the tags` + } + arrTimingTypes.forEach((type: any) => { + if (type != 'Order' && type != 'All' && !onSearchFFTypeSet.has(type)) { + errorObj[`prvdr${i}/tags/timing/${type}`] = + `The timings object ${type} is not present in the onSearch fulfillments` + } + }) + if (!arrTimingTypes.has('Order')) { + errorObj[`prvdr${i}/tags/timing/order`] = `The timings object must be present for Order in the tags` + } + }) + } + } + } catch (error: any) { + logger.error( + `!!Error while checking serviceability and timing construct for bpp/providers[${i}], ${error.stack}`, + ) + } + + try { + logger.info( + `Checking if catalog_link type in message/catalog/bpp/providers[${i}]/tags[1]/list[0] is link or inline`, + ) + const tags = bppPrvdrs[i].tags + + let list: any = [] + tags.map((data: any) => { + if (data.code == 'catalog_link') { + list = data.list + } + }) + + list.map((data: any) => { + if (data.code === 'type') { + if (data.value === 'link') { + if (bppPrvdrs[0].items) { + errorObj[`message/catalog/bpp/providers[0]`] = + `Items arrays should not be present in message/catalog/bpp/providers[${i}]` + } + } + } + }) + } catch (error: any) { + logger.error(`Error while checking the type of catalog_link`) + } + + i++ + } + + setValue('onSearchItems', itemsArray) + setValue(`${ApiSequence.ON_SEARCH}prvdrsId`, prvdrsId) + setValue(`${ApiSequence.ON_SEARCH}prvdrLocId`, prvdrLocId) + setValue(`${ApiSequence.ON_SEARCH}itemsId`, itemsId) + } catch (error: any) { + logger.error(`!!Error while checking Providers info in /${constants.ON_SEARCH}, ${error.stack}`) + } + try { + logger.info(`Checking for errors in default flow in /${constants.ON_SEARCH}`) + const providers = data.message.catalog['bpp/providers'] + + providers.forEach((provider: any) => { + let customGroupDetails: any = {} + + provider?.categories.forEach((category: any) => { + const id: string = category?.id + const customGroupTag = category.tags.find( + (tag: any) => tag.code === 'type' && tag.list.some((item: any) => item.value === 'custom_group'), + ) + + if (customGroupTag) { + const configTag = category.tags.find((tag: any) => tag.code === 'config') + const min = configTag ? parseInt(configTag.list.find((item: any) => item.code === 'min')?.value, 10) : 0 + const max = configTag ? parseInt(configTag.list.find((item: any) => item.code === 'max')?.value, 10) : 0 + + if (min > max) { + errorObj[`${provider.id}/categories/${id}`] = `The "min" is more than "max"` + } + customGroupDetails[id] = { + min: min, + max: max, + numberOfDefaults: 0, + numberOfElements: 0, + } + } + }) + + let combinedIds: any = [] + + provider?.items.forEach((item: any) => { + const typeTag = item.tags.find((tag: any) => tag.code === 'type') + const typeValue = typeTag ? typeTag.list.find((listItem: any) => listItem.code === 'type')?.value : null + + if (typeValue === 'item') { + const customGroupTags = item.tags.filter((tag: any) => tag.code === 'custom_group') + combinedIds = customGroupTags.flatMap((tag: any) => tag.list.map((listItem: any) => listItem.value)) + } else if (typeValue === 'customization') { + const parentTag = item.tags.find((tag: any) => tag.code === 'parent') + const customizationGroupId = parentTag?.list.find((listItem: any) => listItem.code === 'id')?.value + + if (customizationGroupId && customGroupDetails[customizationGroupId]) { + customGroupDetails[customizationGroupId].numberOfElements += 1 + + const defaultParent = parentTag?.list.find( + (listItem: any) => listItem.code === 'default' && listItem.value === 'yes', + ) + if (defaultParent) { + customGroupDetails[customizationGroupId].numberOfDefaults += 1 + + const childTag = item.tags.find((tag: any) => tag.code === 'child') + if (childTag) { + const childIds = childTag.list.map((listItem: any) => listItem.value) + combinedIds = [...combinedIds, ...childIds] + } + } + } + } + }) + + combinedIds.forEach((id: any) => { + if (customGroupDetails[id]) { + const group = customGroupDetails[id] + const min = group.min + const max = group.max + + if (group.numberOfElements <= max) { + errorObj[`${provider.id}/categories/${id}/number_of_elements`] = + 'The number of elements in this customization group is less than the maximum that can be selected.' + } + + if (min > 0 && group.numberOfDefaults < min) { + errorObj[`${provider.id}/categories/${id}/number_of_defaults`] = + 'The number of defaults of this customization group is less than the minimum that can be selected.' + } + } + }) + + const customGroupIds = Object.keys(customGroupDetails) + customGroupIds.forEach((id) => { + const group = customGroupDetails[id] + const max = group.max + + if (group.numberOfElements < max) { + errorObj[`${provider.id}/categories/${id}/number_of_defaults`] = + 'The number of elements in this customization group is less than the maximum that can be selected.' + } + }) + }) + } catch (error: any) { + logger.error(`Error while storing items of bpp/providers in itemsArray for /${constants.ON_SEARCH}, ${error.stack}`) + } + + //Validating Offers + try { + logger.info(`Checking offers under bpp/providers`) + + // Iterate through bpp/providers + for (let i in onSearchCatalog['bpp/providers']) { + const offers = onSearchCatalog['bpp/providers'][i]?.offers ?? [] + if (!offers || !Array.isArray(offers)) { + const key = `bpp/providers[${i}]/offers` + errorObj[key] = `Offers must be an array in bpp/providers[${i}]` + continue + } + + offers.forEach((offer: any, offerIndex: number) => { + // Validate mandatory fields + if (!offer.id) { + const key = `bpp/providers[${i}]/offers[${offerIndex}]/id` + errorObj[key] = `Offer ID is mandatory for offers[${offerIndex}]` + logger.error(`Offer ID is mandatory for offers[${offerIndex}]`) + } + + if (!offer.descriptor || !offer.descriptor.code) { + const key = `bpp/providers[${i}]/offers[${offerIndex}]/descriptor` + errorObj[key] = `Descriptor with code is mandatory for offers[${offerIndex}]` + logger.error(`Descriptor with code is mandatory for offers[${offerIndex}]`) + } + + if (!offer.location_ids || !Array.isArray(offer.location_ids) || offer.location_ids.length === 0) { + const key = `bpp/providers[${i}]/offers[${offerIndex}]/location_ids` + errorObj[key] = `Location IDs array is mandatory for offers[${offerIndex}]` + logger.error(`Location IDs array is mandatory for offers[${offerIndex}]`) + } + + if (!offer.item_ids || !Array.isArray(offer.item_ids) || offer.item_ids.length === 0) { + const key = `bpp/providers[${i}]/offers[${offerIndex}]/item_ids` + errorObj[key] = `Item IDs array is mandatory for offers[${offerIndex}]` + logger.error(`Item IDs array is mandatory for offers[${offerIndex}]`) + } + + if (!offer.time || !offer.time.label || !offer.time.range || !offer.time.range.start || !offer.time.range.end) { + const key = `bpp/providers[${i}]/offers[${offerIndex}]/time` + errorObj[key] = `Time object with label and range (start/end) is mandatory for offers[${offerIndex}]` + logger.error(`Time object with label and range (start/end) is mandatory for offers[${offerIndex}]`) + } + + const tags = offer.tags + if (!tags || !Array.isArray(tags)) { + const key = `bpp/providers[${i}]/offers[${offerIndex}]/tags` + errorObj[key] = + `Tags must be provided for offers[${offerIndex}] with descriptor code '${offer.descriptor?.code}'` + logger.error( + `Tags must be provided for offers[${offerIndex}] with descriptor code '${offer.descriptor?.code}'`, + ) + return + } + + // Validate based on offer type + switch (offer.descriptor?.code) { + case 'discount': + // Validate 'qualifier' + const qualifierDiscount = tags.find((tag: any) => tag.code === 'qualifier') + if (!qualifierDiscount || !qualifierDiscount.list.some((item: any) => item.code === 'min_value')) { + const key = `bpp/providers[${i}]/offers[${offerIndex}]/tags[qualifier]` + errorObj[key] = + `'qualifier' tag must include 'min_value' for offers[${offerIndex}] when offer.descriptor.code = ${offer.descriptor.code}` + logger.error(`'qualifier' tag must include 'min_value' for offers[${offerIndex}]`) + } + + // Validate 'benefit' + const benefitDiscount = tags.find((tag: any) => tag.code === 'benefit') + if (!benefitDiscount) { + const key = `bpp/providers[${i}]/offers[${offerIndex}]/tags[benefit]` + errorObj[key] = + `'benefit' tag is required for offers[${offerIndex}] when offer.descriptor.code = ${offer.descriptor.code}` + logger.error(`'benefit' tag is required for offers[${offerIndex}]`) + } else { + const valueTypeItem = benefitDiscount.list.find((item: any) => item.code === 'value_type') + const valueItem = benefitDiscount.list.find((item: any) => item.code === 'value') + const valueCapItem = benefitDiscount.list.find((item: any) => item.code === 'value_cap') + + if (!valueTypeItem) { + const key = `bpp/providers[${i}]/offers[${offerIndex}]/tags[benefit]/value_type` + errorObj[key] = `'value_type' is required in benefit tag for offers[${offerIndex}]` + logger.error(`'value_type' is required in benefit tag for offers[${offerIndex}]`) + } + + if (!valueItem) { + const key = `bpp/providers[${i}]/offers[${offerIndex}]/tags[benefit]/value` + errorObj[key] = `'value' is required in benefit tag for offers[${offerIndex}]` + logger.error(`'value' is required in benefit tag for offers[${offerIndex}]`) + } else { + // Validate value is a proper number + const value = valueItem.value + if (isNaN(parseFloat(value)) || !/^-?\d+(\.\d+)?$/.test(value)) { + const key = `bpp/providers[${i}]/offers[${offerIndex}]/tags[benefit]/value` + errorObj[key] = `'value' in benefit tag must be a valid number for offers[${offerIndex}]` + logger.error(`'value' in benefit tag must be a valid number for offers[${offerIndex}]`) + } else if (parseFloat(value) >= 0) { + const key = `bpp/providers[${i}]/offers[${offerIndex}]/tags[benefit]/value` + errorObj[key] = `'value' in 'benefit' tag must be a negative amount for offers[${offerIndex}]` + logger.error(`'value' in 'benefit' tag must be a negative amount for offers[${offerIndex}]`) + } + } + + // Validate value_cap if present + if (valueCapItem) { + const valueCap = valueCapItem.value + if (isNaN(parseFloat(valueCap)) || !/^-?\d+(\.\d+)?$/.test(valueCap)) { + const key = `bpp/providers[${i}]/offers[${offerIndex}]/tags[benefit]/value_cap` + errorObj[key] = `'value_cap' in benefit tag must be a valid number for offers[${offerIndex}]` + logger.error(`'value_cap' in benefit tag must be a valid number for offers[${offerIndex}]`) + } + } + } + break + + case 'buyXgetY': + // Validate 'qualifier' + const qualifierBuyXgetY = tags.find((tag: any) => tag.code === 'qualifier') + if ( + !qualifierBuyXgetY || + !qualifierBuyXgetY.list.some((item: any) => item.code === 'min_value') || + !qualifierBuyXgetY.list.some((item: any) => item.code === 'item_count') + ) { + const key = `bpp/providers[${i}]/offers[${offerIndex}]/tags[qualifier]` + errorObj[key] = + `'qualifier' tag must include 'min_value' and 'item_count' for offers[${offerIndex}] when offer.descriptor.code = ${offer.descriptor.code}` + logger.error(`'qualifier' tag must include 'min_value' and 'item_count' for offers[${offerIndex}]`) + } + + // Validate 'benefit' + const benefitBuyXgetY = tags.find((tag: any) => tag.code === 'benefit') + if (!benefitBuyXgetY || !benefitBuyXgetY.list.some((item: any) => item.code === 'item_count')) { + const key = `bpp/providers[${i}]/offers[${offerIndex}]/tags[benefit]` + errorObj[key] = + `'benefit' tag must include 'item_count' for offers[${offerIndex}] when offer.descriptor.code = ${offer.descriptor.code}` + logger.error(`'benefit' tag must include 'item_count' for offers[${offerIndex}]`) + } + break + + case 'freebie': + // Validate 'qualifier' + const qualifierFreebie = tags.find((tag: any) => tag.code === 'qualifier') + if (!qualifierFreebie || !qualifierFreebie.list.some((item: any) => item.code === 'min_value')) { + const key = `bpp/providers[${i}]/offers[${offerIndex}]/tags[qualifier]` + errorObj[key] = + `'qualifier' tag must include 'min_value' for offers[${offerIndex}] when offer.descriptor.code = ${offer.descriptor.code}` + logger.error(`'qualifier' tag must include 'min_value' for offers[${offerIndex}]`) + } + + // Validate 'benefit' + const benefitFreebie = tags.find((tag: any) => tag.code === 'benefit') + if ( + !benefitFreebie || + !benefitFreebie.list.some((item: any) => item.code === 'item_count') || + !benefitFreebie.list.some((item: any) => item.code === 'item_id') || + !benefitFreebie.list.some((item: any) => item.code === 'item_value') + ) { + const key = `bpp/providers[${i}]/offers[${offerIndex}]/tags[benefit]` + errorObj[key] = + `'benefit' tag must include 'item_count', 'item_id', and 'item_value' for offers[${offerIndex}] when offer.descriptor.code = ${offer.descriptor.code}` + logger.error( + `'benefit' tag must include 'item_count', 'item_id', and 'item_value' for offers[${offerIndex}]`, + ) + } + break + + case 'slab': + // Validate 'qualifier' + const qualifierSlab = tags.find((tag: any) => tag.code === 'qualifier') + if (!qualifierSlab || !qualifierSlab.list.some((item: any) => item.code === 'min_value')) { + const key = `bpp/providers[${i}]/offers[${offerIndex}]/tags[qualifier]` + errorObj[key] = + `'qualifier' tag must include 'min_value' for offers[${offerIndex}] when offer.descriptor.code = ${offer.descriptor.code}` + logger.error(`'qualifier' tag must include 'min_value' for offers[${offerIndex}]`) + } + + // Validate 'benefit' + const benefitSlab = tags.find((tag: any) => tag.code === 'benefit') + if ( + !benefitSlab || + !benefitSlab.list.some((item: any) => item.code === 'value') || + !benefitSlab.list.some((item: any) => item.code === 'value_type') || + !benefitSlab.list.some((item: any) => item.code === 'value_cap') + ) { + const key = `bpp/providers[${i}]/offers[${offerIndex}]/tags[benefit]` + errorObj[key] = + `'benefit' tag must include 'value', 'value_type', and 'value_cap' for offers[${offerIndex}] when offer.descriptor.code = ${offer.descriptor.code}` + logger.error( + `'benefit' tag must include 'value', 'value_type', and 'value_cap' for offers[${offerIndex}]`, + ) + } + break + + case 'combo': + // Validate 'qualifier' + const qualifierCombo = tags.find((tag: any) => tag.code === 'qualifier') + if ( + !qualifierCombo || + !qualifierCombo.list.some((item: any) => item.code === 'min_value') || + !qualifierCombo.list.some((item: any) => item.code === 'item_id') + ) { + const key = `bpp/providers[${i}]/offers[${offerIndex}]/tags[qualifier]` + errorObj[key] = + `'qualifier' tag must include 'min_value' and 'item_id' for offers[${offerIndex}] when offer.descriptor.code = ${offer.descriptor.code}` + logger.error(`'qualifier' tag must include 'min_value' and 'item_id' for offers[${offerIndex}]`) + } + + // Validate 'benefit' + const benefitCombo = tags.find((tag: any) => tag.code === 'benefit') + if ( + !benefitCombo || + !benefitCombo.list.some((item: any) => item.code === 'value') || + !benefitCombo.list.some((item: any) => item.code === 'value_type') || + !benefitCombo.list.some((item: any) => item.code === 'value_cap') + ) { + const key = `bpp/providers[${i}]/offers[${offerIndex}]/tags[benefit]` + errorObj[key] = + `'benefit' tag must include 'value', 'value_type', and 'value_cap' for offers[${offerIndex}] when offer.descriptor.code = ${offer.descriptor.code}` + logger.error( + `'benefit' tag must include 'value', 'value_type', and 'value_cap' for offers[${offerIndex}]`, + ) + } + break + + case 'delivery': + // Validate 'qualifier' + const qualifierDelivery = tags.find((tag: any) => tag.code === 'qualifier') + if (!qualifierDelivery || !qualifierDelivery.list.some((item: any) => item.code === 'min_value')) { + const key = `bpp/providers[${i}]/offers[${offerIndex}]/tags[qualifier]` + errorObj[key] = + `'qualifier' tag must include 'min_value' for offers[${offerIndex}] when offer.descriptor.code = ${offer.descriptor.code}` + logger.error(`'qualifier' tag must include 'min_value' for offers[${offerIndex}]`) + } + + // Validate 'benefit' + const benefitDelivery = tags.find((tag: any) => tag.code === 'benefit') + if ( + !benefitDelivery || + !benefitDelivery.list.some((item: any) => item.code === 'value') || + !benefitDelivery.list.some((item: any) => item.code === 'value_type') + ) { + const key = `bpp/providers[${i}]/offers[${offerIndex}]/tags[benefit]` + errorObj[key] = + `'benefit' tag must include 'value' and 'value_type' for offers[${offerIndex}] when offer.descriptor.code = ${offer.descriptor.code}` + logger.error(`'benefit' tag must include 'value' and 'value_type' for offers[${offerIndex}]`) + } + break + + case 'exchange': + // Validate 'qualifier' + const qualifierExchange = tags.find((tag: any) => tag.code === 'qualifier') + if (!qualifierExchange || !qualifierExchange.list.some((item: any) => item.code === 'min_value')) { + const key = `bpp/providers[${i}]/offers[${offerIndex}]/tags[qualifier]` + errorObj[key] = + `'qualifier' tag must include 'min_value' for offers[${offerIndex}] when offer.descriptor.code = ${offer.descriptor.code}` + logger.error(`'qualifier' tag must include 'min_value' for offers[${offerIndex}]`) + } + + // Validate that benefits should not exist or should be empty + const benefitExchange = tags.find((tag: any) => tag.code === 'benefit') + if (benefitExchange && benefitExchange.list.length > 0) { + const key = `bpp/providers[${i}]/offers[${offerIndex}]/tags[benefit]` + errorObj[key] = + `'benefit' tag must not include any values for offers[${offerIndex}] when offer.descriptor.code = ${offer.descriptor.code}` + logger.error(`'benefit' tag must not include any values for offers[${offerIndex}]`) + } + break + + default: + logger.info(`No specific validation required for offer type: ${offer.descriptor?.code}`) + } + }) + } + } catch (error: any) { + logger.error(`Error while checking offers under bpp/providers: ${error.stack}`) + } + + return Object.keys(errorObj).length > 0 && errorObj +} diff --git a/utils/Retail_.1.2.5/Search/on_search.ts b/utils/Retail_.1.2.5/Search/on_search.ts new file mode 100644 index 00000000..359c5b0b --- /dev/null +++ b/utils/Retail_.1.2.5/Search/on_search.ts @@ -0,0 +1,2127 @@ +/* eslint-disable no-case-declarations */ +/* eslint-disable no-prototype-builtins */ +import { logger } from '../../../shared/logger' +import { setValue, getValue } from '../../../shared/dao' +import constants, { ApiSequence } from '../../../constants' +import { + validateSchemaRetailV2, + isObjectEmpty, + checkContext, + // timeDiff as timeDifference, + checkGpsPrecision, + emailRegex, + checkBppIdOrBapId, + checkServiceabilityType, + validateLocations, + isSequenceValid, + isValidPhoneNumber, + checkMandatoryTags, + areTimestampsLessThanOrEqualTo, + getStatutoryRequirement, + checkForStatutory, + validateBppUri, + validateBapUri, + validateMetaTags, + validateFinanceTags, +} from '../..' +import _, { isEmpty } from 'lodash' +import { compareSTDwithArea } from '../../index' +import { BPCJSON, agriJSON, groceryJSON, healthJSON, homeJSON } from '../../../constants/category' +import { electronicsData } from '../../../constants/electronics' +import { applianceData } from '../../../constants/appliance' +import { fashion } from '../../../constants/fashion' +import { DOMAIN, FLOW, OFFERSFLOW, statutory_reqs } from '../../enum' +import { ret1aJSON } from '../../../constants/ret1a' +export const checkOnsearch = (data: any, flow?: string) => { + console.log('in this on_search 1.2.5') + + if (!data || isObjectEmpty(data)) { + return { [ApiSequence.ON_SEARCH]: 'JSON cannot be empty' } + } + + const { message, context } = data + + if (!message || !context || !message.catalog || isObjectEmpty(message) || isObjectEmpty(message.catalog)) { + return { missingFields: '/context, /message, /catalog or /message/catalog is missing or empty' } + } + const schemaValidation = validateSchemaRetailV2(context.domain.split(':')[1], constants.ON_SEARCH, data) + let collect_payment_tags:any = {} + + setValue(`${ApiSequence.ON_SEARCH}_context`, context) + setValue(`${ApiSequence.ON_SEARCH}_message`, message) + const providerOffers: any[] = message?.catalog['bpp/providers']?.flatMap((provider: any) => provider?.offers || []) + if (providerOffers && providerOffers.length > 0) { + setValue(`${ApiSequence.ON_SEARCH}_offers`, providerOffers) + } + let errorObj: any = {} + + if (schemaValidation !== 'error') { + Object.assign(errorObj, schemaValidation) + } + + validateBapUri(context.bap_uri, context.bap_id, errorObj) + validateBppUri(context.bpp_uri, context.bpp_id, errorObj) + if (context.transaction_id == context.message_id) { + errorObj['on_search_full_catalog_refresh'] = + `Context transaction_id (${context.transaction_id}) and message_id (${context.message_id}) can't be the same.` + } + try { + logger.info(`Comparing Message Ids of /${constants.SEARCH} and /${constants.ON_SEARCH}`) + if (!_.isEqual(getValue(`${ApiSequence.SEARCH}_msgId`), context.message_id)) { + errorObj[`${ApiSequence.ON_SEARCH}_msgId`] = + `Message Ids for /${constants.SEARCH} and /${constants.ON_SEARCH} api should be same` + } + } catch (error: any) { + logger.error(`!!Error while checking message id for /${constants.ON_SEARCH}, ${error.stack}`) + } + + if (!_.isEqual(data.context.domain.split(':')[1], getValue(`domain`))) { + errorObj[`Domain[${data.context.action}]`] = `Domain should be same in each action` + } + + const checkBap = checkBppIdOrBapId(context.bap_id) + const checkBpp = checkBppIdOrBapId(context.bpp_id) + + if (checkBap) Object.assign(errorObj, { bap_id: 'context/bap_id should not be a url' }) + if (checkBpp) Object.assign(errorObj, { bpp_id: 'context/bpp_id should not be a url' }) + + try { + logger.info(`Checking for context in /${constants.ON_SEARCH}`) + const contextRes: any = checkContext(context, constants.ON_SEARCH) + if (!contextRes?.valid) { + Object.assign(errorObj, contextRes.ERRORS) + } + } catch (error: any) { + logger.error(`Error while checking for context in /${constants.ON_SEARCH}, ${error.stack}`) + } + + setValue(`${ApiSequence.ON_SEARCH}`, data) + const searchContext: any = getValue(`${ApiSequence.SEARCH}_context`) + + try { + logger.info(`Storing BAP_ID and BPP_ID in /${constants.ON_SEARCH}`) + setValue('bapId', context.bap_id) + setValue('bppId', context.bpp_id) + } catch (error: any) { + logger.error(`!!Error while storing BAP and BPP Ids in /${constants.ON_SEARCH}, ${error.stack}`) + } + + try { + logger.info(`Comparing transaction Ids of /${constants.SEARCH} and /${constants.ON_SEARCH}`) + if (!_.isEqual(searchContext.transaction_id, context.transaction_id)) { + errorObj.transaction_id = `Transaction Id for /${constants.SEARCH} and /${constants.ON_SEARCH} api should be same` + } + } catch (error: any) { + logger.info( + `Error while comparing transaction ids for /${constants.SEARCH} and /${constants.ON_SEARCH} api, ${error.stack}`, + ) + } + + // removed timestamp difference check + // try { + // logger.info(`Comparing timestamp of /${constants.SEARCH} and /${constants.ON_SEARCH}`) + // const tmpstmp = searchContext?.timestamp + // if (_.gte(tmpstmp, context.timestamp)) { + // errorObj.tmpstmp = `Timestamp for /${constants.SEARCH} api cannot be greater than or equal to /${constants.ON_SEARCH} api` + // } else { + // const timeDiff = timeDifference(context.timestamp, tmpstmp) + // logger.info(timeDiff) + // if (timeDiff > 5000) { + // errorObj.tmpstmp = `context/timestamp difference between /${constants.ON_SEARCH} and /${constants.SEARCH} should be less than 5 sec` + // } + // } + // } catch (error: any) { + // logger.info( + // `Error while comparing timestamp for /${constants.SEARCH} and /${constants.ON_SEARCH} api, ${error.stack}`, + // ) + // } + + try { + logger.info(`Comparing Message Ids of /${constants.SEARCH} and /${constants.ON_SEARCH}`) + if (!_.isEqual(searchContext.message_id, context.message_id)) { + errorObj.message_id = `Message Id for /${constants.SEARCH} and /${constants.ON_SEARCH} api should be same` + } + } catch (error: any) { + logger.info( + `Error while comparing message ids for /${constants.SEARCH} and /${constants.ON_SEARCH} api, ${error.stack}`, + ) + } + + try { + const providers = data.message.catalog['bpp/providers'] + providers.forEach((provider: any) => { + const items = provider.items.forEach((item: any) => { + console.log('item inside items', item?.['@ondc/org/available_on_cod']) + }) + + console.log('items>>', items) + console.log('provider items', provider.items) + const address = provider.locations[0].address + + if (address) { + const area_code = Number.parseInt(address.area_code) + const std = context.city.split(':')[1] + + logger.info(`Comparing area_code and STD Code for /${constants.ON_SEARCH}`) + const areaWithSTD = compareSTDwithArea(area_code, std) + if (!areaWithSTD) { + logger.error(`STD code does not match with correct area_code on /${constants.ON_SEARCH}`) + errorObj.invldAreaCode = `STD code does not match with correct area_code on /${constants.ON_SEARCH}` + } + } + }) + } catch (error: any) { + logger.error( + `Error while matching area_code and std code for /${constants.SEARCH} and /${constants.ON_SEARCH} api, ${error.stack}`, + ) + } + + const onSearchCatalog: any = message.catalog + const onSearchFFIdsArray: any = [] + const prvdrsId = new Set() + const prvdrLocId = new Set() + const itemsId = new Set() + const parentItemIdSet = new Set() + const onSearchFFTypeSet = new Set() + const itemsArray: any = [] + let itemIdList: any = [] + setValue('tmpstmp', context.timestamp) + + // Storing static fulfillment ids in onSearchFFIdsArray, OnSearchFFTypeSet + try { + logger.info(`Saving static fulfillment ids in /${constants.ON_SEARCH}`) + + onSearchCatalog['bpp/providers'].forEach((provider: any) => { + const onSearchFFIds = new Set() + const bppFF = provider.fulfillments + const len = bppFF.length + + let i = 0 + while (i < len) { + onSearchFFTypeSet.add(bppFF[i].type) + onSearchFFIds.add(bppFF[i].id) + i++ + } + onSearchFFIdsArray.push(onSearchFFIds) + }) + + setValue('onSearchFFIdsArray', onSearchFFIdsArray) + } catch (error: any) { + logger.info(`Error while saving static fulfillment ids in /${constants.ON_SEARCH}, ${error.stack}`) + } + + // Storing items of bpp/providers in itemsArray and itemIdList + try { + logger.info(`Storing items of bpp/providers in itemsArray for /${constants.ON_SEARCH}`) + const providers = onSearchCatalog['bpp/providers'] + providers.forEach((provider: any) => { + const items = provider.items + itemsArray.push(items) + items.forEach((item: any) => { + itemIdList.push(item.id) + }) + }) + setValue('ItemList', itemIdList) + setValue('onSearchItems', itemsArray) + } catch (error: any) { + logger.error( + `Error while storing items of bpp/providers in itemsArray for /${constants.ON_SEARCH}, ${error.stack}`, + ) + } + + // Checking for mandatory Items in provider IDs + try { + const domain = context.domain.split(':')[1] + logger.info(`Checking for item tags in bpp/providers[0].items.tags in ${domain}`) + const isoDurationRegex = /^P(?=\d|T\d)(\d+D)?(T(\d+H)?(\d+M)?(\d+S)?)?$/; + for (let i in onSearchCatalog['bpp/providers']) { + const items = onSearchCatalog['bpp/providers'][i].items + items.forEach((item: any) => { + const replacementTerms = item.replacement_terms + + if (replacementTerms !== undefined) { + if (!Array.isArray(replacementTerms) || replacementTerms.length === 0) { + errorObj['on_search_full_catalog_refresh'] = + `replacement_terms must be a non-empty array if present for item ID '${item.id}'`; + return; + } + + for (const term of replacementTerms) { + if (!term.hasOwnProperty('replace_within')) { + errorObj['on_search_full_catalog_refresh'] = + `Missing 'replace_within' in replacement_terms for item ID '${item.id}'`; + + } + + const duration = term.replace_within?.duration; + + if (!duration || !isoDurationRegex.test(duration)) { + errorObj['on_search_full_catalog_refresh'] = + `Invalid or missing ISO 8601 duration in replacement_terms for item ID '${item.id}'. Found: '${duration}'`; + + } + } + } + }) + let errors: any + switch (domain) { + case DOMAIN.RET10: + errors = checkMandatoryTags(i, items, errorObj, groceryJSON, 'Grocery') + break + case DOMAIN.RET12: + errors = checkMandatoryTags(i, items, errorObj, fashion, 'Fashion') + break + case DOMAIN.RET13: + errors = checkMandatoryTags(i, items, errorObj, BPCJSON, 'BPC') + break + case DOMAIN.RET14: + errors = checkMandatoryTags(i, items, errorObj, electronicsData, 'Electronics') + break + case DOMAIN.RET15: + errors = checkMandatoryTags(i, items, errorObj, applianceData, 'Appliances') + break + case DOMAIN.RET16: + errors = checkMandatoryTags(i, items, errorObj, homeJSON, 'Home & Kitchen') + break + case DOMAIN.RET18: + errors = checkMandatoryTags(i, items, errorObj, healthJSON, 'Health & Wellness') + break + case DOMAIN.AGR10: + errors = checkMandatoryTags(i, items, errorObj, agriJSON, 'Agriculture') + break + case DOMAIN.RET1A: + errors = checkMandatoryTags(i, items, errorObj, ret1aJSON, 'Automobile') + break + } + Object.assign(errorObj, errors) + } + } catch (error: any) { + logger.error(`!!Errors while checking for items in bpp/providers/items, ${error.stack}`) + } + + // Comparing valid timestamp in context.timestamp and bpp/providers/items/time/timestamp + try { + logger.info(`Comparing valid timestamp in context.timestamp and bpp/providers/items/time/timestamp`) + const timestamp = context.timestamp + for (let i in onSearchCatalog['bpp/providers']) { + const items = onSearchCatalog['bpp/providers'][i].items + items.forEach((item: any, index: number) => { + const itemTimeStamp = item.time.timestamp + const op = areTimestampsLessThanOrEqualTo(itemTimeStamp, timestamp) + if (!op) { + const key = `bpp/providers[${i}]/items/time/timestamp[${index}]` + errorObj[key] = `Timestamp for item[${index}] can't be greater than context.timestamp` + logger.error(`Timestamp for item[${index}] can't be greater than context.timestamp`) + } + }) + } + } catch (error: any) { + logger.error( + `!!Errors while checking timestamp in context.timestamp and bpp/providers/items/time/timestamp, ${error.stack}`, + ) + } + + // Checking for duplicate providerID in bpp/providers + try { + for (let i in onSearchCatalog['bpp/providers']) { + logger.info(`Validating uniqueness for provider id in bpp/providers[${i}]...`) + const prvdr = onSearchCatalog['bpp/providers'][i] + if (prvdrsId.has(prvdr.id)) { + const key = `prvdr${i}id` + errorObj[key] = `duplicate provider id: ${prvdr.id} in bpp/providers` + } else { + prvdrsId.add(prvdr.id) + } + } + setValue(`${ApiSequence.ON_SEARCH}prvdrsId`, prvdrsId) + } catch (error: any) { + logger.error(`!!Errors while checking provider id in bpp/providers, ${error.stack}`) + } + + // Checking for long_desc and short_desc in bpp/providers/items/descriptor/ + try { + logger.info(`Checking for long_desc and short_desc in bpp/providers/items/descriptor/`) + for (let i in onSearchCatalog['bpp/providers']) { + const items = onSearchCatalog['bpp/providers'][i].items + items.forEach((item: any, index: number) => { + if (!item.descriptor.short_desc || !item.descriptor.long_desc) { + logger.error( + `short_desc and long_desc should not be provided as empty string "" in /message/catalog/bpp/providers[${i}]/items[${index}]/descriptor`, + ) + const key = `bpp/providers[${i}]/items[${index}]/descriptor` + errorObj[key] = + `short_desc and long_desc should not be provided as empty string "" in /message/catalog/bpp/providers[${i}]/items[${index}]/descriptor` + } + }) + } + } catch (error: any) { + logger.error( + `!!Errors while checking timestamp in context.timestamp and bpp/providers/items/time/timestamp, ${error.stack}`, + ) + } + // Checking for code in bpp/providers/items/descriptor/ + try { + logger.info(`Checking for code in bpp/providers/items/descriptor/`) + for (let i in onSearchCatalog['bpp/providers']) { + const items = onSearchCatalog['bpp/providers'][i].items + items.forEach((item: any, index: number) => { + if (!item.descriptor.code) { + logger.error(`code should be provided in /message/catalog/bpp/providers[${i}]/items[${index}]/descriptor`) + const key = `bpp/providers[${i}]/items[${index}]/descriptor` + errorObj[key] = `code should provided in /message/catalog/bpp/providers[${i}]/items[${index}]/descriptor` + } else { + const itemCodeArr = item.descriptor.code.split(':') + const itemDescType = itemCodeArr[0] + const itemDescCode = itemCodeArr[1] + const domain = getValue('domain') + const subdomain = domain?.substring(3) + if (domain != 'AGR10' && domain != 'RET1A') { + switch (subdomain) { + case '10': + case '13': + case '16': + case '18': + if (itemDescType != '1') { + const key = `bpp/providers[${i}]/items[${index}]/descriptor/code` + errorObj[key] = + `code should have 1:EAN as a value in /message/catalog/bpp/providers[${i}]/items[${index}]/descriptor/code` + } else { + const regex = /^\d{8}$|^\d{13}$/ + if (!regex.test(itemDescCode)) { + const key = `bpp/providers[${i}]/items[${index}]/descriptor/code` + errorObj[key] = + `code should provided in /message/catalog/bpp/providers[${i}]/items[${index}]/descriptor/code(${itemDescCode}) should be number and with either length 8 or 13` + } + } + break + case '12': + if (itemDescType == '4') { + const regex = /^\d{4}$|^\d{6}$|^\d{8}$|^\d{10}$/ + if (!regex.test(itemDescCode)) { + const key = `bpp/providers[${i}]/items[${index}]/descriptor/code` + errorObj[key] = + `code should provided in /message/catalog/bpp/providers[${i}]/items[${index}]/descriptor/code should be number and have a length 4, 6, 8 or 10.` + } + } else { + const key = `bpp/providers[${i}]/items[${index}]/descriptor/code` + errorObj[key] = + `code should have 4:HSN as a value in /message/catalog/bpp/providers[${i}]/items[${index}]/descriptor/code` + } + break + case '14': + case '15': + if (itemDescType == '3') { + const regex = /^\d{8}$|^\d{12}$|^\d{13}$|^\d{14}$/ + if (!regex.test(itemDescCode)) { + const key = `bpp/providers[${i}]/items[${index}]/descriptor/code` + errorObj[key] = + `code should provided in /message/catalog/bpp/providers[${i}]/items[${index}]/descriptor/code should be number and have a length 8, 12, 13 or 14}.` + } + } else { + const key = `bpp/providers[${i}]/items[${index}]/descriptor/code` + errorObj[key] = + `code should have 3:GTIN as a value in /message/catalog/bpp/providers[${i}]/items[${index}]/descriptor/code` + } + break + default: + const key = `bpp/providers[${i}]/items[${index}]/descriptor/code` + errorObj[key] = + `code should have a valid value in /message/catalog/bpp/providers[${i}]/items[${index}]/descriptor/code` + break + } + } + } + }) + } + } catch (error: any) { + logger.error( + `!!Errors while checking timestamp in context.timestamp and bpp/providers/items/descriptor/code, ${error.stack}`, + ) + } + + // Adding parent_item_id in a set + try { + logger.info(`Adding parent_item_id in a set on /${constants.ON_SEARCH}`) + const providers = onSearchCatalog['bpp/providers'] + providers.forEach((provider: any) => { + provider.items.forEach((item: any) => { + if (!parentItemIdSet.has(item.parent_item_id)) { + parentItemIdSet.add(item.parent_item_id) + } + }) + }) + + setValue('parentItemIdSet', parentItemIdSet) + } catch (error: any) { + logger.error(`Error while adding parent_item_id in a set on /${constants.ON_SEARCH}, ${error.stack}`) + } + + // Checking image array for bpp/providers/[]/categories/[]/descriptor/images[] + try { + logger.info(`Checking image array for bpp/provider/categories/descriptor/images[]`) + for (let i in onSearchCatalog['bpp/providers']) { + const categories = onSearchCatalog['bpp/providers'][i].categories + if (categories) { + categories.forEach((item: any, index: number) => { + if (item.descriptor.images && item.descriptor.images.length < 1) { + const key = `bpp/providers[${i}]/categories[${index}]/descriptor` + errorObj[key] = `Images should not be provided as empty array for categories[${index}]/descriptor` + logger.error(`Images should not be provided as empty array for categories[${index}]/descriptor`) + } + }) + } + } + } catch (error: any) { + logger.error( + `!!Errors while checking image array for bpp/providers/[]/categories/[]/descriptor/images[], ${error.stack}`, + ) + } + + try { + logger.info(`Checking for np_type in bpp/descriptor`) + const descriptor = onSearchCatalog['bpp/descriptor'] + descriptor?.tags.map((tag: { code: any; list: any[] }) => { + if (tag.code === 'bpp_terms') { + const npType = tag.list.find((item) => item.code === 'np_type') + if (!npType) { + errorObj['bpp/descriptor'] = `Missing np_type in bpp/descriptor` + setValue(`${ApiSequence.ON_SEARCH}np_type`, '') + } else { + setValue(`${ApiSequence.ON_SEARCH}np_type`, npType.value) + } + const accept_bap_terms = tag.list.find((item) => item.code === 'accept_bap_terms') + if (accept_bap_terms) { + errorObj['bpp/descriptor/accept_bap_terms'] = + `accept_bap_terms is not required in bpp/descriptor/tags for now ` + } + // const collect_payment = tag.list.find((item) => item.code === 'collect_payment') + // if (collect_payment) { + // errorObj['bpp/descriptor/collect_payment'] = `collect_payment is not required in bpp/descriptor/tags for now ` + // } + } + if(flow === FLOW.FLOW007 || flow === FLOW.FLOW0099 || flow === OFFERSFLOW.FLOW0098){ + collect_payment_tags = tag.list.find((item) => item.code === 'collect_payment') + if(!collect_payment_tags){ + errorObj['bpp/descriptor/tags/collect_payment'] = `collect_payment is required in bpp/descriptor/tags for on_search catalogue for flow: ${flow} ` + } + if (!['Y', 'N'].includes(collect_payment_tags.value)) { + errorObj['bpp/descriptor/tags/collect_payment'] = `value must be "Y" or "N" for flow: ${flow}`; + } + setValue(collect_payment_tags.value,"collect_payment") + } + }) + } catch (error: any) { + logger.error(`Error while checking np_type in bpp/descriptor for /${constants.ON_SEARCH}, ${error.stack}`) + } + + + //Validating Offers + try { + logger.info(`Checking offers under bpp/providers`) + + // Iterate through bpp/providers + for (let i in onSearchCatalog['bpp/providers']) { + const offers = onSearchCatalog['bpp/providers'][i]?.offers ?? [] + if (!offers || !Array.isArray(offers)) { + const key = `bpp/providers[${i}]/offers` + errorObj[key] = `Offers must be an array in bpp/providers[${i}]` + continue + } + + offers.forEach((offer: any, offerIndex: number) => { + // Validate mandatory fields + if (!offer.id) { + const key = `bpp/providers[${i}]/offers[${offerIndex}]/id` + errorObj[key] = `Offer ID is mandatory for offers[${offerIndex}]` + logger.error(`Offer ID is mandatory for offers[${offerIndex}]`) + } + + if (!offer.descriptor || !offer.descriptor.code) { + const key = `bpp/providers[${i}]/offers[${offerIndex}]/descriptor` + errorObj[key] = `Descriptor with code is mandatory for offers[${offerIndex}]` + logger.error(`Descriptor with code is mandatory for offers[${offerIndex}]`) + } + + if (!offer.location_ids || !Array.isArray(offer.location_ids) || offer.location_ids.length === 0) { + const key = `bpp/providers[${i}]/offers[${offerIndex}]/location_ids` + errorObj[key] = `Location IDs array is mandatory for offers[${offerIndex}]` + logger.error(`Location IDs array is mandatory for offers[${offerIndex}]`) + } + + if (!offer.item_ids || !Array.isArray(offer.item_ids) || offer.item_ids.length === 0) { + const key = `bpp/providers[${i}]/offers[${offerIndex}]/item_ids` + errorObj[key] = `Item IDs array is mandatory for offers[${offerIndex}]` + logger.error(`Item IDs array is mandatory for offers[${offerIndex}]`) + } + + if (!offer.time || !offer.time.label || !offer.time.range || !offer.time.range.start || !offer.time.range.end) { + const key = `bpp/providers[${i}]/offers[${offerIndex}]/time` + errorObj[key] = `Time object with label and range (start/end) is mandatory for offers[${offerIndex}]` + logger.error(`Time object with label and range (start/end) is mandatory for offers[${offerIndex}]`) + } + + const tags = offer.tags + if (!tags || !Array.isArray(tags)) { + const key = `bpp/providers[${i}]/offers[${offerIndex}]/tags` + errorObj[key] = + `Tags must be provided for offers[${offerIndex}] with descriptor code '${offer.descriptor?.code}'` + logger.error( + `Tags must be provided for offers[${offerIndex}] with descriptor code '${offer.descriptor?.code}'`, + ) + return + } + const metaTagsError = validateMetaTags(tags) + if (metaTagsError) { + let i = 0 + const len = metaTagsError.length + while (i < len) { + const key = `metaTagsError${i}` + errorObj[key] = `${metaTagsError[i]}` + i++ + } + } + + // Validate based on offer type + switch (offer.descriptor?.code) { + case 'discount': + // Validate 'qualifier' + const qualifierDiscount = tags.find((tag: any) => tag.code === 'qualifier') + if (!qualifierDiscount || !qualifierDiscount.list.some((item: any) => item.code === 'min_value')) { + const key = `bpp/providers[${i}]/offers[${offerIndex}]/tags[qualifier]` + errorObj[key] = + `'qualifier' tag must include 'min_value' for offers[${offerIndex}] when offer.descriptor.code = ${offer.descriptor.code}` + logger.error(`'qualifier' tag must include 'min_value' for offers[${offerIndex}]`) + } + + // Validate 'benefit' + const benefitDiscount = tags.find((tag: any) => tag.code === 'benefit') + if (!benefitDiscount) { + const key = `bpp/providers[${i}]/offers[${offerIndex}]/tags[benefit]` + errorObj[key] = + `'benefit' tag is required for offers[${offerIndex}] when offer.descriptor.code = ${offer.descriptor.code}` + logger.error(`'benefit' tag is required for offers[${offerIndex}]`) + } else { + const valueTypeItem = benefitDiscount.list.find((item: any) => item.code === 'value_type') + const valueItem = benefitDiscount.list.find((item: any) => item.code === 'value') + const valueCapItem = benefitDiscount.list.find((item: any) => item.code === 'value_cap') + + if (!valueTypeItem) { + const key = `bpp/providers[${i}]/offers[${offerIndex}]/tags[benefit]/value_type` + errorObj[key] = `'value_type' is required in benefit tag for offers[${offerIndex}]` + logger.error(`'value_type' is required in benefit tag for offers[${offerIndex}]`) + } + + if (!valueItem) { + const key = `bpp/providers[${i}]/offers[${offerIndex}]/tags[benefit]/value` + errorObj[key] = `'value' is required in benefit tag for offers[${offerIndex}]` + logger.error(`'value' is required in benefit tag for offers[${offerIndex}]`) + } else { + // Validate value is a proper number + const value = valueItem.value + if (isNaN(parseFloat(value)) || !/^-?\d+(\.\d+)?$/.test(value)) { + const key = `bpp/providers[${i}]/offers[${offerIndex}]/tags[benefit]/value` + errorObj[key] = `'value' in benefit tag must be a valid number for offers[${offerIndex}]` + logger.error(`'value' in benefit tag must be a valid number for offers[${offerIndex}]`) + } else if (parseFloat(value) >= 0) { + const key = `bpp/providers[${i}]/offers[${offerIndex}]/tags[benefit]/value` + errorObj[key] = `'value' in 'benefit' tag must be a negative amount for offers[${offerIndex}]` + logger.error(`'value' in 'benefit' tag must be a negative amount for offers[${offerIndex}]`) + } + } + + // Validate value_cap if present + if (valueCapItem) { + const valueCap = valueCapItem.value + if (isNaN(parseFloat(valueCap)) || !/^-?\d+(\.\d+)?$/.test(valueCap)) { + const key = `bpp/providers[${i}]/offers[${offerIndex}]/tags[benefit]/value_cap` + errorObj[key] = `'value_cap' in benefit tag must be a valid number for offers[${offerIndex}]` + logger.error(`'value_cap' in benefit tag must be a valid number for offers[${offerIndex}]`) + } + } + } + break + + case 'buyXgetY': + // Validate 'qualifier' + const qualifierBuyXgetY = tags.find((tag: any) => tag.code === 'qualifier') + if ( + !qualifierBuyXgetY || + !qualifierBuyXgetY.list.some((item: any) => item.code === 'min_value') || + !qualifierBuyXgetY.list.some((item: any) => item.code === 'item_count') + ) { + const key = `bpp/providers[${i}]/offers[${offerIndex}]/tags[qualifier]` + errorObj[key] = + `'qualifier' tag must include 'min_value' and 'item_count' for offers[${offerIndex}] when offer.descriptor.code = ${offer.descriptor.code}` + logger.error(`'qualifier' tag must include 'min_value' and 'item_count' for offers[${offerIndex}]`) + } + + // Validate 'benefit' + const benefitBuyXgetY = tags.find((tag: any) => tag.code === 'benefit') + if (!benefitBuyXgetY || !benefitBuyXgetY.list.some((item: any) => item.code === 'item_count')) { + const key = `bpp/providers[${i}]/offers[${offerIndex}]/tags[benefit]` + errorObj[key] = + `'benefit' tag must include 'item_count' for offers[${offerIndex}] when offer.descriptor.code = ${offer.descriptor.code}` + logger.error(`'benefit' tag must include 'item_count' for offers[${offerIndex}]`) + } + break + + case 'freebie': + // Validate 'qualifier' + const qualifierFreebie = tags.find((tag: any) => tag.code === 'qualifier') + if (!qualifierFreebie || !qualifierFreebie.list.some((item: any) => item.code === 'min_value')) { + const key = `bpp/providers[${i}]/offers[${offerIndex}]/tags[qualifier]` + errorObj[key] = + `'qualifier' tag must include 'min_value' for offers[${offerIndex}] when offer.descriptor.code = ${offer.descriptor.code}` + logger.error(`'qualifier' tag must include 'min_value' for offers[${offerIndex}]`) + } + + // Validate 'benefit' + const benefitFreebie = tags.find((tag: any) => tag.code === 'benefit') + if ( + !benefitFreebie || + !benefitFreebie.list.some((item: any) => item.code === 'item_count') || + !benefitFreebie.list.some((item: any) => item.code === 'item_id') || + !benefitFreebie.list.some((item: any) => item.code === 'item_value') + ) { + const key = `bpp/providers[${i}]/offers[${offerIndex}]/tags[benefit]` + errorObj[key] = + `'benefit' tag must include 'item_count', 'item_id', and 'item_value' for offers[${offerIndex}] when offer.descriptor.code = ${offer.descriptor.code}` + logger.error( + `'benefit' tag must include 'item_count', 'item_id', and 'item_value' for offers[${offerIndex}]`, + ) + } + break + + case 'slab': + // Validate 'qualifier' + const qualifierSlab = tags.find((tag: any) => tag.code === 'qualifier') + if (!qualifierSlab || !qualifierSlab.list.some((item: any) => item.code === 'min_value')) { + const key = `bpp/providers[${i}]/offers[${offerIndex}]/tags[qualifier]` + errorObj[key] = + `'qualifier' tag must include 'min_value' for offers[${offerIndex}] when offer.descriptor.code = ${offer.descriptor.code}` + logger.error(`'qualifier' tag must include 'min_value' for offers[${offerIndex}]`) + } + + // Validate 'benefit' + const benefitSlab = tags.find((tag: any) => tag.code === 'benefit') + if ( + !benefitSlab || + !benefitSlab.list.some((item: any) => item.code === 'value') || + !benefitSlab.list.some((item: any) => item.code === 'value_type') || + !benefitSlab.list.some((item: any) => item.code === 'value_cap') + ) { + const key = `bpp/providers[${i}]/offers[${offerIndex}]/tags[benefit]` + errorObj[key] = + `'benefit' tag must include 'value', 'value_type', and 'value_cap' for offers[${offerIndex}] when offer.descriptor.code = ${offer.descriptor.code}` + logger.error( + `'benefit' tag must include 'value', 'value_type', and 'value_cap' for offers[${offerIndex}]`, + ) + } + break + + case 'combo': + // Validate 'qualifier' + const qualifierCombo = tags.find((tag: any) => tag.code === 'qualifier') + if ( + !qualifierCombo || + !qualifierCombo.list.some((item: any) => item.code === 'min_value') || + !qualifierCombo.list.some((item: any) => item.code === 'item_id') + ) { + const key = `bpp/providers[${i}]/offers[${offerIndex}]/tags[qualifier]` + errorObj[key] = + `'qualifier' tag must include 'min_value' and 'item_id' for offers[${offerIndex}] when offer.descriptor.code = ${offer.descriptor.code}` + logger.error(`'qualifier' tag must include 'min_value' and 'item_id' for offers[${offerIndex}]`) + } + + // Validate 'benefit' + const benefitCombo = tags.find((tag: any) => tag.code === 'benefit') + if ( + !benefitCombo || + !benefitCombo.list.some((item: any) => item.code === 'value') || + !benefitCombo.list.some((item: any) => item.code === 'value_type') || + !benefitCombo.list.some((item: any) => item.code === 'value_cap') + ) { + const key = `bpp/providers[${i}]/offers[${offerIndex}]/tags[benefit]` + errorObj[key] = + `'benefit' tag must include 'value', 'value_type', and 'value_cap' for offers[${offerIndex}] when offer.descriptor.code = ${offer.descriptor.code}` + logger.error( + `'benefit' tag must include 'value', 'value_type', and 'value_cap' for offers[${offerIndex}]`, + ) + } + break + + case 'delivery': + // Validate 'qualifier' + const qualifierDelivery = tags.find((tag: any) => tag.code === 'qualifier') + if (!qualifierDelivery || !qualifierDelivery.list.some((item: any) => item.code === 'min_value')) { + const key = `bpp/providers[${i}]/offers[${offerIndex}]/tags[qualifier]` + errorObj[key] = + `'qualifier' tag must include 'min_value' for offers[${offerIndex}] when offer.descriptor.code = ${offer.descriptor.code}` + logger.error(`'qualifier' tag must include 'min_value' for offers[${offerIndex}]`) + } + + // Validate 'benefit' + const benefitDelivery = tags.find((tag: any) => tag.code === 'benefit') + if ( + !benefitDelivery || + !benefitDelivery.list.some((item: any) => item.code === 'value') || + !benefitDelivery.list.some((item: any) => item.code === 'value_type') + ) { + const key = `bpp/providers[${i}]/offers[${offerIndex}]/tags[benefit]` + errorObj[key] = + `'benefit' tag must include 'value' and 'value_type' for offers[${offerIndex}] when offer.descriptor.code = ${offer.descriptor.code}` + logger.error(`'benefit' tag must include 'value' and 'value_type' for offers[${offerIndex}]`) + } + break + + case 'exchange': + // Validate 'qualifier' + // const qualifierExchange = tags.find((tag: any) => tag.code === 'qualifier') + // if (!qualifierExchange || !qualifierExchange.list.some((item: any) => item.code === 'min_value')) { + // const key = `bpp/providers[${i}]/offers[${offerIndex}]/tags[qualifier]` + // errorObj[key] = + // `'qualifier' tag must include 'min_value' for offers[${offerIndex}] when offer.descriptor.code = ${offer.descriptor.code}` + // logger.error(`'qualifier' tag must include 'min_value' for offers[${offerIndex}]`) + // } + + // // Validate that benefits should not exist or should be empty + // const benefitExchange = tags.find((tag: any) => tag.code === 'benefit') + // if (benefitExchange && benefitExchange.list.length > 0) { + // const key = `bpp/providers[${i}]/offers[${offerIndex}]/tags[benefit]` + // errorObj[key] = + // `'benefit' tag must not include any values for offers[${offerIndex}] when offer.descriptor.code = ${offer.descriptor.code}` + // logger.error(`'benefit' tag must not include any values for offers[${offerIndex}]`) + // } + if(context.domain !== "ONDC:RET14" || context.domain !== "ONDC:RET15"){ + errorObj["unsupportedDomain"]= `exchange is not possible for ${context.domain} as supported domains are 'ONDC:RET14','ONDC:RET15' is required for flow: ${flow}` + } + break + case 'financing': + let collect_payment_value = collect_payment_tags?.value + if (flow === FLOW.FLOW0099 || collect_payment_value === 'no') { + const financeTagsError = validateFinanceTags(tags) + if (financeTagsError) { + let i = 0 + const len = financeTagsError.length + while (i < len) { + const key = `financeTagsError${i}` + errorObj[key] = `${financeTagsError[i]}` + i++ + } + } + } + break + default: + logger.info(`No specific validation required for offer type: ${offer.descriptor?.code}`) + } + }) + } + } catch (error: any) { + logger.error(`Error while checking offers under bpp/providers: ${error.stack}`) + } + // Checking price of items in bpp/providers + try { + const providers = onSearchCatalog['bpp/providers'] + providers.forEach((provider: any, i: number) => { + const items = provider.items + items.forEach((item: any, j: number) => { + if (item.price && item.price.value) { + const priceValue = parseFloat(item.price.value) + if (priceValue < 1) { + const key = `prvdr${i}item${j}price` + errorObj[key] = `item.price.value should be greater than 0` + } + } + }) + }) + } catch (error: any) { + logger.error(`Error while checking price of items in bpp/providers for /${constants.ON_SEARCH}, ${error.stack}`) + } + + // Mapping items with thier respective providers + try { + const itemProviderMap: any = {} + const providers = onSearchCatalog['bpp/providers'] + providers.forEach((provider: any) => { + const items = provider.items + const itemArray: any = [] + items.forEach((item: any) => { + itemArray.push(item.id) + }) + itemProviderMap[provider.id] = itemArray + }) + + setValue('itemProviderMap', itemProviderMap) + } catch (e: any) { + logger.error(`Error while mapping items with thier respective providers ${e.stack}`) + } + + // Checking for quantity of items in bpp/providers + try { + logger.info(`Checking for quantity of items in bpp/providers for /${constants.ON_SEARCH}`) + const providers = onSearchCatalog['bpp/providers'] + providers.forEach((provider: any, i: number) => { + const items = provider.items + function getProviderCreds() { + return providers.map((provider: any) => { + const creds = provider?.creds + if ((flow === FLOW.FLOW017 && creds === undefined) || creds.length === 0) { + errorObj['MissingCreds'] = `creds must be present in order in /${constants.ON_SEARCH}` + } + + return { + providerId: provider.id, + creds, + } + }) + } + + const result = getProviderCreds() + setValue('credsWithProviderId', result) + + items.forEach((item: any, j: number) => { + if (item.quantity && item.quantity.available && typeof item.quantity.available.count === 'string') { + const availCount = parseInt(item.quantity.available.count, 10) + const maxCount = parseInt(item.quantity.maximum.count, 10) + const minCount = parseInt(item.quantity.minimum.count, 10) + if (!minCount) { + const key = `prvdr${i}item${j}minimum.count` + errorObj[key] = `item.quantity.minimum.count must be added , if not set default as 99 ` + } + if (item.quantity.unitized.measure.value < 1) { + const key = `prvdr${i}item${j}unitized` + errorObj[key] = `item.quantity.unitized.measure.value should be greater than 0` + } + if (availCount < 0 || maxCount < 0) { + const key = `prvdr${i}item${j}invldCount` + errorObj[key] = + `item.quantity.available.count and item.quantity.maximum.count should be greater than or equal to 0` + } + } + }) + }) + } catch (error: any) { + logger.error(`Error while checking quantity of items in bpp/providers for /${constants.ON_SEARCH}, ${error.stack}`) + } + + // Checking for items categoryId and it's mapping with statutory_reqs + if (getValue('domain') === 'RET10') { + try { + logger.info( + `Checking for items categoryId and it's mapping with statutory_reqs in bpp/providers for /${constants.ON_SEARCH}`, + ) + const providers = onSearchCatalog['bpp/providers'] + providers.forEach((provider: any, i: number) => { + const items = provider.items + items.forEach((item: any, j: number) => { + if (!_.isEmpty(item?.category_id)) { + + const statutoryRequirement: any = getStatutoryRequirement(item.category_id) + let errors: any + switch (statutoryRequirement) { + case statutory_reqs.PrepackagedFood: + errors = checkForStatutory(item, i, j, errorObj, statutory_reqs.PrepackagedFood) + break + case statutory_reqs.PackagedCommodities: + errors = checkForStatutory(item, i, j, errorObj, statutory_reqs.PackagedCommodities) + break + case statutory_reqs.None: + break + default: + const key = `prvdr${i}item${j}statutoryReq` + errorObj[key] = + `The following item/category_id is not a valid one in bpp/providers for /${constants.ON_SEARCH}` + break + } + Object.assign(errorObj, errors) + } + }) + }) + } catch (error: any) { + logger.error( + `Error while checking for items categoryId and it's mapping with statutory_reqs in bpp/providers for /${constants.ON_SEARCH}, ${error.stack}`, + ) + } + } + + // Checking for duplicate varient in bpp/providers/items for on_search + // try { + // logger.info(`Checking for duplicate varient in bpp/providers/items for on_search`) + // for (let i in onSearchCatalog['bpp/providers']) { + // const varientPath: any = findVariantPath(onSearchCatalog['bpp/providers'][i].categories) + // const items = onSearchCatalog['bpp/providers'][i].items + // const map = checkDuplicateParentIdItems(items) + // for (let key in map) { + // if (map[key].length > 1) { + // const item = varientPath.find((item: any) => { + // return item.item_id === key + // }) + // const pathForVarient = item.paths + // let valueArray = [] + // if (pathForVarient.length) { + // for (let j = 0; j < map[key].length; j++) { + // let itemValues: any = {} + // for (let path of pathForVarient) { + // if (path === 'item.quantity.unitized.measure') { + // const unit = map[key][j].quantity.unitized.measure.unit + // const value = map[key][j].quantity.unitized.measure.value + // itemValues['unit'] = unit + // itemValues['value'] = value + // } else { + // const val = findValueAtPath(path, map[key][j]) + // itemValues[path.split('.').pop()] = val + // } + // } + // valueArray.push(itemValues) + // } + // checkForDuplicates(valueArray, errorObj) + // } + // } + // } + // } + // } catch (error: any) { + // logger.error(`!!Errors while checking parent_item_id in bpp/providers/[]/items/[]/parent_item_id/, ${error.stack}`) + // } + + + try { + logger.info(`Checking Providers info (bpp/providers) in /${constants.ON_SEARCH}`) + let i = 0 + const bppPrvdrs = onSearchCatalog['bpp/providers'] + const len = bppPrvdrs.length + const tmpstmp = context.timestamp + + while (i < len) { + const categoriesId = new Set() + const customGrpId = new Set() + const seqSet = new Set() + const itemCategory_id = new Set() + const categoryRankSet = new Set() + const prvdrLocationIds = new Set() + const prvdr = bppPrvdrs[i] + + logger.info(`Checking store enable/disable timestamp in bpp/providers[${i}]`) + try { + if (prvdr.time) { + const providerTime = new Date(prvdr.time.timestamp).getTime() + const contextTimestamp = new Date(tmpstmp).getTime() + if (providerTime > contextTimestamp) { + errorObj.StoreEnableDisable = `store enable/disable timestamp (/bpp/providers/time/timestamp) should be less then or equal to context.timestamp` + } + } + } catch (error: any) { + logger.error(`Error while checking store enable/disable timestamp in bpp/providers[${i}]`, error) + } + + logger.info(`Checking store timings in bpp/providers[${i}]`) + + prvdr.locations.forEach((loc: any, iter: any) => { + try { + logger.info(`Checking gps precision of store location in /bpp/providers[${i}]/locations[${iter}]`) + const has = Object.prototype.hasOwnProperty + if (has.call(loc, 'gps')) { + if (!checkGpsPrecision(loc.gps)) { + errorObj.gpsPrecision = `/bpp/providers[${i}]/locations[${iter}]/gps coordinates must be specified with at least 4 decimal places of precision.` + } + } + } catch (error) { + logger.error( + `!!Error while checking gps precision of store location in /bpp/providers[${i}]/locations[${iter}]`, + error, + ) + } + + try { + if (prvdrLocId.has(loc?.id)) { + const key = `prvdr${i}${loc.id}${iter}` + errorObj[key] = `duplicate location id: ${loc.id} in /bpp/providers[${i}]/locations[${iter}]` + } else { + prvdrLocId.add(loc.id) + } + prvdrLocationIds.add(loc?.id) + logger.info('Checking store days...') + const days = loc?.time?.days?.split(',') + days.forEach((day: any) => { + day = parseInt(day) + if (isNaN(day) || day < 1 || day > 7) { + const key = `prvdr${i}locdays${iter}` + errorObj[key] = + `store days (bpp/providers[${i}]/locations[${iter}]/time/days) should be in the format ("1,2,3,4,5,6,7") where 1- Monday and 7- Sunday` + } + }) + + logger.info('Checking fixed or split timings') + + //scenario 1: range =1 freq/times =1 + if (loc?.time?.range && (loc.time?.schedule?.frequency || loc.time?.schedule?.times)) { + const key = `prvdr${i}loctime${iter}` + errorObj[key] = + `Either one of fixed (range) or split (frequency and times) timings should be provided in /bpp/providers[${i}]/locations[${iter}]/time` + } + + // scenario 2: range=0 freq || times =1 + if (!loc?.time?.range && (!loc?.time?.schedule?.frequency || !loc?.time?.schedule?.times)) { + const key = `prvdr${i}loctime${iter}` + errorObj[key] = + `Either one of fixed timings (range) or split timings (both frequency and times) should be provided in /bpp/providers[${i}]/locations[${iter}]/time` + } + + //scenario 3: range=1 (start and end not compliant) frequency=0; + if ('range' in loc.time) { + logger.info('checking range (fixed timings) start and end') + const startTime: any = 'start' in loc?.time?.range ? parseInt(loc?.time?.range?.start) : '' + const endTime: any = 'end' in loc?.time?.range ? parseInt(loc?.time?.range?.end) : '' + if (isNaN(startTime) || isNaN(endTime) || startTime > endTime || endTime > 2359) { + errorObj.startEndTime = `end time must be greater than start time in fixed timings /locations/time/range (fixed store timings)` + } + } + } catch (error: any) { + logger.error(`Validation error for frequency: ${error.stack}`) + } + }) + + try { + logger.info(`Checking for upcoming holidays`) + const location = onSearchCatalog['bpp/providers'][i]['locations'] + if (!location) { + logger.error('No location detected ') + } + + const scheduleObject = location[i].time.schedule.holidays + const timestamp = context.timestamp + const [currentDate] = timestamp.split('T') + + scheduleObject.map((date: string) => { + const dateObj = new Date(date) + const currentDateObj = new Date(currentDate) + if (dateObj.getTime() < currentDateObj.getTime()) { + const key = `/message/catalog/bpp/providers/loc${i}/time/schedule/holidays` + errorObj[key] = `Holidays cannot be past ${currentDate}` + } + }) + } catch (e) { + logger.error('No Holiday', e) + } + + try { + logger.info(`Checking categories for provider (${prvdr.id}) in bpp/providers[${i}]`) + let j = 0 + const categories = onSearchCatalog['bpp/providers'][i]['categories'] + if (!categories || !categories.length) { + const key = `prvdr${i}categories` + errorObj[key] = `Support for variants is mandatory, categories must be present in bpp/providers[${i}]` + } + const iLen = categories?.length + while (j < iLen) { + logger.info(`Validating uniqueness for categories id in bpp/providers[${i}].items[${j}]...`) + const category = categories[j] + + const fulfillments = onSearchCatalog['bpp/providers'][i]['fulfillments'] + const phoneNumber = fulfillments[i].contact.phone + + if (!isValidPhoneNumber(phoneNumber)) { + const key = `bpp/providers${i}fulfillments${i}` + errorObj[key] = + `Please enter a valid phone number consisting of 10 or 11 digits without any spaces or special characters. ` + } + + if (categoriesId.has(category.id)) { + const key = `prvdr${i}category${j}` + errorObj[key] = `duplicate category id: ${category.id} in bpp/providers[${i}]` + } else { + categoriesId.add(category.id) + } + + try { + category.tags.map((tag: { code: any; list: any[] }, index: number) => { + switch (tag.code) { + case 'attr': + const attrList = tag.list.find((item) => item.code === 'name') + if (attrList) { + const isValid = + attrList.value === 'item.quantity.unitized.measure' || + attrList.value.startsWith('item.tags.attribute') + + if (!isValid) { + const key = `prvdr${i}category${j}tags${index}` + errorObj[key] = + `list.code == attr then name should be 'item.quantity.unitized.measure' or 'item.tags.attribute.{object.keys}' in bpp/providers[${i}]` + } + } + break + case 'type': + const codeList = tag.list.find((item) => item.code === 'type') + if ( + !( + codeList.value === 'custom_menu' || + codeList.value === 'custom_group' || + codeList.value === 'variant_group' + ) + ) { + const key = `prvdr${i}category${j}tags${index}` + errorObj[key] = + `list.code == type then value should be one of 'custom_menu','custom_group' and 'variant_group' in bpp/providers[${i}]` + } + + if (codeList.value === 'custom_group') { + customGrpId.add(category.id) + } + + break + case 'timing': + for (const item of tag.list) { + switch (item.code) { + case 'day_from': + case 'day_to': + const dayValue = parseInt(item.value) + if (isNaN(dayValue) || dayValue < 1 || dayValue > 7 || !/^-?\d+(\.\d+)?$/.test(item.value)) { + errorObj.custom_menu_timing_tag = `Invalid value for '${item.code}': ${item.value}` + } + + break + case 'time_from': + case 'time_to': + if (!/^([01]\d|2[0-3])[0-5]\d$/.test(item.value)) { + errorObj.time_to = `Invalid time format for '${item.code}': ${item.value}` + } + + break + default: + errorObj.Tagtiming = `Invalid list.code for 'timing': ${item.code}` + } + } + + const dayFromItem = tag.list.find((item: any) => item.code === 'day_from') + const dayToItem = tag.list.find((item: any) => item.code === 'day_to') + const timeFromItem = tag.list.find((item: any) => item.code === 'time_from') + const timeToItem = tag.list.find((item: any) => item.code === 'time_to') + + if (dayFromItem && dayToItem && timeFromItem && timeToItem) { + const dayFrom = parseInt(dayFromItem.value, 10) + const dayTo = parseInt(dayToItem.value, 10) + const timeFrom = parseInt(timeFromItem.value, 10) + const timeTo = parseInt(timeToItem.value, 10) + + if (dayTo < dayFrom) { + errorObj.day_from = "'day_to' must be greater than or equal to 'day_from'" + } + + if (timeTo <= timeFrom) { + errorObj.time_from = "'time_to' must be greater than 'time_from'" + } + } + + break + case 'display': + for (const item of tag.list) { + if (item.code !== 'rank' || !/^-?\d+(\.\d+)?$/.test(item.value)) { + errorObj.rank = `Invalid value for 'display': ${item.value}` + } else { + if (categoryRankSet.has(category.id)) { + const key = `prvdr${i}category${j}rank` + errorObj[key] = `duplicate rank in category id: ${category.id} in bpp/providers[${i}]` + } else { + categoryRankSet.add(category.id) + } + } + } + + break + case 'config': + const minItem: any = tag.list.find((item: { code: string }) => item.code === 'min') + const maxItem: any = tag.list.find((item: { code: string }) => item.code === 'max') + const inputItem: any = tag.list.find((item: { code: string }) => item.code === 'input') + const seqItem: any = tag.list.find((item: { code: string }) => item.code === 'seq') + + if (!minItem || !maxItem) { + errorObj[`customization_config_${j}`] = + `Both 'min' and 'max' values are required in 'config' at index: ${j}` + } + + if (!/^-?\d+(\.\d+)?$/.test(minItem.value)) { + errorObj[`customization_config_min_${j}`] = + `Invalid value for ${minItem.code}: ${minItem.value} at index: ${j}` + } + + if (!/^-?\d+(\.\d+)?$/.test(maxItem.value)) { + errorObj[`customization_config_max_${j}`] = + `Invalid value for ${maxItem.code}: ${maxItem.value}at index: ${j}` + } + + if (!/^-?\d+(\.\d+)?$/.test(seqItem.value)) { + errorObj[`config_seq_${j}`] = `Invalid value for ${seqItem.code}: ${seqItem.value} at index: ${j}` + } + + const inputEnum = ['select', 'text'] + if (!inputEnum.includes(inputItem.value)) { + errorObj[`config_input_${j}`] = + `Invalid value for 'input': ${inputItem.value}, it should be one of ${inputEnum} at index: ${j}` + } + + break + } + }) + logger.info(`Category '${category.descriptor.name}' is valid.`) + } catch (error: any) { + logger.error(`Validation error for category '${category.descriptor.name}': ${error.message}`) + } + + j++ + } + } catch (error: any) { + logger.error(`!!Errors while checking categories in bpp/providers[${i}], ${error.stack}`) + } + + try { + logger.info(`Checking items for provider (${prvdr.id}) in bpp/providers[${i}]`) + let j = 0 + const items = onSearchCatalog['bpp/providers'][i]['items'] + + const iLen = items.length + while (j < iLen) { + logger.info(`Validating uniqueness for item id in bpp/providers[${i}].items[${j}]...`) + const item = items[j] + + if (itemsId.has(item.id)) { + const key = `prvdr${i}item${j}` + errorObj[key] = `duplicate item id: ${item.id} in bpp/providers[${i}]` + } else { + itemsId.add(item.id) + } + + if ('category_id' in item) { + itemCategory_id.add(item.category_id) + } + try { + if ('category_ids' in item) { + item[`category_ids`].map((category: string, index: number) => { + const categoryId = category.split(':')[0] + const seq = category.split(':')[1] + + if (seqSet.has(seq)) { + const key = `prvdr${i}item${j}ctgryseq${index}` + errorObj[key] = `duplicate seq : ${seq} in category_ids in prvdr${i}item${j}` + } else { + seqSet.add(seq) + } + + if (!categoriesId.has(categoryId)) { + const key = `prvdr${i}item${j}ctgryId${index}` + errorObj[key] = `item${j} should have category_ids one of the Catalog/categories/id` + } + }) + } + } catch (error: any) { + logger.error(`Error while checking category_ids for item id: ${item.id}, ${error.stack}`) + } + + try { + logger.info(`Checking selling price and maximum price for item id: ${item.id}`) + + const statutory_reqs_prepackaged_food = + onSearchCatalog['bpp/providers'][i]['items'][j]['@ondc/org/statutory_reqs_prepackaged_food'] + + if (context.domain === 'ONDC:RET18') { + if (!statutory_reqs_prepackaged_food.ingredients_info) { + const key = `prvdr${i}items${j}@ondc/org/statutory_reqs_prepackaged_food` + errorObj[key] = + `In ONDC:RET18 for @ondc/org/statutory_reqs_prepackaged_food ingredients_info is a valid field ` + } + } else if (context.domain === 'ONDC:RET10') { + const mandatoryFields = [ + 'nutritional_info', + 'additives_info', + 'brand_owner_FSSAI_license_no', + 'other_FSSAI_license_no', + 'importer_FSSAI_license_no', + ] + mandatoryFields.forEach((field) => { + if (statutory_reqs_prepackaged_food && !statutory_reqs_prepackaged_food[field]) { + const key = `prvdr${i}items${j}@ondc/org/statutory_reqs_prepackaged_food` + errorObj[key] = + `In ONDC:RET10 @ondc/org/statutory_reqs_prepackaged_food following fields are valid and required 'nutritional_info', 'additives_info','other_FSSAI_license_no', + 'brand_owner_FSSAI_license_no','importer_FSSAI_license_no'` + } + }) + } + } catch (error: any) { + logger.error(`Error while checking selling price and maximum price for item id: ${item.id}, ${error.stack}`) + } + + try { + if (item.quantity && item.quantity.maximum && typeof item.quantity.maximum.count === 'string') { + const maxCount = parseInt(item.quantity.maximum.count, 10) + const availCount = parseInt(item.quantity.available.count, 10) + if (availCount == 99 && maxCount <= 0) { + const key = `prvdr${i}item${j}maxCount` + errorObj[key] = + `item.quantity.maximum.count should be either default value 99 (no cap per order) or any other positive value (cap per order) in /bpp/providers[${i}]/items[${j}]` + } + } + } catch (error: any) { + logger.error(`Error while checking available and max quantity for item id: ${item.id}, ${error.stack}`) + } + + try { + if (item.quantity && item.quantity.maximum && typeof item.quantity.maximum.count === 'string') { + const maxCount = parseInt(item.quantity.maximum.count, 10) + const availCount = parseInt(item.quantity.available.count, 10) + if (availCount == 99 && maxCount == 0) { + const key = `prvdr${i}item${j}maxCount` + errorObj[key] = `item.quantity.maximum.count cant be 0 if item is in stock ` + } + } + } catch (error: any) { + logger.error(`Error while checking available and max quantity for item id: ${item.id}, ${error.stack}`) + } + + try { + if ('price' in item) { + const sPrice = parseFloat(item.price.value) + const maxPrice = parseFloat(item.price.maximum_value) + + if (sPrice > maxPrice) { + const key = `prvdr${i}item${j}Price` + errorObj[key] = + `selling price of item /price/value with id: (${item.id}) can't be greater than the maximum price /price/maximum_value in /bpp/providers[${i}]/items[${j}]/` + } + } + } catch (error: any) { + logger.error(`Error while checking selling price and maximum price for item id: ${item.id}, ${error.stack}`) + } + + try { + logger.info(`Checking fulfillment_id for item id: ${item.id}`) + + if ('price' in item) { + const upper = parseFloat(item.price?.tags?.[0].list[1].value) + const lower = parseFloat(item.price?.tags?.[0].list[0].value) + + if (upper > lower) { + const key = `prvdr${i}item${j}Price/tags/list` + errorObj[key] = + `selling lower range of item /price/range/value with id: (${item.id}) can't be greater than the upper in /bpp/providers[${i}]/items[${j}]/` + } + } + } catch (error: any) { + logger.error(`Error while checking price range for item id: ${item.id}, error: ${error.stack}`) + } + + try { + if (item.fulfillment_id && !onSearchFFIdsArray[i].has(item.fulfillment_id)) { + const key = `prvdr${i}item${j}ff` + errorObj[key] = + `fulfillment_id in /bpp/providers[${i}]/items[${j}] should map to one of the fulfillments id in bpp/prvdr${i}/fulfillments` + } + } catch (error: any) { + logger.error(`Error while checking fulfillment_id for item id: ${item.id}, error: ${error.stack}`) + } + + try { + logger.info(`Checking location_id for item id: ${item.id}`) + + if (item.location_id && !prvdrLocId.has(item.location_id)) { + const key = `prvdr${i}item${j}loc` + errorObj[key] = + `location_id in /bpp/providers[${i}]/items[${j}] should be one of the locations id in /bpp/providers[${i}]/locations` + } + } catch (error: any) { + logger.error(`Error while checking location_id for item id: ${item.id}, error: ${error.stack}`) + } + try { + logger.info(`Checking default_selection for F&B RET11 customizations...`) + + const items = getValue('items') + + _.filter(items, (item) => { + // Check if the item has customizations (tags) and a price range + if (item.customizations && item.price) { + const customTags = item.customizations.tags + const defaultSelection = customTags?.default_selection + + const itemSellingPrice = parseFloat(item.price.value) // Selling price of the item + + // Retrieve the customization selling price and MRP + const customizationSellingPrice = parseFloat(defaultSelection.value) + const customizationMRP = parseFloat(defaultSelection.maximum_value) + + // Calculate the expected selling price and MRP for the customization + item + const expectedSellingPrice = customizationSellingPrice + itemSellingPrice + const expectedMRP = customizationMRP + itemSellingPrice + + // Validation: Ensure that default_selection.value matches selling price of customization + item + if (defaultSelection.value !== expectedSellingPrice) { + const key = `item${item.id}CustomTags/default_selection/value` + errorObj[key] = + `The selling price of customization + item for id: ${item.id} does not match the expected value (${expectedSellingPrice}).` + } + + // Validation: Ensure that default_selection.maximum_value matches MRP of customization + item + if (defaultSelection.maximum_value !== expectedMRP) { + const key = `item${item.id}CustomTags/default_selection/maximum_value` + errorObj[key] = + `The MRP of customization + item for id: ${item.id} does not match the expected MRP (${expectedMRP}).` + } + + logger.info(`Checked default_selection for item id: ${item.id}`) + } + }) + } catch (error: any) { + logger.error(`Error while checking default_selection for items, ${error.stack}`) + } + + try { + logger.info(`Checking consumer care details for item id: ${item.id}`) + if ('@ondc/org/contact_details_consumer_care' in item) { + let consCare = item['@ondc/org/contact_details_consumer_care'] + + consCare = consCare.split(',') + + if (!isValidPhoneNumber(consCare[2])) { + const key = `prvdr${i}consCare` + errorObj[key] = + `@ondc/org/contact_details_consumer_care contactno should consist of 10 or 11 digits without any spaces or special characters in /bpp/providers[${i}]/items` + } + + if (consCare.length < 3) { + const key = `prvdr${i}consCare` + errorObj[key] = + `@ondc/org/contact_details_consumer_care should be in the format "name,email,contactno" in /bpp/providers[${i}]/items` + } else { + const checkEmail: boolean = emailRegex(consCare[1].trim()) + if (isNaN(consCare[2].trim()) || !checkEmail) { + const key = `prvdr${i}consCare` + errorObj[key] = + `@ondc/org/contact_details_consumer_care email should be in /bpp/providers[${i}]/items` + } + } + } + } catch (error: any) { + logger.error(`Error while checking consumer care details for item id: ${item.id}, ${error.stack}`) + } + + try { + item.tags.map((tag: { code: any; list: any[] }, index: number) => { + switch (tag.code) { + case 'type': + if ( + tag.list && + Array.isArray(tag.list) && + tag.list.some( + (listItem: { code: string; value: string }) => + listItem.code === 'type' && listItem.value === 'item', + ) + ) { + if (!item.time) { + const key = `prvdr${i}item${j}time` + errorObj[key] = `item_id: ${item.id} should contain time object in bpp/providers[${i}]` + } + } + + break + + case 'custom_group': + tag.list.map((it: { code: string; value: string }, index: number) => { + if (!customGrpId.has(it.value)) { + const key = `prvdr${i}item${j}tag${index}cstmgrp_id` + errorObj[key] = + `item_id: ${item.id} should have custom_group_id one of the ids passed in categories bpp/providers[${i}]` + } + }) + + break + + case 'config': + const idList: any = tag.list.find((item: { code: string }) => item.code === 'id') + const minList: any = tag.list.find((item: { code: string }) => item.code === 'min') + const maxList: any = tag.list.find((item: { code: string }) => item.code === 'max') + const seqList: any = tag.list.find((item: { code: string }) => item.code === 'seq') + + if (!categoriesId.has(idList.value)) { + const key = `prvdr${i}item${j}tags${index}config_list` + errorObj[key] = + `value in catalog/items${j}/tags${index}/config/list/ should be one of the catalog/category/ids` + } + + if (!/^-?\d+(\.\d+)?$/.test(minList.value)) { + const key = `prvdr${i}item${j}tags${index}config_min` + errorObj[key] = `Invalid value for ${minList.code}: ${minList.value}` + } + + if (!/^-?\d+(\.\d+)?$/.test(maxList.value)) { + const key = `prvdr${i}item${j}tags${index}config_max` + errorObj[key] = `Invalid value for ${maxList.code}: ${maxList.value}` + } + + if (!/^-?\d+(\.\d+)?$/.test(seqList.value)) { + const key = `prvdr${i}item${j}tags${index}config_seq` + errorObj[key] = `Invalid value for ${seqList.code}: ${seqList.value}` + } + + break + + case 'timing': + for (const item of tag.list) { + switch (item.code) { + case 'day_from': + case 'day_to': + const dayValue = parseInt(item.value) + if (isNaN(dayValue) || dayValue < 1 || dayValue > 5 || !/^-?\d+(\.\d+)?$/.test(item.value)) { + const key = `prvdr${i}item${j}tags${index}timing_day` + errorObj[key] = `Invalid value for '${item.code}': ${item.value}` + } + + break + case 'time_from': + case 'time_to': + if (!/^([01]\d|2[0-3])[0-5]\d$/.test(item.value)) { + const key = `prvdr${i}item${j}tags${index}timing_time` + errorObj[key] = `Invalid time format for '${item.code}': ${item.value}` + } + + break + default: + errorObj.Tagtiming = `Invalid list.code for 'timing': ${item.code}` + } + } + + const dayFromItem = tag.list.find((item: any) => item.code === 'day_from') + const dayToItem = tag.list.find((item: any) => item.code === 'day_to') + const timeFromItem = tag.list.find((item: any) => item.code === 'time_from') + const timeToItem = tag.list.find((item: any) => item.code === 'time_to') + + if (dayFromItem && dayToItem && timeFromItem && timeToItem) { + const dayFrom = parseInt(dayFromItem.value, 10) + const dayTo = parseInt(dayToItem.value, 10) + const timeFrom = parseInt(timeFromItem.value, 10) + const timeTo = parseInt(timeToItem.value, 10) + + if (dayTo < dayFrom) { + const key = `prvdr${i}item${j}tags${index}timing_dayfrom` + errorObj[key] = "'day_to' must be greater than or equal to 'day_from'" + } + + if (timeTo <= timeFrom) { + const key = `prvdr${i}item${j}tags${index}timing_timefrom` + errorObj[key] = "'time_to' must be greater than 'time_from'" + } + } + + break + + case 'veg_nonveg': + const allowedCodes = ['veg', 'non_veg', 'egg'] + + for (const it of tag.list) { + if (it.code && !allowedCodes.includes(it.code)) { + const key = `prvdr${i}item${j}tag${index}veg_nonveg` + errorObj[key] = + `item_id: ${item.id} should have veg_nonveg one of the 'veg', 'non_veg' in bpp/providers[${i}]` + } + } + + break + } + }) + } catch (error: any) { + logger.error(`Error while checking tags for item id: ${item.id}`, error) + } + + j++ + } + } catch (error: any) { + logger.error(`!!Errors while checking items in bpp/providers[${i}], ${error.stack}`) + } + + try { + logger.info(`checking rank in bpp/providers[${i}].category.tags`) + const rankSeq = isSequenceValid(seqSet) + if (rankSeq === false) { + const key = `prvdr${i}ctgry_tags` + errorObj[key] = `rank should be in sequence provided in bpp/providers[${i}]/categories/tags/display` + } + } catch (error: any) { + logger.error(`!!Errors while checking rank in bpp/providers[${i}].category.tags, ${error.stack}`) + } + + // servicability Construct + try { + logger.info(`Checking serviceability construct for bpp/providers[${i}]`) + const tags = onSearchCatalog['bpp/providers'][i]['tags'] + if (!tags || !tags.length) { + const key = `prvdr${i}tags` + errorObj[key] = `tags must be present in bpp/providers[${i}]` + } + + if (tags) { + const circleRequired = checkServiceabilityType(tags) + if (circleRequired) { + const errors = validateLocations(message.catalog['bpp/providers'][i].locations, tags) + errorObj = { ...errorObj, ...errors } + } + } + + //checking for each serviceability construct and matching serviceability constructs with the previous ones + const serviceabilitySet = new Set() + const timingSet = new Set() + tags.forEach((sc: any, t: any) => { + if (sc.code === 'serviceability') { + if (serviceabilitySet.has(JSON.stringify(sc))) { + const key = `prvdr${i}tags${t}` + errorObj[key] = + `serviceability construct /bpp/providers[${i}]/tags[${t}] should not be same with the previous serviceability constructs` + } + + serviceabilitySet.add(JSON.stringify(sc)) + if ('list' in sc) { + if (sc.list.length < 5) { + const key = `prvdr${i}tags${t}` + errorObj[key] = + `serviceability construct /bpp/providers[${i}]/tags[${t}] should be defined as per the API contract` + } + + //checking location + const loc = sc.list.find((elem: any) => elem && elem.code === 'location') + if (!loc) { + const key = `prvdr${i}tags${t}loc` + errorObj[key] = + `serviceability construct /bpp/providers[${i}]/tags[${t}] should be defined as per the API contract (location is missing)` + } else if (typeof loc === 'object' && 'value' in loc) { + if (!prvdrLocId.has(loc.value)) { + const key = `prvdr${i}tags${t}loc` + errorObj[key] = + `location in serviceability construct should be one of the location ids bpp/providers[${i}]/locations` + } + } else { + const key = `prvdr${i}tags${t}loc` + errorObj[key] = + `serviceability construct /bpp/providers[${i}]/tags[${t}] should be defined as per the API contract (location is missing)` + } + + //checking category + const ctgry = sc.list.find((elem: any) => elem && elem.code === 'category') + if (!ctgry) { + const key = `prvdr${i}tags${t}ctgry` + errorObj[key] = + `serviceability construct /bpp/providers[${i}]/tags[${t}] should be defined as per the API contract (category is missing)` + } else if (typeof ctgry === 'object' && 'value' in ctgry) { + if (!itemCategory_id.has(ctgry.value)) { + const key = `prvdr${i}tags${t}ctgry` + errorObj[key] = + `category in serviceability construct should be one of the category ids bpp/providers[${i}]/items/category_id` + } + } else { + const key = `prvdr${i}tags${t}ctgry` + errorObj[key] = + `serviceability construct /bpp/providers[${i}]/tags[${t}] should be defined as per the API contract (category is missing)` + } + + //checking type (hyperlocal, intercity or PAN India) + const type = sc.list.find((elem: any) => elem && elem.code === 'type') + if (!type) { + const key = `prvdr${i}tags${t}type` + errorObj[key] = + `serviceability construct /bpp/providers[${i}]/tags[${t}] should be defined as per the API contract (type is missing)` + } else if (typeof type === 'object' && 'value' in type) { + switch (type.value) { + case '10': + { + //For hyperlocal + + //checking value + const val = sc.list.find((elem: any) => elem && elem.code === 'val') + if (!val) { + const key = `prvdr${i}tags${t}val` + errorObj[key] = + `serviceability construct /bpp/providers[${i}]/tags[${t}] should be defined as per the API contract (value is missing for code "val")` + } else if (typeof val === 'object' && 'value' in val) { + if (isNaN(val.value)) { + const key = `prvdr${i}tags${t}valvalue` + errorObj[key] = + `value should be a number (code:"val") for type 10 (hyperlocal) in /bpp/providers[${i}]/tags[${t}]` + } + } else { + const key = `prvdr${i}tags${t}val` + errorObj[key] = + `serviceability construct /bpp/providers[${i}]/tags[${t}] should be defined as per the API contract (value is missing for code "val")` + } + + //checking unit + const unit = sc.list.find((elem: any) => elem && elem.code === 'unit') + if (!unit) { + const key = `prvdr${i}tags${t}unit` + errorObj[key] = + `serviceability construct /bpp/providers[${i}]/tags[${t}] should be defined as per the API contract (value is missing for code "unit")` + } else if (typeof unit === 'object' && 'value' in unit) { + if (unit.value != 'km') { + const key = `prvdr${i}tags${t}unitvalue` + errorObj[key] = + `value should be "km" (code:"unit") for type 10 (hyperlocal) in /bpp/providers[${i}]/tags[${t}]` + } + } else { + const key = `prvdr${i}tags${t}unit` + errorObj[key] = + `serviceability construct /bpp/providers[${i}]/tags[${t}] should be defined as per the API contract (value is missing for code "unit")` + } + } + + break + case '11': + { + //intercity + + //checking value + const val = sc.list.find((elem: any) => elem && elem.code === 'val') + if (!val) { + const key = `prvdr${i}tags${t}val` + errorObj[key] = + `serviceability construct /bpp/providers[${i}]/tags[${t}] should be defined as per the API contract (value is missing for code "val")` + } else if (typeof val === 'object' && 'value' in val) { + const pincodes = val.value.split(/,|-/) + pincodes.forEach((pincode: any) => { + if (isNaN(pincode) || pincode.length != 6) { + const key = `prvdr${i}tags${t}valvalue` + errorObj[key] = + `value should be a valid range of pincodes (code:"val") for type 11 (intercity) in /bpp/providers[${i}]/tags[${t}]` + } + }) + } else { + const key = `prvdr${i}tags${t}val` + errorObj[key] = + `serviceability construct /bpp/providers[${i}]/tags[${t}] should be defined as per the API contract (value is missing for code "val")` + } + + //checking unit + const unit = sc.list.find((elem: any) => elem && elem.code === 'unit') + if (!unit) { + const key = `prvdr${i}tags${t}unit` + errorObj[key] = + `serviceability construct /bpp/providers[${i}]/tags[${t}] should be defined as per the API contract (value is missing for code "unit")` + } else if (typeof unit === 'object' && 'value' in unit) { + if (unit.value != 'pincode') { + const key = `prvdr${i}tags${t}unitvalue` + errorObj[key] = + `value should be "pincode" (code:"unit") for type 11 (intercity) in /bpp/providers[${i}]/tags[${t}]` + } + } else { + const key = `prvdr${i}tags${t}unit` + errorObj[key] = + `serviceability construct /bpp/providers[${i}]/tags[${t}] should be defined as per the API contract (value is missing for code "unit")` + } + } + + break + case '12': + { + //PAN India + + //checking value + const val = sc.list.find((elem: any) => elem && elem.code === 'val') + if (!val) { + const key = `prvdr${i}tags${t}val` + errorObj[key] = + `serviceability construct /bpp/providers[${i}]/tags[${t}] should be defined as per the API contract (value is missing for code "val")` + } else if (typeof val === 'object' && 'value' in val) { + if (val.value != 'IND') { + const key = `prvdr${i}tags${t}valvalue` + errorObj[key] = + `value should be "IND" (code:"val") for type 12 (PAN India) in /bpp/providers[${i}]tags[${t}]` + } + } else { + const key = `prvdr${i}tags${t}val` + errorObj[key] = + `serviceability construct /bpp/providers[${i}]/tags[${t}] should be defined as per the API contract (value is missing for code "val")` + } + + //checking unit + const unit = sc.list.find((elem: any) => elem && elem.code === 'unit') + if (!unit) { + const key = `prvdr${i}tags${t}unit` + errorObj[key] = + `serviceability construct /bpp/providers[${i}]/tags[${t}] should be defined as per the API contract (value is missing for code "unit")` + } else if (typeof unit === 'object' && 'value' in unit) { + if (unit.value != 'country') { + const key = `prvdr${i}tags${t}unitvalue` + errorObj[key] = + `value should be "country" (code:"unit") for type 12 (PAN India) in /bpp/providers[${i}]tags[${t}]` + } + } else { + const key = `prvdr${i}tags${t}unit` + errorObj[key] = + `serviceability construct /bpp/providers[${i}]/tags[${t}] should be defined as per the API contract (value is missing for code "unit")` + } + } + + break + default: { + const key = `prvdr${i}tags${t}type` + errorObj[key] = + `serviceability construct /bpp/providers[${i}]/tags[${t}] should be defined as per the API contract (invalid type "${type.value}")` + } + } + } else { + const key = `prvdr${i}tags${t}type` + errorObj[key] = + `serviceability construct /bpp/providers[${i}]/tags[${t}] should be defined as per the API contract (type is missing)` + } + } + } + if (sc.code === 'timing') { + if (timingSet.has(JSON.stringify(sc))) { + const key = `prvdr${i}tags${t}` + errorObj[key] = + `timing construct /bpp/providers[${i}]/tags[${t}] should not be same with the previous timing constructs` + } + + timingSet.add(JSON.stringify(sc)) + const fulfillments = prvdr['fulfillments'] + const fulfillmentTypes = fulfillments.map((fulfillment: any) => fulfillment.type) + + let isOrderPresent = false + const typeCode = sc?.list.find((item: any) => item.code === 'type') + if (typeCode) { + const timingType = typeCode.value + if ( + timingType === 'Order' || + timingType === 'Delivery' || + timingType === 'Self-Pickup' || + timingType === 'All' + ) { + isOrderPresent = true + } else if (!fulfillmentTypes.includes(timingType)) { + errorObj[`provider[${i}].timing`] = + `The type '${timingType}' in timing tags should match with types in fulfillments array, along with 'Order'` + } + } + + if (!isOrderPresent) { + errorObj[`provider[${i}].tags.timing`] = `'Order' type must be present in timing tags` + } + } + }) + if (isEmpty(serviceabilitySet)) { + const key = `prvdr${i}tags/serviceability` + errorObj[key] = `serviceability construct is mandatory in /bpp/providers[${i}]/tags` + } else if (serviceabilitySet.size != itemCategory_id.size) { + const key = `prvdr${i}/serviceability` + errorObj[key] = + `The number of unique category_id should be equal to count of serviceability in /bpp/providers[${i}]` + } + if (isEmpty(timingSet)) { + const key = `prvdr${i}tags/timing` + errorObj[key] = `timing construct is mandatory in /bpp/providers[${i}]/tags` + } else { + const timingsPayloadArr = new Array(...timingSet).map((item: any) => JSON.parse(item)) + const timingsAll = _.chain(timingsPayloadArr) + .filter((payload) => _.some(payload.list, { code: 'type', value: 'All' })) + .value() + + // Getting timings object for 'Delivery', 'Self-Pickup' and 'Order' + const timingsOther = _.chain(timingsPayloadArr) + .filter( + (payload) => + _.some(payload.list, { code: 'type', value: 'Order' }) || + _.some(payload.list, { code: 'type', value: 'Delivery' }) || + _.some(payload.list, { code: 'type', value: 'Self-Pickup' }), + ) + .value() + + if (timingsAll.length > 0 && timingsOther.length > 0) { + errorObj[`prvdr${i}tags/timing`] = + `If the timings of type 'All' is provided then timings construct for 'Order'/'Delivery'/'Self-Pickup' is not required` + } + + const arrTimingTypes = new Set() + + function checkTimingTag(tag: any) { + const typeObject = tag.list.find((item: { code: string }) => item.code === 'type') + const typeValue = typeObject ? typeObject.value : null + arrTimingTypes.add(typeValue) + for (const item of tag.list) { + switch (item.code) { + case 'day_from': + case 'day_to': + const dayValue = parseInt(item.value) + if (isNaN(dayValue) || dayValue < 1 || dayValue > 7 || !/^-?\d+(\.\d+)?$/.test(item.value)) { + errorObj[`prvdr${i}/day_to$/${typeValue}`] = `Invalid value for '${item.code}': ${item.value}` + } + + break + case 'time_from': + case 'time_to': + if (!/^([01]\d|2[0-3])[0-5]\d$/.test(item.value)) { + errorObj[`prvdr${i}/tags/time_to/${typeValue}`] = + `Invalid time format for '${item.code}': ${item.value}` + } + break + case 'location': + if (!prvdrLocationIds.has(item.value)) { + errorObj[`prvdr${i}/tags/location/${typeValue}`] = + `Invalid location value as it's unavailable in location/ids` + } + break + case 'type': + break + default: + errorObj[`prvdr${i}/tags/tag_timings/${typeValue}`] = `Invalid list.code for 'timing': ${item.code}` + } + } + + const dayFromItem = tag.list.find((item: any) => item.code === 'day_from') + const dayToItem = tag.list.find((item: any) => item.code === 'day_to') + const timeFromItem = tag.list.find((item: any) => item.code === 'time_from') + const timeToItem = tag.list.find((item: any) => item.code === 'time_to') + + if (dayFromItem && dayToItem && timeFromItem && timeToItem) { + const dayFrom = parseInt(dayFromItem.value, 10) + const dayTo = parseInt(dayToItem.value, 10) + const timeFrom = parseInt(timeFromItem.value, 10) + const timeTo = parseInt(timeToItem.value, 10) + + if (dayTo < dayFrom) { + errorObj[`prvdr${i}/tags/day_from/${typeValue}`] = + "'day_to' must be greater than or equal to 'day_from'" + } + + if (timeTo <= timeFrom) { + errorObj[`prvdr${i}/tags/time_from/${typeValue}`] = "'time_to' must be greater than 'time_from'" + } + } + } + + if (timingsAll.length > 0) { + if (timingsAll.length > 1) { + errorObj[`prvdr${i}tags/timing/All`] = `The timings object for 'All' should be provided once!` + } + checkTimingTag(timingsAll[0]) + } + + if (timingsOther.length > 0) { + timingsOther.forEach((tagTimings: any) => { + checkTimingTag(tagTimings) + }) + onSearchFFTypeSet.forEach((type: any) => { + if (!arrTimingTypes.has(type)) { + errorObj[`prvdr${i}/tags/timing/${type}`] = `The timings object must be present for ${type} in the tags` + } + }) + arrTimingTypes.forEach((type: any) => { + if (type != 'Order' && type != 'All' && !onSearchFFTypeSet.has(type)) { + errorObj[`prvdr${i}/tags/timing/${type}`] = + `The timings object ${type} is not present in the onSearch fulfillments` + } + }) + if (!arrTimingTypes.has('Order')) { + errorObj[`prvdr${i}/tags/timing/order`] = `The timings object must be present for Order in the tags` + } + } + } + } catch (error: any) { + logger.error(`!!Error while checking serviceability construct for bpp / providers[${i}], ${error.stack} `) + } + + try { + logger.info( + `Checking if catalog_link type in message / catalog / bpp / providers[${i}]/tags[1]/list[0] is link or inline`, + ) + const tags = bppPrvdrs[i].tags + + let list: any = [] + tags.map((data: any) => { + if (data.code == 'catalog_link') { + list = data.list + } + }) + + list.map((data: any) => { + if (data.code === 'type') { + if (data.value === 'link') { + if (bppPrvdrs[0].items) { + errorObj[`message / catalog / bpp / providers[0]`] = + `Items arrays should not be present in message / catalog / bpp / providers[${i}]` + } + } + } + }) + } catch (error: any) { + logger.error(`Error while checking the type of catalog_link`) + } + + i++ + } + + setValue(`${ApiSequence.ON_SEARCH}prvdrLocId`, prvdrLocId) + setValue(`${ApiSequence.ON_SEARCH}itemsId`, itemsId) + + if (flow === FLOW.FLOW012) { + const providers = data.message.catalog['bpp/providers'] + + providers.forEach((provider: any) => { + const codItems = provider.items.filter((item: any) => item?.['@ondc/org/available_on_cod'] === true) + setValue('coditems', codItems) + }) + } + if (flow === FLOW.FLOW01F) { + const descriptor = data.message.catalog['bpp/descriptor']?.tags + const termsObj = descriptor.find((ele: { code: string }): any => ele.code === 'bpp_terms') + setValue('bppTerms', termsObj.list) + } + if (flow === FLOW.FLOW016) { + // Flow 016 specific validation - check for custom group in categories + try { + logger.info(`Checking for custom group categories in /${constants.ON_SEARCH} for flow 016`) + const providers = message.catalog['bpp/providers'] + const customGroups: any[] = [] + + if (!providers || !Array.isArray(providers) || providers.length === 0) { + errorObj.missingProviders = `No providers found in /${constants.ON_SEARCH} for flow 016` + } else { + let customGroupFound = false + + for (const provider of providers) { + if (provider.categories && Array.isArray(provider.categories)) { + for (const category of provider.categories) { + // Check if the category has the required structure for custom_group + const isTypeCustomGroup = category.tags?.some((tag: any) => + tag.code === 'type' && + tag.list?.some((item: any) => item.code === 'type' && item.value === 'custom_group') + ) + + const hasConfigInput = category.tags?.some((tag: any) => + tag.code === 'config' && + tag.list?.some((item: any) => item.code === 'input' && item.value === 'text') + ) + + if (isTypeCustomGroup && hasConfigInput) { + customGroupFound = true + // Save the custom group for later validation + customGroups.push({ + id: category.id, + descriptor: category.descriptor, + tags: category.tags + }) + logger.info(`Found valid custom group category: ${category.id}`) + } + } + } + } + + if (!customGroupFound) { + errorObj.missingCustomGroup = `No custom_group category with input type 'text' found in /${constants.ON_SEARCH} for flow 016` + } else { + // Save custom groups to DAO for later validation in SELECT + setValue('flow016_custom_groups', customGroups) + logger.info(`Saved ${customGroups.length} custom groups for flow 016`) + } + } + } catch (error: any) { + logger.error(`Error while checking custom group categories in /${constants.ON_SEARCH} for flow 016, ${error.stack}`) + errorObj.customGroupCheckError = `Error validating custom group categories: ${error.message}` + } + } + } catch (error: any) { + logger.error(`!!Error while checking Providers info in /${constants.ON_SEARCH}, ${error.stack}`) + } + + return Object.keys(errorObj).length > 0 && errorObj +} diff --git a/utils/Retail_.1.2.5/Select/onSelect.ts b/utils/Retail_.1.2.5/Select/onSelect.ts new file mode 100644 index 00000000..610d47cc --- /dev/null +++ b/utils/Retail_.1.2.5/Select/onSelect.ts @@ -0,0 +1,1624 @@ +/* eslint-disable no-prototype-builtins */ +import { getValue, setValue } from '../../../shared/dao' +import constants, { ApiSequence, ffCategory } from '../../../constants' +import { validateSchemaRetailV2, isObjectEmpty, checkContext, timeDiff, isoDurToSec, checkBppIdOrBapId } from '../..' +import _ from 'lodash' +import { logger } from '../../../shared/logger' +import { FLOW, taxNotInlcusive } from '../../enum' + +interface BreakupElement { + '@ondc/org/title_type': string + item?: { + quantity: any + } +} + +const retailPymntTtl: { [key: string]: string } = { + 'delivery charges': 'delivery', + 'packing charges': 'packing', + tax: 'tax', + discount: 'discount', + 'convenience fee': 'misc', + offer: 'offer', +} +export const checkOnSelect = (data: any,flow?:string) => { + if (!data || isObjectEmpty(data)) { + return { [ApiSequence.ON_SELECT]: 'JSON cannot be empty' } + } + console.log(flow); + + + const { message, context } = data + if (!message || !context || !message.order || isObjectEmpty(message) || isObjectEmpty(message.order)) { + return { missingFields: '/context, /message, /order or /message/order is missing or empty' } + } + const schemaValidation = validateSchemaRetailV2(context.domain.split(':')[1], constants.ON_SELECT, data) + const contextRes: any = checkContext(context, constants.ON_SELECT) + + const errorObj: any = {} + const checkBap = checkBppIdOrBapId(context.bap_id) + const checkBpp = checkBppIdOrBapId(context.bpp_id) + + try { + logger.info(`Comparing Message Ids of /${constants.SELECT} and /${constants.ON_SELECT}`) + if (!_.isEqual(getValue(`${ApiSequence.SELECT}_msgId`), context.message_id)) { + errorObj[`${ApiSequence.ON_SELECT}_msgId`] = + `Message Ids for /${constants.SELECT} and /${constants.ON_SELECT} api should be same` + } + } catch (error: any) { + logger.error(`!!Error while checking message id for /${constants.ON_SELECT}, ${error.stack}`) + } + + try { + logger.info(`Comparing Message Ids of /${constants.SELECT} and /${constants.ON_SELECT}`) + if (!_.isEqual(getValue(`${ApiSequence.SELECT}_msgId`), context.message_id)) { + errorObj[`${ApiSequence.ON_SELECT}_msgId`] = + `Message Ids for /${constants.SELECT} and /${constants.ON_SELECT} api should be same` + } + } catch (error: any) { + logger.error(`!!Error while checking message id for /${constants.ON_SELECT}, ${error.stack}`) + } + + if (!_.isEqual(data.context.domain.split(':')[1], getValue(`domain`))) { + errorObj[`Domain[${data.context.action}]`] = `Domain should be same in each action` + } + + if (checkBap) Object.assign(errorObj, { bap_id: 'context/bap_id should not be a url' }) + if (checkBpp) Object.assign(errorObj, { bpp_id: 'context/bpp_id should not be a url' }) + + if (schemaValidation !== 'error') { + Object.assign(errorObj, schemaValidation) + } + + if (!contextRes?.valid) { + Object.assign(errorObj, contextRes.ERRORS) + } + + const searchContext: any = getValue(`${ApiSequence.SEARCH}_context`) + const searchMessage: any = getValue(`${ApiSequence.ON_SEARCH}_message`) + + try { + logger.info(`Comparing city of /${constants.SEARCH} and /${constants.ON_SELECT}`) + if (!_.isEqual(searchContext.city, context.city)) { + errorObj.city = `City code mismatch in /${constants.SEARCH} and /${constants.ON_SELECT}` + } + } catch (error: any) { + logger.error(`!!Error while comparing city in /${constants.SEARCH} and /${constants.ON_SELECT}, ${error.stack}`) + } + + try { + logger.info(`Comparing timestamp of /${constants.SELECT} and /${constants.ON_SELECT}`) + const tmpstmp = getValue('tmpstmp') + if (_.gte(tmpstmp, context.timestamp)) { + errorObj.tmpstmp = `Timestamp for /${constants.SELECT} api cannot be greater than or equal to /${constants.ON_SELECT} api` + } else { + const timeDifference = timeDiff(context.timestamp, tmpstmp) + logger.info(timeDifference) + if (timeDifference > 5000) { + errorObj.tmpstmp = `context/timestamp difference between /${constants.ON_SELECT} and /${constants.SELECT} should be less than 5 sec` + } + } + + setValue('tmpstmp', context.timestamp) + } catch (error: any) { + logger.error( + `!!Error while comparing timestamp for /${constants.SELECT} and /${constants.ON_SELECT}, ${error.stack}`, + ) + } + + try { + // Checking for valid item ids in /on_select + const itemsOnSelect = getValue('SelectItemList') + const itemsList = message.order.items + const selectItems: any = [] + itemsList.forEach((item: any, index: number) => { + if (!itemsOnSelect?.includes(item.id)) { + const key = `inVldItemId[${index}]` + errorObj[key] = `Invalid Item Id provided in /${constants.ON_SELECT}: ${item.id}` + } else { + selectItems.push(item.id) + } + }) + setValue('SelectItemList', selectItems) + } catch (error: any) { + logger.error(`Error while checking for item IDs for /${constants.ON_SELECT}, ${error.stack}`) + } + + try { + const fulfillments = message.order.fulfillments + const selectFlflmntSet: any = [] + const fulfillment_tat_obj: any = {} + fulfillments.forEach((flflmnt: any) => { + fulfillment_tat_obj[flflmnt.id] = isoDurToSec(flflmnt['@ondc/org/TAT']) + selectFlflmntSet.push(flflmnt.id) + }) + setValue('selectFlflmntSet', selectFlflmntSet) + setValue('fulfillment_tat_obj', fulfillment_tat_obj) + } catch (error: any) { + logger.error(`Error while checking for fulfillment IDs for /${constants.ON_SELECT}`, error.stack) + } + + try { + logger.info(`Comparing transaction Ids of /${constants.SELECT} and /${constants.ON_SELECT}`) + const txnId = getValue('txnId') + if (!_.isEqual(txnId, context.transaction_id)) { + errorObj.txnId = `Transaction Id should be same from /${constants.SELECT} onwards` + } + } catch (error: any) { + logger.error( + `!!Error while comparing transaction ids for /${constants.SELECT} and /${constants.ON_SELECT} api, ${error.stack}`, + ) + } + + try { + logger.info(`Comparing Message Ids of /${constants.SELECT} and /${constants.ON_SELECT}`) + if (!_.isEqual(getValue(`${ApiSequence.SELECT}_msgId`), context.message_id)) { + errorObj[`${ApiSequence.ON_SELECT}_msgId`] = + `Message Ids for /${constants.SELECT} and /${constants.ON_SELECT} api should be same` + if (!_.isEqual(getValue(`${ApiSequence.SELECT}_msgId`), context.message_id)) { + errorObj[`${ApiSequence.ON_SELECT}_msgId`] = + `Message Ids for /${constants.SELECT} and /${constants.ON_SELECT} api should be same` + } + } + } catch (error: any) { + logger.error(`!!Error while checking message id for /${constants.ON_SELECT}, ${error.stack}`) + logger.error(`!!Error while checking message id for /${constants.ON_SELECT}, ${error.stack}`) + } + + let on_select_error: any = {} + try { + logger.info(`Checking domain-error in /${constants.ON_SELECT}`) + if (data.hasOwnProperty('error')) { + on_select_error = data.error + } + } catch (error: any) { + logger.info(`Error while checking domain-error in /${constants.ON_SELECT}, ${error.stack}`) + } + + const on_select: any = message.order + + const itemFlfllmnts: any = {} + + try { + logger.info(`Checking provider id in /${constants.ON_SEARCH} and /${constants.ON_SELECT}`) + if (getValue('providerId') != on_select.provider.id) { + errorObj.prvdrId = `provider.id mismatches in /${constants.SELECT} and /${constants.ON_SELECT}` + } + if (!on_select.provider.locations) { + errorObj.prvdrLoc = `provider.locations[0].id is missing in /${constants.ON_SELECT}` + } else if (on_select.provider.locations[0].id != getValue('providerLoc')) { + errorObj.prvdrLoc = `provider.locations[0].id mismatches in /${constants.SELECT} and /${constants.ON_SELECT}` + } + } catch (error: any) { + logger.error( + `Error while comparing provider ids in /${constants.ON_SEARCH} and /${constants.ON_SELECT}, ${error.stack}`, + ) + } + + try { + logger.info(`Item Id and Fulfillment Id Mapping in /on_select`) + let i = 0 + const len = on_select.items.length + while (i < len) { + const found = on_select.fulfillments.some((fId: { id: any }) => fId.id === on_select.items[i].fulfillment_id) + if (!found) { + const key = `fId${i}` + errorObj[key] = `fulfillment_id for item ${on_select.items[i].id} does not exist in order.fulfillments[]` + } + + i++ + } + } catch (error: any) { + logger.error(`!!Error while checking Item Id and Fulfillment Id Mapping in /${constants.ON_SELECT}, ${error.stack}`) + } + + try { + logger.info('Mapping and storing item Id and fulfillment Id') + let i = 0 + const len = on_select.items.length + while (i < len) { + const id = on_select.items[i].id + itemFlfllmnts[id] = on_select.items[i].fulfillment_id + i++ + } + setValue('itemFlfllmnts', itemFlfllmnts) + } catch (error: any) { + logger.error(`!!Error occurred while mapping and storing item Id and fulfillment Id, ${error.stack}`) + } + + try { + logger.info(`Checking TAT and TTS in /${constants.ON_SELECT}`) + const tts: any = getValue('timeToShip') + on_select.fulfillments.forEach((ff: { [x: string]: any }, indx: any) => { + const tat = isoDurToSec(ff['@ondc/org/TAT']) + + if (tat < tts) { + errorObj.ttstat = `/fulfillments[${indx}]/@ondc/org/TAT (O2D) in /${constants.ON_SELECT} can't be less than @ondc/org/time_to_ship (O2S) in /${constants.ON_SEARCH}` + } + + if (tat === tts) { + errorObj.ttstat = `/fulfillments[${indx}]/@ondc/org/TAT (O2D) in /${constants.ON_SELECT} can't be equal to @ondc/org/time_to_ship (O2S) in /${constants.ON_SEARCH}` + } + + logger.info(tat, 'asdfasdf', tts) + }) + } catch (error: any) { + logger.error(`!!Error while checking TAT and TTS in /${constants.ON_SELECT}`) + } + + try { + logger.info(`Checking TAT and TTS in /${constants.ON_SELECT} and /${constants.ON_SEARCH}`) + const catalog = searchMessage.catalog + const providers = catalog['bpp/providers'] + let max_time_to_ships = [] + for (let providerIndex = 0; providerIndex < providers.length; providerIndex++) { + const providerItems = providers[providerIndex].items + for (let itemIndex = 0; itemIndex < providerItems.length; itemIndex++) { + const timeToShip = isoDurToSec(providerItems[itemIndex]['@ondc/org/time_to_ship']) + if (timeToShip) { + max_time_to_ships.push(timeToShip) + } + } + } + const max_tts = max_time_to_ships.sort((a, b) => a - b)[0] + const on_select_tat = on_select.fulfillments.map((e: any) => isoDurToSec(e['@ondc/org/TAT'])) + + if (on_select_tat < max_tts) { + errorObj.ttstat = `/fulfillments/@ondc/org/TAT (O2D) in /${constants.ON_SELECT} can't be less than @ondc/org/time_ship (O2S) in /${constants.ON_SEARCH}` + } + + if (on_select_tat === max_tts) { + errorObj.ttstat = `/fulfillments/@ondc/org/TAT (O2D) in /${constants.ON_SELECT} can't be equal to @ondc/org/time_ship (O2S) in /${constants.ON_SEARCH}` + } + } catch (error: any) { + logger.error(`!!Error while Checking TAT and TTS in /${constants.ON_SELECT} and /${constants.ON_SEARCH}`) + } + + let nonServiceableFlag = 0 + try { + logger.info(`Checking fulfillments' state in ${constants.ON_SELECT}`) + const ffState = on_select.fulfillments.every((ff: { state: { descriptor: any } }) => { + if (ff.state) { + const ffDesc = ff.state.descriptor + + if (ffDesc.code === 'Non-serviceable') { + nonServiceableFlag = 1 + } + + return ffDesc.hasOwnProperty('code') + ? ffDesc.code === 'Serviceable' || ffDesc.code === 'Non-serviceable' + : false + } + return + }) + + if (!ffState) + errorObj.ffStateCode = `Pre-order fulfillment state codes should be used in fulfillments[].state.descriptor.code` + else if ( + nonServiceableFlag && + (!on_select_error || !(on_select_error.type === 'DOMAIN-ERROR' && on_select_error.code === '30009')) + ) { + errorObj.notServiceable = `Non Serviceable Domain error should be provided when fulfillment is not serviceable` + } + } catch (error: any) { + logger.error(`!!Error while checking fulfillments' state in /${constants.ON_SELECT}, ${error.stack}`) + } + + try { + logger.info(`Checking fulfillments' state in ${constants.ON_SELECT}`) + on_select.fulfillments.forEach((ff: any, idx: number) => { + if (ff.state) { + const ffDesc = ff.state.descriptor + + function checkFFOrgCategory(selfPickupOrDelivery: number) { + if (!ff['@ondc/org/category'] || !ffCategory[selfPickupOrDelivery].includes(ff['@ondc/org/category'])) { + const key = `fulfillment${idx}/@ondc/org/category` + errorObj[key] = + `In Fulfillment${idx}, @ondc/org/category is not a valid value in ${constants.ON_SELECT} and should have one of these values ${[ffCategory[selfPickupOrDelivery]]}` + } + const domain = data.context.domain.split(':')[1] + if (ff.type === 'Delivery' && domain === 'RET11' && ff['@ondc/org/category'] !== 'Immediate Delivery') { + const key = `fulfillment${idx}/@ondc/org/category` + errorObj[key] = + `In Fulfillment${idx}, @ondc/org/category should be "Immediate Delivery" for F&B in ${constants.ON_SELECT}` + } + } + if (ffDesc.code === 'Serviceable' && ff.type == 'Delivery') { + checkFFOrgCategory(0) + } else if (ff.type == 'Self-Pickup') { + checkFFOrgCategory(1) + } + } else { + const key = `fulfillment${idx}/descCode` + errorObj[key] = `In Fulfillment${idx}, descriptor code is mandatory in ${constants.ON_SELECT}` + } + }) + } catch (error: any) { + logger.error(`!!Error while checking fulfillments @ondc/org/category in /${constants.ON_SELECT}, ${error.stack}`) + } + + let onSelectPrice: any = 0 //Net price after discounts and tax in /on_select + let onSelectItemsPrice = 0 //Price of only items in /on_select + + try { + logger.info(`Comparing count of items in ${constants.SELECT} and ${constants.ON_SELECT}`) + const itemsIdList: any = getValue('itemsIdList') + if (on_select.quote) { + on_select.quote.breakup.forEach((item: { [x: string]: any }) => { + if (item['@ondc/org/item_id'] in itemsIdList) { + if ( + item['@ondc/org/title_type'] === 'item' && + itemsIdList[item['@ondc/org/item_id']] != item['@ondc/org/item_quantity'].count + ) { + const countkey = `invldCount[${item['@ondc/org/item_id']}]` + errorObj[countkey] = + `Count of item with id: ${item['@ondc/org/item_id']} does not match in ${constants.SELECT} & ${constants.ON_SELECT}` + } + } + }) + } else { + logger.error(`Missing quote object in ${constants.ON_SELECT}`) + errorObj.missingQuote = `Missing quote object in ${constants.ON_SELECT}` + } + } catch (error: any) { + // errorObj.countErr = `Count of item does not match with the count in /select`; + logger.error( + `!!Error while comparing count items in ${constants.SELECT} and ${constants.ON_SELECT}, ${error.stack}`, + ) + } + + try { + const itemPrices = new Map() + + on_select.quote.breakup.forEach((item: { [x: string]: any; price: { value: any } }) => { + if (item['@ondc/org/item_id'] && item.price && item.price.value && item['@ondc/org/title_type'] === 'item') { + itemPrices.set(item['@ondc/org/item_id'], Math.abs(item.item.price.value)) + } + }) + + setValue('selectPriceMap', itemPrices) + } catch (error: any) { + logger.error(`!!Error while checking and comparing the quoted price in /${constants.ON_SELECT}, ${error.stack}`) + } + + try { + logger.info(`Checking available and maximum count in ${constants.ON_SELECT}`) + on_select.quote.breakup.forEach((element: any, i: any) => { + const itemId = element['@ondc/org/item_id'] + if ( + element.item?.quantity && + element.item.quantity?.available && + element.item.quantity?.maximum && + typeof element.item.quantity.available.count === 'string' && + typeof element.item.quantity.maximum.count === 'string' + ) { + const availCount = parseInt(element.item.quantity.available.count, 10) + const maxCount = parseInt(element.item.quantity.maximum.count, 10) + if (isNaN(availCount) || isNaN(maxCount) || availCount <= 0) { + errorObj[`qntcnt${i}`] = + `Available and Maximum count should be greater than 0 for item id: ${itemId} in quote.breakup[${i}]` + } else if ( + element.item.quantity.available.count.trim() === '' || + element.item.quantity.maximum.count.trim() === '' + ) { + errorObj[`qntcnt${i}`] = + `Available or Maximum count should not be empty string for item id: ${itemId} in quote.breakup[${i}]` + } + } + }) + } catch (error: any) { + logger.error(`Error while checking available and maximum count in ${constants.ON_SELECT}, ${error.stack}`) + } + + try { + logger.info(`-x-x-x-x-Quote Breakup ${constants.ON_SELECT} all checks-x-x-x-x`) + const itemsIdList: any = getValue('itemsIdList') + const itemsCtgrs: any = getValue('itemsCtgrs') + const providerOffers: any = getValue(`${ApiSequence.ON_SEARCH}_offers`) + const applicableOffers: any[] = [] + const orderItemIds = on_select?.items?.map((item: any) => item.id) || [] + const items:any = orderItemIds + .map((id:any) => { + const item = on_select?.quote?.breakup.find((entry:any) => entry['@ondc/org/item_id'] === id) + return item ? { id, price: item.price.value,quantity:item["@ondc/org/item_quantity"]?.count } : null + }) + .filter((item: any) => item !== null) + console.log('itemPrices of found items in breakup', JSON.stringify(items)) + + const priceSums = items.reduce((acc: Record, item: { id: string; price: string }) => { + const { id, price } = item; + acc[id] = (acc[id] || 0) + parseFloat(price); + return acc; + }, {}); + console.log("priceSums",priceSums); + + + console.log("providerOffers",JSON.stringify(providerOffers)); + if (on_select.quote) { + const totalWithoutOffers = on_select?.quote?.breakup.reduce((sum: any, item: any) => { + if (item['@ondc/org/title_type'] !== 'offer') { + const value = parseFloat(item.price?.value || '0') + return sum + value + } + return sum + }, 0) + + console.log('Total without offers:', totalWithoutOffers.toFixed(2)) + const offers: any = on_select.quote.breakup.filter((offer: any) => offer['@ondc/org/title_type'] === 'offer') + const applicableOffer = getValue('selected_offer') + console.log('applicableOffer', applicableOffer) + const deliveryCharges = + Math.abs( + parseFloat( + on_select.quote.breakup.find((item: any) => item['@ondc/org/title_type'] === 'delivery')?.price?.value, + ), + ) || 0 + + if (offers.length > 0) { + setValue('on_select_offers', offers) + const additiveOffers = offers.filter((offer: any) => { + const metaTag = offer?.item.tags?.find((tag: any) => tag.code === 'offer') + return metaTag?.list?.some((entry: any) => entry.code === 'additive' && entry.value.toLowerCase() === 'yes') + }) + + const nonAdditiveOffers = offers.filter((offer: any) => { + const metaTag = offer?.item.tags?.find((tag: any) => tag.code === 'offer') + return metaTag?.list?.some((entry: any) => entry.code === 'additive' && entry.value.toLowerCase() === 'no') + }) + + if (additiveOffers.length > 0) { + // offers.length = 0 + additiveOffers.forEach((offer: any) => { + const providerOffer = providerOffers.find((o: any) => o.id === offer["@ondc/org/item_id"]) + if (providerOffer) { + applicableOffers.push(providerOffer) + } + }) + } else if (nonAdditiveOffers.length === 1) { + // Apply the single non-additive offer + applicableOffers.length = 0 + const offer = nonAdditiveOffers[0] + const offerId = offer?.["@ondc/org/item_id"] + const providerOffer = providerOffers.find((o: any) => o.id === offerId) + if (providerOffer) { + applicableOffers.push(providerOffer) + } + } else if (nonAdditiveOffers.length > 1) { + console.log('nonAdditiveOffers', nonAdditiveOffers) + + applicableOffers.length = 0 + nonAdditiveOffers.forEach((offer: any,index:number) => { + errorObj[`offer[${index}]`] = + `Offer ${offer["@ondc/org/item_id"]} is non-additive and cannot be combined with other non-additive offers.` + }) + // setValue('Addtive-Offers',false) + // return + } + console.log('Applicable Offers:', applicableOffers) + } + const offerTypesInBreakup: string[] = []; + on_select.quote.breakup.forEach((element: any, i: any) => { + const titleType = element['@ondc/org/title_type'] + + console.log(`Calculating quoted Price Breakup for element ${element.title}`) + let offerType:string = "" + + if (titleType === "offer") { + const priceValue = parseFloat(element.price.value); + + if (isNaN(priceValue)) { + errorObj.invalidPrice = `Price for title type "offer" is not a valid number.`; + } + offerType = element?.item?.tags + ?.find((tag: any) => tag.code === 'offer') + ?.list?.find((entry: any) => entry.code === 'type')?.value + if (offerType) { + offerTypesInBreakup.push(offerType); + } + // else if (priceValue >= 0 ) { + // errorObj.positivePrice = `Price for title type "offer" must be negative, but got ${priceValue}.`; + // } + } + onSelectPrice += parseFloat(element.price.value) + + if (titleType === 'item') { + if (!(element['@ondc/org/item_id'] in itemFlfllmnts)) { + const brkupitemid = `brkupitemid${i}` + errorObj[brkupitemid] = + `item with id: ${element['@ondc/org/item_id']} in quote.breakup[${i}] does not exist in items[]` + } + + logger.info(`Comparing individual item's total price and unit price `) + if (!element.hasOwnProperty('item')) { + errorObj.priceBreakup = `Item's unit price missing in quote.breakup for item id ${element['@ondc/org/item_id']}` + } else if ( + parseFloat(element.item.price.value) * element['@ondc/org/item_quantity'].count != + element.price.value + ) { + errorObj.priceBreakup = `Item's unit and total price mismatch for id: ${element['@ondc/org/item_id']}` + } + } + + logger.info(`Calculating Items' prices in /${constants.ON_SELECT}`) + if (typeof itemsIdList === 'object' && itemsIdList && element['@ondc/org/item_id'] in itemsIdList) { + if ( + titleType === 'item' || + (titleType === 'tax' && !taxNotInlcusive.includes(itemsCtgrs[element['@ondc/org/item_id']])) + ) { + onSelectItemsPrice += parseFloat(element.price.value) + } + } + + if (titleType === 'tax' || titleType === 'discount') { + if (!(element['@ondc/org/item_id'] in itemFlfllmnts)) { + const brkupitemsid = `brkupitemstitles${i}` + errorObj[brkupitemsid] = + `item with id: ${element['@ondc/org/item_id']} in quote.breakup[${i}] does not exist in items[] (should be a valid item id)` + } + } + + // TODO: + // if (['tax', 'discount', 'packing', 'misc'].includes(titleType)) { + // if (parseFloat(element.price.value) == 0) { + // const key = `breakupItem${titleType}` + // errorObj[key] = `${titleType} line item should not be present if price=0` + // } + // } + + if (titleType === 'packing' || titleType === 'delivery' || titleType === 'misc') { + if (!Object.values(itemFlfllmnts).includes(element['@ondc/org/item_id'])) { + const brkupffid = `brkupfftitles${i}` + errorObj[brkupffid] = + `invalid id: ${element['@ondc/org/item_id']} in ${titleType} line item (should be a valid fulfillment_id as provided in message.items for the items)` + } + } + + if (titleType === 'offer' && providerOffers.length > 0 && offers.length > 0) { + try { + if (applicableOffers?.length > 0) { + const offerId = element?.["@ondc/org/item_id"] + const onSelectOfferAutoApplicable = element?.item?.tags + ?.find((tag: any) => tag.code === 'offer') + ?.list?.find((entry: any) => entry.code === 'auto')?.value + if (!offerId) { + errorObj['inVldItemId'] = [`offerId cannot be null or empty.`] + return + } + const quoteType = + element?.item?.tags + .find((tag: any) => tag.code === 'quote') + ?.list?.map((type: any) => type.value) + .join(',') || '' + + console.log('quoteType', quoteType) + // if(quoteType == "order"){ + // const offerId = element['@ondc/org/item_id'] + // if (!offerId) { + // errorObj['inVldItemId'] = [`offerId cannot be null or empty.`] + // return + // } + // const applicableOffer = getValue('selected_offer') + // console.log('applicableOffer', applicableOffer) + // const offer = applicableOffer?.find((offer: any) => offer?.id === offerId) + // if(!offer){ + // errorObj[`invalidOffer`] = + // `Offer with id '${offerId}' is not applicable for this order.`; + // return; + // } + + // } + const offerPriceValue: number = Math.abs(parseFloat(element?.price?.value)) + console.log('offerType', offerType) + console.log('offerId', offerId) + + // const applicableOffer = getValue('selected_offer') + // console.log('applicableOffer', applicableOffer) + const selectedOffer = applicableOffer?.find((offer: any) => offer?.id === offerId) + if (!applicableOffer) { + const providerOffer = applicableOffers?.find((p: any) => p?.id === offerId) + const providerMetaTag = + providerOffer?.tags + ?.find((tag: any) => tag.code === 'meta') + ?.list?.find((code: any) => code.code === 'auto')?.value || {} + const offerAutoApplicable: boolean = + providerMetaTag === onSelectOfferAutoApplicable && onSelectOfferAutoApplicable === 'yes' + if (!offerAutoApplicable && offerId) { + errorObj[`invalidOffer[${offerId}]`] = + `Offer with id '${offerId}' is not applicable for this order as this offer cannot be auto applied but found in on select as defined in the catalog.` + return + } + if (!selectedOffer && !offerAutoApplicable) { + const key = `inVldItemId[${i}]` + errorObj[key] = + `item with id: ${element['@ondc/org/item_id']} in quote.breakup[${i}] does not exist in select offers id (should be a valid item id)` + } + } + + const providerOffer = providerOffers?.find((p: any) => p?.id === offerId) + const orderLocationIds = on_select?.provider?.locations?.map((loc: any) => loc.id) || [] + + console.log('providerOffer', JSON.stringify(providerOffer)) + + const offerLocationIds = providerOffer?.location_ids || [] + const locationMatch = offerLocationIds.some((id: string) => orderLocationIds.includes(id)) + + if (!locationMatch) { + errorObj[`offer_location[${i}]`] = + `Offer with id '${offerId}' is not applicable for any of the order's locations. \nApplicable locations in offer: [${offerLocationIds.join(', ')}], \nLocations in order: [${orderLocationIds.join(', ')}].` + return + } + + const offerItemIds = providerOffer?.item_ids || [] + const matchingItems = offerItemIds.find((id: string) => orderItemIds.includes(id)) || [] + console.log("matchingItems",JSON.stringify(matchingItems)); + + + if (matchingItems.length === 0 || !matchingItems) { + errorObj[`offer_item[${i}]`] = + `Offer with id '${offerId}' is not applicable for any of the ordered item(s). \nApplicable items in offer: [${offerItemIds.join(', ')}], \nItems in order: [${orderItemIds.join(', ')}].` + return + } + + const benefitTag: any = providerOffer?.tags?.find((tag: any) => { + return tag?.code === 'benefit' + }) + const benefitList = benefitTag?.list || [] + const qualifierTag: any = providerOffer?.tags?.find((tag: any) => { + return tag?.code === 'qualifier' + }) + const qualifierList: any = qualifierTag?.list || [] + console.log('qualifierList', qualifierList, qualifierTag) + + const minValue = parseFloat(qualifierList.find((l: any) => l.code === 'min_value')?.value) || 0 + console.log('min_value', minValue) + // setvalue + const itemsOnSearch: any = getValue(`onSearchItems`) + console.log('itemsOnSearch', JSON.stringify(itemsOnSearch)) + if (offerType === 'discount') { + if (minValue > 0 && minValue !== null) { + const qualifies: boolean = totalWithoutOffers >= minValue + console.log('qualifies', qualifies, minValue) + + if (!qualifies) { + errorObj['offerNA'] = + `Offer not applicable for quote with actual quote value before discount is ${totalWithoutOffers} as required min_value for order is ${minValue}` + } + } + + const benefitList = benefitTag?.list || [] + + const valueType = benefitList.find((l: any) => l?.code === 'value_type')?.value + const value_cap = Math.abs( + parseFloat(benefitList.find((l: any) => l?.code === 'value_cap')?.value || '0'), + ) + const benefitValue = Math.abs( + parseFloat(benefitList.find((l: any) => l.code === 'value')?.value || '0'), + ) + const quotedPrice = parseFloat(on_select.quote.price.value || '0') + let qualifies = false + + if (valueType === 'percent') { + if (value_cap === 0) { + errorObj['priceErr'] = `Offer benefit value_cap cannot be equal to ${value_cap}` + } else { + console.log('delivery charges', offerPriceValue) + let expectedDiscount = 0 + expectedDiscount = (benefitValue / 100) * totalWithoutOffers + if (expectedDiscount > value_cap) { + errorObj.invalidOfferBenefit = `offer discount ${expectedDiscount} exceeds value_cap ${value_cap}` + expectedDiscount = value_cap + } + // if (expectedDiscount > deliveryCharges) { + // errorObj.priceMismatch = `Discount exceeds delivery charge. Discount: ₹${expectedDiscount.toFixed(2)}, Delivery Charge: ₹${deliveryCharges.toFixed(2)}` + // } + if (offerPriceValue !== expectedDiscount) { + errorObj.priceMismatch = `Discount value mismatch. Expected: -${expectedDiscount.toFixed(2)}, Found: -${offerPriceValue.toFixed(2)}` + } + } + } else { + if (benefitValue !== offerPriceValue) { + errorObj['priceErr'] = + `Discount mismatch: Expected discount is -₹${benefitValue.toFixed(2)}, but found -₹${offerPriceValue.toFixed(2)}. in offer with ${offerId} in ${titleType}` + } + + const quoteAfterBenefit = totalWithoutOffers - benefitValue + + qualifies = Math.abs(quoteAfterBenefit - quotedPrice) < 0.01 + + if (!qualifies) { + errorObj['priceErr'] = + `Quoted price mismatch: After ₹${benefitValue} discount on ₹${totalWithoutOffers}, expected price is ₹${quoteAfterBenefit.toFixed(2)}, but got ₹${quotedPrice.toFixed(2)}.` + } + } + } + if (offerType === 'freebie') { + // const benefitTag: any = providerOffer?.tags?.find((tag: any) => { + // return tag?.code === 'benefit' + // }) + // const benefitList = benefitTag?.list || [] + // const qualifierTag: any = providerOffer?.tags?.find((tag: any) => { + // return tag?.code === 'qualifier' + // }) + // if(!benefitTag){ + // errorObj.invalidTags = `bpp/providers/offers/${offerId} tags with code benefit are missing and required` + // return + // } + // const qualifierList: any = qualifierTag?.list || [] + // console.log('qualifierList', qualifierList, qualifierTag) + + // const minValue = parseFloat(qualifierList.find((l: any) => l.code === 'min_value')?.value) || 0 + // console.log('min_value', minValue) + + if (minValue > 0 && minValue !== null) { + console.log('benefit lsit', benefitList) + const qualifies: boolean = totalWithoutOffers >= minValue + + console.log('qualifies', qualifies, minValue) + + if (!qualifies) { + errorObj['offerNa'] = + `Offer not applicable for quote with actual quote value before discount is ${totalWithoutOffers} as required min_value for order is ${minValue}` + } + const benefitItemId = benefitList.find((entry: any) => entry.code === 'item_id')?.value || '' + const benefitItemCount = parseInt( + benefitList.find((entry: any) => entry.code === 'item_count')?.value || '0', + ) + const itemTags = element?.item?.tags || [] + + const offerTag = itemTags.find((tag: any) => tag.code === 'offer') + if (!offerTag) { + errorObj.invalidTags = `tags are required in on_select /quote with @ondc/org/title_type:${titleType} and offerId:${offerId}` + } + + const offerItemId = offerTag?.list?.find((entry: any) => entry.code === 'item_id')?.value || '' + console.log("offerItemId",offerItemId); + + const offerItemCount = parseInt( + offerTag?.list?.find((entry: any) => entry.code === 'item_count')?.value || '0', + ) + if (!offerItemCount) { + errorObj.invalidItems = `item_count is required in on_select /quote with @ondc/org/title_type:${titleType} ` + } + if (offerItemId !== benefitItemId) { + errorObj.invalidItems = `Mismatch: item_id used in on_select quote.breakup (${offerItemId}) doesn't match with offer benefit item_id (${benefitItemId}) in on_search catalog for offer ID: ${offerId}` + } + if (benefitItemCount !== offerItemCount) { + errorObj.invalidItems = `Mismatch: item_id used in on_select quote.breakup (${offerItemCount}) quantity doesn't match with offer benefit item_id (${benefitItemCount}) in on_search catalog for offer ID: ${offerId}` + } + if (!offerItemId) { + errorObj.invalidItems = `item_id is required in on_select /quote with @ondc/org/title_type:${titleType} with offer_id:${offerId}` + } + + // const offerPrice = Math.abs(parseFloat(element?.price?.value || '0')) + + const itemIds = offerItemId.split(',').map((id: string) => id.trim()) + + const matchedItems = itemsOnSearch[0].filter((item: any) => itemIds.includes(item.id)) + console.log("matchedItems",matchedItems); + if (matchedItems.length === 0) { + errorObj[`offer_item[${i}]`] = + `Item(s) with ID(s) ${itemIds.join(', ')} not found in catalog for offer ID: ${offerId}` + return + } + + + const priceMismatchItems: string[] = [] + let totalExpectedOfferValue: number = 0 + console.log(totalExpectedOfferValue) + let allItemsEligible = true + + matchedItems?.forEach((item: any) => { + const itemPrice = Math.abs(parseFloat(item?.price?.value || '0')) + const availableCount = parseInt(item?.quantity?.available?.count || '0', 10) + + // Calculate the expected total price for the item + const expectedItemTotal = itemPrice * offerItemCount + totalExpectedOfferValue += expectedItemTotal + + // Validate stock availability + if (availableCount < offerItemCount) { + errorObj.invalidItems = `Item ID: ${item.id} does not have sufficient stock. Required: ${offerItemCount}, Available: ${availableCount}` + allItemsEligible = false + } + + // Validate price consistency + // const quotedPrice = Math.abs(parseFloat(element?.price?.value || '0')) + // if (expectedItemTotal !== quotedPrice) { + // priceMismatchItems.push( + // `ID: ${item.id} (Expected Total: ₹${expectedItemTotal}, Quoted: ₹${quotedPrice})`, + // ) + // allItemsEligible = false + // } + }) + + if (priceMismatchItems.length > 0) { + errorObj.priceMismatch1 = `Price mismatch found for item(s): ${priceMismatchItems.join('; ')}` + } + + if (!allItemsEligible) { + const missingOrOutOfStock = itemIds.filter((id: string) => { + const matchedItem = matchedItems.find((item: any) => item.id === id) + if (!matchedItem) return true + const availableCount = parseInt(matchedItem?.quantity?.available?.count || '0', 10) + return availableCount < offerItemCount + }) + + if (missingOrOutOfStock.length > 0) { + errorObj.invalidItems = `Item(s) with ID(s) ${missingOrOutOfStock.join(', ')} not found in catalog or do not have enough stock for offer ID: ${offerId}` + } + } + } else { + console.log('benefit lsit', benefitList) + const benefitItemId = benefitList.find((entry: any) => entry.code === 'item_id')?.value || '' + const benefitItemCount = parseInt( + benefitList.find((entry: any) => entry.code === 'item_count')?.value || '0', + ) + const itemTags = element?.item?.tags || [] + + const offerTag = itemTags.find((tag: any) => tag.code === 'offer') + if (!offerTag) { + errorObj.invalidTags = `tags are required in on_select /quote with @ondc/org/title_type:${titleType} and offerId:${offerId}` + } + + const offerItemId = offerTag?.list?.find((entry: any) => entry.code === 'item_id')?.value || '' + const offerItemCount = parseInt( + offerTag?.list?.find((entry: any) => entry.code === 'item_count')?.value || '0', + ) + if (!offerItemCount) { + errorObj.invalidItems = `item_count is required in on_select /quote with @ondc/org/title_type:${titleType} ` + } + if (offerItemId !== benefitItemId) { + errorObj.invalidItems = `Mismatch: item_id used in on_select quote.breakup (${offerItemId}) doesn't match with offer benefit item_id (${benefitItemId}) in on_search catalog for offer ID: ${offerId}` + } + if (benefitItemCount !== offerItemCount) { + errorObj.invalidItems = `Mismatch: item_id used in on_select quote.breakup (${offerItemCount}) quantity doesn't match with offer benefit item_id (${benefitItemCount}) in on_search catalog for offer ID: ${offerId}` + } + if (!offerItemId) { + errorObj.invalidItems = `item_id is required in on_select /quote with @ondc/org/title_type:${titleType} with offer_id:${offerId}` + } + + // const offerPrice = Math.abs(parseFloat(element?.price?.value || '0')) + + const itemIds = offerItemId.split(',').map((id: string) => id.trim()) + // let totalExpectedOfferValue = 0 + const matchedItems = itemsOnSearch[0].filter((item: any) => itemIds.includes(item.id)) + + const priceMismatchItems: string[] = [] + let totalExpectedOfferValue = 0 + console.log(totalExpectedOfferValue) + let allItemsEligible = true + + matchedItems.forEach((item: any) => { + const itemPrice = Math.abs(parseFloat(item?.price?.value || '0')) + const availableCount = parseInt(item?.quantity?.available?.count || '0', 10) + + // Calculate the expected total price for the item + const expectedItemTotal = itemPrice * offerItemCount + totalExpectedOfferValue += expectedItemTotal + + // Validate stock availability + if (availableCount < offerItemCount) { + errorObj.invalidItems = `Item ID: ${item.id} does not have sufficient stock. Required: ${offerItemCount}, Available: ${availableCount}` + allItemsEligible = false + } + + // Validate price consistency + const quotedPrice = Math.abs(parseFloat(element?.price?.value || '0')) + if (expectedItemTotal !== quotedPrice) { + priceMismatchItems.push( + `ID: ${item.id} (Expected Total: ₹${expectedItemTotal}, Quoted: ₹${quotedPrice})`, + ) + allItemsEligible = false + } + }) + + // Report any price mismatches + if (priceMismatchItems.length > 0) { + errorObj.priceMismatch = `Price mismatch found for item(s): ${priceMismatchItems.join('; ')}` + } + + // If not all items are eligible, identify missing or out-of-stock items + if (!allItemsEligible) { + const missingOrOutOfStock = itemIds.filter((id: string) => { + const matchedItem = matchedItems.find((item: any) => item.id === id) + if (!matchedItem) return true + const availableCount = parseInt(matchedItem?.quantity?.available?.count || '0', 10) + return availableCount < offerItemCount + }) + + if (missingOrOutOfStock.length > 0) { + errorObj.invalidItems = `Item(s) with ID(s) ${missingOrOutOfStock.join(', ')} not found in catalog or do not have enough stock for offer ID: ${offerId}` + } + } + } + } + if (offerType === 'buyXgetY') { + const offerItemsWithQuantity = items + .filter((item: any) => matchingItems.includes(item.id)) + .map((item: any) => ({ + id: item.id, + quantity: item.quantity, + })) + console.log('offerItemQuantity', offerItemsWithQuantity) + const offerMinItemCount = + parseFloat(qualifierList.find((l: any) => l.code === 'item_count')?.value) || 0 + if (!offerMinItemCount || offerMinItemCount === 0) { + errorObj.invalidMinCountQualifier = `Minimum Item Count required in catalog /offers/tags/qualifier/list/code:item_count or minimum item_count cannot be 0 for offer with id :${offerId}` + } + let isOfferEligible: boolean + offerItemsWithQuantity.forEach((item: any) => { + + if (offerMinItemCount) { + isOfferEligible = item.quantity >= offerMinItemCount + } + if (!isOfferEligible) { + errorObj.invalidItems = `Offer with ${offerId} is not applicale as item with id: ${item?.id} and quantity: ${item.quantity} does not match with offer item_count ${offerMinItemCount}` + } + }) + if (minValue > 0 && minValue !== null) { + const qualifies: boolean = minValue >= priceSums + console.log('qualifies', qualifies, minValue) + + if (!qualifies) { + errorObj['offerNa'] = + `Offer with id: ${offerId} not applicable as required ${minValue} min_value for order is not satisfied` + } + } + const benefitItemId = benefitList.find((entry: any) => entry.code === 'item_id')?.value || '' + const benefitItemCount = parseInt( + benefitList.find((entry: any) => entry.code === 'item_count')?.value || '0', + ) + const benefitItemValue = parseInt( + benefitList.find((entry: any) => entry.code === 'item_value')?.value || '0', + ) + const itemTags = element?.item?.tags || [] + + const offerTag = itemTags.find((tag: any) => tag.code === 'offer') + const offerItemValue = offerTag?.list?.find((entry: any) => entry.code === 'item_value')?.value || '' + const quotedPrice = (parseFloat(element?.price?.value || '0')) + if(quotedPrice<0){ + errorObj.invalidPrice = `Price for Item with id: ${offerId} cannot be negative.` + } + if(benefitItemValue<0){ + errorObj.invalidPrice = `Benefit Value for tag benefit and item with id: ${offerId} cannot be negative.` + } + console.log("quotedPrice",quotedPrice,benefitItemValue); + + if(quotedPrice !== offerItemValue){ + errorObj.priceMismatch = `value mismatch benefit_value for tag "item_value" in on_select ${offerItemValue} does not match with /quote/item with itemId: ${offerId}` + } + if(offerItemValue !== benefitItemValue){ + errorObj.benefitValueMismatch = `value mismatch benefit_value in catalog ${benefitItemValue} does not match with on_select item_value ${offerItemValue} /quote/item with itemId: ${offerId}` + } + if(!offerTag){ + errorObj.invalidTags = `tags are required in on_select /quote with @ondc/org/title_type:${titleType} and offerId:${offerId}` + } + + const offerItemId = offerTag?.list?.find((entry: any) => entry.code === 'item_id')?.value || '' + const offerItemCount = parseInt( + offerTag?.list?.find((entry: any) => entry.code === 'item_count')?.value || '0', + ) + if (!offerItemCount) { + errorObj.invalidItems = `item_count is required in on_select /quote with @ondc/org/title_type:${titleType} and offerId:${offerId} ` + } + if (offerItemId !== benefitItemId) { + errorObj.invalidBenefitItem = `Mismatch: item_id used in on_select quote.breakup (${offerItemId}) doesn't match with offer benefit item_id (${benefitItemId}) in on_search catalog for offer ID: ${offerId}` + } + if (benefitItemCount !== offerItemCount) { + errorObj.invalidItemCount = `Mismatch: item_count used in on_select quote.breakup (${offerItemCount}) quantity doesn't match with offer benefit item_count (${benefitItemCount}) in on_search catalog for offer ID: ${offerId}` + } + if (offerItemId) { + const itemIds = offerItemId.split(',').map((id: string) => id.trim()) + // let totalExpectedOfferValue = 0 + const matchedItems = itemsOnSearch[0].filter((item: any) => itemIds.includes(item.id)) + + const priceMismatchItems: string[] = [] + let totalExpectedOfferValue = 0 + console.log(totalExpectedOfferValue) + let allItemsEligible = true + + matchedItems.forEach((item: any) => { + const itemPrice = Math.abs(parseFloat(item?.price?.value || '0')) + const availableCount = parseInt(item?.quantity?.available?.count || '0', 10) + + // Calculate the expected total price for the item + const expectedItemTotal = itemPrice * offerItemCount + totalExpectedOfferValue += expectedItemTotal + + // Validate stock availability + if (availableCount < offerItemCount) { + errorObj.invalidItems = `Item ID: ${item.id} does not have sufficient stock. Required: ${offerItemCount}, Available: ${availableCount}` + allItemsEligible = false + } + + // Validate price consistency + if (expectedItemTotal !== quotedPrice) { + priceMismatchItems.push( + `ID: ${item.id} (Expected Total: ₹${expectedItemTotal}, Quoted: ₹${quotedPrice})`, + ) + allItemsEligible = false + } + }) + + // Report any price mismatches + if (priceMismatchItems.length > 0) { + errorObj.priceMismatch = `Price mismatch found for item(s): ${priceMismatchItems.join('; ')}` + } + + // If not all items are eligible, identify missing or out-of-stock items + if (!allItemsEligible) { + const missingOrOutOfStock = itemIds.filter((id: string) => { + const matchedItem = matchedItems.find((item: any) => item.id === id) + if (!matchedItem) return true + const availableCount = parseInt(matchedItem?.quantity?.available?.count || '0', 10) + return availableCount < offerItemCount + }) + + if (missingOrOutOfStock.length > 0) { + errorObj.invalidItems = `Item(s) with ID(s) ${missingOrOutOfStock.join(', ')} not found in catalog or do not have enough stock for offer ID: ${offerId}` + } + } + } + } + if (offerType === 'delivery' && quoteType === 'fulfillment') { + if (deliveryCharges > 0 || deliveryCharges !== null) { + if (minValue > 0 && minValue !== null) { + const qualifies: boolean = totalWithoutOffers >= minValue + console.log('qualifies', qualifies, minValue) + + if (!qualifies) { + errorObj['offerNA'] = + `Offer with ${offerId} not applicable for quote with actual quote value before discount is ${totalWithoutOffers} as required min_value for order is ${minValue}` + } + } + + const benefitList = benefitTag?.list || [] + + const valueType = benefitList.find((l: any) => l?.code === 'value_type')?.value + const value_cap = Math.abs( + parseFloat(benefitList.find((l: any) => l?.code === 'value_cap')?.value || '0'), + ) + const benefitValue = Math.abs( + parseFloat(benefitList.find((l: any) => l.code === 'value')?.value || '0'), + ) + const quotedPrice = parseFloat(on_select.quote.price.value || '0') + let qualifies = false + + if (valueType === 'percent') { + if (value_cap === 0) { + errorObj['priceErr'] = `Offer benefit amount cannot be equal to ${value_cap}` + } else { + console.log('delivery charges', deliveryCharges, offerPriceValue) + let expectedDiscount = 0 + expectedDiscount = (benefitValue / 100) * deliveryCharges + if (expectedDiscount > value_cap) { + expectedDiscount = value_cap + } + if (expectedDiscount > deliveryCharges) { + errorObj.priceMismatch = `Discount exceeds delivery charge. Discount: ₹${expectedDiscount.toFixed(2)}, Delivery Charge: ₹${deliveryCharges.toFixed(2)}` + } + if (offerPriceValue !== expectedDiscount) { + errorObj.priceMismatch = `Discount value mismatch. Expected: -${expectedDiscount.toFixed(2)}, Found: -${offerPriceValue.toFixed(2)}` + } + } + } else { + if (benefitValue !== offerPriceValue) { + errorObj['priceErr'] = + `Discount mismatch: Expected discount is -₹${benefitValue.toFixed(2)}, but found -₹${offerPriceValue.toFixed(2)}. in offer with ${offerId} in ${titleType}` + } + + if (offerPriceValue !== deliveryCharges) { + errorObj['priceErr'] = + `Discount mismatch: Expected discount is -₹${offerPriceValue.toFixed(2)}, but delivery charges are -₹${deliveryCharges.toFixed(2)}.` + } + + const quoteAfterBenefit = totalWithoutOffers - benefitValue + + qualifies = Math.abs(quoteAfterBenefit - quotedPrice) < 0.01 + + if (!qualifies) { + errorObj['priceErr'] = + `Quoted price mismatch: After ₹${benefitValue} discount on ₹${totalWithoutOffers}, expected price is ₹${quoteAfterBenefit.toFixed(2)}, but got ₹${quotedPrice.toFixed(2)}.` + } + } + } else { + errorObj.invalidOfferType = `item with id: ${offerId} in quote.breakup[${i}] does not exist in items[]. Hence offer cannot be applied for this order.` + } + } + if (offerType === 'combo') { + const qualifierItems = qualifierList.find((item:any)=>item.code === "item_id").value + console.log("qualifierItems",qualifierItems); + const itemIds = qualifierItems.split(',').map((id: string) => id.trim()) + if(!itemIds){ + errorObj.invalidItems = `item_id is required in catalog for code:qualifier /offers/tags/list/value @ondc/org/title_type:${titleType} with offer_id:${offerId}` + } + + const matchedItems = itemsOnSearch[0].filter((item: any) => itemIds.includes(item.id)) + if (matchedItems.length !== itemIds.length) { + errorObj.invalidItems = `One or more item IDs are missing in the search results` + } + + if (minValue > 0 && minValue !== null) { + const qualifies: boolean = totalWithoutOffers >= minValue + + console.log('qualifies', qualifies, minValue) + + if (!qualifies) { + errorObj['priceErr'] = + `Offer not applicable for quote with actual quote value before discount is ${totalWithoutOffers} as required min_value for order is ${minValue}` + } + } + const benefitList = benefitTag?.list || [] + + const valueType = benefitList.find((l: any) => l?.code === 'value_type')?.value + const value_cap = Math.abs( + parseFloat(benefitList.find((l: any) => l?.code === 'value_cap')?.value || '0'), + ) + const benefitValue = Math.abs( + parseFloat(benefitList.find((l: any) => l.code === 'value')?.value || '0'), + ) + const quotedPrice = parseFloat(on_select.quote.price.value || '0') + let qualifies = false + + if (valueType === 'percent') { + if (value_cap === 0) { + errorObj['priceErr'] = `Offer benefit value_cap cannot be equal to ${value_cap}` + } else { + console.log('delivery charges', offerPriceValue) + let expectedDiscount = 0 + expectedDiscount = (benefitValue / 100) * totalWithoutOffers + if (expectedDiscount > value_cap) { + errorObj.invalidOfferBenefit = `offer discount ${expectedDiscount} exceeds value_cap ${value_cap}` + expectedDiscount = value_cap + } + if (offerPriceValue !== expectedDiscount) { + errorObj.priceMismatch = `Discount value mismatch. Expected: -${expectedDiscount.toFixed(2)}, Found: -${offerPriceValue.toFixed(2)}` + } + } + } else { + if (benefitValue !== offerPriceValue) { + errorObj['priceErr'] = + `Discount mismatch: Expected discount is -₹${benefitValue.toFixed(2)}, but found -₹${offerPriceValue.toFixed(2)}. in offer with ${offerId} in ${titleType}` + } + + const quoteAfterBenefit = totalWithoutOffers - benefitValue + + qualifies = Math.abs(quoteAfterBenefit - quotedPrice) < 0.01 + + if (!qualifies) { + errorObj['priceErr'] = + `Quoted price mismatch: After ₹${benefitValue} discount on ₹${totalWithoutOffers}, expected price is ₹${quoteAfterBenefit.toFixed(2)}, but got ₹${quotedPrice.toFixed(2)}.` + } + } + } + if (offerType === 'slab') { + const offerItemsWithQuantity = items + .filter((item: any) => matchingItems.includes(item.id)) + .map((item: any) => ({ + id: item.id, + quantity: item.quantity, + })) + console.log('offerItemQuantity', offerItemsWithQuantity) + + const offerMinItemCount = + parseFloat(qualifierList.find((l: any) => l.code === 'item_count')?.value) || 0 + if (!offerMinItemCount || offerMinItemCount === 0) { + errorObj.invalidItems = `Minimum Item Count required in catalog /offers/tags/qualifier/list/code:item_count or minimum item_count cannot be 0 for offer with id :${offerId}` + } + const itemCountUpperQualifier = qualifierList.find((l: any) => l.code === 'item_count_upper') + console.log('itemCountUpperQualifier', itemCountUpperQualifier) + + if (!itemCountUpperQualifier) { + errorObj.invalidItems = `The "item_count_upper" qualifier is required but was not provided.` + } + const itemCountUpperRaw = itemCountUpperQualifier?.value + let itemCountUpper: any + + if (itemCountUpperRaw === undefined || itemCountUpperRaw.trim() === '') { + // No upper limit specified + itemCountUpper = null + } else { + itemCountUpper = parseFloat(itemCountUpperRaw) + if (isNaN(itemCountUpper)) { + // Handle invalid number format if necessary + itemCountUpper = null + } + } + + if (itemCountUpper !== null && itemCountUpper < offerMinItemCount) { + errorObj.invalidItems = `Invalid configuration: item_count_upper (${itemCountUpper}) cannot be less than item_count (${offerMinItemCount}).` + } + let isOfferEligible: boolean + offerItemsWithQuantity.forEach((item: any) => { + if (!itemCountUpper) { + isOfferEligible = item.quantity >= offerMinItemCount + } + if (itemCountUpper) { + isOfferEligible = item.quantity >= offerMinItemCount && item?.quantity <= itemCountUpper + } + if (!isOfferEligible) { + errorObj.invalidItems = `Offer with ${offerId} is not applicale as item with id: ${item?.id} and quantity: ${item.quantity} does not match with offer item_count ${offerMinItemCount} and item_count_upper ${itemCountUpper}` + } + }) + if (minValue > 0 && minValue !== null) { + const qualifies: boolean = totalWithoutOffers >= minValue + + console.log('qualifies', qualifies, minValue) + + if (!qualifies) { + errorObj['priceErr'] = + `Offer not applicable for quote with actual quote value before discount is ${totalWithoutOffers} as required min_value for order is ${minValue}` + } + } + const benefitList = benefitTag?.list || [] + + const valueType = benefitList.find((l: any) => l?.code === 'value_type')?.value + const value_cap = Math.abs( + parseFloat(benefitList.find((l: any) => l?.code === 'value_cap')?.value || '0'), + ) + const benefitValue = Math.abs( + parseFloat(benefitList.find((l: any) => l.code === 'value')?.value || '0'), + ) + const quotedPrice = parseFloat(on_select.quote.price.value || '0') + let qualifies = false + + if (valueType === 'percent') { + if (value_cap === 0) { + errorObj['priceErr'] = `Offer benefit value_cap cannot be equal to ${value_cap}` + } else { + console.log('delivery charges', offerPriceValue) + let expectedDiscount = 0 + expectedDiscount = (benefitValue / 100) * totalWithoutOffers + if (expectedDiscount > value_cap) { + errorObj.invalidOfferBenefit = `offer discount ${expectedDiscount} exceeds value_cap ${value_cap}` + expectedDiscount = value_cap + } + // if (expectedDiscount > deliveryCharges) { + // errorObj.priceMismatch = `Discount exceeds delivery charge. Discount: ₹${expectedDiscount.toFixed(2)}, Delivery Charge: ₹${deliveryCharges.toFixed(2)}` + // } + if (offerPriceValue !== expectedDiscount) { + errorObj.priceMismatch = `Discount value mismatch. Expected: -${expectedDiscount.toFixed(2)}, Found: -${offerPriceValue.toFixed(2)}` + } + } + } else { + if (benefitValue !== offerPriceValue) { + errorObj['priceErr'] = + `Discount mismatch: Expected discount is -₹${benefitValue.toFixed(2)}, but found -₹${offerPriceValue.toFixed(2)}. in offer with ${offerId} in ${titleType}` + } + + const quoteAfterBenefit = totalWithoutOffers - benefitValue + + qualifies = Math.abs(quoteAfterBenefit - quotedPrice) < 0.01 + + if (!qualifies) { + errorObj['priceErr'] = + `Quoted price mismatch: After ₹${benefitValue} discount on ₹${totalWithoutOffers}, expected price is ₹${quoteAfterBenefit.toFixed(2)}, but got ₹${quotedPrice.toFixed(2)}.` + } + } + } + } + } catch (error: any) { + logger.error( + `!!Error while checking and validating the offer price in /${constants.ON_SELECT}, ${error.stack}`, + ) + } + } + }) + switch (flow) { + case '0091': + if (!offerTypesInBreakup.includes('discount')) { + errorObj['0091'] = `Flow 0091 requires at least one 'discount' offer in the breakup.`; + } + break; + + case '0092': + if (!offerTypesInBreakup.includes('buyxgety')) { + errorObj['0092'] = `Flow 0092 requires at least one 'buyxgety' offer in the breakup.`; + } + break; + + case '0093': + if (!offerTypesInBreakup.includes('freebie')) { + errorObj['0093'] = `Flow 0093 requires at least one 'freebie' offer in the breakup.`; + } + break; + + case '0094': + if (!offerTypesInBreakup.includes('slab')) { + errorObj['0094'] = `Flow 0094 requires at least one 'slab' offer in the breakup.`; + } + break; + + case '0095': + if (!offerTypesInBreakup.includes('combo')) { + errorObj['0095'] = `Flow 0095 requires at least one 'combo' offer in the breakup.`; + } + break; + + case '0096': + if (!offerTypesInBreakup.includes('delivery')) { + errorObj['0096'] = `Flow 0096 requires at least one 'delivery' offer in the breakup.`; + } + break; + + default: + console.warn(`No specific validation for flow ${flow}`); + break; + } + + + setValue('onSelectPrice', on_select.quote.price.value) + onSelectPrice = onSelectPrice.toFixed(2) + + logger.info( + `Matching quoted Price ${parseFloat(on_select.quote.price.value)} with Breakup Price ${onSelectPrice}`, + ) + if (Math.round(onSelectPrice) != Math.round(parseFloat(on_select.quote.price.value))) { + errorObj.quoteBrkup = `quote.price.value ${on_select.quote.price.value} does not match with the price breakup ${onSelectPrice}` + } + + const selectedPrice = getValue('selectedPrice') + logger.info( + `Matching price breakup of items ${onSelectItemsPrice} (/${constants.ON_SELECT}) with selected items price ${selectedPrice} (${constants.SELECT})`, + ) + + if (typeof selectedPrice === 'number' && onSelectItemsPrice !== selectedPrice) { + errorObj.priceErr = `Warning: Quoted Price in /${constants.ON_SELECT} INR ${onSelectItemsPrice} does not match with the total price of items in /${constants.SELECT} INR ${selectedPrice} i.e price for the item mismatch in on_search and on_select` + logger.info('Quoted Price and Selected Items price mismatch') + } + } else { + logger.error(`Missing quote object in ${constants.ON_SELECT}`) + } + } catch (error: any) { + logger.error(`!!Error while checking and comparing the quoted price in /${constants.ON_SELECT}, ${error.stack}`) + } + + try { + // checking if delivery line item present in case of Serviceable + logger.info(`Checking if delivery line item present in case of Serviceable for ${constants.ON_SELECT}`) + if (on_select.quote) { + const quoteBreakup = on_select.quote.breakup + const deliveryItems = quoteBreakup.filter( + (item: { [x: string]: string }) => item['@ondc/org/title_type'] === 'delivery', + ) + const noOfDeliveries = deliveryItems.length + if (!noOfDeliveries && !nonServiceableFlag) { + errorObj.deliveryLineItem = `delivery line item must be present in quote/breakup (if location is serviceable)` + } + + // Checking for delivery charges in non servicable locations + if (noOfDeliveries && nonServiceableFlag) { + deliveryItems.map((e: any) => { + if (e.price.value > 0) { + logger.error('Delivery charges not applicable for non-servicable locations') + } + }) + } + } else { + logger.error(`Missing quote object in ${constants.ON_SELECT}`) + } + } catch (error: any) { + logger.info(`!!Error occurred while checking delivery line item in /${constants.ON_SELECT}, ${error.stack}`) + } + + try { + logger.info(`Checking payment breakup title & type in /${constants.ON_SELECT}`) + if (on_select.quote) { + on_select.quote.breakup.forEach((item: { [x: string]: any; title: string }) => { + if ( + item['@ondc/org/title_type'] != 'item' && + !Object.values(retailPymntTtl).includes(item['@ondc/org/title_type']) + ) { + errorObj.pymntttltyp = `Quote breakup Payment title type "${item['@ondc/org/title_type']}" is not as per the API contract` + } + + if ( + item['@ondc/org/title_type'] !== 'item' && + item['@ondc/org/title_type'] !== 'offer' && + !(item.title.toLowerCase().trim() in retailPymntTtl) + ) { + errorObj.pymntttl = `Quote breakup Payment title "${item.title}" is not as per the API Contract` + } else if ( + item['@ondc/org/title_type'] !== 'item' && + item['@ondc/org/title_type'] !== 'offer' && + retailPymntTtl[item.title.toLowerCase().trim()] !== item['@ondc/org/title_type'] + ) { + errorObj.pymntttlmap = `Quote breakup Payment title "${item.title}" comes under the title type "${retailPymntTtl[item.title.toLowerCase().trim()]}"` + } + }) + } else { + logger.error(`Missing quote object in ${constants.ON_SELECT}`) + } + } catch (error: any) { + logger.error(`!!Error while checking payment breakup title & type in /${constants.ON_SELECT}, ${error.stack}`) + } + + try { + //matching fulfillments TAT + logger.info('Checking Fulfillment TAT...') + on_select.fulfillments.forEach((ff: { [x: string]: any; id: any }) => { + if (!ff['@ondc/org/TAT']) { + logger.info(`Fulfillment TAT must be present for Fulfillment ID: ${ff.id}`) + errorObj.ffTAT = `Fulfillment TAT must be present for fulfillment ID: ${ff.id}` + } + }) + } catch (error: any) { + logger.info(`Error while checking fulfillments TAT in /${constants.ON_SELECT}`) + } + + try { + // Checking fulfillment.id, fulfillment.type and tracking + logger.info('Checking fulfillment.id, fulfillment.type and tracking') + on_select.fulfillments.forEach((ff: any) => { + let ffId = '' + if (!ff.id) { + logger.info(`Fulfillment Id must be present `) + errorObj['ffId'] = `Fulfillment Id must be present` + } + + ffId = ff.id + + if (ffId) { + if (ff.tracking === false || ff.tracking === true) { + setValue(`${ffId}_tracking`, ff.tracking) + } else { + logger.info(`Tracking must be present for fulfillment ID: ${ff.id} in boolean form`) + errorObj['ffTracking'] = `Tracking must be present for fulfillment ID: ${ff.id} in boolean form` + } + } + }) + } catch (error: any) { + logger.info(`Error while checking fulfillments id, type and tracking in /${constants.ON_SELECT}`) + } + + try { + logger.info('Checking quote validity quote.ttl') + if (!on_select.quote.hasOwnProperty('ttl')) { + errorObj.qtTtl = 'quote.ttl: Validity of the quote is missing' + } + } catch (error: any) { + logger.error(`!!Error while checking quote.ttl in /${constants.ON_SELECT}`) + } + + try { + if (on_select.quote) { + logger.info(`Storing Quote object in /${constants.ON_SELECT}`) + on_select.quote.breakup.forEach((element: BreakupElement) => { + if (element['@ondc/org/title_type'] === 'item') { + if (element.item && element.item.hasOwnProperty('quantity')) { + delete element.item.quantity + } + } + }) + //saving on select quote + setValue('quoteObj', on_select.quote) + } + } catch (error: any) { + logger.error(`!!Error while storing quote object in /${constants.ON_SELECT}, ${error.stack}`) + } + + // Checking fulfillmentID with providerID for ON_SELECT + try { + logger.info(`Comparing fulfillmentID with providerID for /${constants.ON_SELECT} `) + const len: number = on_select.fulfillments.length + let i = 0 + while (i < len) { + const fulfillment_id = on_select.fulfillments[i].id + const provider_id = on_select.provider.id + if (fulfillment_id === provider_id) { + logger.error(`FullfillmentID can't be equal to ProviderID on ${constants.ON_SELECT}`) + } + + i++ + } + } catch (error: any) { + logger.error(`!Error while comparing fulfillmentID with providerID in /${constants.ON_SELECT}, ${error.stack}`) + } + + setValue('quote_price', on_select.quote.price.value) + const MinOrderValue = getValue('MinOrderValue') + if (MinOrderValue) { + if (_.lt(Number(on_select.quote.price.value), Number(MinOrderValue))) { + const key = `orderValue` + errorObj[key] = `Order value must be greater or equal to Minimum Order Value` + } + } + if(flow===FLOW.FLOW003){ + const fulfillments = on_select.fulfillments + setValue('fulfillmentSlots',fulfillments) + + } + + if (flow === FLOW.FLOW016) { + // Flow 016 specific validation - check for customization items and their relationships + try { + logger.info(`Checking for customization items in /${constants.SELECT} for flow 016`) + + const items = on_select.items + if (!items || !Array.isArray(items) || items.length === 0) { + errorObj.missingItems = `No items found in /${constants.SELECT} for flow 016` + return isObjectEmpty(errorObj) ? {} : errorObj + } + + // Get the custom groups saved from ON_SEARCH + const customGroups = getValue('flow016_custom_groups') + if (!customGroups || !Array.isArray(customGroups) || customGroups.length === 0) { + errorObj.missingCustomGroups = `No custom groups were found in previous /${constants.ON_SEARCH} for flow 016` + return isObjectEmpty(errorObj) ? {} : errorObj + } + + // Find the regular item (type: item) + const regularItem = items.find((item: any) => { + return item.tags?.some((tag: any) => + tag.code === 'type' && + tag.list?.some((listItem: any) => listItem.code === 'type' && listItem.value === 'item') + ) + }) + + if (!regularItem) { + errorObj.missingRegularItem = `No item with type 'item' found in /${constants.SELECT} for flow 016` + return isObjectEmpty(errorObj) ? {} : errorObj + } + + // Find the customization item (type: customization) + const customizationItem = items.find((item: any) => { + return item.tags?.some((tag: any) => + tag.code === 'type' && + tag.list?.some((listItem: any) => listItem.code === 'type' && listItem.value === 'customization') + ) + }) + + if (!customizationItem) { + errorObj.missingCustomizationItem = `No item with type 'customization' found in /${constants.SELECT} for flow 016` + return isObjectEmpty(errorObj) ? {} : errorObj + } + + // Check if the customization item has the parent_item_id linked to the regular item + if (customizationItem.parent_item_id !== regularItem.id) { + errorObj.incorrectParentLink = `Customization item's parent_item_id '${customizationItem.parent_item_id}' doesn't match the regular item id '${regularItem.id}'` + } + + // Check if the customization item has the descriptor with input_text + const hasInputText = customizationItem.descriptor?.tags?.some((tag: any) => + tag.code === 'customization' && + tag.list?.some((listItem: any) => listItem.code === 'input_text' && listItem.value) + ) + console.log('hasInputText', hasInputText) + + if (!hasInputText) { + errorObj.missingInputText = `Customization item is missing descriptor.tags with code 'customization' and list with code 'input_text'` + } + + // Check if the customization item parent matches a custom_group from ON_SEARCH + let parentMatch = false + const parentId = customizationItem.tags?.find((tag: any) => + tag.code === 'parent' && + tag.list?.some((listItem: any) => listItem.code === 'id') + )?.list?.find((listItem: any) => listItem.code === 'id')?.value + + if (!parentId) { + errorObj.missingParentId = `Customization item is missing parent.id tag reference in tags` + } else { + // Check if this parent id matches any custom group id from ON_SEARCH + parentMatch = customGroups.some((group: any) => group.id === parentId) + + if (!parentMatch) { + errorObj.invalidParentId = `Customization item parent id '${parentId}' doesn't match any custom_group id from ON_SEARCH` + } else { + logger.info(`Found valid customization item with parent id: ${parentId} matching a custom_group from ON_SEARCH`) + } + } + + // Save the validation result for reference in subsequent API calls + setValue('flow016_customization_valid', !isObjectEmpty(errorObj)) + + } catch (error: any) { + logger.error(`Error while checking customization items in /${constants.SELECT} for flow 016, ${error.stack}`) + errorObj.customizationCheckError = `Error validating customization items: ${error.message}` + } + } + + + + return Object.keys(errorObj).length > 0 && errorObj +} diff --git a/utils/Retail_.1.2.5/Select/select.ts b/utils/Retail_.1.2.5/Select/select.ts new file mode 100644 index 00000000..f748a4c1 --- /dev/null +++ b/utils/Retail_.1.2.5/Select/select.ts @@ -0,0 +1,672 @@ +import { getValue, setValue } from '../../../shared/dao' +import constants, { ApiSequence } from '../../../constants' +import { + validateSchemaRetailV2, + isObjectEmpty, + checkContext, + checkBppIdOrBapId, + findItemByItemType, + isoDurToSec, +} from '../..' +import _ from 'lodash' +import { logger } from '../../../shared/logger' +import { FLOW } from '../../enum' + +const tagFinder = (item: { tags: any[] }, value: string): any => { + const res = item?.tags?.find((tag: any) => { + return ( + tag.code === 'type' && + tag.list && + tag.list.find((listItem: any) => { + return listItem.code === 'type' && listItem.value == value + }) + ) + }) + return res +} + +export const checkSelect = (data: any, msgIdSet: any, apiSeq: any) => { + if (!data || isObjectEmpty(data)) { + return { [ApiSequence.SELECT]: 'JSON cannot be empty' } + } + + const { message, context } = data + if (!message || !context || !message.order || isObjectEmpty(message) || isObjectEmpty(message.order)) { + return { missingFields: '/context, /message, /order or /message/order is missing or empty' } + } + + const schemaValidation = validateSchemaRetailV2(context.domain.split(':')[1], constants.SELECT, data) + + const contextRes: any = checkContext(context, constants.SELECT) + const onSearch: any = getValue(`${ApiSequence.ON_SEARCH}`) + const flow = getValue('flow') + + const errorObj: any = {} + + try { + if (flow === '3' && apiSeq == ApiSequence.SELECT_OUT_OF_STOCK) { + logger.info(`Adding Message Id /${constants.SELECT_OUT_OF_STOCK}`) + if (msgIdSet.has(context.message_id)) { + errorObj[`${ApiSequence.SELECT_OUT_OF_STOCK}_msgId`] = `Message id should not be same with previous calls` + } + msgIdSet.add(context.message_id) + setValue(`${ApiSequence.SELECT_OUT_OF_STOCK}_msgId`, data.context.message_id) + } else { + logger.info(`Adding Message Id /${constants.SELECT}`) + if (msgIdSet.has(context.message_id)) { + errorObj[`${ApiSequence.SELECT}_msgId`] = `Message id should not be same with previous calls` + } + msgIdSet.add(context.message_id) + setValue(`${ApiSequence.SELECT}_msgId`, data.context.message_id) + } + } catch (error: any) { + if (flow === '3' && apiSeq == ApiSequence.SELECT_OUT_OF_STOCK) { + logger.error(`!!Error while checking message id for /${constants.SELECT_OUT_OF_STOCK}, ${error.stack}`) + } else { + logger.error(`!!Error while checking message id for /${constants.SELECT}, ${error.stack}`) + } + } + + let selectedPrice = 0 + const itemsIdList: any = {} + const itemsCtgrs: any = {} + const itemsTat: any[] = [] + + if (!_.isEqual(data.context.domain.split(':')[1], getValue(`domain`))) { + errorObj[`Domain[${data.context.action}]`] = `Domain should be same in each action` + } + + const checkBap = checkBppIdOrBapId(context.bap_id) + const checkBpp = checkBppIdOrBapId(context.bpp_id) + + if (checkBap) Object.assign(errorObj, { bap_id: 'context/bap_id should not be a url' }) + if (checkBpp) Object.assign(errorObj, { bpp_id: 'context/bpp_id should not be a url' }) + + if (schemaValidation !== 'error') { + Object.assign(errorObj, schemaValidation) + } + + if (!contextRes?.valid) { + Object.assign(errorObj, contextRes.ERRORS) + } + + const select = message.order + + setValue(`${ApiSequence.SELECT}`, data) + setValue('providerId', select.provider.id) + setValue('providerLoc', select.provider.locations[0].id) + setValue('items', select.items) + + const searchContext: any = getValue(`${ApiSequence.SEARCH}_context`) + const onSearchContext: any = getValue(`${ApiSequence.ON_SEARCH}_context`) + + let providerOnSelect = null + const itemIdArray: any[] = [] + const customIdArray: any[] = [] + const itemsOnSelect: any = [] + const itemMap: any = {} + const itemMapper: any = {} + + try { + logger.info(`Comparing city of /${constants.ON_SEARCH} and /${constants.SELECT}`) + if (!_.isEqual(onSearchContext.city, context.city)) { + const key = `${ApiSequence.ON_SEARCH}_city` + errorObj[key] = `City code mismatch in /${ApiSequence.ON_SEARCH} and /${ApiSequence.SELECT}` + } + } catch (error: any) { + logger.info(`Error while comparing city in /${ApiSequence.SEARCH} and /${ApiSequence.SELECT}, ${error.stack}`) + } + + try { + logger.info(`Comparing timestamp of /${constants.ON_SEARCH} and /${constants.SELECT}`) + if (_.gte(onSearchContext.timestamp, context.timestamp)) { + errorObj.tmpstmp = `Timestamp for /${constants.ON_SEARCH} api cannot be greater than or equal to /${constants.SELECT} api` + } + + setValue('tmpstmp', context.timestamp) + } catch (error: any) { + logger.info( + `Error while comparing timestamp for /${constants.ON_SEARCH} and /${constants.SELECT} api, ${error.stack}`, + ) + } + + try { + logger.info(`Comparing Message Ids of /${constants.ON_SEARCH} and /${constants.SELECT}`) + if (_.isEqual(onSearchContext.message_id, context.message_id)) { + const key = `${ApiSequence.ON_SEARCH}_msgId` + errorObj[key] = `Message Id for /${ApiSequence.ON_SEARCH} and /${ApiSequence.SELECT} api cannot be same` + } + + if (_.isEqual(searchContext.message_id, context.message_id)) { + const key = `${ApiSequence.SEARCH}_msgId` + errorObj[key] = `Message Id for /${ApiSequence.SEARCH} and /${ApiSequence.SELECT} api cannot be same` + } + + setValue('txnId', context.transaction_id) + } catch (error: any) { + logger.info( + `Error while comparing message ids for /${constants.ON_SEARCH} and /${constants.SELECT} api, ${error.stack}`, + ) + } + + try { + logger.info(`Storing item IDs and thier count in /${constants.SELECT}`) + const itemsOnSearch: any = getValue(`${ApiSequence.ON_SEARCH}itemsId`) + + if (!itemsOnSearch?.length) { + errorObj.invalidItems = `No Items found on ${constants.ON_SEARCH} API` + } + + select.items.forEach((item: { id: string | number; quantity: { count: number } }) => { + if (!itemsOnSearch?.includes(item.id)) { + errorObj[`invalidItemId[${item.id}]`] = `Invalid item found in /${constants.SELECT} id: ${item.id}` + } + itemIdArray.push(item.id) + itemsOnSelect.push(item.id) + itemsIdList[item.id] = item.quantity.count + }) + setValue('itemsIdList', itemsIdList) + setValue('SelectItemList', itemsOnSelect) + } catch (error: any) { + logger.error(`Error while storing item IDs in /${constants.SELECT}, ${error.stack}`) + } + + try { + logger.info(`Checking for GPS precision in /${constants.SELECT}`) + select.fulfillments?.forEach((ff: any) => { + if (ff.hasOwnProperty('end')) { + setValue('buyerGps', ff.end?.location?.gps) + setValue('buyerAddr', ff.end?.location?.address?.area_code) + + const gps = ff.end?.location?.gps?.split(',') + const gpsLat: string = gps[0] + Array.from(gpsLat).forEach((char: any) => { + if (char !== '.' && isNaN(parseInt(char))) { + errorObj.LatgpsErr = `fulfillments location.gps is not as per the API contract` + } + }) + const gpsLong = gps[1] + Array.from(gpsLong).forEach((char: any) => { + if (char !== '.' && isNaN(parseInt(char))) { + errorObj.LongGpsErr = `fulfillments location.gps is not as per the API contract` + } + }) + if (!gpsLat || !gpsLong) { + errorObj.gpsErr = `fulfillments location.gps is not as per the API contract` + } + if (!ff.end.location.address.hasOwnProperty('area_code')) { + errorObj.areaCode = `address.area_code is required property in /${constants.SELECT}` + } + } + }) + } catch (error: any) { + logger.error(`!!Error while checking GPS Precision in /${constants.SELECT}, ${error.stack}`) + } + + try { + logger.info(`Checking for valid provider in /${constants.ON_SEARCH} and /${constants.SELECT}`) + let provider = onSearch?.message?.catalog['bpp/providers'].filter( + (provider: { id: any }) => provider.id === select.provider.id, + ) + + if (provider?.length === 0) { + errorObj.providerId = `provider with provider.id: ${select.provider.id} does not exist in on_search` + } else { + providerOnSelect = provider[0] + + setValue('providerGps', providerOnSelect?.locations[0]?.gps) + setValue('providerName', providerOnSelect?.descriptor?.name) + } + } catch (error: any) { + logger.error( + `Error while checking for valid provider in /${constants.ON_SEARCH} and /${constants.SELECT}, ${error.stack}`, + ) + } + + try { + logger.info(`Checking for valid location ID inside item list for /${constants.SELECT}`) + const allOnSearchItems: any = getValue('onSearchItems') + let onSearchItems = allOnSearchItems.flat() + select.items.forEach((item: any, index: number) => { + onSearchItems.forEach((it: any) => { + const tagsTypeArr = _.filter(it?.tags, { code: 'type' }) + let isNotCustomization = true + if (tagsTypeArr.length > 0) { + const tagsType = _.filter(tagsTypeArr[0]?.list, { code: 'type' }) + if (tagsType.length > 0) { + if (tagsType[0]?.value == 'customization') { + isNotCustomization = false + } + } + } + if (it.id === item.id && it.location_id !== item.location_id && isNotCustomization) { + errorObj[`location_id[${index}]`] = `location_id should be same for the item ${item.id} as in on_search` + } + }) + }) + } catch (error: any) { + logger.error(`Error while checking for valid location ID inside item list for /${constants.SELECT}, ${error.stack}`) + } + + try { + logger.info(`Checking for duplicate parent_item_id in /${constants.SELECT}`) + select.items.forEach((item: any, index: number) => { + if (!itemMapper[item.id]) { + // If the item is not in the map, add it + itemMapper[item.id] = item.parent_item_id + } else { + if (itemMapper[item.id] === item.parent_item_id) { + const key = `item${index}id_parent_item_id` + errorObj[key] = `/message/order/items/parent_item_id cannot be duplicate if item/id is same` + } + } + }) + } catch (error: any) { + logger.error(`Error while checking for duplicate parent_item_id in /${constants.SELECT}, ${error.stack}`) + } + + try { + logger.info(`Mapping the items with thier prices on /${constants.ON_SEARCH} and /${constants.SELECT}`) + const allOnSearchItems: any = getValue('onSearchItems') + let onSearchItems = allOnSearchItems.flat() + select.items.forEach((item: any) => { + const itemOnSearch = onSearchItems.find((it: any) => { + return it.id === item.id + }) + + if (itemOnSearch) { + logger.info(`ITEM ID: ${item.id}, Price: ${itemOnSearch.price.value}, Count: ${item.quantity.count}`) + itemsCtgrs[item.id] = itemOnSearch.category_id + itemsTat.push(itemOnSearch['@ondc/org/time_to_ship']) + selectedPrice += itemOnSearch.price.value * item.quantity?.count + } + }) + setValue('selectedPrice', selectedPrice) + setValue('itemsCtgrs', itemsCtgrs) + } catch (error: any) { + logger.error( + `Error while mapping the items with thier prices on /${constants.ON_SEARCH} and /${constants.SELECT}, ${error.stack}`, + ) + } + + try { + logger.info(`Saving time_to_ship in /${constants.SELECT}`) + let timeToShip = 0 + itemsTat?.forEach((tts: any) => { + const ttship = isoDurToSec(tts) + logger.info(ttship) + timeToShip = Math.max(timeToShip, ttship) + }) + setValue('timeToShip', timeToShip) + } catch (error: any) { + logger.error(`!!Error while saving time_to_ship in ${constants.SELECT}`, error) + } + + try { + logger.info(`Checking for Consistent location IDs for parent_item_id in /${constants.SELECT}`) + select.items.forEach((item: any, index: number) => { + const itemTag = tagFinder(item, 'item') + if (itemTag) { + if (!itemMap[item.parent_item_id]) { + itemMap[item.parent_item_id] = { + location_id: item.location_id, + } + } + } + + if (itemTag && itemMap[item.parent_item_id].location_id !== item.location_id) { + const key = `item${index}location_id` + errorObj[key] = `Inconsistent location_id for parent_item_id ${item.parent_item_id}` + } + }) + } catch (error: any) { + logger.error( + `Error while checking for Consistent location IDs for parent_item_id in /${constants.SELECT}, ${error.stack}`, + ) + } + + const checksOnValidProvider = (provider: any) => { + try { + logger.info(`Comparing provider location in /${constants.ON_SEARCH} and /${constants.SELECT}`) + if (provider?.locations[0]?.id != select.provider?.locations[0]?.id) { + errorObj.prvdLoc = `provider.locations[0].id ${provider.locations[0].id} mismatches in /${constants.ON_SEARCH} and /${constants.SELECT}` + } + } catch (error: any) { + logger.error( + `!!Error while comparing provider's location id in /${constants.ON_SEARCH} and /${constants.SELECT}, ${error.stack}`, + ) + } + + try { + logger.info(`Checking for valid items for provider in /${constants.SELECT}`) + const itemProviderMap: any = getValue(`itemProviderMap`) + const providerID = select.provider.id + const items = select.items + items.forEach((item: any, index: number) => { + if (!itemProviderMap[providerID].includes(item.id)) { + errorObj[`itemProvider[${index}]`] = + `Item with id ${item.id} is not available for provider with id ${provider.id}` + } + }) + } catch (error: any) { + logger.error(`Error while checking for valid items for provider in /${constants.SELECT}, ${error.stack}`) + } + + try { + logger.info(`Storing item IDs on custom ID array`) + provider?.categories?.map((item: { id: string }) => { + customIdArray.push(item.id) + }) + setValue('select_customIdArray', customIdArray) + } catch (error: any) { + logger.error(`Error while storing item IDs on custom ID array, ${error.stack}`) + } + + try { + logger.info(`Checking for valid time object in /${constants.SELECT}`) + if (provider?.time && provider?.time?.label === 'disable') { + errorObj.disbledProvider = `provider with provider.id: ${provider.id} was disabled in on_search ` + } + } catch (error: any) { + logger.error(`Error while checking for valid time object in /${constants.SELECT}, ${error.stack}`) + } + + try { + logger.info(`Checking for valid base Item in /${constants.SELECT}`) + select.items.forEach((item: any) => { + const baseItem = findItemByItemType(item) + if (baseItem) { + const searchBaseItem = provider.items.find((it: { id: any }) => it.id === baseItem.id) + if (searchBaseItem && searchBaseItem.time.label === 'disable') { + errorObj.itemDisabled = `disabled item with id ${baseItem.id} cannot be selected` + } + } + }) + } catch (error: any) { + logger.error(`Error while checking for valid base Item in /${constants.SELECT}, ${error.stack}`) + } + + try { + logger.info(`Checkinf or customization Items in /${constants.SELECT}`) + select.items.forEach((item: any, index: number) => { + const customizationTag = tagFinder(item, 'customization') + if (customizationTag) { + const parentTag = item.tags.find((tag: any) => { + return ( + tag.code === 'parent' && + tag.list && + tag.list.find((listItem: { code: string; value: any }) => { + return listItem.code === 'id' && customIdArray.includes(listItem.value) + }) + ) + }) + + if (!parentTag) { + const key = `item${index}customization_id` + errorObj[key] = + `/message/order/items/tags/customization/value in item: ${item.id} should be one of the customizations id mapped in on_search` + } + } + }) + } catch (error: any) { + logger.error(`Error while checking for customization Items in /${constants.SELECT}, ${error.stack}`) + } + try { + logger.info(`Checking or offers in /${constants.SELECT}`) + console.log('offers in select call', JSON.stringify(select.offers)) + + if (select?.offers && select?.offers.length > 0) { + const providerOffers: any = getValue(`${ApiSequence.ON_SEARCH}_offers`) + const applicableOffers: any[] = [] + const orderItemIds = select?.items?.map((item: any) => item.id) || [] + const orderLocationIds = select?.provider?.locations?.map((item: any) => item.id) || [] + + select.offers.forEach((offer: any, index: number) => { + const providerOffer = providerOffers?.find((providedOffer: any) => providedOffer?.id === offer?.id) + console.log('providerOffer in select call', JSON.stringify(providerOffer)) + + if (!providerOffer) { + errorObj[`offer[${index}]`] = `Offer with id ${offer.id} is not available for the provider.` + return + } + + const offerLocationIds = providerOffer?.location_ids || [] + const locationMatch = offerLocationIds.some((id: string) => orderLocationIds.includes(id)) + if (!locationMatch) { + errorObj[`offer[${index}]`] = + `Offer with id '${offer.id}' is not applicable for any of the order's locations [${orderLocationIds.join(', ')}].` + return + } + + const offerItemIds = providerOffer?.item_ids || [] + const itemMatch = offerItemIds.some((id: string) => orderItemIds.includes(id)) + if (!itemMatch) { + errorObj[`offer[${index}]`] = + `Offer with id '${offer.id}' is not applicable for any of the ordered item(s) [${orderItemIds.join(', ')}].` + return + } + + const { label, range } = providerOffer?.time || {} + const start = range?.start + const end = range?.end + if (label !== 'valid' || !start || !end) { + errorObj[`offer[${index}]`] = `Offer with id ${offer.id} has an invalid or missing time configuration.` + return + } + + const currentTimeStamp = new Date(context?.timestamp) + const startTime = new Date(start) + const endTime = new Date(end) + if (!(currentTimeStamp >= startTime && currentTimeStamp <= endTime)) { + errorObj[`offer[${index}]`] = `Offer with id ${offer.id} is not currently valid based on time range.` + return + } + + const isSelected = offer?.tags?.some( + (tag: any) => + tag.code === 'selection' && + tag.list?.some((entry: any) => entry.code === 'apply' && entry.value === 'yes'), + ) + if (!isSelected) { + errorObj[`offer[${index}]`] = `Offer with id ${offer.id} is not selected (apply: "yes" missing).` + return + } + + applicableOffers.push({ ...providerOffer, index }) + console.log('applicableOffers', JSON.stringify(applicableOffers)) + }) + + // Additive validation + const additiveOffers = applicableOffers.filter((offer) => { + const metaTag = offer.tags?.find((tag: any) => tag.code === 'meta') + return metaTag?.list?.some((entry: any) => entry.code === 'additive' && entry.value.toLowerCase() === 'yes') + }) + + const nonAdditiveOffers = applicableOffers.filter((offer) => { + const metaTag = offer.tags?.find((tag: any) => tag.code === 'meta') + return metaTag?.list?.some((entry: any) => entry.code === 'additive' && entry.value.toLowerCase() === 'no') + }) + + if (additiveOffers.length > 0) { + // Apply all additive offers + applicableOffers.length = 0 + additiveOffers.forEach((offer) => { + const providerOffer = providerOffers.find((o: any) => o.id === offer.id) + if (providerOffer) { + applicableOffers.push(providerOffer) + } + }) + } else if (nonAdditiveOffers.length === 1) { + // Apply the single non-additive offer + applicableOffers.length = 0 + const offer = nonAdditiveOffers[0] + const providerOffer = providerOffers.find((o: any) => o.id === offer.id) + if (providerOffer) { + applicableOffers.push(providerOffer) + } + } else if (nonAdditiveOffers.length > 1) { + // Multiple non-additive offers selected; add errors + applicableOffers.length = 0 + nonAdditiveOffers.forEach((offer) => { + errorObj[`offer[${offer.index}]`] = + `Offer ${offer.id} is non-additive and cannot be combined with other non-additive offers.` + }) + // setValue('Addtive-Offers',false) + return + } + console.log('Applicable Offers in select:', applicableOffers) + setValue('selected_offer', applicableOffers) + } + } catch (error: any) { + logger.error(`Error while checking for offers in /${constants.SELECT}, ${error.stack}`) + } + } + + if (providerOnSelect) { + checksOnValidProvider(providerOnSelect) + } else { + errorObj.providerChecks = `Warning: Missed checks for provider as provider with ID: ${select.provider.id} does not exist on ${constants.ON_SEARCH} API` + } + + let minVal: any = null + + try { + const providers = onSearch?.message?.catalog['bpp/providers'] + const getAllTags = (providers: any[]) => { + return providers.flatMap((provider) => { + return provider.tags + }) + } + + const tagList = getAllTags(providers) + const tag = tagList.find((ele): any => ele.code === 'order_value') + minVal = tag.list.find((ele: { code: string }) => ele.code === 'min_value') + if (minVal.value) setValue('MinOrderValue', minVal.value) + } catch (error: any) { + logger.error(`!!Error while extracting MinOrderValue in ${constants.SELECT}`, error) + } + + const validDomains = ['ONDC:RET10', 'ONDC:RET13', 'ONDC:RET18'] + if (flow === FLOW.FLOW008 && validDomains.includes(context.domain)) { + if (!minVal) { + const key = `order_value` + errorObj[key] = `Tags must contain "order_value" with Minimum Order Value` + } + if (minVal) { + const price = getValue('selectedPrice') + if (_.lt(price, minVal.value)) { + const key = `minimum_order_value` + errorObj[key] = `Order value must be greater or equal to Minimum Order Value` + } + } + } + + try { + const domains = ['ONDC:RET14', 'ONDC:RET15'] + if (flow === FLOW.FLOW016 && domains.includes(context.domain)) { + const provider = onSearch?.message?.catalog['bpp/providers'].find( + (provider: { id: any }) => provider.id === select.provider.id, + ) + + const getCategories = provider.categories.find((ele: any) => ele.id === 'CG1') + const inputType = getCategories.tags + .find((ele: any) => ele.code === 'config') + .list?.find((ele: { code: string }): any => ele.code === 'input') + if (inputType.value !== 'text') { + const key = `customization` + errorObj[key] = `customization input type must be text for Free text customizations flow` + } + } + } catch (error: any) { + logger.error(`!!Error while checking customization ${constants.SELECT}`, error) + } + if (flow === FLOW.FLOW016) { + // Flow 016 specific validation - check for customization items and their relationships + try { + logger.info(`Checking for customization items in /${constants.SELECT} for flow 016`) + + const items = select.items + if (!items || !Array.isArray(items) || items.length === 0) { + errorObj.missingItems = `No items found in /${constants.SELECT} for flow 016` + return isObjectEmpty(errorObj) ? {} : errorObj + } + + // Get the custom groups saved from ON_SEARCH + const customGroups = getValue('flow016_custom_groups') + if (!customGroups || !Array.isArray(customGroups) || customGroups.length === 0) { + errorObj.missingCustomGroups = `No custom groups were found in previous /${constants.ON_SEARCH} for flow 016` + return isObjectEmpty(errorObj) ? {} : errorObj + } + + // Find the regular item (type: item) + const regularItem = items.find((item: any) => { + return item.tags?.some((tag: any) => + tag.code === 'type' && + tag.list?.some((listItem: any) => listItem.code === 'type' && listItem.value === 'item') + ) + }) + + if (!regularItem) { + errorObj.missingRegularItem = `No item with type 'item' found in /${constants.SELECT} for flow 016` + return isObjectEmpty(errorObj) ? {} : errorObj + } + + // Find the customization item (type: customization) + const customizationItem = items.find((item: any) => { + return item.tags?.some((tag: any) => + tag.code === 'type' && + tag.list?.some((listItem: any) => listItem.code === 'type' && listItem.value === 'customization') + ) + }) + + if (!customizationItem) { + errorObj.missingCustomizationItem = `No item with type 'customization' found in /${constants.SELECT} for flow 016` + return isObjectEmpty(errorObj) ? {} : errorObj + } + + // Check if the customization item has the parent_item_id linked to the regular item + if (customizationItem.parent_item_id !== regularItem.id) { + errorObj.incorrectParentLink = `Customization item's parent_item_id '${customizationItem.parent_item_id}' doesn't match the regular item id '${regularItem.id}'` + } + + // Check if the customization item has the descriptor with input_text + const hasInputText = customizationItem.descriptor?.tags?.some((tag: any) => + tag.code === 'customization' && + tag.list?.some((listItem: any) => listItem.code === 'input_text' && listItem.value) + ) + + if (!hasInputText) { + errorObj.missingInputText = `Customization item is missing descriptor.tags with code 'customization' and list with code 'input_text'` + } + + // Check if the customization item parent matches a custom_group from ON_SEARCH + let parentMatch = false + const parentId = customizationItem.tags?.find((tag: any) => + tag.code === 'parent' && + tag.list?.some((listItem: any) => listItem.code === 'id') + )?.list?.find((listItem: any) => listItem.code === 'id')?.value + + if (!parentId) { + errorObj.missingParentId = `Customization item is missing parent.id tag reference in tags` + } else { + // Check if this parent id matches any custom group id from ON_SEARCH + parentMatch = customGroups.some((group: any) => group.id === parentId) + + if (!parentMatch) { + errorObj.invalidParentId = `Customization item parent id '${parentId}' doesn't match any custom_group id from ON_SEARCH` + } else { + logger.info(`Found valid customization item with parent id: ${parentId} matching a custom_group from ON_SEARCH`) + } + } + + // Save the validation result for reference in subsequent API calls + setValue('flow016_customization_valid', !isObjectEmpty(errorObj)) + + } catch (error: any) { + logger.error(`Error while checking customization items in /${constants.SELECT} for flow 016, ${error.stack}`) + errorObj.customizationCheckError = `Error validating customization items: ${error.message}` + } + } + + return Object.keys(errorObj).length > 0 && errorObj +} diff --git a/utils/Retail_.1.2.5/Status/onStatusDelivered.ts b/utils/Retail_.1.2.5/Status/onStatusDelivered.ts new file mode 100644 index 00000000..a3564b19 --- /dev/null +++ b/utils/Retail_.1.2.5/Status/onStatusDelivered.ts @@ -0,0 +1,545 @@ +/* eslint-disable no-prototype-builtins */ +import _ from 'lodash' +import constants, { ApiSequence, ROUTING_ENUMS, PAYMENT_STATUS } from '../../../constants' +import { logger } from '../../../shared/logger' +import { + validateSchemaRetailV2, + isObjectEmpty, + checkContext, + areTimestampsLessThanOrEqualTo, + compareTimeRanges, + compareFulfillmentObject, + compareAllObjects, + getProviderId, + deepCompare, +} from '../..' +import { getValue, setValue } from '../../../shared/dao' +import { FLOW } from '../../enum' + +export const checkOnStatusDelivered = (data: any, state: string, msgIdSet: any, fulfillmentsItemsSet: any) => { + const onStatusObj: any = {} + try { + if (!data || isObjectEmpty(data)) { + return { [ApiSequence.ON_STATUS_DELIVERED]: 'JSON cannot be empty' } + } + const flow = getValue('flow') + const { message, context }: any = data + + if (!message || !context || isObjectEmpty(message)) { + return { missingFields: '/context, /message, is missing or empty' } + } + const searchContext: any = getValue(`${ApiSequence.SEARCH}_context`) + const schemaValidation = validateSchemaRetailV2(context.domain.split(':')[1], constants.ON_STATUS, data) + const contextRes: any = checkContext(context, constants.ON_STATUS) + + if (schemaValidation !== 'error') { + Object.assign(onStatusObj, schemaValidation) + } + + try { + logger.info(`Adding Message Id /${constants.ON_STATUS_DELIVERED}`) + if (msgIdSet.has(context.message_id)) { + onStatusObj[`${ApiSequence.ON_STATUS_DELIVERED}_msgId`] = `Message id should not be same with previous calls` + } + msgIdSet.add(context.message_id) + } catch (error: any) { + logger.error(`!!Error while checking message id for /${constants.ON_STATUS_DELIVERED}, ${error.stack}`) + } + + if (!contextRes?.valid) { + Object.assign(onStatusObj, contextRes.ERRORS) + } + + setValue(`${ApiSequence.ON_STATUS_DELIVERED}`, data) + + if (!_.isEqual(data.context.domain.split(':')[1], getValue(`domain`))) { + onStatusObj[`Domain[${data.context.action}]`] = `Domain should be same in each action` + } + + try { + logger.info(`Checking context for /${constants.ON_STATUS} API`) //checking context + const res: any = checkContext(context, constants.ON_STATUS) + if (!res.valid) { + Object.assign(onStatusObj, res.ERRORS) + } + } catch (error: any) { + logger.error(`!!Some error occurred while checking /${constants.ON_STATUS} context, ${error.stack}`) + } + + try { + logger.info(`Comparing city of /${constants.SEARCH} and /${constants.ON_STATUS}`) + if (!_.isEqual(searchContext.city, context.city)) { + onStatusObj.city = `City code mismatch in /${constants.SEARCH} and /${constants.ON_STATUS}` + } + } catch (error: any) { + logger.error(`!!Error while comparing city in /${constants.SEARCH} and /${constants.ON_STATUS}, ${error.stack}`) + } + + try { + logger.info(`Comparing transaction Ids of /${constants.SELECT} and /${constants.ON_STATUS}`) + if (!_.isEqual(getValue('txnId'), context.transaction_id)) { + onStatusObj.txnId = `Transaction Id should be same from /${constants.SELECT} onwards` + } + } catch (error: any) { + logger.info( + `!!Error while comparing transaction ids for /${constants.SELECT} and /${constants.ON_STATUS} api, ${error.stack}`, + ) + } + + const on_status = message.order + try { + logger.info(`Comparing order Id in /${constants.ON_CONFIRM} and /${constants.ON_STATUS}_${state}`) + if (on_status.id != getValue('cnfrmOrdrId')) { + logger.info(`Order id (/${constants.ON_STATUS}_${state}) mismatches with /${constants.CONFIRM})`) + onStatusObj.onStatusOdrId = `Order id in /${constants.CONFIRM} and /${constants.ON_STATUS}_${state} do not match` + } + } catch (error) { + logger.info( + `!!Error while comparing order id in /${constants.ON_STATUS}_${state} and /${constants.CONFIRM}`, + error, + ) + } + + try { + logger.info( + `Comparing timestamp of /${constants.ON_STATUS}_OutForDelivery and /${constants.ON_STATUS}_${state} API`, + ) + if (_.gte(getValue('tmstmp'), context.timestamp)) { + onStatusObj.inVldTmstmp = `Timestamp for /${constants.ON_STATUS}_OutForDelivery api cannot be greater than or equal to /${constants.ON_STATUS}_${state} api` + } + + setValue('tmpstmp', context.timestamp) + } catch (error: any) { + logger.error(`!!Error occurred while comparing timestamp for /${constants.ON_STATUS}_${state}, ${error.stack}`) + } + try { + logger.info(`Comparing timestamp of /${constants.ON_CONFIRM} and /${constants.ON_STATUS}_${state} API`) + if (_.gte(getValue('onCnfrmtmpstmp'), context.timestamp)) { + onStatusObj.tmpstmp1 = `Timestamp for /${constants.ON_CONFIRM} api cannot be greater than or equal to /${constants.ON_STATUS}_${state} api` + } + } catch (error: any) { + logger.error(`!!Error occurred while comparing timestamp for /${constants.ON_STATUS}_${state}, ${error.stack}`) + } + + try { + // For Delivery Object + const DELobj = _.filter(on_status.fulfillments, { type: 'Delivery' }) + if (!DELobj.length) { + logger.error(`Delivery object is mandatory for ${ApiSequence.ON_STATUS_DELIVERED}`) + const key = `missingDelivery` + onStatusObj[key] = `Delivery object is mandatory for ${ApiSequence.ON_STATUS_DELIVERED}` + } else { + const deliveryObj = DELobj[0] + if (!deliveryObj.tags) { + const key = `missingTags` + onStatusObj[key] = `Tags are mandatory in Delivery Fulfillment for ${ApiSequence.ON_STATUS_DELIVERED}` + } else { + const tags = deliveryObj.tags + const routingTagArr = _.filter(tags, { code: 'routing' }) + if (!routingTagArr.length) { + const key = `missingRouting/Tag` + onStatusObj[key] = + `RoutingTag object is mandatory in Tags of Delivery Object for ${ApiSequence.ON_STATUS_DELIVERED}` + } else { + const routingTag = routingTagArr[0] + const routingTagList = routingTag.list + if (!routingTagList) { + const key = `missingRouting/Tag/List` + onStatusObj[key] = + `RoutingTagList is mandatory in RoutingTag of Delivery Object for ${ApiSequence.ON_STATUS_DELIVERED}` + } else { + const routingTagTypeArr = _.filter(routingTagList, { code: 'type' }) + if (!routingTagTypeArr.length) { + const key = `missingRouting/Tag/List/Type` + onStatusObj[key] = + `RoutingTagListType object is mandatory in RoutingTag/List of Delivery Object for ${ApiSequence.ON_STATUS_DELIVERED}` + } else { + const routingTagType = routingTagTypeArr[0] + if (!ROUTING_ENUMS.includes(routingTagType.value)) { + const key = `missingRouting/Tag/List/Type/Value` + onStatusObj[key] = + `RoutingTagListType Value is mandatory in RoutingTag of Delivery Object for ${ApiSequence.ON_STATUS_DELIVERED} and should be equal to 'P2P' or 'P2H2P'` + } + } + } + } + } + } + } catch (error: any) { + logger.error(`Error while checking Fulfillments Delivery Obj in /${ApiSequence.ON_STATUS_PICKED}, ${error.stack}`) + } + try { + // For Delivery Object + const DELobj = _.filter(on_status.fulfillments, { type: 'Delivery' }) + if (!DELobj.length) { + logger.error(`Delivery object is mandatory for ${ApiSequence.ON_STATUS_DELIVERED}`) + const key = `missingDelivery` + onStatusObj[key] = `Delivery object is mandatory for ${ApiSequence.ON_STATUS_DELIVERED}` + } else { + const deliveryObj = DELobj[0] + if (!deliveryObj.tags) { + const key = `missingTags` + onStatusObj[key] = `Tags are mandatory in Delivery Fulfillment for ${ApiSequence.ON_STATUS_DELIVERED}` + } else { + const tags = deliveryObj.tags + const routingTagArr = _.filter(tags, { code: 'routing' }) + if (!routingTagArr.length) { + const key = `missingRouting/Tag` + onStatusObj[key] = + `RoutingTag object is mandatory in Tags of Delivery Object for ${ApiSequence.ON_STATUS_DELIVERED}` + } else { + const routingTag = routingTagArr[0] + const routingTagList = routingTag.list + if (!routingTagList) { + const key = `missingRouting/Tag/List` + onStatusObj[key] = + `RoutingTagList is mandatory in RoutingTag of Delivery Object for ${ApiSequence.ON_STATUS_DELIVERED}` + } else { + const routingTagTypeArr = _.filter(routingTagList, { code: 'type' }) + if (!routingTagTypeArr.length) { + const key = `missingRouting/Tag/List/Type` + onStatusObj[key] = + `RoutingTagListType object is mandatory in RoutingTag/List of Delivery Object for ${ApiSequence.ON_STATUS_DELIVERED}` + } else { + const routingTagType = routingTagTypeArr[0] + if (!ROUTING_ENUMS.includes(routingTagType.value)) { + const key = `missingRouting/Tag/List/Type/Value` + onStatusObj[key] = + `RoutingTagListType Value is mandatory in RoutingTag of Delivery Object for ${ApiSequence.ON_STATUS_DELIVERED} and should be equal to 'P2P' or 'P2H2P'` + } + } + } + } + } + } + } catch (error: any) { + logger.error(`Error while checking Fulfillments Delivery Obj in /${ApiSequence.ON_STATUS_PICKED}, ${error.stack}`) + } + + const contextTime = context.timestamp + try { + logger.info(`Comparing order.updated_at and context timestamp for /${constants.ON_STATUS}_${state} API`) + + if (!areTimestampsLessThanOrEqualTo(on_status.updated_at, contextTime)) { + onStatusObj.tmpstmp2 = ` order.updated_at timestamp should be less than or eqaul to context timestamp for /${constants.ON_STATUS}_${state} api` + } + } catch (error: any) { + logger.error( + `!!Error occurred while comparing order updated at for /${constants.ON_STATUS}_${state}, ${error.stack}`, + ) + } + + try { + if (!_.isEqual(on_status.created_at, getValue('cnfrmTmpstmp'))) { + onStatusObj.tmpstmp = `Created At timestamp for /${constants.ON_STATUS}_${state} should be equal to context timestamp at ${constants.CONFIRM}` + } + } catch (error: any) { + logger.error(`!!Error occurred while comparing timestamp for /${constants.ON_STATUS}_${state}, ${error.stack}`) + } + + try { + logger.info(`Checking order state in /${constants.ON_STATUS}_${state}`) + if (on_status.state != 'Completed') { + onStatusObj.ordrState = `order/state should be "Completed" for /${constants.ON_STATUS}_${state}` + } + } catch (error) { + logger.error(`!!Error while checking order state in /${constants.ON_STATUS}_${state}`) + } + try { + logger.info(`comparing fulfillment ranges `) + const storedFulfillment = getValue(`deliveryFulfillment`) + const deliveryFulfillment = on_status.fulfillments.filter((fulfillment: any) => fulfillment.type === 'Delivery') + const storedFulfillmentAction = getValue('deliveryFulfillmentAction') + const fulfillmentRangeerrors = compareTimeRanges( + storedFulfillment, + storedFulfillmentAction, + deliveryFulfillment[0], + ApiSequence.ON_STATUS_DELIVERED, + ) + if (fulfillmentRangeerrors) { + let i = 0 + const len = fulfillmentRangeerrors.length + while (i < len) { + const key = `fulfilmntRngErr${i}` + onStatusObj[key] = `${fulfillmentRangeerrors[i]}` + i++ + } + } + } catch (error: any) { + logger.error(`Error while comparing fulfillment ranges , ${error.stack}`) + } + + try { + logger.info(`Checking delivery timestamp in /${constants.ON_STATUS}_${state}`) + const noOfFulfillments = on_status.fulfillments.length + let orderDelivered = false + let i = 0 + const deliveryTimestamps: any = {} + + while (i < noOfFulfillments) { + const fulfillment = on_status.fulfillments[i] + const ffState = fulfillment.state.descriptor.code + + //type should be Delivery + if (fulfillment.type != 'Delivery') { + i++ + continue + } + + if (ffState === constants.ORDER_DELIVERED) { + orderDelivered = true + const pickUpTime = fulfillment.start.time.timestamp + const deliveryTime = fulfillment.end.time.timestamp + deliveryTimestamps[fulfillment.id] = deliveryTime + try { + //checking delivery time exists or not + if (!deliveryTime) { + onStatusObj.deliverytime = `delivery timestamp is missing` + } else { + try { + //checking delivery time matching with context timestamp + if (!_.lte(deliveryTime, contextTime)) { + onStatusObj.deliveryTime = `delivery timestamp should be less than or equal to context/timestamp and can't be future dated as this on_status is sent after the the product is delivered; as delivery timestamp is ${deliveryTime} and context timestamp is ${contextTime}` + } + } catch (error) { + logger.error( + `!!Error while checking delivery time matching with context timestamp in /${constants.ON_STATUS}_${state}`, + error, + ) + } + try { + //checking delivery time and pickup time + if (_.gte(pickUpTime, deliveryTime)) { + onStatusObj.delPickTime = `delivery timestamp (/end/time/timestamp) can't be less than or equal to the pickup timestamp (start/time/timestamp)` + } + } catch (error) { + logger.error( + `!!Error while checking delivery time and pickup time in /${constants.ON_STATUS}_${state}`, + error, + ) + } + + try { + //checking order/updated_at timestamp + if (!_.gte(on_status.updated_at, deliveryTime)) { + onStatusObj.updatedAt = `order/updated_at timestamp can't be less than the delivery time` + } + + if (!_.gte(contextTime, on_status.updated_at)) { + onStatusObj.updatedAtTime = `order/updated_at timestamp can't be future dated (should match context/timestamp)` + } + } catch (error) { + logger.info( + `!!Error while checking order/updated_at timestamp in /${constants.ON_STATUS}_${state}`, + error, + ) + } + } + } catch (error) { + logger.error(`!!Error delivery timestamp is missing /${constants.ON_STATUS}_${state}`, error) + } + } + + i++ + } + + try { + // Checking fulfillment.id, fulfillment.type and tracking + logger.info('Checking fulfillment.id, fulfillment.type and tracking') + on_status.fulfillments.forEach((ff: any) => { + let ffId = '' + + if (!ff.id) { + logger.info(`Fulfillment Id must be present `) + onStatusObj['ffId'] = `Fulfillment Id must be present` + } + + ffId = ff.id + if (ff.type != 'Cancel') { + if (getValue(`${ffId}_tracking`)) { + if (ff.tracking === false || ff.tracking === true) { + if (getValue(`${ffId}_tracking`) != ff.tracking) { + logger.info(`Fulfillment Tracking mismatch with the ${constants.ON_SELECT} call`) + onStatusObj['ffTracking'] = `Fulfillment Tracking mismatch with the ${constants.ON_SELECT} call` + } + } else { + logger.info(`Tracking must be present for fulfillment ID: ${ff.id} in boolean form`) + onStatusObj['ffTracking'] = `Tracking must be present for fulfillment ID: ${ff.id} in boolean form` + } + } + } + }) + } catch (error: any) { + logger.info(`Error while checking fulfillments id, type and tracking in /${constants.ON_STATUS}`) + } + + if (!orderDelivered) { + onStatusObj.noOrdrDelivered = `fulfillments/state should be ${constants.ORDER_DELIVERED} for /${constants.ON_STATUS}_${constants.ORDER_DELIVERED}` + } + } catch (error) { + logger.info(`Error while checking delivery timestamp in /${constants.ON_STATUS}_${state}.json`) + } + try { + if (flow === FLOW.FLOW012) { + logger.info('Payment status check in on status delivered call') + const payment = on_status.payment + if (payment.status == PAYMENT_STATUS.NOT_PAID) { + logger.error( + `Payment status should be ${PAYMENT_STATUS.PAID} for ${FLOW.FLOW012} flow (Item has been delivered in this state!)`, + ) + onStatusObj.pymntstatus = `Payment status should be ${PAYMENT_STATUS.PAID} for ${FLOW.FLOW012} flow since Item has been delivered in this state (Cash on Delivery)` + } + if (!payment?.time || !payment?.time?.timestamp) { + onStatusObj['missingTimestamp'] = + `Payment must have time with timestamp for ${PAYMENT_STATUS.PAID} in ${FLOW.FLOW012} flow since Item has been delivered in this state (Cash on Delivery)` + } + } + } catch (err: any) { + logger.error('Error while checking payment in message/order/payment: ' + err.message) + } + + if (flow === '6' || flow === '2' || flow === '3' || flow === '5') { + try { + // For Delivery Object + const fulfillments = on_status.fulfillments + if (!fulfillments.length) { + const key = `missingFulfillments` + onStatusObj[key] = `missingFulfillments is mandatory for ${ApiSequence.ON_STATUS_DELIVERED}` + } else { + const fulfillmentsItemsStatusSet = new Set() + fulfillments.forEach((ff: any, i: number) => { + if (ff.type == 'Delivery' && !_.isEqual(ff?.start?.time?.timestamp, getValue('deliveryTmpStmp'))) { + onStatusObj[`message/order.fulfillments/${i}`] = + `Mismatch occur while comparing ${ff.type} fulfillment start timestamp with the ${ApiSequence.ON_STATUS_PICKED}` + } + fulfillmentsItemsStatusSet.add(JSON.stringify(ff)) + }) + let i: number = 0 + fulfillmentsItemsSet.forEach((obj1: any) => { + const keys = Object.keys(obj1) + + let obj2: any = _.filter(fulfillments, { type: `${obj1.type}` }) + let apiSeq = + obj1.type === 'Cancel' + ? ApiSequence.ON_UPDATE_PART_CANCEL + : getValue('onCnfrmState') === 'Accepted' + ? ApiSequence.ON_CONFIRM + : ApiSequence.ON_STATUS_PENDING + if (obj2.length > 0) { + obj2 = obj2[0] + if (obj2.type == 'Delivery') { + delete obj2?.tags + delete obj2?.agent + delete obj2?.start?.instructions + delete obj2?.end?.instructions + delete obj2?.start?.time?.timestamp + delete obj2?.end?.time?.timestamp + delete obj2?.state + } + apiSeq = + obj2.type === 'Cancel' + ? ApiSequence.ON_UPDATE_PART_CANCEL + : getValue('onCnfrmState') === 'Accepted' + ? ApiSequence.ON_CONFIRM + : ApiSequence.ON_STATUS_PENDING + const errors = compareFulfillmentObject(obj1, obj2, keys, i, apiSeq) + if (errors.length > 0) { + errors.forEach((item: any) => { + onStatusObj[item.errKey] = item.errMsg + }) + } + } else { + onStatusObj[`message/order.fulfillments/${i}`] = + `Missing fulfillment type '${obj1.type}' in ${ApiSequence.ON_STATUS_DELIVERED} as compared to ${apiSeq}` + } + i++ + }) + fulfillmentsItemsSet.clear() + fulfillmentsItemsStatusSet.forEach((ff: any) => { + const obj: any = JSON.parse(ff) + delete obj?.state + delete obj?.start?.time + delete obj?.end?.time + fulfillmentsItemsSet.add(obj) + }) + } + } catch (error: any) { + logger.error( + `Error while checking Fulfillments Delivery Obj in /${ApiSequence.ON_STATUS_DELIVERED}, ${error.stack}`, + ) + } + } + + if (flow === FLOW.FLOW020) { + const fulfillments = on_status.fulfillments + if (!fulfillments.length) { + const key = `missingFulfillments` + onStatusObj[key] = `missingFulfillments is mandatory for ${ApiSequence.ON_STATUS_OUT_FOR_DELIVERY}` + } + + fulfillments.forEach((fulfillment: any) => { + const tags = fulfillment.tags || [] + const delayTag = tags.find((tag: { code: string }) => tag.code === 'fulfillment_delay') + const fulfillmentDelayTagList = getValue('fulfillmentDelayTagList') + if (!delayTag) { + const key = `missingFulfillmentTags` + onStatusObj[key] = + `'fulfillment_delay should be present in FulfillmentTags in ${ApiSequence.ON_STATUS_DELIVERED}` + } + if (delayTag) { + const Errors = compareAllObjects(delayTag.list, fulfillmentDelayTagList) + + if (!Errors.isEqual || !Errors.isObj1InObj2 || !Errors.isObj2InObj1 || !Errors.isContained) { + const key = `missingFulfillmentTags` + onStatusObj[key] = `missingFulfillmentTags are mandatory for ${ApiSequence.ON_STATUS_DELIVERED}` + } + } + }) + } + + + try { + const credsWithProviderId = getValue('credsWithProviderId') + const providerId = on_status?.provider?.id + const confirmCreds = on_status?.provider?.creds + const found = credsWithProviderId.find((ele: { providerId: any }) => ele.providerId === providerId) + const expectedCreds = found?.creds + if (!expectedCreds) { + onStatusObj['MissingCreds'] = `creds must be present in /${constants.ON_STATUS_DELIVERED}` + } + if (flow === FLOW.FLOW017) { + + if (!expectedCreds) { + onStatusObj['MissingCreds'] = `creds must be present in /${constants.ON_SEARCH}` + } else if (!deepCompare(expectedCreds, confirmCreds)) { + console.log('here inside else') + onStatusObj['MissingCreds'] = `creds must be present and same as in /${constants.ON_SEARCH}` + } + } + + } catch (err: any) { + logger.error(`!!Some error occurred while checking /${constants.ON_STATUS} API`, err) + } + if (flow === FLOW.FLOW01C) { + const fulfillments = on_status.fulfillments + const deliveryFulfillment = fulfillments.find((f: any) => f.type === 'Delivery') + + if (!deliveryFulfillment.hasOwnProperty('provider_id')) { + onStatusObj['missingFulfillments'] = + `provider_id must be present in ${ApiSequence.ON_STATUS_DELIVERED} as order is accepted` + } + + const id = getProviderId(deliveryFulfillment) + const fulfillmentProviderId = getValue('fulfillmentProviderId') + + if (deliveryFulfillment.hasOwnProperty('provider_id') && id !== fulfillmentProviderId) { + onStatusObj['providerIdMismatch'] = + `provider_id in fulfillment in ${ApiSequence.ON_CONFIRM} does not match expected provider_id: expected '${fulfillmentProviderId}' in ${ApiSequence.ON_STATUS_DELIVERED} but got ${id}` + } + } + + return onStatusObj + } catch (err: any) { + logger.error(`!!Some error occurred while checking /${constants.ON_STATUS} API`, err) + } +} diff --git a/utils/Retail_.1.2.5/Status/onStatusOutForDelivery.ts b/utils/Retail_.1.2.5/Status/onStatusOutForDelivery.ts new file mode 100644 index 00000000..af711ada --- /dev/null +++ b/utils/Retail_.1.2.5/Status/onStatusOutForDelivery.ts @@ -0,0 +1,850 @@ +/* eslint-disable no-prototype-builtins */ +import _ from 'lodash' +import constants, { ApiSequence, ROUTING_ENUMS, PAYMENT_STATUS } from '../../../constants' +import { logger } from '../../../shared/logger' +import { + validateSchemaRetailV2, + isObjectEmpty, + checkContext, + areTimestampsLessThanOrEqualTo, + compareTimeRanges, + compareFulfillmentObject, + compareAllObjects, + getProviderId, + deepCompare, +} from '../..' +import { getValue, setValue } from '../../../shared/dao' +import { FLOW } from '../../enum' + +export const checkOnStatusOutForDelivery = (data: any, state: string, msgIdSet: any, fulfillmentsItemsSet: any) => { + const onStatusObj: any = {} + try { + if (!data || isObjectEmpty(data)) { + return { [ApiSequence.ON_STATUS_OUT_FOR_DELIVERY]: 'JSON cannot be empty' } + } + const flow = getValue('flow') + const { message, context }: any = data + const replacementFulfillment = getValue("replacementFulfillment") + if (!message || !context || isObjectEmpty(message)) { + return { missingFields: '/context, /message, is missing or empty' } + } + + const searchContext: any = getValue(`${ApiSequence.SEARCH}_context`) + const schemaValidation = validateSchemaRetailV2(context.domain.split(':')[1], constants.ON_STATUS, data) + const contextRes: any = checkContext(context, constants.ON_STATUS) + + if (schemaValidation !== 'error') { + Object.assign(onStatusObj, schemaValidation) + } + try { + logger.info(`Adding Message Id /${constants.ON_STATUS_OUT_FOR_DELIVERY}`) + if (msgIdSet.has(context.message_id)) { + onStatusObj[`${ApiSequence.ON_STATUS_OUT_FOR_DELIVERY}_msgId`] = + `Message id should not be same with previous calls` + } + msgIdSet.add(context.message_id) + } catch (error: any) { + logger.error(`!!Error while checking message id for /${constants.ON_STATUS_OUT_FOR_DELIVERY}, ${error.stack}`) + } + if (!contextRes?.valid) { + Object.assign(onStatusObj, contextRes.ERRORS) + } + + if (!_.isEqual(data.context.domain.split(':')[1], getValue(`domain`))) { + onStatusObj[`Domain[${data.context.action}]`] = `Domain should be same in each action` + } + + setValue(`${ApiSequence.ON_STATUS_OUT_FOR_DELIVERY}`, data) + + const packed_message_id: string | null = getValue('packed_message_id') + const out_for_delivery_message_id: string = context.message_id + + setValue(`out_for_delivery_message_id`, out_for_delivery_message_id) + + try { + logger.info( + `Comparing message_id for unsolicited calls for ${constants.ON_STATUS}.packed and ${constants.ON_STATUS}.out_for_delivery`, + ) + + if (packed_message_id === out_for_delivery_message_id) { + onStatusObj['invalid_message_id'] = + `Message_id cannot be same for ${constants.ON_STATUS}.packed and ${constants.ON_STATUS}.out_for_delivery` + } + } catch (error: any) { + logger.error( + `Error while comparing message_id for ${constants.ON_STATUS}.packed and ${constants.ON_STATUS}.out_for_delivery`, + ) + } + + try { + logger.info(`Checking context for /${constants.ON_STATUS} API`) //checking context + const res: any = checkContext(context, constants.ON_STATUS) + if (!res.valid) { + Object.assign(onStatusObj, res.ERRORS) + } + } catch (error: any) { + logger.error(`!!Some error occurred while checking /${constants.ON_STATUS} context, ${error.stack}`) + } + + try { + logger.info(`Comparing city of /${constants.SEARCH} and /${constants.ON_STATUS}`) + if (!_.isEqual(searchContext.city, context.city)) { + onStatusObj.city = `City code mismatch in /${constants.SEARCH} and /${constants.ON_STATUS}` + } + } catch (error: any) { + logger.error(`!!Error while comparing city in /${constants.SEARCH} and /${constants.ON_STATUS}, ${error.stack}`) + } + + try { + logger.info(`Comparing transaction Ids of /${constants.SELECT} and /${constants.ON_STATUS}`) + if (!_.isEqual(getValue('txnId'), context.transaction_id)) { + onStatusObj.txnId = `Transaction Id should be same from /${constants.SELECT} onwards` + } + } catch (error: any) { + logger.info( + `!!Error while comparing transaction ids for /${constants.SELECT} and /${constants.ON_STATUS} api, ${error.stack}`, + ) + } + + const on_status = message.order + if(state === ApiSequence.REPLACEMENT_ON_STATUS_OUT_FOR_DELIVERY){ + try { + logger.info(`Comparing order Id in /${constants.ON_CONFIRM} and /${constants.ON_STATUS}_${state}`) + if (on_status.id != getValue('cnfrmOrdrId')) { + logger.info(`Order id (/${constants.ON_STATUS}_${state}) mismatches with /${constants.CONFIRM})`) + onStatusObj.onStatusOdrId = `Order id in /${constants.CONFIRM} and /${constants.ON_STATUS}_${state} do not match` + } + } catch (error) { + logger.info( + `!!Error while comparing order id in /${constants.ON_STATUS}_${state} and /${constants.CONFIRM}`, + error, + ) + } + + try { + // For Delivery Object + const DELobj = on_status.fulfillments.filter( + (fulfillment: any) => fulfillment.id === replacementFulfillment.id, + ) + if (!DELobj.length) { + logger.error(`Delivery object is mandatory for ${ApiSequence.ON_STATUS_OUT_FOR_DELIVERY}`) + const key = `missingDelivery` + onStatusObj[key] = `Delivery object is mandatory for ${ApiSequence.ON_STATUS_OUT_FOR_DELIVERY}` + } else { + const deliveryObj = DELobj[0] + if (!deliveryObj.tags) { + const key = `missingTags` + onStatusObj[key] = `Tags are mandatory in Delivery Fulfillment for ${ApiSequence.ON_STATUS_OUT_FOR_DELIVERY}` + } else { + const tags = deliveryObj.tags + const routingTagArr = _.filter(tags, { code: 'routing' }) + if (!routingTagArr.length) { + const key = `missingRouting/Tag` + onStatusObj[key] = + `RoutingTag object is mandatory in Tags of Delivery Object for ${ApiSequence.ON_STATUS_OUT_FOR_DELIVERY}` + } else { + const routingTag = routingTagArr[0] + const routingTagList = routingTag.list + if (!routingTagList) { + const key = `missingRouting/Tag/List` + onStatusObj[key] = + `RoutingTagList is mandatory in RoutingTag of Delivery Object for ${ApiSequence.ON_STATUS_OUT_FOR_DELIVERY}` + } else { + const routingTagTypeArr = _.filter(routingTagList, { code: 'type' }) + if (!routingTagTypeArr.length) { + const key = `missingRouting/Tag/List/Type` + onStatusObj[key] = + `RoutingTagListType object is mandatory in RoutingTag/List of Delivery Object for ${ApiSequence.ON_STATUS_OUT_FOR_DELIVERY}` + } else { + const routingTagType = routingTagTypeArr[0] + if (!ROUTING_ENUMS.includes(routingTagType.value)) { + const key = `missingRouting/Tag/List/Type/Value` + onStatusObj[key] = + `RoutingTagListType Value is mandatory in RoutingTag of Delivery Object for ${ApiSequence.ON_STATUS_OUT_FOR_DELIVERY} and should be equal to 'P2P' or 'P2H2P'` + } + } + } + } + } + } + } catch (error: any) { + logger.error( + `Error while checking Fulfillments Delivery Obj in /${ApiSequence.ON_STATUS_OUT_FOR_DELIVERY}, ${error.stack}`, + ) + } + try { + // For Delivery Object + const DELobj = on_status.fulfillments.filter( + (fulfillment: any) => fulfillment.id === replacementFulfillment.id, + ) + if (!DELobj.length) { + logger.error(`Delivery object is mandatory for ${ApiSequence.ON_STATUS_OUT_FOR_DELIVERY}`) + const key = `missingDelivery` + onStatusObj[key] = `Delivery object is mandatory for ${ApiSequence.ON_STATUS_OUT_FOR_DELIVERY}` + } else { + const ffStateCode = DELobj[0]?.state?.descriptor?.code + setValue(`ffIdPrecancel`, ffStateCode) + const deliveryObj = DELobj[0] + if (!deliveryObj.tags) { + const key = `missingTags` + onStatusObj[key] = `Tags are mandatory in Delivery Fulfillment for ${ApiSequence.ON_STATUS_OUT_FOR_DELIVERY}` + } else { + const tags = deliveryObj.tags + const routingTagArr = _.filter(tags, { code: 'routing' }) + if (!routingTagArr.length) { + const key = `missingRouting/Tag` + onStatusObj[key] = + `RoutingTag object is mandatory in Tags of Delivery Object for ${ApiSequence.ON_STATUS_OUT_FOR_DELIVERY}` + } else { + const routingTag = routingTagArr[0] + const routingTagList = routingTag.list + if (!routingTagList) { + const key = `missingRouting/Tag/List` + onStatusObj[key] = + `RoutingTagList is mandatory in RoutingTag of Delivery Object for ${ApiSequence.ON_STATUS_OUT_FOR_DELIVERY}` + } else { + const routingTagTypeArr = _.filter(routingTagList, { code: 'type' }) + if (!routingTagTypeArr.length) { + const key = `missingRouting/Tag/List/Type` + onStatusObj[key] = + `RoutingTagListType object is mandatory in RoutingTag/List of Delivery Object for ${ApiSequence.ON_STATUS_OUT_FOR_DELIVERY}` + } else { + const routingTagType = routingTagTypeArr[0] + if (!ROUTING_ENUMS.includes(routingTagType.value)) { + const key = `missingRouting/Tag/List/Type/Value` + onStatusObj[key] = + `RoutingTagListType Value is mandatory in RoutingTag of Delivery Object for ${ApiSequence.ON_STATUS_OUT_FOR_DELIVERY} and should be equal to 'P2P' or 'P2H2P'` + } + } + } + } + } + } + } catch (error: any) { + logger.error( + `Error while checking Fulfillments Delivery Obj in /${ApiSequence.ON_STATUS_OUT_FOR_DELIVERY}, ${error.stack}`, + ) + } + + try { + logger.info(`Comparing timestamp of /${constants.ON_CONFIRM} and /${constants.ON_STATUS}_${state} API`) + if (_.gte(getValue('onCnfrmtmpstmp'), context.timestamp)) { + onStatusObj.tmpstmp1 = `Timestamp for /${constants.ON_CONFIRM} api cannot be greater than or equal to /${constants.ON_STATUS}_${state} api` + } + } catch (error: any) { + logger.error(`!!Error occurred while comparing timestamp for /${constants.ON_STATUS}_${state}, ${error.stack}`) + } + try { + logger.info( + `Comparing timestamp of /${constants.ON_STATUS}_Out_for_delivery and /${constants.ON_STATUS}_${state} API`, + ) + if (_.gte(getValue('tmstmp'), context.timestamp)) { + onStatusObj.inVldTmstmp = `Timestamp for /${constants.ON_STATUS}_Out_for_delivery api cannot be greater than or equal to /${constants.ON_STATUS}_${state} api` + } + + setValue('tmpstmp', context.timestamp) + } catch (error: any) { + logger.error(`!!Error occurred while comparing timestamp for /${constants.ON_STATUS}_${state}, ${error.stack}`) + } + + const contextTime = context.timestamp + try { + logger.info(`Comparing order.updated_at and context timestamp for /${constants.ON_STATUS}_${state} API`) + + if (!areTimestampsLessThanOrEqualTo(on_status.updated_at, contextTime)) { + onStatusObj.tmpstmp2 = ` order.updated_at timestamp should be less than or eqaul to context timestamp for /${constants.ON_STATUS}_${state} api` + } + } catch (error: any) { + logger.error( + `!!Error occurred while comparing order updated at for /${constants.ON_STATUS}_${state}, ${error.stack}`, + ) + } + + try { + logger.info(`comparing fulfillment ranges `) + // const storedFulfillment = getValue(`deliveryFulfillment`) + const deliveryFulfillment = on_status.fulfillments.filter( + (fulfillment: any) => fulfillment.id === replacementFulfillment.id, + ) + if (deliveryFulfillment.length === 0) { + onStatusObj['rplcmnt-fulfillment'] = + `Fulfillment with id :${replacementFulfillment.id} not found in ${ApiSequence.REPLACEMENT_ON_STATUS_OUT_FOR_DELIVERY} fulfillments` + return onStatusObj + } + // const storedFulfillmentAction = getValue('deliveryFulfillmentAction') + const fulfillmentRangeerrors = compareTimeRanges( + replacementFulfillment, + ApiSequence.REPLACEMENT_ON_STATUS_OUT_FOR_DELIVERY, + deliveryFulfillment[0], + ApiSequence.ON_STATUS_OUT_FOR_DELIVERY, + ) + if (fulfillmentRangeerrors) { + let i = 0 + const len = fulfillmentRangeerrors.length + while (i < len) { + const key = `fulfilmntRngErr${i}` + onStatusObj[key] = `${fulfillmentRangeerrors[i]}` + i++ + } + } + } catch (error: any) { + logger.error(`Error while comparing fulfillment ranges , ${error.stack}`) + } + try { + if (on_status.updated_at) { + setValue('PreviousUpdatedTimestamp', on_status.updated_at) + } + } catch (error: any) { + logger.error(`!!Error while checking order updated timestamp in /${constants.REPLACEMENT_ON_STATUS_OUT_FOR_DELIVERY}, ${error.stack}`) + } + + try { + if (!_.isEqual(getValue(`cnfrmTmpstmp`), on_status.created_at)) { + onStatusObj.tmpstmp = `Created At timestamp for /${constants.REPLACEMENT_ON_STATUS_OUT_FOR_DELIVERY} should be equal to context timestamp at ${constants.CONFIRM}` + } + } catch (error: any) { + logger.error( + `!!Error occurred while comparing order created at for /${constants.REPLACEMENT_ON_STATUS_OUT_FOR_DELIVERY}, ${error.stack}`, + ) + } + + try { + logger.info(`Checking order state in /${constants.ON_STATUS}_${state}`) + if (on_status.state != 'Completed') { + onStatusObj.ordrState = `order/state should be "Completed" for /${constants.REPLACEMENT_ON_STATUS_OUT_FOR_DELIVERY}` + } + } catch (error: any) { + logger.error(`!!Error while checking order state in /${constants.REPLACEMENT_ON_STATUS_OUT_FOR_DELIVERY} Error: ${error.stack}`) + } + + try { + logger.info(`Checking Out_for_delivery timestamp in /${constants.REPLACEMENT_ON_STATUS_OUT_FOR_DELIVERY}`) + // const noOfFulfillments = on_status.fulfillments.length + let orderOut_for_delivery = false + // let i = 0 + const outforDeliveryTimestamps: any = {} + + // while (i < noOfFulfillments) { + const fulfillment = on_status.fulfillments.find((fulfillment:any)=>fulfillment.id === replacementFulfillment.id) + const ffState = fulfillment.state.descriptor.code + + //type should be Delivery + // if (fulfillment.type != 'Delivery') { + // i++ + // continue + // } + + if (ffState === constants.ORDER_OUT_FOR_DELIVERY) { + orderOut_for_delivery = true + const out_for_delivery_time = fulfillment.start.time.timestamp + outforDeliveryTimestamps[fulfillment.id] = out_for_delivery_time + if (!out_for_delivery_time) { + onStatusObj.out_for_delivery_time = `Out_for_delivery timestamp is missing` + } else { + try { + //checking out for delivery time matching with context timestamp + if (!_.lte(out_for_delivery_time, contextTime)) { + onStatusObj.out_for_delivery_time = `Fulfillments start timestamp should match context/timestamp and can't be future dated` + } + } catch (error) { + logger.error( + `!!Error while checking Out_for_delivery time matching with context timestamp in /${constants.REPLACEMENT_ON_STATUS_OUT_FOR_DELIVERY}`, + error, + ) + } + + try { + //checking order/updated_at timestamp + if (!_.gte(on_status.updated_at, out_for_delivery_time)) { + onStatusObj.updatedAt = `order/updated_at timestamp can't be less than the Out_for_delivery time` + } + + if (!_.gte(contextTime, on_status.updated_at)) { + onStatusObj.updatedAtTime = `order/updated_at timestamp can't be future dated (should match context/timestamp)` + } + } catch (error) { + logger.error( + `!!Error while checking order/updated_at timestamp in /${constants.REPLACEMENT_ON_STATUS_OUT_FOR_DELIVERY}`, + error, + ) + } + } + } + + // i++ + // } + + try { + // Checking fulfillment.id, fulfillment.type and tracking + logger.info('Checking fulfillment.id, fulfillment.type and tracking') + on_status.fulfillments.forEach((ff: any) => { + let ffId = '' + + if (!ff.id) { + logger.info(`Fulfillment Id must be present `) + onStatusObj['ffId'] = `Fulfillment Id must be present` + } + + ffId = ff.id + if (ff.type != 'Cancel') { + if (getValue(`${ffId}_tracking`)) { + if (ff.tracking === false || ff.tracking === true) { + if (getValue(`${ffId}_tracking`) != ff.tracking) { + logger.info(`Fulfillment Tracking mismatch with the ${constants.ON_SELECT} call`) + onStatusObj['ffTracking'] = `Fulfillment Tracking mismatch with the ${constants.ON_SELECT} call` + } + } else { + logger.info(`Tracking must be present for fulfillment ID: ${ff.id} in boolean form`) + onStatusObj['ffTracking'] = `Tracking must be present for fulfillment ID: ${ff.id} in boolean form` + } + } + } + }) + } catch (error: any) { + logger.info(`Error while checking fulfillments id, type and tracking in /${constants.ON_STATUS}`) + } + + setValue('outforDeliveryTimestamps', outforDeliveryTimestamps) + + if (!orderOut_for_delivery) { + onStatusObj.noOrdrOut_for_delivery = `fulfillments/state Should be ${state} for /${constants.ON_STATUS}_${constants.ORDER_OUT_FOR_DELIVERY}` + } + } catch (error: any) { + logger.info( + `Error while checking out for delivery timestamp in /${constants.REPLACEMENT_ON_STATUS_OUT_FOR_DELIVERY}.json Error: ${error.stack}`, + ) + } + } + if(state === ApiSequence.ON_STATUS_OUT_FOR_DELIVERY){ + try { + logger.info(`Comparing order Id in /${constants.ON_CONFIRM} and /${constants.ON_STATUS}_${state}`) + if (on_status.id != getValue('cnfrmOrdrId')) { + logger.info(`Order id (/${constants.ON_STATUS}_${state}) mismatches with /${constants.CONFIRM})`) + onStatusObj.onStatusOdrId = `Order id in /${constants.CONFIRM} and /${constants.ON_STATUS}_${state} do not match` + } + } catch (error) { + logger.info( + `!!Error while comparing order id in /${constants.ON_STATUS}_${state} and /${constants.CONFIRM}`, + error, + ) + } + + try { + // For Delivery Object + const DELobj = _.filter(on_status.fulfillments, { type: 'Delivery' }) + if (!DELobj.length) { + logger.error(`Delivery object is mandatory for ${ApiSequence.ON_STATUS_OUT_FOR_DELIVERY}`) + const key = `missingDelivery` + onStatusObj[key] = `Delivery object is mandatory for ${ApiSequence.ON_STATUS_OUT_FOR_DELIVERY}` + } else { + const deliveryObj = DELobj[0] + if (!deliveryObj.tags) { + const key = `missingTags` + onStatusObj[key] = `Tags are mandatory in Delivery Fulfillment for ${ApiSequence.ON_STATUS_OUT_FOR_DELIVERY}` + } else { + const tags = deliveryObj.tags + const routingTagArr = _.filter(tags, { code: 'routing' }) + if (!routingTagArr.length) { + const key = `missingRouting/Tag` + onStatusObj[key] = + `RoutingTag object is mandatory in Tags of Delivery Object for ${ApiSequence.ON_STATUS_OUT_FOR_DELIVERY}` + } else { + const routingTag = routingTagArr[0] + const routingTagList = routingTag.list + if (!routingTagList) { + const key = `missingRouting/Tag/List` + onStatusObj[key] = + `RoutingTagList is mandatory in RoutingTag of Delivery Object for ${ApiSequence.ON_STATUS_OUT_FOR_DELIVERY}` + } else { + const routingTagTypeArr = _.filter(routingTagList, { code: 'type' }) + if (!routingTagTypeArr.length) { + const key = `missingRouting/Tag/List/Type` + onStatusObj[key] = + `RoutingTagListType object is mandatory in RoutingTag/List of Delivery Object for ${ApiSequence.ON_STATUS_OUT_FOR_DELIVERY}` + } else { + const routingTagType = routingTagTypeArr[0] + if (!ROUTING_ENUMS.includes(routingTagType.value)) { + const key = `missingRouting/Tag/List/Type/Value` + onStatusObj[key] = + `RoutingTagListType Value is mandatory in RoutingTag of Delivery Object for ${ApiSequence.ON_STATUS_OUT_FOR_DELIVERY} and should be equal to 'P2P' or 'P2H2P'` + } + } + } + } + } + } + } catch (error: any) { + logger.error( + `Error while checking Fulfillments Delivery Obj in /${ApiSequence.ON_STATUS_OUT_FOR_DELIVERY}, ${error.stack}`, + ) + } + try { + // For Delivery Object + const DELobj = _.filter(on_status.fulfillments, { type: 'Delivery' }) + if (!DELobj.length) { + logger.error(`Delivery object is mandatory for ${ApiSequence.ON_STATUS_OUT_FOR_DELIVERY}`) + const key = `missingDelivery` + onStatusObj[key] = `Delivery object is mandatory for ${ApiSequence.ON_STATUS_OUT_FOR_DELIVERY}` + } else { + const ffStateCode = DELobj[0]?.state?.descriptor?.code + setValue(`ffIdPrecancel`, ffStateCode) + const deliveryObj = DELobj[0] + if (!deliveryObj.tags) { + const key = `missingTags` + onStatusObj[key] = `Tags are mandatory in Delivery Fulfillment for ${ApiSequence.ON_STATUS_OUT_FOR_DELIVERY}` + } else { + const tags = deliveryObj.tags + const routingTagArr = _.filter(tags, { code: 'routing' }) + if (!routingTagArr.length) { + const key = `missingRouting/Tag` + onStatusObj[key] = + `RoutingTag object is mandatory in Tags of Delivery Object for ${ApiSequence.ON_STATUS_OUT_FOR_DELIVERY}` + } else { + const routingTag = routingTagArr[0] + const routingTagList = routingTag.list + if (!routingTagList) { + const key = `missingRouting/Tag/List` + onStatusObj[key] = + `RoutingTagList is mandatory in RoutingTag of Delivery Object for ${ApiSequence.ON_STATUS_OUT_FOR_DELIVERY}` + } else { + const routingTagTypeArr = _.filter(routingTagList, { code: 'type' }) + if (!routingTagTypeArr.length) { + const key = `missingRouting/Tag/List/Type` + onStatusObj[key] = + `RoutingTagListType object is mandatory in RoutingTag/List of Delivery Object for ${ApiSequence.ON_STATUS_OUT_FOR_DELIVERY}` + } else { + const routingTagType = routingTagTypeArr[0] + if (!ROUTING_ENUMS.includes(routingTagType.value)) { + const key = `missingRouting/Tag/List/Type/Value` + onStatusObj[key] = + `RoutingTagListType Value is mandatory in RoutingTag of Delivery Object for ${ApiSequence.ON_STATUS_OUT_FOR_DELIVERY} and should be equal to 'P2P' or 'P2H2P'` + } + } + } + } + } + } + } catch (error: any) { + logger.error( + `Error while checking Fulfillments Delivery Obj in /${ApiSequence.ON_STATUS_OUT_FOR_DELIVERY}, ${error.stack}`, + ) + } + + try { + logger.info(`Comparing timestamp of /${constants.ON_CONFIRM} and /${constants.ON_STATUS}_${state} API`) + if (_.gte(getValue('onCnfrmtmpstmp'), context.timestamp)) { + onStatusObj.tmpstmp1 = `Timestamp for /${constants.ON_CONFIRM} api cannot be greater than or equal to /${constants.ON_STATUS}_${state} api` + } + } catch (error: any) { + logger.error(`!!Error occurred while comparing timestamp for /${constants.ON_STATUS}_${state}, ${error.stack}`) + } + try { + logger.info( + `Comparing timestamp of /${constants.ON_STATUS}_Out_for_delivery and /${constants.ON_STATUS}_${state} API`, + ) + if (_.gte(getValue('tmstmp'), context.timestamp)) { + onStatusObj.inVldTmstmp = `Timestamp for /${constants.ON_STATUS}_Out_for_delivery api cannot be greater than or equal to /${constants.ON_STATUS}_${state} api` + } + + setValue('tmpstmp', context.timestamp) + } catch (error: any) { + logger.error(`!!Error occurred while comparing timestamp for /${constants.ON_STATUS}_${state}, ${error.stack}`) + } + + const contextTime = context.timestamp + try { + logger.info(`Comparing order.updated_at and context timestamp for /${constants.ON_STATUS}_${state} API`) + + if (!areTimestampsLessThanOrEqualTo(on_status.updated_at, contextTime)) { + onStatusObj.tmpstmp2 = ` order.updated_at timestamp should be less than or eqaul to context timestamp for /${constants.ON_STATUS}_${state} api` + } + } catch (error: any) { + logger.error( + `!!Error occurred while comparing order updated at for /${constants.ON_STATUS}_${state}, ${error.stack}`, + ) + } + + try { + logger.info(`comparing fulfillment ranges `) + const storedFulfillment = getValue(`deliveryFulfillment`) + const deliveryFulfillment = on_status.fulfillments.filter((fulfillment: any) => fulfillment.type === 'Delivery') + const storedFulfillmentAction = getValue('deliveryFulfillmentAction') + const fulfillmentRangeerrors = compareTimeRanges( + storedFulfillment, + storedFulfillmentAction, + deliveryFulfillment[0], + ApiSequence.ON_STATUS_OUT_FOR_DELIVERY, + ) + if (fulfillmentRangeerrors) { + let i = 0 + const len = fulfillmentRangeerrors.length + while (i < len) { + const key = `fulfilmntRngErr${i}` + onStatusObj[key] = `${fulfillmentRangeerrors[i]}` + i++ + } + } + } catch (error: any) { + logger.error(`Error while comparing fulfillment ranges , ${error.stack}`) + } + try { + if (on_status.updated_at) { + setValue('PreviousUpdatedTimestamp', on_status.updated_at) + } + } catch (error: any) { + logger.error(`!!Error while checking order updated timestamp in /${constants.ON_STATUS}_${state}, ${error.stack}`) + } + + try { + if (!_.isEqual(getValue(`cnfrmTmpstmp`), on_status.created_at)) { + onStatusObj.tmpstmp = `Created At timestamp for /${constants.ON_STATUS}_${state} should be equal to context timestamp at ${constants.CONFIRM}` + } + } catch (error: any) { + logger.error( + `!!Error occurred while comparing order created at for /${constants.ON_STATUS}_${state}, ${error.stack}`, + ) + } + + try { + logger.info(`Checking order state in /${constants.ON_STATUS}_${state}`) + if (on_status.state != 'In-progress') { + onStatusObj.ordrState = `order/state should be "In-progress" for /${constants.ON_STATUS}_${state}` + } + } catch (error: any) { + logger.error(`!!Error while checking order state in /${constants.ON_STATUS}_${state} Error: ${error.stack}`) + } + + try { + logger.info(`Checking Out_for_delivery timestamp in /${constants.ON_STATUS}_${state}`) + const noOfFulfillments = on_status.fulfillments.length + let orderOut_for_delivery = false + let i = 0 + const outforDeliveryTimestamps: any = {} + + while (i < noOfFulfillments) { + const fulfillment = on_status.fulfillments[i] + const ffState = fulfillment.state.descriptor.code + + //type should be Delivery + if (fulfillment.type != 'Delivery') { + i++ + continue + } + + if (ffState === constants.ORDER_OUT_FOR_DELIVERY) { + orderOut_for_delivery = true + const out_for_delivery_time = fulfillment.start.time.timestamp + outforDeliveryTimestamps[fulfillment.id] = out_for_delivery_time + if (!out_for_delivery_time) { + onStatusObj.out_for_delivery_time = `Out_for_delivery timestamp is missing` + } else { + try { + //checking out for delivery time matching with context timestamp + if (!_.lte(out_for_delivery_time, contextTime)) { + onStatusObj.out_for_delivery_time = `Fulfillments start timestamp should match context/timestamp and can't be future dated` + } + } catch (error) { + logger.error( + `!!Error while checking Out_for_delivery time matching with context timestamp in /${constants.ON_STATUS}_${state}`, + error, + ) + } + + try { + //checking order/updated_at timestamp + if (!_.gte(on_status.updated_at, out_for_delivery_time)) { + onStatusObj.updatedAt = `order/updated_at timestamp can't be less than the Out_for_delivery time` + } + + if (!_.gte(contextTime, on_status.updated_at)) { + onStatusObj.updatedAtTime = `order/updated_at timestamp can't be future dated (should match context/timestamp)` + } + } catch (error) { + logger.error( + `!!Error while checking order/updated_at timestamp in /${constants.ON_STATUS}_${state}`, + error, + ) + } + } + } + + i++ + } + + try { + // Checking fulfillment.id, fulfillment.type and tracking + logger.info('Checking fulfillment.id, fulfillment.type and tracking') + on_status.fulfillments.forEach((ff: any) => { + let ffId = '' + + if (!ff.id) { + logger.info(`Fulfillment Id must be present `) + onStatusObj['ffId'] = `Fulfillment Id must be present` + } + + ffId = ff.id + if (ff.type != 'Cancel') { + if (getValue(`${ffId}_tracking`)) { + if (ff.tracking === false || ff.tracking === true) { + if (getValue(`${ffId}_tracking`) != ff.tracking) { + logger.info(`Fulfillment Tracking mismatch with the ${constants.ON_SELECT} call`) + onStatusObj['ffTracking'] = `Fulfillment Tracking mismatch with the ${constants.ON_SELECT} call` + } + } else { + logger.info(`Tracking must be present for fulfillment ID: ${ff.id} in boolean form`) + onStatusObj['ffTracking'] = `Tracking must be present for fulfillment ID: ${ff.id} in boolean form` + } + } + } + }) + } catch (error: any) { + logger.info(`Error while checking fulfillments id, type and tracking in /${constants.ON_STATUS}`) + } + + setValue('outforDeliveryTimestamps', outforDeliveryTimestamps) + + if (!orderOut_for_delivery) { + onStatusObj.noOrdrOut_for_delivery = `fulfillments/state Should be ${state} for /${constants.ON_STATUS}_${constants.ORDER_OUT_FOR_DELIVERY}` + } + } catch (error: any) { + logger.info( + `Error while checking out for delivery timestamp in /${constants.ON_STATUS}_${state}.json Error: ${error.stack}`, + ) + } + try { + if (flow === FLOW.FLOW012) { + logger.info('Payment status check in on status out for delivery call') + const payment = on_status.payment + if (payment.status !== PAYMENT_STATUS.NOT_PAID) { + logger.error(`Payment status should be ${PAYMENT_STATUS.NOT_PAID} for ${FLOW.FLOW012} flow (Cash on Delivery)`) + onStatusObj.pymntstatus = `Payment status should be ${PAYMENT_STATUS.NOT_PAID} for ${FLOW.FLOW012} flow (Cash on Delivery)` + } + } + } catch (err: any) { + logger.error('Error while checking payment in message/order/payment: ' + err.message) + } + + if (flow === '6' || flow === '2' || flow === '3' || flow === '5') { + try { + // For Delivery Object + const fulfillments = on_status.fulfillments + if (!fulfillments.length) { + const key = `missingFulfillments` + onStatusObj[key] = `missingFulfillments is mandatory for ${ApiSequence.ON_STATUS_OUT_FOR_DELIVERY}` + } else { + fulfillments.forEach((ff: any, i: number) => { + if (ff.type == 'Delivery' && !_.isEqual(ff?.start?.time?.timestamp, getValue('deliveryTmpStmp'))) { + onStatusObj[`message/order.fulfillments/${i}`] = + `Mismatch occur while comparing ${ff.type} fulfillment start timestamp with the ${ApiSequence.ON_STATUS_PICKED}` + } + }) + let i: number = 0 + fulfillmentsItemsSet.forEach((obj1: any) => { + const keys = Object.keys(obj1) + + let obj2: any = _.filter(fulfillments, { type: `${obj1.type}` }) + let apiSeq = + obj1.type === 'Cancel' + ? ApiSequence.ON_UPDATE_PART_CANCEL + : getValue('onCnfrmState') === 'Accepted' + ? ApiSequence.ON_CONFIRM + : ApiSequence.ON_STATUS_PENDING + if (obj2.length > 0) { + obj2 = obj2[0] + if (obj2.type == 'Delivery') { + delete obj2?.tags + delete obj2?.agent + delete obj2?.start?.instructions + delete obj2?.end?.instructions + delete obj2?.start?.time?.timestamp + delete obj2?.state + } + apiSeq = + obj2.type === 'Cancel' + ? ApiSequence.ON_UPDATE_PART_CANCEL + : getValue('onCnfrmState') === 'Accepted' + ? ApiSequence.ON_CONFIRM + : ApiSequence.ON_STATUS_PENDING + const errors = compareFulfillmentObject(obj1, obj2, keys, i, apiSeq) + if (errors.length > 0) { + errors.forEach((item: any) => { + onStatusObj[item.errKey] = item.errMsg + }) + } + } else { + onStatusObj[`message/order.fulfillments/${i}`] = + `Missing fulfillment type '${obj1.type}' in ${ApiSequence.ON_STATUS_OUT_FOR_DELIVERY} as compared to ${apiSeq}` + } + i++ + }) + } + } catch (error: any) { + logger.error( + `Error while checking Fulfillments Delivery Obj in /${ApiSequence.ON_STATUS_OUT_FOR_DELIVERY}, ${error.stack}`, + ) + } + } + + if (flow === FLOW.FLOW020) { + const fulfillments = on_status.fulfillments + + fulfillments?.forEach((fulfillment: any) => { + const tags = fulfillment.tags || [] + const delayTag = tags.find((tag: { code: string }) => tag.code === 'fulfillment_delay') + const fulfillmentDelayTagList = getValue('fulfillmentDelayTagList') + + const Errors = compareAllObjects(delayTag.list, fulfillmentDelayTagList) + + if (!Errors.isEqual || !Errors.isObj1InObj2 || !Errors.isObj2InObj1 || !Errors.isContained) { + const key = `missingFulfillmentTags` + onStatusObj[key] = `missingFulfillmentTags are mandatory for ${ApiSequence.ON_STATUS_OUT_FOR_DELIVERY}` + } + }) + } + if (flow === FLOW.FLOW01C) { + const fulfillments = on_status.fulfillments + const deliveryFulfillment = fulfillments.find((f: any) => f.type === 'Delivery') + + if (!deliveryFulfillment.hasOwnProperty('provider_id')) { + onStatusObj['missingFulfillments'] = + `provider_id must be present in ${ApiSequence.ON_STATUS_OUT_FOR_DELIVERY} as order is accepted` + } + + const id = getProviderId(deliveryFulfillment) + const fulfillmentProviderId = getValue('fulfillmentProviderId') + + if (deliveryFulfillment.hasOwnProperty('provider_id') && id !== fulfillmentProviderId) { + onStatusObj['providerIdMismatch'] = + `provider_id in fulfillment in ${ApiSequence.ON_CONFIRM} does not match expected provider_id: expected '${fulfillmentProviderId}' in ${ApiSequence.ON_STATUS_OUT_FOR_DELIVERY} but got ${id}` + } + } + + try { + const credsWithProviderId = getValue('credsWithProviderId') + const providerId = on_status?.provider?.id + const confirmCreds = on_status?.provider?.creds + const found = credsWithProviderId.find((ele: { providerId: any }) => ele.providerId === providerId) + const expectedCreds = found?.creds + if (!expectedCreds) { + onStatusObj['MissingCreds'] = `creds must be present in /${constants.ON_STATUS_OUT_FOR_DELIVERY}` + } + if (flow === FLOW.FLOW017) { + + if (!expectedCreds) { + onStatusObj['MissingCreds'] = `creds must be present in /${constants.ON_SEARCH}` + } else if (!deepCompare(expectedCreds, confirmCreds)) { + console.log('here inside else') + onStatusObj['MissingCreds'] = `creds must be present and same as in /${constants.ON_SEARCH}` + } + } + } catch (err: any) { + logger.error(`!!Some error occurred while checking /${constants.ON_STATUS} API`, err) + } + + } + + return onStatusObj + } catch (err: any) { + logger.error(`!!Some error occurred while checking /${constants.ON_STATUS} API`, err) + } +} diff --git a/utils/Retail_.1.2.5/Status/onStatusPacked.ts b/utils/Retail_.1.2.5/Status/onStatusPacked.ts new file mode 100644 index 00000000..7303cfc0 --- /dev/null +++ b/utils/Retail_.1.2.5/Status/onStatusPacked.ts @@ -0,0 +1,466 @@ +/* eslint-disable no-prototype-builtins */ +import _ from 'lodash' +import constants, { ApiSequence, PAYMENT_STATUS } from '../../../constants' +import { logger } from '../../../shared/logger' +import { + validateSchemaRetailV2, + isObjectEmpty, + checkContext, + areTimestampsLessThanOrEqualTo, + compareTimeRanges, + compareFulfillmentObject, + getProviderId, + deepCompare, +} from '../..' +import { getValue, setValue } from '../../../shared/dao' +import { FLOW } from '../../enum' + +export const checkOnStatusPacked = (data: any, state: string, msgIdSet: any, fulfillmentsItemsSet: any) => { + const onStatusObj: any = {} + try { + if (!data || isObjectEmpty(data)) { + return { [ApiSequence.ON_STATUS_PACKED]: 'JSON cannot be empty' } + } + + const flow = getValue('flow') + const replaceValue = getValue('replaceValue)') + const replacementFulfillment = getValue('replacementFulfillment') + const { message, context }: any = data + if (!message || !context || isObjectEmpty(message)) { + return { missingFields: '/context, /message, is missing or empty' } + } + + if (!_.isEqual(data.context.domain.split(':')[1], getValue(`domain`))) { + onStatusObj[`Domain[${data.context.action}]`] = `Domain should be same in each action` + } + + const searchContext: any = getValue(`${ApiSequence.SEARCH}_context`) + const schemaValidation = validateSchemaRetailV2('RET11', constants.ON_STATUS, data) + const contextRes: any = checkContext(context, constants.ON_STATUS) + + if (schemaValidation !== 'error') { + Object.assign(onStatusObj, schemaValidation) + } + + if (!contextRes?.valid) { + Object.assign(onStatusObj, contextRes.ERRORS) + } + + try { + logger.info(`Adding Message Id /${constants.ON_STATUS_PACKED}`) + if (msgIdSet.has(context.message_id)) { + onStatusObj[`${ApiSequence.ON_STATUS_PACKED}_msgId`] = `Message id should not be same with previous calls` + } + msgIdSet.add(context.message_id) + } catch (error: any) { + logger.error(`!!Error while checking message id for /${constants.ON_STATUS_PACKED}, ${error.stack}`) + } + + setValue(`${ApiSequence.ON_STATUS_PACKED}`, data) + + const pending_message_id: string | null = getValue('pending_message_id') + const packed_message_id: string = context.message_id + + setValue(`packed_message_id`, packed_message_id) + + try { + logger.info( + `Comparing message_id for unsolicited calls for ${constants.ON_STATUS}.pending and ${constants.ON_STATUS}.packed`, + ) + + if (pending_message_id === packed_message_id) { + onStatusObj['invalid_message_id'] = + `Message_id cannot be same for ${constants.ON_STATUS}.pending and ${constants.ON_STATUS}.packed` + } + } catch (error: any) { + logger.error( + `Error while comparing message_id for ${constants.ON_STATUS}.pending and ${constants.ON_STATUS}.packed`, + ) + } + + try { + logger.info(`Checking context for /${constants.ON_STATUS} API`) //checking context + const res: any = checkContext(context, constants.ON_STATUS) + if (!res.valid) { + Object.assign(onStatusObj, res.ERRORS) + } + } catch (error: any) { + logger.error(`!!Some error occurred while checking /${constants.ON_STATUS} context, ${error.stack}`) + } + + try { + logger.info(`Comparing city of /${constants.SEARCH} and /${constants.ON_STATUS}`) + if (!_.isEqual(searchContext.city, context.city)) { + onStatusObj.city = `City code mismatch in /${constants.SEARCH} and /${constants.ON_STATUS}` + } + } catch (error: any) { + logger.error(`!!Error while comparing city in /${constants.SEARCH} and /${constants.ON_STATUS}, ${error.stack}`) + } + + try { + logger.info(`Comparing transaction Ids of /${constants.SELECT} and /${constants.ON_STATUS}`) + if (!_.isEqual(getValue('txnId'), context.transaction_id)) { + onStatusObj.txnId = `Transaction Id should be same from /${constants.SELECT} onwards` + } + } catch (error: any) { + logger.info( + `!!Error while comparing transaction ids for /${constants.SELECT} and /${constants.ON_STATUS} api, ${error.stack}`, + ) + } + + const on_status = message.order + if (state === ApiSequence.REPLACEMENT_ON_STATUS_PACKED || replaceValue === 'yes') { + console.log('replacementFulfillment', replacementFulfillment) + try { + const orderState = on_status.state ? (on_status.state === 'Completed' ? true : false) : false + if (!orderState) { + onStatusObj['rplcmntOrderState'] = + `Mismatch ${ApiSequence.REPLACEMENT_ON_STATUS_PENDING} and ${ApiSequence.ON_UPDATE_REPLACEMENT} and order state should be completed` + } + logger.info(`Comparing order Id in /${constants.ON_CONFIRM} and /${constants.REPLACEMENT_ON_STATUS_PACKED}`) + if (on_status.id != getValue('cnfrmOrdrId')) { + logger.info(`Order id (/${constants.REPLACEMENT_ON_STATUS_PACKED}) mismatches with /${constants.CONFIRM})`) + onStatusObj.onStatusOdrId = `Order id in /${constants.CONFIRM} and /${constants.REPLACEMENT_ON_STATUS_PACKED} do not match` + } + } catch (error) { + logger.info( + `!!Error while comparing order id in /${constants.REPLACEMENT_ON_STATUS_PACKED} and /${constants.CONFIRM}`, + error, + ) + } + try { + logger.info(`Comparing timestamp of /${constants.ON_STATUS}_Pending and /${constants.ON_STATUS}_${state} API`) + if (_.gte(getValue('tmstmp'), context.timestamp)) { + onStatusObj.inVldTmstmp = `Timestamp for /${constants.ON_STATUS}_Pending api cannot be greater than or equal to /${constants.REPLACEMENT_ON_STATUS_PACKED} api` + } + setValue('tmpstmp', context.timestamp) + } catch (error: any) { + logger.error( + `!!Error occurred while comparing timestamp for /${constants.REPLACEMENT_ON_STATUS_PACKED}, ${error.stack}`, + ) + } + try { + if (!_.isEqual(getValue(`cnfrmTmpstmp`), on_status.created_at)) { + onStatusObj.tmpstmp = `Created At timestamp for /${constants.REPLACEMENT_ON_STATUS_PACKED}.message.order should be equal to context timestamp at ${constants.CONFIRM}` + } + } catch (error: any) { + logger.error( + `!!Error occurred while comparing timestamp for /${constants.REPLACEMENT_ON_STATUS_PACKED}, ${error.stack}`, + ) + } + try { + logger.info( + `Comparing timestamp of /${constants.ON_CONFIRM} and /${constants.REPLACEMENT_ON_STATUS_PACKED} API`, + ) + if (_.gte(getValue('onCnfrmtmpstmp'), context.timestamp)) { + onStatusObj.tmpstmp1 = `Timestamp for /${constants.ON_CONFIRM} api cannot be greater than or equal to /${constants.REPLACEMENT_ON_STATUS_PACKED} api` + } + } catch (error: any) { + logger.error(`!!Error occurred while comparing timestamp for /${constants.ON_STATUS}_${state}, ${error.stack}`) + } + + try { + logger.info(`comparing fulfillment ranges `) + // const storedFulfillment = getValue(`deliveryFulfillment`) + const deliveryFulfillment = on_status.fulfillments.filter( + (fulfillment: any) => fulfillment.id === replacementFulfillment.id, + ) + // const storedFulfillmentAction = getValue('deliveryFulfillmentAction') + if (deliveryFulfillment.length === 0) { + onStatusObj['rplcmnt-fulfillment'] = + `Fulfillment with id :${replacementFulfillment.id} not found in ${ApiSequence.REPLACEMENT_ON_STATUS_PACKED} fulfillments` + return onStatusObj + } + console.log("delivery fulfillment in "); + + if (deliveryFulfillment[0].state.descriptor.code !== 'Packed') { + onStatusObj['rplcmnt-fulfillment'] = + `Fulfillment with id :${replacementFulfillment.id} should have fulfillment/state/descriptor/code to be Packed` + return onStatusObj + } + const fulfillmentRangeerrors = compareTimeRanges( + replacementFulfillment, + ApiSequence.REPLACEMENT_ON_STATUS_PACKED, + deliveryFulfillment[0], + ApiSequence.ON_STATUS_PACKED, + ) + if (fulfillmentRangeerrors) { + let i = 0 + const len = fulfillmentRangeerrors.length + while (i < len) { + const key = `fulfilmntRngErr${i}` + onStatusObj[key] = `${fulfillmentRangeerrors[i]}` + i++ + } + } + } catch (error: any) { + logger.error(`Error while comparing fulfillment ranges , ${error.stack}`) + } + + try { + // Checking fulfillment.id, fulfillment.type and tracking + logger.info('Checking fulfillment.id, fulfillment.type and tracking') + on_status.fulfillments.forEach((ff: any) => { + let ffId = '' + + if (!ff.id) { + logger.info(`Fulfillment Id must be present `) + onStatusObj['ffId'] = `Fulfillment Id must be present` + } + + ffId = ff.id + if (ff.type != 'Cancel') { + if (`${ffId}_tracking`) { + if (ff.tracking === false || ff.tracking === true) { + if (getValue(`${ffId}_tracking`) != ff.tracking) { + logger.info(`Fulfillment Tracking mismatch with the ${constants.ON_SELECT} call`) + onStatusObj['ffTracking'] = `Fulfillment Tracking mismatch with the ${constants.ON_SELECT} call` + } + } else { + logger.info(`Tracking must be present for fulfillment ID: ${ff.id} in boolean form`) + onStatusObj['ffTracking'] = `Tracking must be present for fulfillment ID: ${ff.id} in boolean form` + } + } + } + }) + } catch (error: any) { + logger.info(`Error while checking fulfillments id, type and tracking in /${constants.ON_STATUS}`) + } + + const contextTime = context.timestamp + try { + logger.info( + `Comparing order.updated_at and context timestamp for /${constants.REPLACEMENT_ON_STATUS_PACKED} API`, + ) + + if (!areTimestampsLessThanOrEqualTo(on_status.updated_at, contextTime)) { + onStatusObj.tmpstmp2 = ` order.updated_at timestamp should be less than or eqaul to context timestamp for /${constants.REPLACEMENT_ON_STATUS_PACKED} api` + } + } catch (error: any) { + logger.error( + `!!Error occurred while comparing order updated at for /${constants.REPLACEMENT_ON_STATUS_PACKED}, ${error.stack}`, + ) + } + } + if (state === 'packed') { + try { + logger.info(`Comparing order Id in /${constants.ON_CONFIRM} and /${constants.ON_STATUS}_${state}`) + if (on_status.id != getValue('cnfrmOrdrId')) { + logger.info(`Order id (/${constants.ON_STATUS}_${state}) mismatches with /${constants.CONFIRM})`) + onStatusObj.onStatusOdrId = `Order id in /${constants.CONFIRM} and /${constants.ON_STATUS}_${state} do not match` + } + } catch (error) { + logger.info( + `!!Error while comparing order id in /${constants.ON_STATUS}_${state} and /${constants.CONFIRM}`, + error, + ) + } + + try { + logger.info(`Comparing timestamp of /${constants.ON_STATUS}_Pending and /${constants.ON_STATUS}_${state} API`) + if (_.gte(getValue('tmstmp'), context.timestamp)) { + onStatusObj.inVldTmstmp = `Timestamp for /${constants.ON_STATUS}_Pending api cannot be greater than or equal to /${constants.ON_STATUS}_${state} api` + } + setValue('tmpstmp', context.timestamp) + } catch (error: any) { + logger.error(`!!Error occurred while comparing timestamp for /${constants.ON_STATUS}_${state}, ${error.stack}`) + } + try { + if (!_.isEqual(getValue(`cnfrmTmpstmp`), on_status.created_at)) { + onStatusObj.tmpstmp = `Created At timestamp for /${constants.ON_STATUS}_${state}.message.order should be equal to context timestamp at ${constants.CONFIRM}` + } + } catch (error: any) { + logger.error(`!!Error occurred while comparing timestamp for /${constants.ON_STATUS}_${state}, ${error.stack}`) + } + try { + logger.info(`Comparing timestamp of /${constants.ON_CONFIRM} and /${constants.ON_STATUS}_${state} API`) + if (_.gte(getValue('onCnfrmtmpstmp'), context.timestamp)) { + onStatusObj.tmpstmp1 = `Timestamp for /${constants.ON_CONFIRM} api cannot be greater than or equal to /${constants.ON_STATUS}_${state} api` + } + } catch (error: any) { + logger.error(`!!Error occurred while comparing timestamp for /${constants.ON_STATUS}_${state}, ${error.stack}`) + } + + try { + logger.info(`comparing fulfillment ranges `) + const storedFulfillment = getValue(`deliveryFulfillment`) + const deliveryFulfillment = on_status.fulfillments.filter((fulfillment: any) => fulfillment.type === 'Delivery') + const storedFulfillmentAction = getValue('deliveryFulfillmentAction') + const fulfillmentRangeerrors = compareTimeRanges( + storedFulfillment, + storedFulfillmentAction, + deliveryFulfillment[0], + ApiSequence.ON_STATUS_PACKED, + ) + if (fulfillmentRangeerrors) { + let i = 0 + const len = fulfillmentRangeerrors.length + while (i < len) { + const key = `fulfilmntRngErr${i}` + onStatusObj[key] = `${fulfillmentRangeerrors[i]}` + i++ + } + } + } catch (error: any) { + logger.error(`Error while comparing fulfillment ranges , ${error.stack}`) + } + + try { + // Checking fulfillment.id, fulfillment.type and tracking + logger.info('Checking fulfillment.id, fulfillment.type and tracking') + on_status.fulfillments.forEach((ff: any) => { + let ffId = '' + + if (!ff.id) { + logger.info(`Fulfillment Id must be present `) + onStatusObj['ffId'] = `Fulfillment Id must be present` + } + + ffId = ff.id + if (ff.type != 'Cancel') { + if (`${ffId}_tracking`) { + if (ff.tracking === false || ff.tracking === true) { + if (getValue(`${ffId}_tracking`) != ff.tracking) { + logger.info(`Fulfillment Tracking mismatch with the ${constants.ON_SELECT} call`) + onStatusObj['ffTracking'] = `Fulfillment Tracking mismatch with the ${constants.ON_SELECT} call` + } + } else { + logger.info(`Tracking must be present for fulfillment ID: ${ff.id} in boolean form`) + onStatusObj['ffTracking'] = `Tracking must be present for fulfillment ID: ${ff.id} in boolean form` + } + } + } + }) + } catch (error: any) { + logger.info(`Error while checking fulfillments id, type and tracking in /${constants.ON_STATUS}`) + } + + const contextTime = context.timestamp + try { + logger.info(`Comparing order.updated_at and context timestamp for /${constants.ON_STATUS}_${state} API`) + + if (!areTimestampsLessThanOrEqualTo(on_status.updated_at, contextTime)) { + onStatusObj.tmpstmp2 = ` order.updated_at timestamp should be less than or eqaul to context timestamp for /${constants.ON_STATUS}_${state} api` + } + } catch (error: any) { + logger.error( + `!!Error occurred while comparing order updated at for /${constants.ON_STATUS}_${state}, ${error.stack}`, + ) + } + try { + if (flow === FLOW.FLOW012) { + logger.info('Payment status check in on status packed call') + const payment = on_status.payment + if (payment.status !== PAYMENT_STATUS.NOT_PAID) { + logger.error(`Payment status should be ${PAYMENT_STATUS.NOT_PAID} for ${FLOW.FLOW012} flow (Cash on Delivery)`); + onStatusObj.pymntstatus = `Payment status should be ${PAYMENT_STATUS.NOT_PAID} for ${FLOW.FLOW012} flow (Cash on Delivery)` + } + } + } catch (err: any) { + logger.error('Error while checking payment in message/order/payment: ' + err.message) + } + + try { + logger.info(`Checking order state in /${constants.ON_STATUS}_${state}`) + if (on_status.state != 'In-progress') { + onStatusObj.ordrState = `order/state should be "In-progress" for /${constants.ON_STATUS}_${state}` + } + } catch (error: any) { + logger.error(`!!Error while checking order state in /${constants.ON_STATUS}_${state} Error: ${error.stack}`) + } + + if (flow === '6' || flow === '2' || flow === '3' || flow === '5') { + try { + // For Delivery Object + const fulfillments = on_status.fulfillments + if (!fulfillments.length) { + const key = `missingFulfillments` + onStatusObj[key] = `missingFulfillments is mandatory for ${ApiSequence.ON_STATUS_PACKED}` + } else { + let i: number = 0 + fulfillmentsItemsSet.forEach((obj1: any) => { + const keys = Object.keys(obj1) + + let obj2: any = _.filter(fulfillments, { type: `${obj1.type}` }) + let apiSeq = + obj1.type === 'Cancel' + ? ApiSequence.ON_UPDATE_PART_CANCEL + : getValue('onCnfrmState') === 'Accepted' + ? ApiSequence.ON_CONFIRM + : ApiSequence.ON_STATUS_PENDING + if (obj2.length > 0) { + obj2 = obj2[0] + if (obj2.type == 'Delivery') { + delete obj2?.start?.instructions + delete obj2?.end?.instructions + delete obj2?.tags + delete obj2?.state + } + apiSeq = + obj2.type === 'Cancel' + ? ApiSequence.ON_UPDATE_PART_CANCEL + : getValue('onCnfrmState') === 'Accepted' + ? ApiSequence.ON_CONFIRM + : ApiSequence.ON_STATUS_PENDING + const errors = compareFulfillmentObject(obj1, obj2, keys, i, apiSeq) + if (errors.length > 0) { + errors.forEach((item: any) => { + onStatusObj[item.errKey] = item.errMsg + }) + } + } else { + onStatusObj[`message/order.fulfillments/${i}`] = + `Missing fulfillment type '${obj1.type}' in ${ApiSequence.ON_STATUS_PACKED} as compared to ${apiSeq}` + } + i++ + }) + } + } catch (error: any) { + logger.error( + `Error while checking Fulfillments Delivery Obj in /${ApiSequence.ON_STATUS_PACKED}, ${error.stack}`, + ) + } + } + try { + const credsWithProviderId = getValue('credsWithProviderId') + const providerId = on_status?.provider?.id + const confirmCreds = on_status?.provider?.creds + const found = credsWithProviderId.find((ele: { providerId: any }) => ele.providerId === providerId) + const expectedCreds = found?.creds + if (!expectedCreds) { + onStatusObj['MissingCreds'] = + `creds must be present in /${constants.ON_CANCEL} same as in /${constants.ON_SEARCH}` + } + if (flow === FLOW.FLOW017) { + if (!expectedCreds) { + onStatusObj['MissingCreds'] = `creds must be present in /${constants.ON_STATUS_PACKED} ` + } else if (!deepCompare(expectedCreds, confirmCreds)) { + onStatusObj['MissingCreds'] = `creds must be present and same as in /${constants.ON_SEARCH}` + } + } + } catch (err: any) { + logger.error(`!!Some error occurred while checking /${constants.ON_STATUS} API`, err) + } + if (flow === FLOW.FLOW01C) { + const fulfillments = on_status.fulfillments + const deliveryFulfillment = fulfillments.find((f: any) => f.type === 'Delivery') + + if (!deliveryFulfillment.hasOwnProperty('provider_id')) { + onStatusObj['missingFulfillments'] = + `provider_id must be present in ${ApiSequence.ON_STATUS_PACKED} as order is accepted` + } + + const id = getProviderId(deliveryFulfillment) + const fulfillmentProviderId = getValue('fulfillmentProviderId') + + if (deliveryFulfillment.hasOwnProperty('provider_id') && id !== fulfillmentProviderId) { + onStatusObj['providerIdMismatch'] = + `provider_id in fulfillment in ${ApiSequence.ON_CONFIRM} does not match expected provider_id: expected '${fulfillmentProviderId}' in ${ApiSequence.ON_STATUS_PACKED} but got ${id}` + } + } + } + return onStatusObj + } catch (err: any) { + logger.error(`!!Some error occurred while checking /${constants.ON_STATUS} API`, err) + } +} diff --git a/utils/Retail_.1.2.5/Status/onStatusPending.ts b/utils/Retail_.1.2.5/Status/onStatusPending.ts new file mode 100644 index 00000000..48bd3c98 --- /dev/null +++ b/utils/Retail_.1.2.5/Status/onStatusPending.ts @@ -0,0 +1,432 @@ +/* eslint-disable no-prototype-builtins */ +import _ from 'lodash' +import constants, { ApiSequence, PAYMENT_STATUS } from '../../../constants' +import { logger } from '../../../shared/logger' +import { FLOW } from '../../enum' +import { + validateSchemaRetailV2, + isObjectEmpty, + checkContext, + areTimestampsLessThanOrEqualTo, + payment_status, + compareTimeRanges, + compareCoordinates, + getProviderId, + deepCompare, +} from '../..' +import { getValue, setValue } from '../../../shared/dao' + +export const checkOnStatusPending = (data: any, state: string, msgIdSet: any, fulfillmentsItemsSet: any) => { + const onStatusObj: any = {} + const flow = getValue('flow') + const replaceValue = getValue('replaceValue)') + const { message, context }: any = data + if (!message || !context || isObjectEmpty(message)) { + return { missingFields: '/context, /message, is missing or empty' } + } + try { + const searchContext: any = getValue(`${ApiSequence.SEARCH}_context`) + const schemaValidation = validateSchemaRetailV2(context.domain.split(':')[1], constants.ON_STATUS, data) + const contextRes: any = checkContext(context, constants.ON_STATUS) + + if (schemaValidation !== 'error') { + Object.assign(onStatusObj, schemaValidation) + } + + if (!contextRes?.valid) { + Object.assign(onStatusObj, contextRes.ERRORS) + } + + if (!_.isEqual(data.context.domain.split(':')[1], getValue(`domain`))) { + onStatusObj[`Domain[${data.context.action}]`] = `Domain should be same in each action` + } + + try { + logger.info(`Adding Message Id /${constants.ON_STATUS_PENDING}`) + if (msgIdSet.has(context.message_id)) { + onStatusObj[`${ApiSequence.ON_STATUS_PENDING}_msgId`] = `Message id should not be same with previous calls` + } + msgIdSet.add(context.message_id) + } catch (error: any) { + logger.error(`!!Error while checking message id for /${constants.ON_STATUS_PENDING}, ${error.stack}`) + } + + setValue(`${ApiSequence.ON_STATUS_PENDING}`, data) + setValue('pending_message_id', context.message_id) + + try { + logger.info(`Checking context for /${constants.ON_STATUS} API`) //checking context + const res: any = checkContext(context, constants.ON_STATUS) + if (!res.valid) { + Object.assign(onStatusObj, res.ERRORS) + } + } catch (error: any) { + logger.error(`!!Some error occurred while checking /${constants.ON_STATUS} context, ${error.stack}`) + } + + try { + logger.info(`Comparing city of /${constants.SEARCH} and /${constants.ON_STATUS}`) + if (!_.isEqual(searchContext.city, context.city)) { + onStatusObj.city = `City code mismatch in /${constants.SEARCH} and /${constants.ON_STATUS}` + } + } catch (error: any) { + logger.error(`!!Error while comparing city in /${constants.SEARCH} and /${constants.ON_STATUS}, ${error.stack}`) + } + + try { + logger.info(`Comparing transaction Ids of /${constants.SELECT} and /${constants.ON_STATUS}`) + if (!_.isEqual(getValue('txnId'), context.transaction_id)) { + onStatusObj.txnId = `Transaction Id should be same from /${constants.SELECT} onwards` + } + } catch (error: any) { + logger.info( + `!!Error while comparing transaction ids for /${constants.SELECT} and /${constants.ON_STATUS} api, ${error.stack}`, + ) + } + + } catch (error:any) { + console.log(`Error while checking ${ApiSequence.REPLACEMENT_ON_STATUS_PENDING}`,error.message) + } + try { + if(state === ApiSequence.REPLACEMENT_ON_STATUS_PENDING || replaceValue === "yes"){ + const replacementFulfillment = getValue("replacementFulfillment") + console.log("replacementFulfillment",replacementFulfillment); + + if(!replacementFulfillment){ + onStatusObj["rplcmnt"] = `Fulfillment for replacement is required.` + return + } + // const onUpdateReplacementState = replacementFulfillment.state.descriptor.code + const on_status = message.order + try { + const orderState = on_status.state ? (on_status.state === "Completed" ? true : false) : false + if(!orderState){ + onStatusObj["rplcmntOrderState"] = `Mismatch ${ApiSequence.REPLACEMENT_ON_STATUS_PENDING} and ${ApiSequence.ON_UPDATE_REPLACEMENT} and order state should be completed` + } + logger.info(`Comparing order Id in /${constants.ON_CONFIRM} and /${constants.REPLACEMENT_ON_STATUS_PENDING}`) + if (on_status.id != getValue('cnfrmOrdrId')) { + logger.info(`Order id (/${constants.REPLACEMENT_ON_STATUS_PENDING}) mismatches with /${constants.CONFIRM})`) + onStatusObj.onStatusOdrId = `Order id in /${constants.CONFIRM} and /${constants.REPLACEMENT_ON_STATUS_PENDING} do not match` + } + } catch (error) { + logger.info( + `!!Error while comparing order id in /${constants.REPLACEMENT_ON_STATUS_PENDING} and /${constants.CONFIRM}`, + error, + ) + } + try { + // Checking fulfillment.id, fulfillment.type and tracking + logger.info('Checking fulfillment.id, fulfillment.type and tracking') + on_status.fulfillments.forEach((ff: any) => { + let ffId = '' + + if (!ff.id) { + logger.info(`Fulfillment Id must be present `) + onStatusObj['ffId'] = `Fulfillment Id must be present` + } + + ffId = ff.id + if (ff.type != "Cancel") { + if (getValue(`${ffId}_tracking`)) { + if (ff.tracking === false || ff.tracking === true) { + if (getValue(`${ffId}_tracking`) != ff.tracking) { + logger.info(`Fulfillment Tracking mismatch with the ${constants.ON_SELECT} call`) + onStatusObj['ffTracking'] = `Fulfillment Tracking mismatch with the ${constants.ON_SELECT} call` + } + } else { + logger.info(`Tracking must be present for fulfillment ID: ${ff.id} in boolean form`) + onStatusObj['ffTracking'] = `Tracking must be present for fulfillment ID: ${ff.id} in boolean form` + } + } + } + }) + } catch (error: any) { + logger.info(`Error while checking fulfillments id, type and tracking in /${constants.ON_STATUS}_${state}`) + } + + try { + logger.info(`Storing delivery fulfillment if not present in ${constants.ON_CONFIRM} and comparing if present`) + + const deliveryFulfillment = on_status.fulfillments.find((fulfillment: any) => fulfillment.id === replacementFulfillment.id) + console.log("deliveryFulfillment in replacement",deliveryFulfillment); + + if(!deliveryFulfillment){ + onStatusObj["rplcmnt-fulfillment"] = `Fulfillment with id :${replacementFulfillment.id} not found in ${ApiSequence.REPLACEMENT_ON_STATUS_PENDING} fulfillments` + return onStatusObj + } + try { + setValue(`replacementFulfillmentPendingStatus`, deliveryFulfillment) + if (!deliveryFulfillment['@ondc/org/TAT']) { + onStatusObj[`message.order.fulfillments[${deliveryFulfillment.id}]`] = + `'TAT' must be provided in message/order/fulfillments` + } + // Comparing on_confirm delivery fulfillment with on_update replace fulfillment + const ffDesc = deliveryFulfillment.state.descriptor + + const ffStateCheck = ffDesc.hasOwnProperty('code') ? ffDesc.code === 'Pending' : false + setValue(`ffIdPrecancel`, ffDesc?.code) + if (!ffStateCheck) { + const key = `ffState:fulfillment[id]:${deliveryFulfillment.id}` + onStatusObj[key] = `default fulfillments state is missing in /${constants.ON_UPDATE_REPLACEMENT}` + } + + if (!deliveryFulfillment.start || !deliveryFulfillment.end) { + onStatusObj.ffstartend = `fulfillments start and end locations are mandatory for fulfillment id: ${deliveryFulfillment.id}` + } + + try { + if (!compareCoordinates(deliveryFulfillment.start.location.gps, getValue('providerGps'))) { + onStatusObj.sellerGpsErr = `store gps location /fulfillments/:${deliveryFulfillment.id}/start/location/gps can't change` + } + } catch (error: any) { + logger.error(`!!Error while checking store location in /${constants.ON_UPDATE_REPLACEMENT}, ${error.stack}`) + } + + try { + if (!getValue('providerName')) { + onStatusObj.sellerNameErr = `Invalid store name inside fulfillments in /${constants.ON_UPDATE_REPLACEMENT}` + } else if (!_.isEqual(deliveryFulfillment.start.location.descriptor.name, getValue('providerName'))) { + onStatusObj.sellerNameErr = `store name /fulfillments/start/location/descriptor/name can't change with fulfillment id: ${deliveryFulfillment.id}` + } + } catch (error: any) { + logger.error(`!!Error while checking store name in /${constants.ON_CONFIRM}`) + } + + if (!_.isEqual(deliveryFulfillment.end.location.gps, getValue('buyerGps'))) { + onStatusObj.buyerGpsErr = `fulfillments.end.location gps with id ${deliveryFulfillment.id} is not matching with gps in /on_conifrm` + } + + if (!_.isEqual(deliveryFulfillment.end.location.address.area_code, getValue('buyerAddr'))) { + onStatusObj.gpsErr = `fulfillments.end.location.address.area_code with id ${deliveryFulfillment.id} is not matching with area_code in /on_confirm` + } + } catch (error: any) { + logger.error( + `Error while comparing fulfillment obj ${ApiSequence.ON_UPDATE_REPLACEMENT} and ${ApiSequence.ON_CONFIRM}`, + error.stack, + ) + } + } catch (error: any) { + logger.error(`Error while Storing delivery fulfillment, ${error.stack}`) + } + + } + if(state === "pending"){ + try { + const onConfirmOrderState = getValue('onCnfrmState') + if (!data || isObjectEmpty(data)) { + if (onConfirmOrderState === "Accepted") + return + return { [ApiSequence.ON_STATUS_PENDING]: 'JSON cannot be empty' } + } + + if (onConfirmOrderState === "Accepted") + return { errmsg: "When the onConfirm Order State is 'Accepted', the on_status_pending is not required!" } + const on_status = message.order + try { + logger.info(`Comparing order Id in /${constants.ON_CONFIRM} and /${constants.ON_STATUS}_${state}`) + if (on_status.id != getValue('cnfrmOrdrId')) { + logger.info(`Order id (/${constants.ON_STATUS}_${state}) mismatches with /${constants.CONFIRM})`) + onStatusObj.onStatusOdrId = `Order id in /${constants.CONFIRM} and /${constants.ON_STATUS}_${state} do not match` + } + } catch (error) { + logger.info( + `!!Error while comparing order id in /${constants.ON_STATUS}_${state} and /${constants.CONFIRM}`, + error, + ) + } + + try { + // Checking fulfillment.id, fulfillment.type and tracking + logger.info('Checking fulfillment.id, fulfillment.type and tracking') + on_status.fulfillments.forEach((ff: any) => { + let ffId = '' + + if (!ff.id) { + logger.info(`Fulfillment Id must be present `) + onStatusObj['ffId'] = `Fulfillment Id must be present` + } + + ffId = ff.id + if (ff.type != "Cancel") { + if (getValue(`${ffId}_tracking`)) { + if (ff.tracking === false || ff.tracking === true) { + if (getValue(`${ffId}_tracking`) != ff.tracking) { + logger.info(`Fulfillment Tracking mismatch with the ${constants.ON_SELECT} call`) + onStatusObj['ffTracking'] = `Fulfillment Tracking mismatch with the ${constants.ON_SELECT} call` + } + } else { + logger.info(`Tracking must be present for fulfillment ID: ${ff.id} in boolean form`) + onStatusObj['ffTracking'] = `Tracking must be present for fulfillment ID: ${ff.id} in boolean form` + } + } + } + }) + } catch (error: any) { + logger.info(`Error while checking fulfillments id, type and tracking in /${constants.ON_STATUS}`) + } + + try { + logger.info(`Storing delivery fulfillment if not present in ${constants.ON_CONFIRM} and comparing if present`) + const storedFulfillment = getValue(`deliveryFulfillment`) + console.log("storedFulfillment in on_status pending",storedFulfillment,); + + const deliveryFulfillment = on_status.fulfillments.filter((fulfillment: any) => fulfillment.type === 'Delivery') + console.log("deliveryFulfillment",deliveryFulfillment); + + if (!storedFulfillment) { + setValue('deliveryFulfillment', deliveryFulfillment[0]) + setValue('deliveryFulfillmentAction', ApiSequence.ON_STATUS_PENDING) + } else { + const storedFulfillmentAction = getValue('deliveryFulfillmentAction') + const fulfillmentRangeerrors = compareTimeRanges(storedFulfillment, storedFulfillmentAction, deliveryFulfillment[0], ApiSequence.ON_STATUS_PENDING) + + if (fulfillmentRangeerrors) { + let i = 0 + const len = fulfillmentRangeerrors.length + while (i < len) { + const key = `fulfilmntRngErr${i}` + onStatusObj[key] = `${fulfillmentRangeerrors[i]}` + i++ + } + } + } + } catch (error: any) { + logger.error(`Error while Storing delivery fulfillment, ${error.stack}`) + } + + try { + logger.info(`Validating order state`) + setValue('orderState', on_status.state) + if (on_status.state !== 'Accepted') { + onStatusObj[`order_state`] = + `Order state should be accepted whenever Status is being sent 'Accepted'. Current state: ${on_status.state}` + } + } catch (error: any) { + logger.error(`Error while validating order state, ${error.stack}`) + } + + try { + if (!_.isEqual(getValue(`cnfrmTmpstmp`), on_status.created_at)) { + onStatusObj.tmpstmp = `Created At timestamp for /${constants.ON_STATUS}_${state} should be equal to context timestamp at ${constants.CONFIRM}` + } + } catch (error: any) { + logger.error(`!!Error occurred while comparing timestamp for /${constants.ON_STATUS}_${state}, ${error.stack}`) + } + + try { + logger.info(`Comparing timestamp of /${constants.ON_CONFIRM} and /${constants.ON_STATUS}_${state} API`) + if (_.gte(getValue('onCnfrmtmpstmp'), context.timestamp)) { + onStatusObj.tmpstmp1 = `Timestamp for /${constants.ON_CONFIRM} api cannot be greater than or equal to /${constants.ON_STATUS}_${state} api` + } + setValue('tmpstmp', context.timestamp) + } catch (error: any) { + logger.error(`!!Error occurred while comparing timestamp for /${constants.ON_STATUS}_${state}, ${error.stack}`) + } + + const contextTime = context.timestamp + try { + logger.info(`Comparing order.updated_at and context timestamp for /${constants.ON_STATUS}_${state} API`) + + if (!areTimestampsLessThanOrEqualTo(on_status.updated_at, contextTime)) { + onStatusObj.tmpstmp2 = `order.updated_at timestamp should be less than or eqaul to context timestamp for /${constants.ON_STATUS}_${state} api` + } + } catch (error: any) { + logger.error( + `!!Error occurred while comparing order updated at for /${constants.ON_STATUS}_${state}, ${error.stack}`, + ) + } + try { + logger.info(`Checking if transaction_id is present in message.order.payment`) + const payment = on_status.payment + const status = payment_status(payment, flow) + if (!status) { + onStatusObj['message/order/transaction_id'] = `Transaction_id missing in message/order/payment` + } + } catch (err: any) { + logger.error(`Error while checking transaction is in message.order.payment`) + } + try { + if (flow === FLOW.FLOW012) { + logger.info('Payment status check in on status pending call') + const payment = on_status.payment + if (payment.status !== PAYMENT_STATUS.NOT_PAID) { + logger.error(`Payment status should be ${PAYMENT_STATUS.NOT_PAID} for ${FLOW.FLOW012} flow (Cash on Delivery)`); + onStatusObj.pymntstatus = `Payment status should be ${PAYMENT_STATUS.NOT_PAID} for ${FLOW.FLOW012} flow (Cash on Delivery)` + } + } + } catch (err: any) { + logger.error('Error while checking payment in message/order/payment: ' + err.message); + } + if (flow === '6' || flow === '2' || flow === '3' || flow === '5') { + try { + // For Delivery Object + const fulfillments = on_status.fulfillments + if (!fulfillments.length) { + const key = `missingFulfillments` + onStatusObj[key] = `missingFulfillments is mandatory for ${ApiSequence.ON_STATUS_PENDING}` + } + else { + const deliveryObjArr = _.filter(fulfillments, { type: "Delivery" }) + if (!deliveryObjArr.length) { + onStatusObj[`message/order.fulfillments/`] = `Delivery fullfillment must be present in ${ApiSequence.ON_STATUS_PENDING}` + } + else { + const deliverObj = deliveryObjArr[0] + delete deliverObj?.state + delete deliverObj?.tags + delete deliverObj?.start?.instructions + delete deliverObj?.end?.instructions + fulfillmentsItemsSet.add(deliverObj) + } + } + + } catch (error: any) { + logger.error(`Error while checking Fulfillments Delivery Obj in /${ApiSequence.ON_STATUS_PENDING}, ${error.stack}`) + } + } + try { + const credsWithProviderId = getValue('credsWithProviderId') + const providerId = on_status?.provider?.id + const confirmCreds = on_status?.provider?.creds + const found = credsWithProviderId.find((ele: { providerId: any }) => ele.providerId === providerId) + const expectedCreds = found?.creds + if (!expectedCreds) { + onStatusObj['MissingCreds'] = + `creds must be present in /${constants.ON_CANCEL} same as in /${constants.ON_SEARCH}` + } + if (flow === FLOW.FLOW017) { + if (!expectedCreds) { + onStatusObj['MissingCreds'] = `creds must be present in /${constants.ON_STATUS_PENDING} ` + } else if (!deepCompare(expectedCreds, confirmCreds)) { + onStatusObj['MissingCreds'] = `creds must be present and same as in /${constants.ON_SEARCH}` + } + } + } catch (err: any) { + logger.error(`!!Some error occurred while checking /${constants.ON_STATUS} API`, err) + } + if (flow === FLOW.FLOW01C) { + const fulfillments = on_status.fulfillments + const deliveryFulfillment = fulfillments.find((f: any) => f.type === 'Delivery') + + if (!deliveryFulfillment.hasOwnProperty('provider_id')) { + onStatusObj['missingFulfillments'] = + `provider_id must be present in ${ApiSequence.ON_STATUS_PENDING} as order is accepted` + } + + const id = getProviderId(deliveryFulfillment) + const fulfillmentProviderId = getValue('fulfillmentProviderId') + + if (deliveryFulfillment.hasOwnProperty('provider_id') && id !== fulfillmentProviderId) { + onStatusObj['providerIdMismatch'] = + `provider_id in fulfillment in ${ApiSequence.ON_CONFIRM} does not match expected provider_id: expected '${fulfillmentProviderId}' in ${ApiSequence.ON_STATUS_PENDING} but got ${id}` + } + } + } catch (err: any) { + logger.error(`!!Some error occurred while checking /${constants.ON_STATUS} API`, err) + } + } + return onStatusObj + } catch (error:any) { + console.log(`Error while validationg flow ${flow} for replacement ${ApiSequence.REPLACEMENT_ON_STATUS_PENDING}`,error.message) + } +} diff --git a/utils/Retail_.1.2.5/Status/onStatusPicked.ts b/utils/Retail_.1.2.5/Status/onStatusPicked.ts new file mode 100644 index 00000000..b16df38f --- /dev/null +++ b/utils/Retail_.1.2.5/Status/onStatusPicked.ts @@ -0,0 +1,853 @@ +/* eslint-disable no-prototype-builtins */ +import _ from 'lodash' +import constants, { ApiSequence, ROUTING_ENUMS, PAYMENT_STATUS } from '../../../constants' +import { logger } from '../../../shared/logger' +import { + validateSchemaRetailV2, + isObjectEmpty, + checkContext, + areTimestampsLessThanOrEqualTo, + compareTimeRanges, + compareFulfillmentObject, + getProviderId, + deepCompare, +} from '../..' +import { getValue, setValue } from '../../../shared/dao' +import { FLOW } from '../../enum' +import { delivery_delay_reasonCodes } from '../../../constants/reasonCode' + +export const checkOnStatusPicked = (data: any, state: string, msgIdSet: any, fulfillmentsItemsSet: any) => { + const onStatusObj: any = {} + const states: string[] = ['Order-picked-up', 'Order-delivered'] + const replacementFulfillment = getValue("replacementFulfillment") + try { + if (!data || isObjectEmpty(data)) { + return { [ApiSequence.ON_STATUS_PICKED]: 'JSON cannot be empty' } + } + const flow = getValue('flow') + const { message, context }: any = data + if (!message || !context || isObjectEmpty(message)) { + return { missingFields: '/context, /message, is missing or empty' } + } + + const searchContext: any = getValue(`${ApiSequence.SEARCH}_context`) + const schemaValidation = validateSchemaRetailV2(context.domain.split(':')[1], constants.ON_STATUS, data) + const contextRes: any = checkContext(context, constants.ON_STATUS) + + if (schemaValidation !== 'error') { + Object.assign(onStatusObj, schemaValidation) + } + + if (!contextRes?.valid) { + Object.assign(onStatusObj, contextRes.ERRORS) + } + + try { + logger.info(`Adding Message Id /${constants.ON_STATUS_PICKED}`) + if (msgIdSet.has(context.message_id)) { + onStatusObj[`${ApiSequence.ON_STATUS_PICKED}_msgId`] = `Message id should not be same with previous calls` + } + msgIdSet.add(context.message_id) + } catch (error: any) { + logger.error(`!!Error while checking message id for /${constants.ON_STATUS_PICKED}, ${error.stack}`) + } + + if (!_.isEqual(data.context.domain.split(':')[1], getValue(`domain`))) { + onStatusObj[`Domain[${data.context.action}]`] = `Domain should be same in each action` + } + + setValue(`${ApiSequence.ON_STATUS_PICKED}`, data) + + try { + logger.info(`Checking context for /${constants.ON_STATUS} API`) //checking context + const res: any = checkContext(context, constants.ON_STATUS) + if (!res.valid) { + Object.assign(onStatusObj, res.ERRORS) + } + } catch (error: any) { + logger.error(`!!Some error occurred while checking /${constants.ON_STATUS} context, ${error.stack}`) + } + + try { + logger.info(`Comparing city of /${constants.SEARCH} and /${constants.ON_STATUS}`) + if (!_.isEqual(searchContext.city, context.city)) { + onStatusObj.city = `City code mismatch in /${constants.SEARCH} and /${constants.ON_STATUS}` + } + } catch (error: any) { + logger.error(`!!Error while comparing city in /${constants.SEARCH} and /${constants.ON_STATUS}, ${error.stack}`) + } + + try { + logger.info(`Comparing transaction Ids of /${constants.SELECT} and /${constants.ON_STATUS}`) + if (!_.isEqual(getValue('txnId'), context.transaction_id)) { + onStatusObj.txnId = `Transaction Id should be same from /${constants.SELECT} onwards` + } + } catch (error: any) { + logger.info( + `!!Error while comparing transaction ids for /${constants.SELECT} and /${constants.ON_STATUS} api, ${error.stack}`, + ) + } + + const on_status = message.order + if(ApiSequence.REPLACEMENT_ON_STATUS_PICKED === "replacement_on_status_picked"){ + try { + logger.info(`Comparing order Id in /${constants.ON_CONFIRM} and /${constants.REPLACEMENT_ON_STATUS_PICKED}`) + if (on_status.id != getValue('cnfrmOrdrId')) { + logger.info(`Order id (/${constants.REPLACEMENT_ON_STATUS_PICKED}) mismatches with /${constants.CONFIRM})`) + onStatusObj.onStatusOdrId = `Order id in /${constants.CONFIRM} and /${constants.REPLACEMENT_ON_STATUS_PICKED} do not match` + } + } catch (error) { + logger.info( + `!!Error while comparing order id in /${constants.REPLACEMENT_ON_STATUS_PICKED} and /${constants.CONFIRM}`, + error, + ) + } + try { + logger.info(`Comparing timestamp of /${constants.ON_STATUS}_picked and /${constants.REPLACEMENT_ON_STATUS_PICKED} API`) + if (_.gte(getValue('tmpstmp'), context.timestamp)) { + onStatusObj.inVldTmstmp = `Timestamp in previous /${constants.ON_STATUS} api cannot be greater than or equal to /${constants.REPLACEMENT_ON_STATUS_PICKED} api` + } + + setValue('tmpstmp', context.timestamp) + } catch (error: any) { + logger.error(`!!Error occurred while comparing timestamp for /${constants.REPLACEMENT_ON_STATUS_PICKED}, ${error.stack}`) + } + try { + logger.info(`Comparing timestamp of /${constants.ON_CONFIRM} and /${constants.REPLACEMENT_ON_STATUS_PICKED} API`) + if (_.gte(getValue('onCnfrmtmpstmp'), context.timestamp)) { + onStatusObj.tmpstmp1 = `Timestamp for /${constants.ON_CONFIRM} api cannot be greater than or equal to /${constants.REPLACEMENT_ON_STATUS_PICKED} api` + } + } catch (error: any) { + logger.error(`!!Error occurred while comparing timestamp for /${constants.REPLACEMENT_ON_STATUS_PICKED}, ${error.stack}`) + } + + try { + // For Delivery Object + const DELobj = on_status.fulfillments.filter( + (fulfillment: any) => fulfillment.id === replacementFulfillment.id, + ) + if (!DELobj.length) { + logger.error(`Delivery object is mandatory for ${ApiSequence.REPLACEMENT_ON_STATUS_PICKED}`) + const key = `missingDelivery` + onStatusObj[key] = `Delivery object is mandatory for ${ApiSequence.REPLACEMENT_ON_STATUS_PICKED}` + } else { + const deliveryObj = DELobj[0] + if (!deliveryObj.tags) { + const key = `missingTags` + onStatusObj[key] = `Tags are mandatory in Delivery Fulfillment for ${ApiSequence.REPLACEMENT_ON_STATUS_PICKED}` + } + else { + const tags = deliveryObj.tags + const routingTagArr = _.filter(tags, { code: 'routing' }) + if (!routingTagArr.length) { + const key = `missingRouting/Tag` + onStatusObj[key] = `RoutingTag object is mandatory in Tags of Delivery Object for ${ApiSequence.REPLACEMENT_ON_STATUS_PICKED}` + } + else { + const routingTag = routingTagArr[0] + const routingTagList = routingTag.list + if (!routingTagList) { + const key = `missingRouting/Tag/List` + onStatusObj[key] = `RoutingTagList is mandatory in RoutingTag of Delivery Object for ${ApiSequence.REPLACEMENT_ON_STATUS_PICKED}` + } + else { + const routingTagTypeArr = _.filter(routingTagList, { code: 'type' }) + if (!routingTagTypeArr.length) { + const key = `missingRouting/Tag/List/Type` + onStatusObj[key] = `RoutingTagListType object is mandatory in RoutingTag/List of Delivery Object for ${ApiSequence.REPLACEMENT_ON_STATUS_PICKED}` + } + else { + const routingTagType = routingTagTypeArr[0] + if (!ROUTING_ENUMS.includes(routingTagType.value)) { + const key = `missingRouting/Tag/List/Type/Value`; + onStatusObj[key] = `RoutingTagListType Value is mandatory in RoutingTag of Delivery Object for ${ApiSequence.REPLACEMENT_ON_STATUS_PICKED} and should be equal to 'P2P' or 'P2H2P'`; + } + } + } + } + } + } + } catch (error: any) { + logger.error(`Error while checking Fulfillments Delivery Obj in /${ApiSequence.ON_STATUS_PICKED}, ${error.stack}`) + } + + const contextTime = context.timestamp + try { + logger.info(`Comparing order.updated_at and context timestamp for /${constants.REPLACEMENT_ON_STATUS_PICKED} API`) + if (!_.isEqual(on_status.created_at, getValue(`cnfrmTmpstmp`))) { + onStatusObj.tmpstmp = `Created At timestamp for /${constants.REPLACEMENT_ON_STATUS_PICKED} should be equal to context timestamp at ${constants.CONFIRM}` + } + + if (!areTimestampsLessThanOrEqualTo(on_status.updated_at, contextTime)) { + onStatusObj.tmpstmp2 = ` order.updated_at timestamp should be less than or eqaul to context timestamp for /${constants.REPLACEMENT_ON_STATUS_PICKED} api` + } + } catch (error: any) { + logger.error( + `!!Error occurred while comparing order updated at for /${constants.REPLACEMENT_ON_STATUS_PICKED}, ${error.stack}`, + ) + } + + try { + logger.info(`Checking order state in /${constants.REPLACEMENT_ON_STATUS_PICKED}`) + if (on_status.state != 'Completed') { + onStatusObj.ordrState = `order/state should be "REPLACEMENT_ON_STATUS_PICKED" for /${constants.REPLACEMENT_ON_STATUS_PICKED}` + } + } catch (error: any) { + logger.error(`!!Error while checking order state in /${constants.REPLACEMENT_ON_STATUS_PICKED} Error: ${error.stack}`) + } + + try { + logger.info(`Checking pickup timestamp in /${constants.REPLACEMENT_ON_STATUS_PICKED}`) + // const noOfFulfillments = on_status.fulfillments.length + let orderPicked = false + // let i = 0 + const pickupTimestamps: any = {} + + // while (i < noOfFulfillments) { + const fulfillment = on_status.fulfillments.find((fulfillment:any)=> fulfillment.id === replacementFulfillment.id) + const ffState = fulfillment.state.descriptor.code + + //type should be Delivery + // if (fulfillment.id != replacementFulfillment.id) { + // i++ + // continue + // } + + if (ffState === constants.ORDER_PICKED) { + orderPicked = true + const pickUpTime = fulfillment.start?.time.timestamp + pickupTimestamps[fulfillment.id] = pickUpTime + if (!pickUpTime) { + onStatusObj.pickUpTime = `picked timestamp is missing` + } + else { + try { + //checking pickup time matching with context timestamp + if (!_.lte(pickUpTime, contextTime)) { + onStatusObj.pickupTime = `pickup timestamp should match context/timestamp and can't be future dated` + } + } catch (error) { + logger.error( + `!!Error while checking pickup time matching with context timestamp in /${constants.REPLACEMENT_ON_STATUS_PICKED}`, + error, + ) + } + + try { + //checking order/updated_at timestamp + if (!_.gte(on_status.updated_at, pickUpTime)) { + onStatusObj.updatedAt = `order/updated_at timestamp can't be less than the pickup time` + } + + if (!_.gte(contextTime, on_status.updated_at)) { + onStatusObj.updatedAtTime = `order/updated_at timestamp can't be future dated (should match context/timestamp)` + } + } catch (error) { + logger.error( + `!!Error while checking order/updated_at timestamp in /${constants.REPLACEMENT_ON_STATUS_PICKED}`, + error, + ) + } + } + } + + // i++ + // } + + try { + logger.info(`Storing delivery fulfillment if not present in ${constants.ON_CONFIRM} and comparing if present`) + const storedFulfillment = getValue(`deliveryFulfillment`) + const deliveryFulfillment = on_status.fulfillments.filter((fulfillment: any) => fulfillment.id === replacementFulfillment.id) + const { start, end } = deliveryFulfillment[0] + const startRange = start.time.range + const endRange = end.time.range + + if (!startRange || !endRange) { + onStatusObj[ + `fulfillment.${[deliveryFulfillment.id]}.range` + ]`Delivery fulfillment (${deliveryFulfillment.id}) has incomplete time range.` + } + if (!storedFulfillment) { + setValue('deliveryFulfillment', deliveryFulfillment[0]) + setValue('deliveryFulfillmentAction', ApiSequence.ON_STATUS_PICKED) + } else { + // const storedFulfillmentAction = getValue('deliveryFulfillmentAction') + const fulfillmentRangeerrors = compareTimeRanges( + replacementFulfillment, + ApiSequence.REPLACEMENT_ON_STATUS_PICKED, + deliveryFulfillment[0], + ApiSequence.ON_STATUS_PICKED, + ) + + if (fulfillmentRangeerrors) { + let i = 0 + const len = fulfillmentRangeerrors.length + while (i < len) { + const key = `fulfilmntRngErr${i}` + onStatusObj[key] = `${fulfillmentRangeerrors[i]}` + i++ + } + } + } + } catch (error: any) { + logger.error(`Error while Storing delivery fulfillment, ${error.stack}`) + } + try { + // Checking fulfillment.id, fulfillment.type and tracking + logger.info('Checking fulfillment.id, fulfillment.type and tracking') + on_status.fulfillments.forEach((ff: any) => { + let ffId = '' + + if (!ff.id) { + logger.info(`Fulfillment Id must be present `) + onStatusObj['ffId'] = `Fulfillment Id must be present` + } + + ffId = ff.id + if (ff.type != 'Cancel') { + if (getValue(`${ffId}_tracking`)) { + if (ff.tracking === false || ff.tracking === true) { + if (getValue(`${ffId}_tracking`) != ff.tracking) { + logger.info(`Fulfillment Tracking mismatch with the ${constants.ON_SELECT} call`) + onStatusObj['ffTracking'] = `Fulfillment Tracking mismatch with the ${constants.ON_SELECT} call` + } + } else { + logger.info(`Tracking must be present for fulfillment ID: ${ff.id} in boolean form`) + onStatusObj['ffTracking'] = `Tracking must be present for fulfillment ID: ${ff.id} in boolean form` + } + } + } + }) + } catch (error: any) { + logger.info(`Error while checking fulfillments id, type and tracking in /${constants.ON_STATUS}`) + } + + setValue('pickupTimestamps', pickupTimestamps) + + if (!orderPicked) { + onStatusObj.noOrdrPicked = `fulfillments/state should be ${constants.ORDER_PICKED} for /${constants.REPLACEMENT_ON_STATUS_PICKED}` + } + } catch (error: any) { + logger.info( + `Error while checking pickup timestamp in /${constants.REPLACEMENT_ON_STATUS_PICKED}.json Error: ${error.stack}`, + ) + } + } + if (ApiSequence.ON_STATUS_PICKED === 'picked') { + try { + logger.info(`Comparing order Id in /${constants.ON_CONFIRM} and /${constants.ON_STATUS}_${state}`) + if (on_status.id != getValue('cnfrmOrdrId')) { + logger.info(`Order id (/${constants.ON_STATUS}_${state}) mismatches with /${constants.CONFIRM})`) + onStatusObj.onStatusOdrId = `Order id in /${constants.CONFIRM} and /${constants.ON_STATUS}_${state} do not match` + } + } catch (error) { + logger.info( + `!!Error while comparing order id in /${constants.ON_STATUS}_${state} and /${constants.CONFIRM}`, + error, + ) + } + try { + logger.info(`Comparing timestamp of /${constants.ON_STATUS}_picked and /${constants.ON_STATUS}_${state} API`) + if (_.gte(getValue('tmpstmp'), context.timestamp)) { + onStatusObj.inVldTmstmp = `Timestamp in previous /${constants.ON_STATUS} api cannot be greater than or equal to /${constants.ON_STATUS}_${state} api` + } + + setValue('tmpstmp', context.timestamp) + } catch (error: any) { + logger.error(`!!Error occurred while comparing timestamp for /${constants.ON_STATUS}_${state}, ${error.stack}`) + } + try { + logger.info(`Comparing timestamp of /${constants.ON_CONFIRM} and /${constants.ON_STATUS}_${state} API`) + if (_.gte(getValue('onCnfrmtmpstmp'), context.timestamp)) { + onStatusObj.tmpstmp1 = `Timestamp for /${constants.ON_CONFIRM} api cannot be greater than or equal to /${constants.ON_STATUS}_${state} api` + } + } catch (error: any) { + logger.error(`!!Error occurred while comparing timestamp for /${constants.ON_STATUS}_${state}, ${error.stack}`) + } + + try { + // For Delivery Object + const DELobj = _.filter(on_status.fulfillments, { type: 'Delivery' }) + if (!DELobj.length) { + logger.error(`Delivery object is mandatory for ${ApiSequence.ON_STATUS_PICKED}`) + const key = `missingDelivery` + onStatusObj[key] = `Delivery object is mandatory for ${ApiSequence.ON_STATUS_PICKED}` + } else { + const deliveryObj = DELobj[0] + if (!deliveryObj.tags) { + const key = `missingTags` + onStatusObj[key] = `Tags are mandatory in Delivery Fulfillment for ${ApiSequence.ON_STATUS_PICKED}` + } else { + const tags = deliveryObj.tags + const routingTagArr = _.filter(tags, { code: 'routing' }) + if (!routingTagArr.length) { + const key = `missingRouting/Tag` + onStatusObj[key] = + `RoutingTag object is mandatory in Tags of Delivery Object for ${ApiSequence.ON_STATUS_PICKED}` + } else { + const routingTag = routingTagArr[0] + const routingTagList = routingTag.list + if (!routingTagList) { + const key = `missingRouting/Tag/List` + onStatusObj[key] = + `RoutingTagList is mandatory in RoutingTag of Delivery Object for ${ApiSequence.ON_STATUS_PICKED}` + } else { + const routingTagTypeArr = _.filter(routingTagList, { code: 'type' }) + if (!routingTagTypeArr.length) { + const key = `missingRouting/Tag/List/Type` + onStatusObj[key] = + `RoutingTagListType object is mandatory in RoutingTag/List of Delivery Object for ${ApiSequence.ON_STATUS_PICKED}` + } else { + const routingTagType = routingTagTypeArr[0] + if (!ROUTING_ENUMS.includes(routingTagType.value)) { + const key = `missingRouting/Tag/List/Type/Value` + onStatusObj[key] = + `RoutingTagListType Value is mandatory in RoutingTag of Delivery Object for ${ApiSequence.ON_STATUS_PICKED} and should be equal to 'P2P' or 'P2H2P'` + } + } + } + } + } + } + } catch (error: any) { + logger.error( + `Error while checking Fulfillments Delivery Obj in /${ApiSequence.ON_STATUS_PICKED}, ${error.stack}`, + ) + } + + const contextTime = context.timestamp + try { + logger.info(`Comparing order.updated_at and context timestamp for /${constants.ON_STATUS}_${state} API`) + if (!_.isEqual(on_status.created_at, getValue(`cnfrmTmpstmp`))) { + onStatusObj.tmpstmp = `Created At timestamp for /${constants.ON_STATUS}_${state} should be equal to context timestamp at ${constants.CONFIRM}` + } + + if (!areTimestampsLessThanOrEqualTo(on_status.updated_at, contextTime)) { + onStatusObj.tmpstmp2 = ` order.updated_at timestamp should be less than or eqaul to context timestamp for /${constants.ON_STATUS}_${state} api` + } + } catch (error: any) { + logger.error( + `!!Error occurred while comparing order updated at for /${constants.ON_STATUS}_${state}, ${error.stack}`, + ) + } + + try { + logger.info(`Checking order state in /${constants.ON_STATUS}_${state}`) + if (on_status.state != 'In-progress') { + onStatusObj.ordrState = `order/state should be "In-progress" for /${constants.ON_STATUS}_${state}` + } + } catch (error: any) { + logger.error(`!!Error while checking order state in /${constants.ON_STATUS}_${state} Error: ${error.stack}`) + } + + try { + logger.info(`Checking pickup timestamp in /${constants.ON_STATUS}_${state}`) + const noOfFulfillments = on_status.fulfillments.length + let orderPicked = false + let i = 0 + const pickupTimestamps: any = {} + + while (i < noOfFulfillments) { + const fulfillment = on_status.fulfillments[i] + const ffState = fulfillment.state.descriptor.code + + //type should be Delivery + if (fulfillment.type != 'Delivery') { + i++ + continue + } + + if (ffState === constants.ORDER_PICKED) { + orderPicked = true + const pickUpTime = fulfillment.start?.time.timestamp + pickupTimestamps[fulfillment.id] = pickUpTime + if (!pickUpTime) { + onStatusObj.pickUpTime = `picked timestamp is missing` + } else { + try { + //checking pickup time matching with context timestamp + if (!_.lte(pickUpTime, contextTime)) { + onStatusObj.pickupTime = `pickup timestamp should match context/timestamp and can't be future dated` + } + } catch (error) { + logger.error( + `!!Error while checking pickup time matching with context timestamp in /${constants.ON_STATUS}_${state}`, + error, + ) + } + + try { + //checking order/updated_at timestamp + if (!_.gte(on_status.updated_at, pickUpTime)) { + onStatusObj.updatedAt = `order/updated_at timestamp can't be less than the pickup time` + } + + if (!_.gte(contextTime, on_status.updated_at)) { + onStatusObj.updatedAtTime = `order/updated_at timestamp can't be future dated (should match context/timestamp)` + } + } catch (error) { + logger.error( + `!!Error while checking order/updated_at timestamp in /${constants.ON_STATUS}_${state}`, + error, + ) + } + } + } + + i++ + } + + try { + logger.info(`Storing delivery fulfillment if not present in ${constants.ON_CONFIRM} and comparing if present`) + const storedFulfillment = getValue(`deliveryFulfillment`) + const deliveryFulfillment = on_status.fulfillments.filter( + (fulfillment: any) => fulfillment.type === 'Delivery', + ) + const { start, end } = deliveryFulfillment[0] + const startRange = start.time.range + const endRange = end.time.range + + if (!startRange || !endRange) { + onStatusObj[ + `fulfillment.${[deliveryFulfillment.id]}.range` + ]`Delivery fulfillment (${deliveryFulfillment.id}) has incomplete time range.` + } + if (storedFulfillment == 'undefined') { + setValue('deliveryFulfillment', deliveryFulfillment[0]) + setValue('deliveryFulfillmentAction', ApiSequence.ON_STATUS_PICKED) + } else { + const storedFulfillmentAction = getValue('deliveryFulfillmentAction') + const fulfillmentRangeerrors = compareTimeRanges( + storedFulfillment, + storedFulfillmentAction, + deliveryFulfillment[0], + ApiSequence.ON_STATUS_PICKED, + ) + + if (fulfillmentRangeerrors) { + let i = 0 + const len = fulfillmentRangeerrors.length + while (i < len) { + const key = `fulfilmntRngErr${i}` + onStatusObj[key] = `${fulfillmentRangeerrors[i]}` + i++ + } + } + } + } catch (error: any) { + logger.error(`Error while Storing delivery fulfillment, ${error.stack}`) + } + try { + // Checking fulfillment.id, fulfillment.type and tracking + logger.info('Checking fulfillment.id, fulfillment.type and tracking') + on_status.fulfillments.forEach((ff: any) => { + let ffId = '' + + if (!ff.id) { + logger.info(`Fulfillment Id must be present `) + onStatusObj['ffId'] = `Fulfillment Id must be present` + } + + ffId = ff.id + if (ff.type != 'Cancel') { + if (getValue(`${ffId}_tracking`)) { + if (ff.tracking === false || ff.tracking === true) { + if (getValue(`${ffId}_tracking`) != ff.tracking) { + logger.info(`Fulfillment Tracking mismatch with the ${constants.ON_SELECT} call`) + onStatusObj['ffTracking'] = `Fulfillment Tracking mismatch with the ${constants.ON_SELECT} call` + } + } else { + logger.info(`Tracking must be present for fulfillment ID: ${ff.id} in boolean form`) + onStatusObj['ffTracking'] = `Tracking must be present for fulfillment ID: ${ff.id} in boolean form` + } + } + } + }) + } catch (error: any) { + logger.info(`Error while checking fulfillments id, type and tracking in /${constants.ON_STATUS}`) + } + + setValue('pickupTimestamps', pickupTimestamps) + + if (!orderPicked) { + onStatusObj.noOrdrPicked = `fulfillments/state should be ${constants.ORDER_PICKED} for /${constants.ON_STATUS}_${constants.ORDER_PICKED}` + } + } catch (error: any) { + logger.info( + `Error while checking pickup timestamp in /${constants.ON_STATUS}_${state}.json Error: ${error.stack}`, + ) + } + try { + if (flow === FLOW.FLOW012) { + logger.info('Payment status check in on status picked call') + const payment = on_status.payment + if (payment.status !== PAYMENT_STATUS.NOT_PAID) { + logger.error( + `Payment status should be ${PAYMENT_STATUS.NOT_PAID} for ${FLOW.FLOW012} flow (Cash on Delivery)`, + ) + onStatusObj.pymntstatus = `Payment status should be ${PAYMENT_STATUS.NOT_PAID} for ${FLOW.FLOW012} flow (Cash on Delivery)` + } + } + } catch (err: any) { + logger.error('Error while checking payment in message/order/payment: ' + err.message) + } + + if (flow === '6' || flow === '2' || flow === '3' || flow === '5') { + try { + // For Delivery Object + const fulfillments = on_status.fulfillments + if (!fulfillments.length) { + const key = `missingFulfillments` + onStatusObj[key] = `missingFulfillments is mandatory for ${ApiSequence.ON_STATUS_PICKED}` + } else { + fulfillments.forEach((ff: any) => { + if (ff.type == 'Delivery') { + setValue('deliveryTmpStmp', ff?.start?.time?.timestamp) + } + }) + let i: number = 0 + fulfillmentsItemsSet.forEach((obj1: any) => { + const keys = Object.keys(obj1) + + let obj2: any = _.filter(fulfillments, { type: `${obj1.type}` }) + let apiSeq = + obj1.type === 'Cancel' + ? ApiSequence.ON_UPDATE_PART_CANCEL + : getValue('onCnfrmState') === 'Accepted' + ? ApiSequence.ON_CONFIRM + : ApiSequence.ON_STATUS_PENDING + if (obj2.length > 0) { + obj2 = obj2[0] + if (obj2.type == 'Delivery') { + delete obj2?.start?.instructions + delete obj2?.end?.instructions + delete obj2?.agent + delete obj2?.start?.time?.timestamp + delete obj2?.tags + delete obj2?.state + } + apiSeq = + obj2.type === 'Cancel' + ? ApiSequence.ON_UPDATE_PART_CANCEL + : getValue('onCnfrmState') === 'Accepted' + ? ApiSequence.ON_CONFIRM + : ApiSequence.ON_STATUS_PENDING + const errors = compareFulfillmentObject(obj1, obj2, keys, i, apiSeq) + if (errors.length > 0) { + errors.forEach((item: any) => { + onStatusObj[item.errKey] = item.errMsg + }) + } + } else { + onStatusObj[`message/order.fulfillments/${i}`] = + `Missing fulfillment type '${obj1.type}' in ${ApiSequence.ON_STATUS_PICKED} as compared to ${apiSeq}` + } + i++ + }) + } + } catch (error: any) { + logger.error( + `Error while checking Fulfillments Delivery Obj in /${ApiSequence.ON_STATUS_PICKED}, ${error.stack}`, + ) + } + } + + function validateFulfillmentTags(fulfillments: any) { + const errors: any[] = [] + + fulfillments.forEach((fulfillment: any) => { + const tags = fulfillment.tags || [] + // Step 1: Get all fulfillment_delay tags + const delayTags = tags.filter((tag: { code: string }) => tag.code === 'fulfillment_delay') + + if (delayTags.length === 0) { + errors.push({ + fulfillmentId: fulfillment.id, + error: "Missing 'fulfillment_delay' tag", + }) + return + } + + // Step 2: Group by 'state' and pick latest by 'timestamp' + const latestByState: Record = {} + + delayTags.forEach((tag: any) => { + const tagList = tag.list || [] + const stateEntry = tagList.find((entry: any) => entry.code === 'state') + const timestampEntry = tagList.find((entry: any) => entry.code === 'timestamp') + if (stateEntry && stateEntry.value && timestampEntry && timestampEntry.value) { + const state = stateEntry.value + const timestamp = new Date(timestampEntry.value).getTime() + + const existingTimestamp = _.get(latestByState[state], 'list', []).find( + (e: any) => e.code === 'timestamp', + )?.value + + if (!latestByState[state] || _.gt(new Date(existingTimestamp).getTime(), timestamp)) { + latestByState[state] = tag.list + } + } + }) + + // Step 3: Validate only latest fulfillment_delay tags per state + Object.entries(latestByState).forEach(([stateValue, tag]) => { + const tagList = tag.list || [] + setValue('fulfillmentDelayTagList', tagList) + // Validate state (already grouped by it, but still check validity) + if (!states.includes(stateValue)) { + errors.push({ + fulfillmentId: fulfillment.id, + error: `'state' value '${stateValue}' must be one of ${states}`, + }) + } + + // Validate reason_id + const reasonEntry = tag.find((entry: any) => entry.code === 'reason_id') + if (!reasonEntry || !reasonEntry.value) { + errors.push({ + fulfillmentId: fulfillment.id, + error: `Missing or invalid 'reason_id' in 'fulfillment_delay' tag (state: ${stateValue})`, + }) + } else if (!delivery_delay_reasonCodes.includes(reasonEntry.value)) { + errors.push({ + fulfillmentId: fulfillment.id, + error: `'reason_id' must be one of ${delivery_delay_reasonCodes} (state: ${stateValue})`, + }) + } + + // Validate timestamp + const timestampEntry = tag.find((entry: any) => entry.code === 'timestamp') + + if (!timestampEntry || !timestampEntry.value) { + errors.push({ + fulfillmentId: fulfillment.id, + error: `Missing or invalid 'timestamp' in 'fulfillment_delay' tag (state: ${stateValue})`, + }) + } else { + try { + const stateEntry = tag.find((entry: any) => entry.code === 'state') + const deliveryFulfillment = fulfillments.find((f: any) => f.type === 'Delivery') + + if (!stateEntry?.value || !timestampEntry?.value || !deliveryFulfillment) return + + const state = stateEntry.value + const timestamp = timestampEntry.value + + const stateTimestampMap: Record = { + 'Order-picked-up': deliveryFulfillment.start?.time?.timestamp, + 'Order-delivered': deliveryFulfillment.end?.time?.timestamp, + } + + const fulfillmentTimestamp = stateTimestampMap[state] + + if (fulfillmentTimestamp && _.gte(timestamp, fulfillmentTimestamp)) { + onStatusObj.tmpstmp = `Timestamp in fulfillmentDelay in fulfillmentTags cannot be greater than or equal to ${state === 'Order-picked-up' ? 'start' : 'end'} timestamp in fulfillments` + } + + if (_.gte(timestamp, context.timestamp)) { + onStatusObj.tmpstmp = `Timestamp for /${constants.ON_STATUS_PICKED} api cannot be greater than or equal to /on_status_picked api` + } + + setValue('timestampOrderPicked', timestamp) + } catch (error: any) { + logger.error(`!!Error comparing timestamp for /${constants.ON_STATUS_PICKED}, ${error.stack}`) + } + + const isValidDate = !isNaN(Date.parse(timestampEntry.value)) + if (!isValidDate) { + errors.push({ + fulfillmentId: fulfillment.id, + error: `'timestamp' value '${timestampEntry.value}' is not a valid ISO date (state: ${stateValue})`, + }) + } + } + }) + }) + + return errors + } + if (flow === FLOW.FLOW020) { + const fulfillments = on_status.fulfillments + const res = validateFulfillmentTags(fulfillments) + res.map((ele: { fulfillmentId: string; error: string }, index: number) => { + const key = `invalid_attribute/${index}/${ele.fulfillmentId}` + onStatusObj[key] = `${ele.error}` + }) + } + if (flow === FLOW.FLOW01C) { + const fulfillments = on_status.fulfillments + const deliveryFulfillment = fulfillments.find((f: any) => f.type === 'Delivery') + + if (!deliveryFulfillment.hasOwnProperty('provider_id')) { + onStatusObj['missingFulfillments'] = + `provider_id must be present in ${ApiSequence.ON_STATUS_PICKED} as order is accepted` + } + + const id = getProviderId(deliveryFulfillment) + const fulfillmentProviderId = getValue('fulfillmentProviderId') + + if (deliveryFulfillment.hasOwnProperty('provider_id') && id !== fulfillmentProviderId) { + onStatusObj['providerIdMismatch'] = + `provider_id in fulfillment in ${ApiSequence.ON_CONFIRM} does not match expected provider_id: expected '${fulfillmentProviderId}' in ${ApiSequence.ON_STATUS_PICKED} but got ${id}` + } + } + + if (flow === FLOW.FLOW003) { + const fulfillmentId = getValue('fulfillmentId') + const slot = getValue('fulfillmentSlots') + const ele = on_status.fulfillments.find((ele: { id: any }): any => ele.id === fulfillmentId) + const item = slot.find((ele: { id: any }): any => ele.id === fulfillmentId) + if (!ele || !item) { + const key = "fulfillments missing" + onStatusObj[key] = `fulfillments must be same as in /${constants.ON_CONFIRM}` + } + if (item?.end?.time?.range && ele?.end?.time?.range) { + const itemRange = item.end.time.range + const eleRange = ele.end.time.range + if (itemRange.start !== eleRange.start || itemRange.end !== eleRange.end) { + const key = "slotsMismatch" + onStatusObj[key] = `slots in fulfillments must be same as in /${constants.ON_CONFIRM}` + } + } + } + + try { + const credsWithProviderId = getValue('credsWithProviderId') + const providerId = on_status?.provider?.id + const confirmCreds = on_status?.provider?.creds + const found = credsWithProviderId.find((ele: { providerId: any }) => ele.providerId === providerId) + const expectedCreds = found?.creds + if (!expectedCreds) { + onStatusObj['MissingCreds'] = `creds must be present in /${constants.ON_STATUS_PICKED}` + } + if (flow === FLOW.FLOW017) { + if (!expectedCreds) { + onStatusObj['MissingCreds'] = `creds must be present in /${constants.ON_SEARCH}` + } else if (!deepCompare(expectedCreds, confirmCreds)) { + console.log('here inside else') + onStatusObj['MissingCreds'] = `creds must be present and same as in /${constants.ON_SEARCH}` + } + } + } catch (err: any) { + logger.error(`!!Some error occurred while checking /${constants.ON_STATUS} API`, err) + } + + try { + const fulfillments = on_status.fulfillments + const deliveryFulfillment = fulfillments.find((f: any) => f.type === 'Delivery') + if (deliveryFulfillment) { + if (flow === FLOW.FLOW00E) { + setValue('orderStatus', deliveryFulfillment?.state?.descriptor?.code) + } + } + } catch (err: any) { + logger.error(`!!Some error occurred while checking /${constants.ON_STATUS} API`, err) + } + } + + + return onStatusObj + } catch (err: any) { + logger.error(`!!Some error occurred while checking /${constants.ON_STATUS} API`, err) + } +} diff --git a/utils/enum.ts b/utils/enum.ts index a8cf57c0..67fbe186 100644 --- a/utils/enum.ts +++ b/utils/enum.ts @@ -702,7 +702,26 @@ export enum FLOW { FLOW6 = '6', FLOW7 = '7', FLOW8 = '8', +<<<<<<< HEAD + FLOW9 = '9', + FLOW020 = '020', + FLOW00B = "00B", + FLOW01C = '01C', + FLOW008 = '008', + FLOW003 = '003', + FLOW00F = '00F', + FLOW011 = '011', + FLOW017 = '017', + FLOW00D = '00D', + FLOW00E = '00E', + FLOW016 = '016', + FLOW01F = '01F', + FLOW007 = '007', + FLOW0099 = '0099', + FLOW00C = '00C' +======= FLOW9 = '9' +>>>>>>> e1d6dda602b94015e70d25b983d8c5cda043a12f } export enum statutory_reqs {