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3C,IACC,OAAOhtE,MAAQ,IAAI0qF,SAAS,cAAb,EAGhB,CAFE,MAAO31E,GACR,GAAsB,iBAAX9B,OAAqB,OAAOA,MACxC,CACA,CAPuB,GCGxB,IAAI03E,oBAAsBL,oBAAoB","sources":["webpack://TerminusDBClient/webpack/universalModuleDefinition","webpack://TerminusDBClient/./index.js","webpack://TerminusDBClient/./lib/accessControl.js","webpack://TerminusDBClient/./lib/axiosInstance.js","webpack://TerminusDBClient/./lib/connectionConfig.js","webpack://TerminusDBClient/./lib/const.js","webpack://TerminusDBClient/./lib/dispatchRequest.js","webpack://TerminusDBClient/./lib/errorMessage.js","webpack://TerminusDBClient/./lib/query/woqlBuilder.js","webpack://TerminusDBClient/./lib/query/woqlCore.js","webpack://TerminusDBClient/./lib/query/woqlDoc.js","webpack://TerminusDBClient/./lib/query/woqlLibrary.js","webpack://TerminusDBClient/./lib/query/woqlPrinter.js","webpack://TerminusDBClient/./lib/query/woqlQuery.js","webpack://TerminusDBClient/./lib/typedef.js","webpack://TerminusDBClient/./lib/utils.js","webpack://TerminusDBClient/./lib/viewer/chartConfig.js","webpack://TerminusDBClient/./lib/viewer/chooserConfig.js","webpack://TerminusDBClient/./lib/viewer/documentFrame.js","webpack://TerminusDBClient/./lib/viewer/frameConfig.js","webpack://TerminusDBClient/./lib/viewer/frameRule.js","webpack://TerminusDBClient/./lib/viewer/graphConfig.js","webpack://TerminusDBClient/./lib/viewer/objectFrame.js","webpack://TerminusDBClient/./lib/viewer/streamConfig.js","webpack://TerminusDBClient/./lib/viewer/tableConfig.js","webpack://TerminusDBClient/./lib/viewer/terminusRule.js","webpack://TerminusDBClient/./lib/viewer/viewConfig.js","webpack://TerminusDBClient/./lib/viewer/woqlChart.js","webpack://TerminusDBClient/./lib/viewer/woqlChooser.js","webpack://TerminusDBClient/./lib/viewer/woqlGraph.js","webpack://TerminusDBClient/./lib/viewer/woqlPaging.js","webpack://TerminusDBClient/./lib/viewer/woqlResult.js","webpack://TerminusDBClient/./lib/viewer/woqlRule.js","webpack://TerminusDBClient/./lib/viewer/woqlStream.js","webpack://TerminusDBClient/./lib/viewer/woqlTable.js","webpack://TerminusDBClient/./lib/viewer/woqlView.js","webpack://TerminusDBClient/./lib/woql.js","webpack://TerminusDBClient/./lib/woqlClient.js","webpack://TerminusDBClient/./node_modules/form-data/lib/browser.js","webpack://TerminusDBClient/./node_modules/pako/index.js","webpack://TerminusDBClient/./node_modules/pako/lib/deflate.js","webpack://TerminusDBClient/./node_modules/pako/lib/inflate.js","webpack://TerminusDBClient/./node_modules/pako/lib/utils/common.js","webpack://TerminusDBClient/./node_modules/pako/lib/utils/strings.js","webpack://TerminusDBClient/./node_modules/pako/lib/zlib/adler32.js","webpack://TerminusDBClient/./node_modules/pako/lib/zlib/constants.js","webpack://TerminusDBClient/./node_modules/pako/lib/zlib/crc32.js","webpack://TerminusDBClient/./node_modules/pako/lib/zlib/deflate.js","webpack://TerminusDBClient/./node_modules/pako/lib/zlib/gzheader.js","webpack://TerminusDBClient/./node_modules/pako/lib/zlib/inffast.js","webpack://TerminusDBClient/./node_modules/pako/lib/zlib/inflate.js","webpack://TerminusDBClient/./node_modules/pako/lib/zlib/inftrees.js","webpack://TerminusDBClient/./node_modules/pako/lib/zlib/messages.js","webpack://TerminusDBClient/./node_modules/pako/lib/zlib/trees.js","webpack://TerminusDBClient/./node_modules/pako/lib/zlib/zstream.js","webpack://TerminusDBClient/./node_modules/axios/dist/browser/axios.cjs","webpack://TerminusDBClient/webpack/bootstrap","webpack://TerminusDBClient/webpack/runtime/global","webpack://TerminusDBClient/webpack/startup"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"TerminusDBClient\"] = factory();\n\telse\n\t\troot[\"TerminusDBClient\"] = factory();\n})(this, () => {\nreturn ","/* eslint-disable global-require */\nconst { Var, Vars, Doc } = require('./lib/query/woqlDoc');\nconst WOQLClient = require('./lib/woqlClient');\nconst UTILS = require('./lib/utils');\nconst View = require('./lib/viewer/woqlView');\nconst WOQL = require('./lib/woql');\nconst WOQLResult = require('./lib/viewer/woqlResult');\nconst WOQLTable = require('./lib/viewer/woqlTable');\nconst WOQLGraph = require('./lib/viewer/woqlGraph');\nconst axiosInstance = require('./lib/axiosInstance');\nconst AccessControl = require('./lib/accessControl');\nconst WOQLQuery = require('./lib/query/woqlBuilder');\n\nmodule.exports = {\n Var,\n Doc,\n Vars,\n WOQLClient,\n UTILS,\n View,\n WOQL,\n WOQLResult,\n WOQLTable,\n WOQLGraph,\n axiosInstance,\n AccessControl,\n WOQLQuery,\n};\n","/* eslint-disable max-len */\n/* eslint-disable no-underscore-dangle */\nconst DispatchRequest = require('./dispatchRequest');\nconst ErrorMessage = require('./errorMessage');\nconst CONST = require('./const');\nconst UTILS = require('./utils');\n// eslint-disable-next-line no-unused-vars\nconst typedef = require('./typedef');\n/**\n * @license Apache Version 2\n * @module AccessControl\n * @constructor AccessControl\n * @description The AccessControl is a driver to work with\n * TerminusDB and TerminusX access control api\n * for the credential you can use the JWT token, the API token or\n * the basic authentication with username and password\n * @example\n * //connect with the API token\n * //(to request a token create an account in https://terminusdb.com/)\n * const accessContol = new AccessControl(\"https://servername.com\",\n * {organization:\"my_team_name\",\n * token:\"dGVybWludXNkYjovLy9kYXRhL2tleXNfYXB........\"})\n * accessControl.getOrgUsers().then(result=>{\n * console.log(result)\n * })\n *\n * //connect with the jwt token this type of connection is only for the dashboard\n * //or for application integrate with our login workflow\n * const accessContol = new AccessControl(\"https://servername.com\",\n * {organization:\"my_team_name\",\n * jwt:\"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IkpXUjBIOXYyeTFORUd........\"})\n * accessControl.getOrgUsers().then(result=>{\n * console.log(result)\n * })\n *\n * //if the jwt is expired you can change it with\n * accessControl.setJwtToken(\"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IkpXUjBIOXYy\n * eTFORUd.......\")\n *\n * //connect with the base authentication this type of connection is only for the local installation\n * const accessContol = new AccessControl(\"http://localhost:6363\",\n * {organization:\"my_team_name\", user:\"admin\"\n * key:\"mykey\"})\n * accessControl.getOrgUsers().then(result=>{\n * console.log(result)\n * })\n *\n */\n\nfunction AccessControl(cloudAPIUrl, params) {\n this.baseURL = this.getAPIUrl(cloudAPIUrl);\n if (!params) return;\n if (params.jwt) {\n this.setJwtToken(params.jwt);\n } else if (params.token) {\n this.setApiToken(params.token);\n } else if (params.key) {\n this.setApiKey(params.key);\n this.user = params.user;\n }\n this.defaultOrganization = this.getDefaultOrganization(params);\n}\n\n/**\n * Get a organization from parameters.\n * @param {object} params - The parameters\n * @return {string|undefined} - organization\n */\nAccessControl.prototype.getDefaultOrganization = function (params) {\n if (params && params.organization && typeof params.organization === 'string') {\n return params.organization;\n }\n return undefined;\n};\n/**\n * Sets the Jwt token for the object\n * @param {string} jwt - The jwt api token to use\n */\nAccessControl.prototype.setJwtToken = function (jwt) {\n if (!jwt) {\n throw new Error('TerminusX Access token required');\n }\n\n this.apiKey = jwt;\n this.apiType = 'jwt';\n};\n\n/**\n * Sets the API token for the object, to request a token create an account in https://terminusdb.com/\n * @param {string} atokenpi - The API token to use to connect with TerminusX\n */\nAccessControl.prototype.setApiToken = function (token) {\n if (!token) {\n throw new Error('TerminusX Access token required');\n }\n\n this.apiKey = token;\n this.apiType = 'apikey';\n};\n\n/**\n * Sets the API token for the object, to request a token create an account in https://terminusdb.com/\n * @param {string} atokenpi - The API token to use to connect with TerminusX\n */\nAccessControl.prototype.setApiKey = function (key) {\n if (!key) {\n throw new Error('TerminusDB bacis authentication key required');\n }\n\n this.apiKey = key;\n this.apiType = 'basic';\n};\n\n/**\n * Get a API url from cloudAPIUrl\n * @param {string} cloudAPIUrl - The base url for cloud\n * @return {string} apiUrl\n */\nAccessControl.prototype.getAPIUrl = function (cloudAPIUrl) {\n if (!cloudAPIUrl || typeof cloudAPIUrl !== 'string') {\n throw new Error('TerminusX api url required!');\n }\n if (cloudAPIUrl.lastIndexOf('/') !== cloudAPIUrl.length - 1) {\n // eslint-disable-next-line no-param-reassign\n cloudAPIUrl += '/'; // always append slash to ensure regularity\n }\n return `${cloudAPIUrl}api`;\n};\n\nAccessControl.prototype.dispatch = function (requestUrl, action, payload) {\n if (!requestUrl) {\n return Promise.reject(\n new Error(\n ErrorMessage.getInvalidParameterMessage(\n action,\n 'Invalid request URL',\n ),\n ),\n );\n }\n return DispatchRequest(\n requestUrl,\n action,\n payload,\n { type: this.apiType, key: this.apiKey, user: this.user },\n null,\n this.customHeaders(),\n );\n};\n\n/**\n * add extra headers to your request\n * @param {object} customHeaders\n * @returns {object}\n */\n\n// eslint-disable-next-line consistent-return\nAccessControl.prototype.customHeaders = function (customHeaders) {\n if (customHeaders) this._customHeaders = customHeaders;\n else return this._customHeaders;\n};\n\n/**\n * -- TerminusDB API ---\n * Get an organization from the TerminusDB API.\n * @param {string} organization - The organization\n * @return {object} - organization\n */\nAccessControl.prototype.getOrganization = function (org) {\n return this.dispatch(`${this.baseURL}/organizations/${org}`, CONST.GET);\n};\n\n/**\n * -- TerminusDB API ---\n * This end point works in basic authentication, admin user\n * Get list of organizations\n * @return {Promise} A promise that returns the call response object, or an Error if rejected.\n */\n\nAccessControl.prototype.getAllOrganizations = function () {\n return this.dispatch(`${this.baseURL}/organizations`, CONST.GET);\n};\n\n/**\n * -- TerminusDB API ---\n * This end point works in basic authentication, admin user\n * Create an organization\n * @param {string} orgName - The organization name to create\n * @return {Promise} A promise that returns the call response object, or an Error if rejected.\n * @example\n * accessControl.createOrganization(\"my_org_name\").then(result=>{\n * console.log(result)\n * })\n */\nAccessControl.prototype.createOrganization = function (orgName) {\n // maybe we have to review this\n return this.dispatch(`${this.baseURL}/organizations/${UTILS.encodeURISegment(orgName)}`, CONST.POST, {});\n};\n\n/**\n * -- TerminusDB API ---\n * Delete an Organization\n * @param {string} orgName - The organization name to delete\n * @return {Promise} A promise that returns the call response object, or an Error if rejected.\n * @example\n * accessControl.deleteOrganization(\"my_org_name\").then(result=>{\n * console.log(result)\n * })\n */\nAccessControl.prototype.deleteOrganization = function (orgName) {\n return this.dispatch(`${this.baseURL}/organizations/${UTILS.encodeURISegment(orgName)}`, CONST.DELETE);\n};\n\n/**\n * --TerminusDB API ---\n * basic authentication, admin user.\n * Create a new role in the system database.\n * @param {string} [name] - The role name.\n * @param {typedef.RolesActions} [actions] - A list of actions\n * @return {Promise} A promise that returns the call response object, or an Error if rejected.\n * @example\n * accessControl.createRole(\"Reader\",[ACTIONS.INSTANCE_READ_ACCESS]).then(result=>{\n * console.log(result)\n * })\n *\n */\nAccessControl.prototype.createRole = function (name, actions) {\n const payload = { name, action: actions };\n return this.dispatch(`${this.baseURL}/roles`, CONST.POST, payload);\n};\n\n/**\n * -- TerminusdDB API ---\n * basic Authentication, admin user.\n * Delete role in the system database, (this api is enabled only in the local installation)\n * @param {string} [name] - The role name.\n * @return {Promise} A promise that returns the call response object, or an Error if rejected.\n * @example\n * accessControl.deleteRole(\"Reader\").then(result=>{\n * console.log(result)\n * })\n *\n */\nAccessControl.prototype.deleteRole = function (name) {\n return this.dispatch(`${this.baseURL}/roles/${UTILS.encodeURISegment(name)}`, CONST.DELETE);\n};\n\n/**\n * -- TerminusdDB API ---\n * basic Authentication, admin user.\n * Return the list of all the users (this api is enabled only in the local installation)\n * @return {Promise} A promise that returns the call response object, or an Error if rejected.\n * @example\n * accessControl.getAllUsers().then(result=>{\n * console.log(result)\n * })\n *\n */\n\nAccessControl.prototype.getAllUsers = function () {\n return this.dispatch(`${this.baseURL}/users`, CONST.GET);\n};\n\n/**\n * -- TerminusdDB API ---\n * basic Authentication, admin user.\n * Add the user into the system database\n * @param {string} name - the user name\n * @param {string} [password] - you need the password for basic authentication\n * @return {Promise} A promise that returns the call response object, or an Error if rejected.\n * @example\n * accessControl.deleteUser(userId).then(result=>{\n * console.log(result)\n * })\n *\n */\n\nAccessControl.prototype.createUser = function (name, password) {\n const payload = { name, password };\n return this.dispatch(`${this.baseURL}/users`, CONST.POST, payload);\n};\n\n/**\n * -- TerminusdDB API ---\n * basic Authentication, admin user.\n * Remove the user from the system database.\n * @param {string} userId - the document user id\n * @return {Promise} A promise that returns the call response object, or an Error if rejected.\n * @example\n * accessControl.deleteUser(userId).then(result=>{\n * console.log(result)\n * })\n *\n */\n\nAccessControl.prototype.deleteUser = function (userId) {\n return this.dispatch(`${this.baseURL}/users/${UTILS.encodeURISegment(userId)}`, CONST.DELETE);\n};\n\n/**\n * -- TerminusdDB API ---\n * Grant/Revoke Capability\n * @param {string} userName - the document user id\n * @param {string} resourceName - the name of a (database or team)\n * @param {array} rolesArr - the roles name list\n * @param {typedef.CapabilityCommand} operation - grant/revoke operation\n * @param {typedef.ScopeType} [scopeType] - the resource type (database or organization)\n * @return {Promise} A promise that returns the call response object, or an Error if rejected.\n * @example\n * //we add an user to an organization and manage users' access\n * //the user myUser can access the Organization and all the database under the organization with \"reader\" Role\n * client.manageCapability(myUser,myteam,[reader],\"grant\",\"organization\").then(result=>{\n * consol.log(result)\n * })\n *\n * //the user myUser can access the database db__001 under the organization myteam\n * //with \"writer\" Role\n * client.manageCapability(myUser,myteam/db__001,[writer],\"grant\",\"database\").then(result=>{\n * consol.log(result)\n * })\n */\n\nAccessControl.prototype.manageCapability = function (userName, resourceName, rolesArr, operation, scopeType) {\n const payload = {\n operation,\n user: userName,\n roles: rolesArr,\n scope: resourceName,\n scope_type: scopeType,\n };\n return this.dispatch(`${this.baseURL}/capabilities`, CONST.POST, payload);\n};\n\n/**\n * --TerminusX and TerminusDB API ---\n * Get all the system database roles types.\n * @return {Promise} A promise that returns the call response object, or an Error if rejected.\n */\nAccessControl.prototype.getAccessRoles = function () {\n return this.dispatch(`${this.baseURL}/roles`, CONST.GET);\n};\n\n/**\n * -- TerminusX and TerminusDB API --\n * Get all the organization's users and roles,\n * @param {string} [orgName] - The organization name.\n * @return {Promise} A promise that returns the call response object, or an Error if rejected.\n * @example\n * accessControl.getOrgUsers().then(result=>{\n * console.log(result)\n * })\n *\n * //this function will return an array of capabilities with users and roles\n * //-- TerminusX -- response array example\n * //[{capability: \"Capability/3ea26e1d698821c570afe9cb4fe81a3......\"\n * // email: {@type: \"xsd:string\", @value: \"user@terminusdb.com\"}\n * // picture: {@type: \"xsd:string\",…}\n * // role: \"Role/dataReader\"\n * // scope: \"Organization/my_org_name\"\n * // user: \"User/auth0%7C613f5dnndjdjkTTT\"}]\n * //\n * //\n * // -- Local Installation -- response array example\n * //[{ \"@id\":\"User/auth0%7C615462f8ab33f4006a6bee0c\",\n * // \"capability\": [{\n * // \"@id\":\"Capability/c52af34b71f6f8916ac0115ecb5fe0e31248ead8b1e3d100852015...\",\n * // \"@type\":\"Capability\",\n * // \"role\": [{\n * // \"@id\":\"Role/admin\",\n * // \"@type\":\"Role\",\n * // \"action\": [\"instance_read_access\"],\n * // \"name\":\"Admin Role\"\n * // }],\n * // \"scope\":\"Organization/@team\"}]]\n */\n\nAccessControl.prototype.getOrgUsers = function (orgName) {\n if (!orgName && !this.defaultOrganization) {\n return Promise.reject(\n new Error(\n ErrorMessage.getInvalidParameterMessage(\n 'GET',\n 'Please provide a organization name',\n ),\n ),\n );\n }\n const org = orgName || this.defaultOrganization;\n return this.dispatch(`${this.baseURL}/organizations/${UTILS.encodeURISegment(org)}/users`, CONST.GET);\n};\n\n/**\n * -- TerminusX and TerminusDB API --\n * Get the user roles for a given organization or the default organization,\n * @param {string} [userName] - The organization name.\n * @param {string} [orgName] - The organization name.\n * @return {Promise} A promise that returns the call response object, or an Error if rejected.\n * @example\n * accessControl.getTeamUserRole(\"myUser\").then(result=>{\n * console.log(result)\n * })\n *\n * //response object example\n * {\n * \"@id\": \"User/myUser\",\n * \"capability\": [\n * {\n * \"@id\":\"Capability/server_access\",\n * \"@type\":\"Capability\",\n * \"role\": [{\n * \"@id\":\"Role/reader\",\n * \"@type\":\"Role\",\n * \"action\": [\n * \"instance_read_access\",\n * ],\n * \"name\":\"reader\"\n * }],\n * \"scope\":\"Organization/myteam\"\n * }\n * ],\n * \"name\": \"myUser\"\n *}\n */\n\nAccessControl.prototype.getTeamUserRoles = function (userName, orgName) {\n if (!orgName && !this.defaultOrganization) {\n return Promise.reject(\n new Error(\n ErrorMessage.getInvalidParameterMessage(\n 'GET',\n 'Please provide a organization name',\n ),\n ),\n );\n }\n const org = orgName || this.defaultOrganization;\n return this.dispatch(`${this.baseURL}/organizations/${UTILS.encodeURISegment(org)}/users/${UTILS.encodeURISegment(userName)}`, CONST.GET);\n};\n\n/**\n * -- TerminusX API ---\n * Check if the organization exists. it is a Head call .\n * IMPORTANT This does not work with the API-TOKEN.\n * @param {string} orgName - The organization name to check if exists.\n * @return {Promise} A promise that returns the call status object, 200: if the organization\n * exists and 404: if the organization does not exist\n */\nAccessControl.prototype.ifOrganizationExists = function (orgName) {\n if (!orgName) {\n return Promise.reject(\n new Error(\n ErrorMessage.getInvalidParameterMessage(\n 'HEAD',\n 'Please provide a organization name',\n ),\n ),\n );\n }\n\n return this.dispatch(`${this.baseURL}/private/organizations/${UTILS.encodeURISegment(orgName)}`, CONST.HEAD);\n};\n\n/**\n * -- TerminusX API ---\n * IMPORTANT This does not work with the API-TOKEN.\n * Create an organization\n * @param {string} orgName - The organization name to create\n * @return {Promise} A promise that returns the call response object, or an Error if rejected.\n * @example\n * accessControl.createOrganization(\"my_org_name\").then(result=>{\n * console.log(result)\n * })\n */\nAccessControl.prototype.createOrganizationRemote = function (orgName) {\n const payload = { organization: orgName };\n return this.dispatch(`${this.baseURL}/private/organizations`, CONST.POST, payload);\n};\n\n/**\n * -- TerminusX API ---\n * Get the pending invitations list.\n * @param {string} [orgName] - The organization name.\n * @return {Promise} A promise that returns the call response object, or an Error if rejected.\n * @example\n * const invitationList = accessControl.getPendingOrgInvites().then(result=>{\n * console.log(invitationList)\n *\n * })\n * //this will return an array of invitations object like this\n * //[{@id: \"Organization/my_team_name/invitations/Invitation/7ad0c9eb82b6175bcda9c0dfc2ac51161ef5ba\n * cb0988d992c4bce82b3fa5d25\"\n * // @type: \"Invitation\"\n * // creation_date: \"2021-10-22T11:13:28.762Z\"\n * // email_to: \"new_user@terminusdb.com\"\n * // invited_by: \"User/auth0%7C6162f8ab33567406a6bee0c\"\n * // role: \"Role/dataReader\"\n * // status: \"needs_invite\"}]\n *\n */\nAccessControl.prototype.getPendingOrgInvites = function (orgName) {\n if (!orgName && !this.defaultOrganization) {\n return Promise.reject(\n new Error(\n ErrorMessage.getInvalidParameterMessage(\n 'GET',\n 'Please provide a organization name',\n ),\n ),\n );\n }\n const org = orgName || this.defaultOrganization;\n return this.dispatch(`${this.baseURL}/organizations/${UTILS.encodeURISegment(org)}/invites`, CONST.GET);\n};\n\n/**\n * -- TerminusX API ---\n * Send a new invitation\n * @param {string} userEmail - The email of user.\n * @param {string} role - The role for user. (the document @id role like Role/collaborator)\n * @param {string} [note] - The note to send with the invitation.\n * @param {string} [orgName] - The organization name.\n * @return {Promise} A promise that returns the call response object, or an Error if rejected.\n * @example\n * accessControl.sendOrgInvite(\"new_user@terminusdb.com\",\"Role/admin\",\n * \"please join myteam\").then(result=>{\n * console.log(result)\n * })\n */\n// eslint-disable-next-line default-param-last\nAccessControl.prototype.sendOrgInvite = function (userEmail, role, note = '', orgName) {\n let errorMessage;\n if (!orgName && !this.defaultOrganization) {\n errorMessage = 'Please provide a organization name';\n } else if (!userEmail) {\n errorMessage = 'Please provide a user email';\n } else if (!role) {\n errorMessage = 'Please provide a role';\n }\n\n if (errorMessage) {\n return Promise.reject(\n new Error(\n ErrorMessage.getInvalidParameterMessage(\n 'POST',\n errorMessage,\n ),\n ),\n );\n }\n const org = orgName || this.defaultOrganization;\n return this.dispatch(`${this.baseURL}/organizations/${UTILS.encodeURISegment(org)}/invites`, CONST.POST, {\n email_to: userEmail,\n role,\n note,\n });\n};\n\n/**\n * -- TerminusX API ---\n * Get the invitation info\n * @param {string} inviteId - The invite id to retrieve.\n * @param {string} [orgName] - The organization name.\n * @return {Promise} A promise that returns the call response object, or an Error if rejected.\n * @example\n * const fullInviteId=\"Organization/my_team_name/invitations/Invitation/7ad0c9eb82b6175bcda9c0dfc\n * 2ac51161ef5ba7cb0988d992c4bce82b3fa5d25\"\n * accessControl.getOrgInvite(fullInviteId).then(result=>{\n * console.log(result)\n * })\n */\nAccessControl.prototype.getOrgInvite = function (inviteId, orgName) {\n let errorMessage;\n if (!orgName && !this.defaultOrganization) {\n errorMessage = 'Please provide a organization name';\n } else if (!inviteId) {\n errorMessage = 'Please provide a invite id';\n }\n\n if (errorMessage) {\n return Promise.reject(\n new Error(\n ErrorMessage.getInvalidParameterMessage(\n 'POST',\n errorMessage,\n ),\n ),\n );\n }\n const org = orgName || this.defaultOrganization;\n const inviteHash = UTILS.removeDocType(inviteId);\n return this.dispatch(`${this.baseURL}/organizations/${UTILS.encodeURISegment(org)}/invites/${inviteHash}`, CONST.GET);\n};\n\n/**\n * -- TerminusX API ---\n * Delete an invitation\n * @param {string} inviteId - The invite id to delete.\n * @param {string} [orgName] - The organization name.\n * @return {Promise} A promise that returns the call response object, or an Error if rejected.\n * @example\n * const fullInviteId=\"Organization/my_team_name/invitations/Invitation/7ad0c9eb82b6175bcda9\n * c0dfc2ac51161ef5ba7cb0988d992c4bce82b3fa5d25\"\n * accessControl.deleteOrgInvite(fullInviteId).then(result=>{\n * console.log(result)\n * })\n */\nAccessControl.prototype.deleteOrgInvite = function (inviteId, orgName) {\n let errorMessage;\n if (!orgName && !this.defaultOrganization) {\n errorMessage = 'Please provide a organization name';\n } else if (!inviteId) {\n errorMessage = 'Please provide a invite id';\n }\n\n if (errorMessage) {\n return Promise.reject(\n new Error(\n ErrorMessage.getInvalidParameterMessage(\n 'POST',\n errorMessage,\n ),\n ),\n );\n }\n const org = orgName || this.defaultOrganization;\n const inviteHash = UTILS.removeDocType(inviteId);\n return this.dispatch(`${this.baseURL}/organizations/${UTILS.encodeURISegment(org)}/invites/${inviteHash}`, CONST.DELETE);\n};\n\n/**\n * -- TerminusX API ---\n * Accept /Reject invitation. if the invitation has been accepted we add the current user\n * to the organization.\n *\n * the only user that can accept this invitation is the user registered with the invitation email,\n * we indentify the user with the jwt token\n * @param {string} inviteId - The invite id to updated.\n * @param {boolean} accepted - The status of the invitation.\n * @param {string} [orgName] - The organization name.\n * @return {Promise} A promise that returns the call response object, or an Error if rejected.\n * @example\n * const fullInviteId=\"Organization/my_team_name/invitations/Invitation/7ad0c9eb82b6175bcda9\n * c0dfc2ac51161ef5ba7cb0988d992c4bce82b3fa5d25\"\n * accessControl.updateOrgInviteStatus(fullInviteId,true).then(result=>{\n * console.log(result)\n * })\n */\nAccessControl.prototype.updateOrgInviteStatus = function (inviteId, accepted, orgName) {\n let errorMessage;\n if (!orgName && !this.defaultOrganization) {\n errorMessage = 'Please provide a organization name';\n } else if (!inviteId) {\n errorMessage = 'Please provide a invite id';\n } else if (typeof accepted === 'undefined') {\n errorMessage = 'Please provide a accepted status';\n }\n\n if (errorMessage) {\n return Promise.reject(\n new Error(\n ErrorMessage.getInvalidParameterMessage(\n 'PUT',\n errorMessage,\n ),\n ),\n );\n }\n const org = orgName || this.defaultOrganization;\n const inviteHash = UTILS.removeDocType(inviteId);\n return this.dispatch(`${this.baseURL}/organizations/${UTILS.encodeURISegment(org)}/invites/${inviteHash}`, CONST.PUT, {\n accepted,\n });\n};\n\n/**\n * -- TerminusX API ---\n * Get the user role for a given organization or the default organization\n * The user is identified by the jwt or the access token\n * @param {string} [orgName] - The organization name.\n * @return {Promise} A promise that returns the call response object, or an Error if rejected.\n * @example\n * accessControl.getTeamUserRole().then(result=>{\n * console.log(result)\n * })\n *\n * //response object example\n * {\"userRole\":\"Role/admin\"}\n */\n\nAccessControl.prototype.getTeamUserRole = function (orgName) {\n if (!orgName && !this.defaultOrganization) {\n return Promise.reject(\n new Error(\n ErrorMessage.getInvalidParameterMessage(\n 'GET',\n 'Please provide a organization name',\n ),\n ),\n );\n }\n const org = orgName || this.defaultOrganization;\n return this.dispatch(`${this.baseURL}/organizations/${UTILS.encodeURISegment(org)}/role`, CONST.GET);\n};\n\n/**\n * -- TerminusX API --\n * Remove an user from an organization, only an admin user can remove an user from an organization\n * @param {string} userId - The id of the user to be removed. (this is the document user's @id)\n * @param {string} [orgName] - The organization name in which the user is to be removed.\n * @return {Promise} A promise that returns the call response object, or an Error if rejected.\n * @example\n * accessControl.removeUserFromOrg(\"User/auth0%7C613f5dnndjdjkTTT\",\"my_org_name\").then(result=>{\n * console.log(result)\n * })\n *\n */\nAccessControl.prototype.removeUserFromOrg = function (userId, orgName) {\n let errorMessage;\n if (!orgName && !this.defaultOrganization) {\n errorMessage = 'Please provide a organization name';\n } else if (!userId) {\n errorMessage = 'Please provide a userId';\n }\n\n if (errorMessage) {\n return Promise.reject(\n new Error(\n ErrorMessage.getInvalidParameterMessage(\n 'DELETE',\n errorMessage,\n ),\n ),\n );\n }\n const org = orgName || this.defaultOrganization;\n const user = UTILS.removeDocType(userId);\n return this.dispatch(`${this.baseURL}/organizations/${UTILS.encodeURISegment(org)}/users/${user}`, CONST.DELETE);\n};\n\n/**\n * -- TerminusX API --\n * Get the user's role for every databases under the organization\n * @param {string} userId - The user's id.\n * @param {string} [orgName] - The organization name.\n * @return {Promise} A promise that returns the call response object, or an Error if rejected.\n * @example\n * accessControl.getDatabaseRolesOfUser('User/auth0%7C61790e366377Yu6596a').then(result=>{\n * console.log(result)\n * })\n *\n * //this is a capabilities list of databases and roles\n * //[ {capability: \"Capability/b395e8523d509dec6b33aefc9baed3b2e2bfadbd4c79d4ff9b20dce2b14e2edc\"\n * //if there is an id we have a user specific capabality for this database\n * // name: {@type: \"xsd:string\", @value: \"profiles_test\"}\n * // role: \"Role/dataUpdater\"\n * // scope: \"UserDatabase/7ebdfae5a02bc7e8f6d79sjjjsa4e179b1df9d4576a3b1d2e5ff3b4859\"\n * // user: \"User/auth0%7C61790e11a3966d006906596a\"},\n *\n * //{ capability: null\n * // if the capability id is null the user level of access for this database is the\n * same of the team\n * //name: {@type: \"xsd:string\", @value: \"Collab002\"}\n * //role: \"Role/dataReader\"\n * // scope: \"UserDatabase/acfcc2db02b83792sssb15239ccdf586fc5b176846ffe4878b1aea6a36c8f\"\n * //user: \"User/auth0%7C61790e11a3966d006906596a\"}]\n */\nAccessControl.prototype.getDatabaseRolesOfUser = function (userId, orgName) {\n let errorMessage;\n if (!orgName && !this.defaultOrganization) {\n errorMessage = 'Please provide a organization name';\n } else if (!userId) {\n errorMessage = 'Please provide a user id';\n }\n\n if (errorMessage) {\n return Promise.reject(\n new Error(\n ErrorMessage.getInvalidParameterMessage(\n 'GET',\n errorMessage,\n ),\n ),\n );\n }\n const org = orgName || this.defaultOrganization;\n const user = UTILS.removeDocType(userId);\n return this.dispatch(`${this.baseURL}/organizations/${UTILS.encodeURISegment(org)}/users/${user}/databases`, CONST.GET);\n};\n\n/**\n * -- TerminusX API --\n * Create a user's a role for a resource (organization/database)\n * @param {string} userId - The user's id.\n * @param {string} scope - The resource name/id.\n * @param {string} role - The user role to be assigned.\n * @param {string} [orgName] - The organization name.\n * @return {Promise} A promise that returns the call response object, or an Error if rejected.\n * @example\n * const dbId = \"UserDatabase/acfcc2db02b83792sssb15239ccdf586fc5b176846ffe4878b1aea6a36c8f\"\n * accessControl.assignUserRole('User/auth0%7C61790e11a3966d006906596a',dbId,\n * \"Role/collaborator\").then(result=>{\n * console.log(result)\n *\n * })\n */\nAccessControl.prototype.createUserRole = function (userId, scope, role, orgName) {\n let errorMessage;\n if (!orgName && !this.defaultOrganization) {\n errorMessage = 'Please provide a organization name';\n } else if (!userId) {\n errorMessage = 'Please provide a user id';\n } else if (!scope) {\n errorMessage = 'Please provide a scope';\n } else if (!role) {\n errorMessage = 'Please provide a role';\n }\n\n if (errorMessage) {\n return Promise.reject(\n new Error(\n ErrorMessage.getInvalidParameterMessage(\n 'POST',\n errorMessage,\n ),\n ),\n );\n }\n const org = orgName || this.defaultOrganization;\n const user = UTILS.removeDocType(userId);\n return this.dispatch(`${this.baseURL}/organizations/${UTILS.encodeURISegment(org)}/users/${user}/capabilities`, CONST.POST, {\n scope,\n role,\n });\n};\n\n/**\n * -- TerminusX API --\n * Update user's a role for a resource (organization/database), (this api works only in terminusX)\n * @param {string} userId - The user's id.\n * @param {string} capabilityId - The capability id.\n * @param {string} scope - The resource name/id.\n * @param {string} role - The user role to be updated.\n * @param {string} [orgName] - The organization name.\n * @return {Promise} A promise that returns the call response object, or an Error if rejected.\n * @example\n * const dbId = \"UserDatabase/acfcc2db02b83792sssb15239ccdf586fc5b176846ffe4878b1aea6a36c8f\"\n * const capId= \"Capability/b395e8523d509dec6b33aefc9baed3b2e2bfadbd4c79d4ff9b20dce2b14e2edc\"\n * accessControl.updateUserRole('User/auth0%7C61790e11a3966d006906596a',capId,dbId,\n * \"Role/dataUpdater\").then(result=>{\n * console.log(result)\n *\n * })\n */\nAccessControl.prototype.updateUserRole = function (userId, capabilityId, scope, role, orgName) {\n let errorMessage;\n if (!orgName && !this.defaultOrganization) {\n errorMessage = 'Please provide a organization name';\n } else if (!userId) {\n errorMessage = 'Please provide a user id';\n } else if (!capabilityId) {\n errorMessage = 'Please provide a capabilityId';\n } else if (!scope) {\n errorMessage = 'Please provide a scope';\n } else if (!role) {\n errorMessage = 'Please provide a role';\n }\n\n if (errorMessage) {\n return Promise.reject(\n new Error(\n ErrorMessage.getInvalidParameterMessage(\n 'PUT',\n errorMessage,\n ),\n ),\n );\n }\n const org = orgName || this.defaultOrganization;\n const user = UTILS.removeDocType(userId);\n const capHash = UTILS.removeDocType(capabilityId);\n return this.dispatch(`${this.baseURL}/organizations/${UTILS.encodeURISegment(org)}/users/${user}/capabilities/${capHash}`, CONST.PUT, {\n scope,\n role,\n });\n};\n\n/**\n * -- TerminusX API --\n * Get all the access request list for a specify organization\n * @param {string} [orgName] - The organization name.\n * @return {Promise} A promise that returns the call response object, or an Error if rejected.\n * @example\n * accessControl.accessRequestsList().then(result=>{\n * console.log(result)\n * })\n *\n */\nAccessControl.prototype.accessRequestsList = function (orgName) {\n if (!orgName && !this.defaultOrganization) {\n return Promise.reject(\n new Error(\n ErrorMessage.getInvalidParameterMessage(\n 'GET',\n 'Please provide a organization name',\n ),\n ),\n );\n }\n const org = orgName || this.defaultOrganization;\n return this.dispatch(`${this.baseURL}/organizations/${UTILS.encodeURISegment(org)}/access_requests`, CONST.GET);\n};\n\n/**\n * -- TerminusX API --\n * Get all the access request list for a specify organization\n * @param {string} [email] - the user email.\n * @param {string} [affiliation] - the user affiliation, company, university etc..\n * @param {string} [note] - the message for the team admin\n * @param {string} [orgName] - The organization name.\n * @return {Promise} A promise that returns the call response object, or an Error if rejected.\n * @example\n * accessControl.sendAccessRequest(\"myemail@terminusdb.com\",\n * \"my_company\",\n * \"please add me to your team\"\n * ).then(result=>{\n * console.log(result)\n * })\n *\n */\nAccessControl.prototype.sendAccessRequest = function (email, affiliation, note, orgName) {\n if (!orgName && !this.defaultOrganization) {\n return Promise.reject(\n new Error(\n ErrorMessage.getInvalidParameterMessage(\n 'POST',\n 'Please provide a organization name',\n ),\n ),\n );\n }\n const payload = { email, affiliation, note };\n const org = orgName || this.defaultOrganization;\n return this.dispatch(`${this.baseURL}/organizations/${UTILS.encodeURISegment(org)}/access_requests`, CONST.POST, payload);\n};\n\n/**\n * -- TerminusX API --\n * Delete an access request to join your team, only an admin user can delete it\n * @param {string} [orgName] - The organization name.\n * @return {Promise} A promise that returns the call response object, or an Error if rejected.\n * @example\n * accessControl.deleteAccessRequest(\"djjdshhsuuwewueueuiHYHYYW.......\").then(result=>{\n * console.log(result)\n * })\n *\n */\nAccessControl.prototype.deleteAccessRequest = function (acceId, orgName) {\n if (!orgName && !this.defaultOrganization) {\n return Promise.reject(\n new Error(\n ErrorMessage.getInvalidParameterMessage(\n 'POST',\n 'Please provide a organization name',\n ),\n ),\n );\n }\n const org = orgName || this.defaultOrganization;\n return this.dispatch(`${this.baseURL}/organizations/${UTILS.encodeURISegment(org)}/access_requests/${acceId}`, CONST.DELETE);\n};\n\n/**\n * -- TerminusX API --\n * Get the userinfo teams ownership and subscription\n * @param {string} [orgName] - The organization name.\n * @return {Promise} A promise that returns the call response object, or an Error if rejected.\n * @example\n * accessControl.getUserInfo().then(result=>{\n * console.log(result)\n * })\n *\n */\nAccessControl.prototype.getUserInfo = function (userName) {\n const userNameUrl = userName || 'info';\n return this.dispatch(`${this.baseURL}/users/${UTILS.encodeURISegment(userNameUrl)}`, CONST.GET);\n};\n\nmodule.exports = AccessControl;\n","const axios = require('axios');\n\nconst axiosInstance = axios.create();\n\nmodule.exports = axiosInstance;\n","/// /@ts-check\n// connectionConfig\nconst { encodeURISegment } = require('./utils');\n// eslint-disable-next-line no-unused-vars\nconst typedef = require('./typedef');\n\n/**\n * @file Terminus DB connection configuration\n * @license Apache Version 2\n * @description Object representing the state of a connection to a terminus db - these are:\n * provides methods for getting and setting connection parameters\n * @constructor\n * @param {string} serverUrl - the terminusdb server url\n * @param {typedef.ParamsObj} [params] - an object with the following connection parameters:\n */\n\nfunction ConnectionConfig(serverUrl, params) {\n /**\n * @type {string}\n */\n this.server = undefined;\n\n // the base server url without the team name\n this.baseServer = undefined;\n\n // remote auth for authenticating to remote servers for push / fetch / clone\n /** @type {typedef.CredentialObj} */\n this.remote_auth = undefined;\n\n // basic auth string for authenticating to local server\n /** @type {typedef.CredentialObj } */\n this.local_auth = undefined;\n\n // these operate as cursors - where within the connected server context, we currently are\n /** @type {string | boolean} */\n this.organizationid = false;\n /** @type {string | boolean} */\n this.dbid = false;\n\n this.default_branch_id = params && params.default_branch_id ? params.default_branch_id : 'main';\n this.default_repo_id = 'local';\n this.system_db = '_system';\n this.api_extension = 'api/';\n // default repository and branch ids\n this.branchid = this.default_branch_id;\n this.repoid = this.default_repo_id;\n // set if pointing at a commit within a branch\n /** @type {string | boolean} */\n this.refid = false;\n /** @type {string | boolean} */\n this.connection_error = false;\n // I can set serverURL only in constructor\n const surl = this.parseServerURL(serverUrl);\n\n this.server = surl;\n if (params) this.update(params);\n}\n\n/**\n * Creates a new connection config object and copies all the state information from this one into it\n * @returns {ConnectionConfig}\n */\nConnectionConfig.prototype.copy = function () {\n const other = new ConnectionConfig(this.server);\n other.api_extension = this.api_extension;\n other.remote_auth = this.remote_auth;\n other.local_auth = this.local_auth;\n other.organizationid = this.organizationid;\n other.dbid = this.dbid;\n other.branchid = this.branchid;\n other.repoid = this.repoid;\n other.refid = this.refid;\n return other;\n};\n\n/**\n * updates connection config with new parameters\n * @param {typedef.ParamsObj} params - an object with the following connection parameters:\n */\n// this is a general review\n// I think we have to throw an error\n// before a servercall\n// when the user of key/jwt is not setted\nConnectionConfig.prototype.update = function (params) {\n if (!params) return;\n const orgID = params.organization || params.user;\n // console.log(\"orgID\",orgID,params)\n this.setOrganization(orgID);\n // if (typeof params.credential !== 'undefined')this.setTokenParameter(params.credential)\n if (typeof params.db !== 'undefined') this.setDB(params.db);\n // this to set the author and the jwt in creation\n if (typeof params.token !== 'undefined') this.setLocalBasicAuth(params.token, params.user, 'apikey');\n // this is for jwt\n else if (typeof params.jwt !== 'undefined') this.setLocalBasicAuth(params.jwt, params.user, 'jwt');\n // this is basic authO\n else if (typeof params.key !== 'undefined') this.setLocalBasicAuth(params.key, params.user);\n // If I set only the user I have to set the\n else if (typeof params.user !== 'undefined') this.setLocalBasicAuth(null, params.user);\n if (typeof params.branch !== 'undefined') this.setBranch(params.branch);\n if (typeof params.ref !== 'undefined') this.setRef(params.ref);\n if (typeof params.repo !== 'undefined') this.setRepo(params.repo);\n};\n\n/* ConnectionConfig.prototype.setTokenParameter = function(param){\n this.tokenParameter = param\n} */\n\n/**\n * Simple gets to retrieve current connection status\n * Gets the current server url\n * @returns {string}\n */\nConnectionConfig.prototype.serverURL = function () {\n return this.server;\n};\n\n/**\n * Simple gets to retrieve current connection status\n * Gets the current server url\n * @returns {string}\n */\nConnectionConfig.prototype.author = function () {\n return this.author;\n};\n\n/**\n * Gets the server connection url\n * @returns {string}\n */\nConnectionConfig.prototype.apiURL = function () {\n return this.server + this.api_extension;\n};\n\n/**\n * Gets the server connection url info\n * @returns {string}\n */\nConnectionConfig.prototype.apiURLInfo = function () {\n return `${this.apiURL()}info`;\n};\n\n/**\n * Gets the current database id\n * @returns {string | boolean}\n */\nConnectionConfig.prototype.db = function () {\n if (!this.dbid) throw new Error('Invalid database name');\n return this.dbid;\n};\n\n/**\n * Gets the current branch id\n * @returns {string}\n */\nConnectionConfig.prototype.branch = function () {\n return this.branchid;\n};\n\n/**\n * Gets the current commit ref id\n * @returns {string | boolean}\n */\nConnectionConfig.prototype.ref = function () {\n return this.refid;\n};\n\n/**\n * Gets the current organization id\n * @returns {string | boolean}\n */\nConnectionConfig.prototype.organization = function () {\n return this.organizationid;\n};\n\n/**\n * Gets the current organization id\n * @returns {string}\n */\nConnectionConfig.prototype.repo = function () {\n return this.repoid;\n};\n\n/**\n *Gets the local Authorization credentials\n *return {CredentialObj | boolean}\n */\nConnectionConfig.prototype.localAuth = function () {\n if (this.local_auth) return this.local_auth;\n return false;\n};\n\n/**\n *Gets the local user name\n *return {string | boolean}\n */\nConnectionConfig.prototype.localUser = function () {\n if (this.local_auth) return this.local_auth.user;\n return false;\n};\n\n/**\n *Gets the current user name\n *@param {boolean} [ignoreJwt]\n *return {string | boolean}\n */\nConnectionConfig.prototype.user = function (ignoreJwt) {\n if (!ignoreJwt && this.remote_auth && this.remote_auth.type === 'jwt') return this.remote_auth.user;\n if (this.local_auth) {\n return this.local_auth.user;\n }\n return false;\n};\n\n/**\n * Check the server URL\n * @param {string} str - the server url string\n * @returns {string}\n */\n\nConnectionConfig.prototype.parseServerURL = function (str) {\n if (str && (str.substring(0, 7) === 'http://' || str.substring(0, 8) === 'https://')) {\n if (str.lastIndexOf('/') !== str.length - 1) {\n // eslint-disable-next-line no-param-reassign\n str += '/'; // always append slash to ensure regularity\n }\n return this.serverUrlEncoding(str);\n }\n // throw an error this is the\n // return false\n throw new Error(`Invalid Server URL: ${str}`);\n};\n\nConnectionConfig.prototype.serverUrlEncoding = function (str) {\n const orgArr = str.split('/');\n if (orgArr.length > 4) {\n // we can need only the server baseurl\n this.baseServer = str.replace(`${orgArr[3]}/`, '');\n // const org = encodeURI(orgArr[3])\n /*\n * if we pass the organization name like Francesca-Bit-9e73\n * I need to encode it 2 times because in the database\n * when we create an id from a property it encodes the property value\n */\n const org = encodeURISegment(orgArr[3]);\n return str.replace(orgArr[3], org);\n }\n this.baseServer = str;\n return str;\n};\n\n/**\n * Clear cursor for connection\n */\nConnectionConfig.prototype.clearCursor = function () {\n this.branchid = this.default_branch_id;\n this.repoid = this.default_repo_id;\n this.organizationid = false;\n this.dbid = false;\n this.refid = false;\n};\n\n/**\n * @param {string | boolean} errorMessage\n */\nConnectionConfig.prototype.setError = function (errorMessage) {\n this.connection_error = errorMessage;\n};\n\n/**\n * Set the organization to which the connected db belongs\n * (not the users organization - set in capabilities)\n * @param {string | boolean} [orgId]\n */\nConnectionConfig.prototype.setOrganization = function (orgId = 'admin') {\n this.organizationid = orgId;\n};\n\n/**\n * Set the local identifier of db\n * @param {string | boolean} dbId - database Id\n */\n\nConnectionConfig.prototype.setDB = function (dbId) {\n this.dbid = dbId;\n};\n\n/**\n * Set the repository type |local|remote|\n * @param {typedef.RepoType | string} repoId - for the local server - identifier of repo\n */\nConnectionConfig.prototype.setRepo = function (repoId) {\n this.repoid = repoId;\n};\n\n/**\n * @param {string} [branchId] - id of branch\n */\nConnectionConfig.prototype.setBranch = function (branchId) {\n this.branchid = branchId || this.default_branch_id;\n};\n\n/**\n * Set an Reference ID or Commit ID.\n * Commit IDs are unique hashes that are created whenever a new commit is recorded\n * @param {string | boolean} refId - commit reference id\n */\nConnectionConfig.prototype.setRef = function (refId) {\n this.refid = refId;\n // return this.refid\n};\n\n/**\n * set the local database connection credential\n * @param {string} [remoteKey] - jwt auth api key\n * @param {string} [remoteUserID] - remote user id\n */\nConnectionConfig.prototype.setRemoteBasicAuth = function (remoteKey, remoteUserID) {\n if (!remoteKey) {\n this.remote_auth = undefined;\n } else {\n this.remote_auth = { type: 'jwt', user: remoteUserID, key: remoteKey };\n }\n};\n\n/**\n * set the local database connection credential\n * @param {string} [userKey] - basic auth api key\n * @param {string} [userId] - user id\n * @param {string} [type] - basic|jwt|apikey\n */\n// to be review this is ok for the basic Auth\nConnectionConfig.prototype.setLocalBasicAuth = function (userKey, userId = 'admin', type = 'basic') {\n this.local_auth = { type, user: userId, key: userKey };\n};\n\n/**\n * Set the local server connection credential\n * @param {typedef.CredentialObj} newCredential\n */\nConnectionConfig.prototype.setLocalAuth = function (newCredential) {\n this.local_auth = newCredential;\n};\n\n/**\n * Set the remote server connection credential\n * @param {typedef.CredentialObj} newCredential\n */\nConnectionConfig.prototype.setRemoteAuth = function (newCredential) {\n this.remote_auth = newCredential;\n};\n\n/**\n *Gets the remote Authorization credentials\n *to connect the local db with a remote terminusdb database for push-pull-clone actions\n *return {CredentialObj| boolean}\n */\nConnectionConfig.prototype.remoteAuth = function () {\n if (this.remote_auth) return this.remote_auth;\n return false;\n};\n\n/**\n * Generate the db endpoit url for create / delete db\n * @returns {string}\n */\nConnectionConfig.prototype.dbURL = function () {\n return this.dbBase('db');\n};\n\n/**\n * Generate URL for the user's api endpoint\n * @param {string} [user] - the user id\n * @returns {string}\n */\n\nConnectionConfig.prototype.userURL = function (user) {\n let url = `${this.apiURL()}user`;\n if (user) url += `/${encodeURISegment(user)}`;\n return url;\n};\n\n/**\n * Generate URL for the user's organization api endpoint\n * @param {string} orgId - the organization id\n * @param {string} [action] - the organization id\n * @returns {string}\n */\n// encodeURIComponent\nConnectionConfig.prototype.organizationURL = function (orgId, action) {\n let url = `${this.apiURL()}organization`;\n // I have to encode the organization 2 times because it is saved encoded inside the database\n //\n if (orgId) url += `/${encodeURISegment(orgId)}`;\n if (action) url += `/${encodeURISegment(action)}`;\n return url;\n};\n\n/**\n * Generate URL for the user's organization api endpoint\n * @param {string} orgId - the organization id\n * @param {string} [action] - the organization id\n * @returns {string}\n */\n\nConnectionConfig.prototype.userOrganizationsURL = function () {\n const url = `${this.apiURL()}user_organizations`;\n return url;\n};\n\n/**\n * Generate URL for the user's roles api endpoint\n * @returns {string}\n */\nConnectionConfig.prototype.rolesURL = function () {\n return `${this.apiURL()}role`;\n};\n\n/**\n * Generate URL to update the user's role api endpoint\n * @returns {string}\n */\n\n// REVIEW maybe it can be the same of roleURL but we can change the rest action in put.\n\nConnectionConfig.prototype.updateRolesURL = function () {\n return `${this.apiURL()}update_role`;\n};\n\n/**\n * Generate URL for create / delete graph api endpoint\n * @param {string} graphType\n * @returns {string}\n */\nConnectionConfig.prototype.graphURL = function (graphType) {\n return `${this.branchBase('graph')}/${graphType}/main`;\n};\n\n/**\n * Generate URL for get / set schema api endpoint\n * @param {string} graphType\n * @returns {string}\n */\nConnectionConfig.prototype.triplesURL = function (graphType) {\n // eslint-disable-next-line vars-on-top\n // eslint-disable-next-line no-var\n let url = '';\n if (this.db() === this.system_db) {\n // eslint-disable-next-line no-unused-vars\n const s = this.dbBase('triples');\n } else {\n url = this.branchBase('triples');\n }\n\n url += `/${graphType}/main`;\n return url;\n};\n\n/**\n * Generate URL for add / get csv api endpoint\n * @returns {string}\n */\n\nConnectionConfig.prototype.csvURL = function () {\n const s = this.branchBase('csv');\n return s;\n};\n\n/**\n * Generate URL for woql query api endpoint\n * @returns {string}\n */\nConnectionConfig.prototype.queryURL = function () {\n if (this.db() === this.system_db) return this.dbBase('woql');\n return this.branchBase('woql');\n};\n\n/**\n * Generate URL for get back the commits logs\n * @returns {string}\n */\nConnectionConfig.prototype.log = function () {\n if (this.db() === this.system_db) return this.dbBase('log');\n return this.branchBase('log');\n};\n\n/**\n * get the url to update the organization role in the system database\n * don't change the end point (this is a terminus db server end point)\n * @returns {string}\n */\nConnectionConfig.prototype.updateOrganizationRoleURL = function () {\n return `${this.apiURL()}update_role`;\n};\n\n/**\n * Generate URL for clone db endpoint\n * @param {string} [newRepoId] the repository id\n * @returns {string}\n */\nConnectionConfig.prototype.cloneURL = function (newRepoId) {\n let crl = `${this.apiURL()}clone/${this.organization()}`;\n if (newRepoId) crl += `/${newRepoId}`;\n return crl;\n};\n\n/**\n * URL at which a db can be cloned\n * @returns {string}\n */\nConnectionConfig.prototype.cloneableURL = function () {\n return `${this.serverURL()}${this.organization()}/${this.db()}`;\n};\n\n/**\n * Generate URL for pull endpoint\n * @returns {string}\n */\nConnectionConfig.prototype.pullURL = function () {\n const purl = this.branchBase('pull');\n return purl;\n};\n\n/**\n * Generate URL for pull endpoint\n * @returns {string}\n */\nConnectionConfig.prototype.patchURL = function () {\n const purl = this.branchBase('patch');\n return purl;\n};\n\n/**\n * Generate URL for diff endpoint\n * @returns {string}\n */\nConnectionConfig.prototype.diffURL = function () {\n const purl = this.branchBase('diff');\n return purl;\n};\n\n/**\n * Generate URL for diff endpoint\n * @returns {string}\n */\nConnectionConfig.prototype.applyURL = function () {\n const purl = this.branchBase('apply');\n return purl;\n};\n\n/**\n * Generate url portion consisting of organization/dbid\n * (unless dbid = system dbname in which case there is no organization)\n * @property {typedef.DocParamsPost|Object} params\n */\n\nConnectionConfig.prototype.docHistoryURL = function (params) {\n const paramsStr = this.queryParameter(params);\n if (this.db() === this.system_db) {\n return this.dbBase('history') + paramsStr;\n }\n return this.branchBase('history') + paramsStr;\n};\n\n/**\n * Generate URL for fetch endpoint\n * @param {string} remoteName\n * @returns {string}\n */\nConnectionConfig.prototype.fetchURL = function (remoteName) {\n const purl = this.dbBase('fetch');\n return `${purl}/${remoteName}/_commits`;\n};\n\n/**\n * Generate URL for rebase endpoint\n * @returns {string}\n */\nConnectionConfig.prototype.rebaseURL = function () {\n const purl = this.branchBase('rebase');\n return purl;\n};\n\n/**\n * Generate URL for reset endpoint\n * @returns {string}\n */\nConnectionConfig.prototype.resetURL = function () {\n const purl = this.branchBase('reset');\n return purl;\n};\n\n/**\n * Generate URL for push endpoint\n * @returns {string}\n */\nConnectionConfig.prototype.pushURL = function () {\n const purl = this.branchBase('push');\n return purl;\n};\n\n/**\n * Generate URL for branch endpoint\n * @param {string} branchId - the branch id\n * @returns {string}\n */\nConnectionConfig.prototype.branchURL = function (branchId) {\n const url = this.repoBase('branch');\n return `${url}/branch/${branchId}`;\n};\n\n/**\n * Generate URL for branch squash endpoint\n */\nConnectionConfig.prototype.squashBranchURL = function (nuid) {\n const b = this.repoBase('squash');\n return `${b}/branch/${nuid}`;\n};\n\n/**\n * Generate URL for branch reset endpoint\n */\nConnectionConfig.prototype.resetBranchUrl = function (nuid) {\n const b = this.repoBase('reset');\n return `${b}/branch/${nuid}`;\n};\n\n/**\n * Generate URL for commit descriptor\n * @param {string} commitId\n * @returns {string} a commit pathname\n */\n// this is not a url\nConnectionConfig.prototype.commitDescriptorUrl = function (commitId) {\n return `${this.organization()}/${this.db()}/${this.repoid}/commit/${commitId}`;\n};\n\n/**\n * Generate URL for optimizing db branch\n */\n// encodeURI() will not encode: ~!@#$&*()=:/,;?+'\nConnectionConfig.prototype.optimizeBranchUrl = function (branchId) {\n // let o = this.optimizeBase()\n const dbBase = this.dbBase('optimize');\n return `${dbBase}/${this.repoid}/branch/${encodeURIComponent(branchId)}`;\n // return dbBase + `${this.user()}/${this.db()}/${this.repoid}/branch/${nuid}`\n};\n\n/**\n * Generate base db url consisting of server/action/organization/dbid\n * @param {typedef.ActionType} action\n * @returns {string}\n */\nConnectionConfig.prototype.dbBase = function (action) {\n return `${this.apiURL()}${action}/${this.dbURLFragment()}`;\n};\n\n// https://127.0.0.1:6363/api/document/admin/cloud-profiles/local/branch/main?graph_type=instance\n// instance\n\n/**\n * Generate base branch url consisting of server/action/organization/dbid/branchid\n * @param {typedef.ActionType} action\n * @returns {string}\n */\nConnectionConfig.prototype.repoBase = function (action) {\n let b = this.dbBase(action);\n if (this.repo()) b += `/${this.repo()}`;\n else b += `/${this.default_repo_id}`;\n return b;\n};\n\n/**\n * Get database branch Url\n * Generate base branch url consisting of server/action/organization/dbid/branchid\n * @param {typedef.ActionType} action\n * @returns {string}\n */\nConnectionConfig.prototype.branchBase = function (action) {\n let b = this.repoBase(action);\n // _meta repo is magic - stores repository metadata\n if (this.repo() === '_meta') {\n return b;\n }\n // _commits branch is magic - stores all commits for repo\n\n /*\n *https://127.0.0.1:6363/api/db/admin/profiles01/local/_commits\n */\n if (this.branch() === '_commits') {\n return `${b}/${this.branch()}`;\n } if (this.ref()) {\n return `${b}/commit/${this.ref()}`;\n } if (this.branch()) {\n return `${b}/branch/${encodeURIComponent(this.branch())}`;\n } b += `/branch/${this.default_branch_id}`;\n return b;\n};\n\n/**\n * Generate url portion consisting of organization/dbid\n * (unless dbid = system dbname in which case there is no organization)\n * @returns {string|boolean}\n */\n// encodeURIComponent\nConnectionConfig.prototype.dbURLFragment = function () {\n if (this.db() === this.system_db) return this.db();\n return `${encodeURISegment(this.organization())}/${encodeURISegment(this.db())}`;\n};\n\n/**\n * Generate url portion consisting of organization/dbid\n * (unless dbid = system dbname in which case there is no organization)\n * @property {typedef.DocParamsPost|Object} params\n */\n\nConnectionConfig.prototype.documentURL = function (params) {\n const paramsStr = this.queryParameter(params);\n if (this.db() === this.system_db) {\n return this.dbBase('document') + paramsStr;\n }\n return this.branchBase('document') + paramsStr;\n};\n\nConnectionConfig.prototype.prefixesURL = function () {\n if (this.db() === this.system_db) {\n return this.dbBase('prefixes');\n }\n return this.branchBase('prefixes');\n};\n\nConnectionConfig.prototype.queryParameter = function (params) {\n if (!params || typeof params !== 'object') return '';\n const queryString = Object.keys(params).map((key) => `${key}=${encodeURISegment(params[key])}`).join('&');\n return `?${queryString}`;\n};\n\nConnectionConfig.prototype.jsonSchemaURL = function (params) {\n const paramsStr = this.queryParameter(params);\n if (this.db() === this.system_db) {\n return this.dbBase('schema') + paramsStr;\n }\n return this.branchBase('schema') + paramsStr;\n};\n\nmodule.exports = ConnectionConfig;\n","/**\n * @file Terminus Constants\n * @license Apache Version 2\n * Constants representing API actions\n */\n\nmodule.exports = Object.freeze({\n POST: 'POST',\n GET: 'GET',\n DELETE: 'DELETE',\n PUT: 'PUT',\n HEAD: 'HEAD',\n QUERY_DOCUMENT: 'QUERY_DOCUMENT',\n SQUASH_BRANCH: 'SQUASH_BRANCH',\n UPDATE_SCHEMA: 'UPDATE_SCHEMA',\n CONNECT: 'connect',\n CREATE_DATABASE: 'create_database',\n READ_DATABASE: 'read_database',\n UPDATE_DATABASE: 'update_database',\n CREATE_USER: 'create_user',\n READ_USER: 'read_user',\n UPDATE_USER: 'update_user',\n CREATE_ORGANIZATION: 'create_organization',\n READ_ORGANIZATION: 'read_organization',\n UPDATE_ORGANIZATION: 'update_organization',\n GET_ROLES: 'get_roles',\n UPDATE_ROLES: 'update_roles',\n CREATE_GRAPH: 'create_graph',\n GET_TRIPLES: 'get_triples',\n INSERT_TRIPLES: 'insert_triples',\n UPDATE_TRIPLES: 'update_triples',\n CLASS_FRAME: 'class_frame',\n WOQL_QUERY: 'woql_query',\n CLONE: 'clone',\n CSV: 'csv',\n WOQL: 'woql',\n FRAME: 'frame',\n PUSH: 'push',\n PULL: 'pull',\n FETCH: 'fetch',\n REBASE: 'rebase',\n RESET: 'reset',\n BRANCH: 'branch',\n RESET_BRANCH: 'reset_branch',\n ADD_CSV: 'add_csv',\n GET_CSV: 'get_csv',\n UPDATE_CSV: 'update_csv',\n MESSAGE: 'message',\n ACTION: 'action',\n INFO: 'info',\n OPTIMIZE_SYSTEM: 'optimize_system',\n GET_DIFF: 'getDiff',\n PATCH: 'patch',\n});\n","/* eslint-disable camelcase */\nconst pako = require('pako');\nconst axiosInstance = require('./axiosInstance');\nconst UTILS = require('./utils');\nconst CONST = require('./const');\nconst ErrorMessage = require('./errorMessage');\nconst { version } = require('../package.json');\n// eslint-disable-next-line no-unused-vars\nconst typedef = require('./typedef');\n/**\n * base 64 encodes a string using either the btoa implementation if available or the Buffer object.\n * @param {String} str string to be base 64 encoded\n */\nfunction btoaImplementation(str) {\n try {\n return btoa(str);\n } catch (err) {\n return Buffer.from(str).toString('base64');\n }\n}\n\n/**\n * @param {object} response\n * @returns {object} Object having two properties result and dataVersion\n */\nfunction getResultWithDataVersion(response) {\n return {\n result: response.data,\n dataVersion: response.headers['terminusdb-data-version']\n ? response.headers['terminusdb-data-version']\n : '',\n };\n}\n/**\n * Create the authorization header string\n * @param {object} auth_obj\n * @returns {object} Object with the Authorization header\n */\n\nfunction formatAuthHeader(auth_obj) {\n if (!auth_obj) return '';\n const authType = { jwt: 'Bearer', basic: 'Basic', apikey: 'Token' };\n let auth_key = auth_obj.key;\n\n if (auth_obj.type === 'basic') {\n auth_key = btoaImplementation(`${auth_obj.user}:${auth_obj.key}`);\n }\n return `${authType[auth_obj.type]} ${auth_key}`;\n}\n\nfunction checkPayload(payload, options, compress) {\n if (!payload || typeof payload !== 'object') return false;\n const jsonStringPost = JSON.stringify(payload);\n if (jsonStringPost && jsonStringPost.length > 1024 && compress) {\n // eslint-disable-next-line no-param-reassign\n options.headers['Content-Encoding'] = 'gzip';\n return pako.gzip(jsonStringPost);\n }\n return false;\n}\n\n/**\n * @file Dispatch Request\n * @license Apache Version 2\n * @description Functions for dispatching API requests via the axios library.\n * @param {string} url API endpoint URL\n * @param {string} action API action\n * @param {object} payload data to be transmitted to endpoint\n * @param {typedef.CredentialObj} local_auth the local authorization object\n * @param {typedef.CredentialObj} remote_auth the remote authoriuzation object\n * @param {object} customHeaders all the custom header to add to your call\n * @param {boolean} [getDataVersion] If true the function will return object having result\n * and dataVersion.\n * @param {boolean} [compress] If true, compress the data with gzip if its size is bigger than 1024\n */\n\n// eslint-disable-next-line max-len\nfunction DispatchRequest(url, action, payload, local_auth, remote_auth = null, customHeaders = null, getDataVersion = false, compress = false) {\n /*\n *CORS is only required when trying to fetch data from a browser,\n *as browsers by default will block requests to different origins\n */\n const options = {\n mode: 'cors', // no-cors, cors, *same-origin\n redirect: 'follow', // manual, *follow, error\n referrer: 'client',\n maxContentLength: Infinity,\n maxBodyLength: Infinity,\n headers: {},\n // url:url,\n // no-referrer, *client\n };\n // Only allow self signed certs on 127.0.0.1\n // and on node\n if (url.startsWith('https://127.0.0.1') && typeof window === 'undefined') {\n // eslint-disable-next-line global-require\n const https = require('https');\n const agent = new https.Agent({\n rejectUnauthorized: false,\n });\n options.httpsAgent = agent;\n }\n\n /*\n * I can call the local database using the local authorization key or\n * a jwt token\n */\n /* if (local_auth && local_auth.type === 'basic') {\n const encoded = btoaImplementation(`${local_auth.user}:${local_auth.key}`);\n options.headers = { Authorization: `Basic ${encoded}` };\n } else if (local_auth && local_auth.type === 'jwt') {\n options.headers = { Authorization: `Bearer ${local_auth.key}` };\n } else if (local_auth && local_auth.type === 'apikey') {\n options.headers = { Authorization: `Token ${local_auth.key}` };\n } */\n /*\n * I can call the local database or a custom installation using the local authorization key or\n * I Can call TerminusX using the jwt token or an apiToken\n */\n if (local_auth && typeof local_auth === 'object') {\n options.headers.Authorization = formatAuthHeader(local_auth);\n }\n\n /*\n * pass the Authorization information of another\n * terminusdb server to the local terminusdb\n * for authentication you can use jwt or the apiKey token in TerminusX or\n * the Basic autentication if is allowed in the custom server\n */\n if (remote_auth && typeof remote_auth === 'object') {\n options.headers['Authorization-Remote'] = formatAuthHeader(remote_auth);\n }\n\n if (customHeaders && typeof customHeaders === 'object') {\n // eslint-disable-next-line array-callback-return\n Object.keys(customHeaders).map((key) => {\n options.headers[key] = customHeaders[key];\n });\n }\n\n if (typeof window === 'undefined') {\n options.headers['User-Agent'] = `terminusdb-client-js/${version}`;\n }\n\n switch (action) {\n case CONST.DELETE: {\n if (payload) {\n options.headers = options.headers ? options.headers : {};\n options.headers['Content-Type'] = 'application/json; charset=utf-8';\n options.data = payload;\n }\n return axiosInstance\n .delete(url, options)\n .then((response) => (getDataVersion ? getResultWithDataVersion(response) : response.data))\n .catch((err) => {\n throw ErrorMessage.apiErrorFormatted(url, options, err);\n });\n }\n case CONST.HEAD: {\n return axiosInstance\n .head(url, options)\n .then((response) => (getDataVersion ? getResultWithDataVersion(response) : response.data))\n .catch((err) => {\n throw ErrorMessage.apiErrorFormatted(url, options, err);\n });\n }\n case CONST.GET: {\n if (payload) {\n const ext = UTILS.URIEncodePayload(payload);\n // eslint-disable-next-line no-param-reassign\n if (ext) url += `?${ext}`;\n }\n return axiosInstance\n .get(url, options)\n .then((response) => {\n const r = getDataVersion ? getResultWithDataVersion(response) : response.data;\n return r;\n })\n .catch((err) => {\n throw ErrorMessage.apiErrorFormatted(url, options, err);\n });\n }\n case CONST.ADD_CSV:\n case CONST.INSERT_TRIPLES: {\n options.headers = options.headers ? options.headers : {};\n options.headers['Content-Type'] = 'application/form-data; charset=utf-8';\n return axiosInstance\n .put(url, payload, options)\n .then((response) => (getDataVersion ? getResultWithDataVersion(response) : response.data))\n .catch((err) => {\n throw ErrorMessage.apiErrorFormatted(url, options, err);\n });\n }\n case CONST.PUT: {\n options.headers = options.headers ? options.headers : {};\n options.headers['Content-Type'] = 'application/json; charset=utf-8';\n let compressedContent = null;\n const jsonString = JSON.stringify(payload);\n\n if (jsonString.length > 1024 && compress) {\n options.headers['Content-Encoding'] = 'gzip';\n compressedContent = pako.gzip(jsonString);\n }\n return axiosInstance\n .put(url, compressedContent || payload, options)\n .then((response) => (getDataVersion ? getResultWithDataVersion(response) : response.data))\n .catch((err) => {\n throw ErrorMessage.apiErrorFormatted(url, options, err);\n });\n }\n case CONST.QUERY_DOCUMENT: {\n options.headers = options.headers ? options.headers : {};\n options.headers['X-HTTP-Method-Override'] = 'GET';\n // eslint-disable-next-line no-fallthrough\n }\n default: {\n options.headers = options.headers ? options.headers : {};\n options.headers['Content-Type'] = 'application/json; charset=utf-8';\n const compressedContentPost = checkPayload(payload, options, compress);\n return axiosInstance\n .post(url, compressedContentPost || payload || {}, options)\n .then((response) => {\n const r = getDataVersion ? getResultWithDataVersion(response) : response.data;\n return r;\n })\n .catch((err) => {\n throw ErrorMessage.apiErrorFormatted(url, options, err);\n });\n }\n }\n}\n\nmodule.exports = DispatchRequest;\n","/* eslint-disable no-restricted-syntax */\n/* eslint-disable prefer-destructuring */\n/* eslint-disable no-use-before-define */\n/* eslint-disable no-param-reassign */\nfunction getErrorAsMessage(url, api, err) {\n let str = '';\n if (err.response) {\n err = err.response;\n if (err.data) str += `${formatErrorMessage(err.data)}`;\n } else if (err.body) str += `${formatErrorMessage(err.body)}`;\n url = url.split('?')[0];\n\n if (err.status) str += `Code: ${err.status}`;\n if (err.action) str += ` Action: ${err.action}`;\n if (err.type) str += ` Type: ${err.type}`;\n if (url) str += ` url: ${url}`;\n if (api && api.method) str += ` method: ${api.method}`;\n if (err.stack) str = [str, err.stack].join('\\n');\n return str;\n}\n\nfunction formatErrorMessage(msg) {\n if (typeof msg === 'object') {\n let nmsg = '';\n for (const key of Object.keys(msg)) {\n if (msg[key] && typeof msg[key] !== 'object') nmsg += `${key} ${msg[key]} `;\n }\n return nmsg;\n }\n return msg;\n}\n\nfunction accessDenied(action, db, server) {\n const err = {};\n err.status = 403;\n err.url = (server || '') + (db || '');\n err.type = 'client';\n err.action = action;\n err.body = `${err.action} not permitted for ${err.url}`;\n return err;\n}\n\nfunction getAPIErrorMessage(url, api, err) {\n return `API Error ${getErrorAsMessage(url, api, err)}`;\n}\n\nfunction getAccessDeniedMessage(url, api, err) {\n return `Access Denied ${getErrorAsMessage(url, api, err)}`;\n}\n\nfunction getInvalidURIMessage(url, call) {\n const str = `Invalid argument to\n ${call}. \n ${url}\n is not a valid Terminus DB API endpoint`;\n return str;\n}\n\nfunction getInvalidParameterMessage(call, msg) {\n const str = `Invalid Parameter to\n ${call}. \n ${msg}`;\n return str;\n}\n\n/**\n * Utility functions for generating and retrieving error messages\n * and storing error state\n */\n\nfunction parseAPIError(response) {\n const err = {};\n err.status = response.status;\n err.type = response.type;\n if (response.data && typeof response.data === 'object') {\n let msg;\n try {\n msg = response.text();\n } catch (e) {\n try {\n msg = response.json();\n } catch (error) {\n msg = response.toString();\n }\n }\n err.body = msg;\n } else if (response.data) err.body = response.data;\n err.url = response.url;\n err.headers = response.headers;\n err.redirected = response.redirected;\n return err;\n}\n\nfunction apiErrorFormatted(url, options, err) {\n const e = new Error(getAPIErrorMessage(url, options, err));\n if (err.response && err.response.data) e.data = err.response.data;\n if (err.response && err.response.status) e.status = err.response.status;\n return e;\n}\n\nmodule.exports = {\n apiErrorFormatted,\n getErrorAsMessage,\n getAPIErrorMessage,\n getAccessDeniedMessage,\n accessDenied,\n getInvalidURIMessage,\n getInvalidParameterMessage,\n parseAPIError,\n};\n","/* eslint-disable guard-for-in */\n/* eslint-disable no-restricted-syntax */\n/* eslint-disable no-underscore-dangle */\n/* eslint-disable no-self-assign */\n/* eslint-disable camelcase */\n/* eslint-disable no-param-reassign */\n// WOQLQuery\n/**\n * module WOQLQuery\n *\n */\n\n/**\n * defines the internal functions of the woql query object - the\n * language API is defined in WOQLQuery\n * @module WOQLQuery\n * @constructor\n * @param {object} [query] json-ld query for initialisation\n * @returns {WOQLQuery}\n */\n\nconst WOQLQueryExt = require('./woqlQuery');\n\n// eslint-disable-next-line no-unused-vars\nconst typedef = require('../typedef');\n// const WOQLLibrary = require('./woqlLibrary');\n\nclass WOQLQuery extends WOQLQueryExt {\n // eslint-disable-next-line no-useless-constructor\n constructor(query) {\n super(query);\n }\n}\n\n// WOQLQuery.prototype.counter = 1;\n/**\n * @param {typedef.GraphRef} [Graph] - the resource identifier of a graph possible\n * @param {string|Var} [Subj] - The IRI of a triple’s subject or a variable\n * @param {string|Var} [Pred] - The IRI of a property or a variable\n * @param {string|Var} [Obj] - The IRI of a node or a variable, or a literal\n * @returns {WOQLQuery} - A WOQLQuery which contains the pattern matching expression\n */\n/**\n * Simple composite functions which produce WOQL queries\n */\nWOQLQuery.prototype.star = function (Graph, Subj, Pred, Obj) {\n Subj = Subj || 'v:Subject';\n Pred = Pred || 'v:Predicate';\n Obj = Obj || 'v:Object';\n Graph = Graph || false;\n if (Graph) {\n return this.quad(Subj, Pred, Obj, Graph);\n }\n return this.triple(Subj, Pred, Obj);\n};\n\n/**\n * @param {string|Var} [Subj] - The IRI of a triple’s subject or a variable\n * @param {string|Var} [Pred] - The IRI of a property or a variable\n * @param {string|Var} [Obj] - The IRI of a node or a variable, or a literal\n * @param {typedef.GraphRef} [Graph] - the resource identifier of a graph possible\n * @returns {WOQLQuery} - A WOQLQuery which contains the pattern matching expression\n */\n\nWOQLQuery.prototype.all = function (Subj, Pred, Obj, Graph) {\n return this.star(Graph, Subj, Pred, Obj);\n};\n\n/**\n * @param {string} s\n * @returns {object}\n */\n\nWOQLQuery.prototype.string = function (s) {\n return { '@type': 'xsd:string', '@value': String(s) };\n};\n\n/**\n * @param {boolean} tf\n * @returns {object}\n */\n\nWOQLQuery.prototype.boolean = function (tf) {\n tf = tf || false;\n return this.literal(tf, 'boolean');\n};\n\n/**\n * @param {any} s\n * @param {string} t\n * @returns {object}\n */\nWOQLQuery.prototype.literal = function (s, t) {\n t = t.indexOf(':') === -1 ? `xsd:${t}` : t;\n return { '@type': t, '@value': s };\n};\n\n/**\n * @param {string} s\n * @returns {object}\n */\n\nWOQLQuery.prototype.iri = function (s) {\n return {\n '@type': 'NodeValue',\n node: s,\n };\n};\n\n/**\n * Update a pattern matching rule for the triple (Subject, Predicate, oldObjValue) with the\n * new one (Subject, Predicate, newObjValue)\n * @param {string|Var} subject - The IRI of a triple’s subject or a variable\n * @param {string|Var} predicate - The IRI of a property or a variable\n * @param {string|Var} newObjValue - The value to update or a literal\n * @param {string|Var} oldObjValue - The old value of the object\n * @returns {WOQLQuery} A WOQLQuery which contains the a Update Triple Statement\n */\n\nWOQLQuery.prototype.update_triple = function (subject, predicate, newObjValue, oldObjValue) {\n const tmp_name = oldObjValue || `v:AnyObject__${this.counter += 1}`;\n return this.and(\n new WOQLQuery().opt(\n new WOQLQuery()\n .triple(subject, predicate, tmp_name)\n .delete_triple(subject, predicate, tmp_name)\n .not()\n .triple(subject, predicate, newObjValue),\n ),\n new WOQLQuery().add_triple(subject, predicate, newObjValue),\n );\n};\n\n/**\n * @description Update a pattern matching rule for the quad [S, P, O, G]\n * (Subject, Predicate, Object, Graph)\n * @param {string} subject - The IRI of a triple’s subject or a variable\n * @param {string} predicate - The IRI of a property or a variable\n * @param {string} newObject - The value to update or a literal\n * @param {string} graph - the resource identifier of a graph possible value are\n * schema/{main - myschema - *} | instance/{main - myschema - *} | inference/{main - myschema - *}\n * @returns {WOQLQuery} A WOQLQuery which contains the a Update Quad Statement\n */\n\nWOQLQuery.prototype.update_quad = function (subject, predicate, newObject, graph) {\n const tmp_name = `v:AnyObject__${this.counter += 1}`;\n return this.and(\n new WOQLQuery().opt(\n new WOQLQuery()\n .quad(subject, predicate, tmp_name, graph)\n .delete_quad(subject, predicate, tmp_name, graph)\n .not()\n .quad(subject, predicate, newObject, graph),\n ),\n new WOQLQuery().add_quad(subject, predicate, newObject, graph),\n );\n};\n\n/**\n * Deletes all triples in the passed graph (defaults to instance/main)\n * @param {typedef.GraphRef} [graphRef] - Resource String identifying the graph from\n * which all triples will be removed\n * @returns {WOQLQuery} - A WOQLQuery which contains the deletion expression\n */\n\nWOQLQuery.prototype.nuke = function (graphRef) {\n if (graphRef) {\n return this.quad('v:A', 'v:B', 'v:C', graphRef).delete_quad('v:A', 'v:B', 'v:C', graphRef);\n }\n return this.triple('v:A', 'v:B', 'v:C').delete_triple('v:A', 'v:B', 'v:C');\n};\n\n/**\n *\n * @param {string|Var} node - The IRI of a node or a variable containing an IRI which will\n * be the subject of the builder functions\n * @param {typedef.FuntionType} [type] - Optional type of builder function to build\n * (default is triple)\n * @returns {WOQLQuery} - A WOQLQuery which contains the partial Node pattern matching expression\n * @example\n */\n\nWOQLQuery.prototype.node = function (node, type) {\n type = type || false;\n if (type === 'add_quad') type = 'AddTriple';\n else if (type === 'delete_quad') type = 'DeleteTriple';\n else if (type === 'add_triple') type = 'AddTriple';\n else if (type === 'delete_triple') type = 'DeleteTriple';\n else if (type === 'quad') type = 'Triple';\n else if (type === 'triple') type = 'Triple';\n if (type && type.indexOf(':') === -1) type = type;\n const ctxt = { subject: node };\n if (type) ctxt.action = type;\n this._set_context(ctxt);\n return this;\n};\n\n// do not remove\n/**\n * Sets the graph resource ID that will be used for subsequent chained function calls\n * @param {typedef.GraphRef} [graphRef] Resource String identifying the graph which will\n * be used for subsequent chained schema calls\n * @returns {WOQLQuery} A WOQLQuery which contains the partial Graph pattern matching expression\n */\nWOQLQuery.prototype.graph = function (graphRef) {\n return this._set_context({\n graph: graphRef,\n });\n};\n// do not remove\nWOQLQuery.prototype._set_context = function (ctxt) {\n if (!this.triple_builder_context) this.triple_builder_context = {};\n\n for (const k in ctxt) {\n this.triple_builder_context[k] = ctxt[k];\n }\n\n return this;\n};\n\n/**\n * @param {string|Var} id - IRI string or variable containing\n * @param {string|Var} type - IRI string or variable containing the IRI of the\n * @param {typedef.GraphRef} [refGraph] - Optional Graph resource identifier\n * @returns {WOQLQuery} A WOQLQuery which contains the insert expression\n */\n\nWOQLQuery.prototype.insert = function (id, type, refGraph) {\n refGraph = refGraph || (this.triple_builder_context ? this.triple_builder_context.graph : false);\n if (refGraph) {\n return this.add_quad(id, 'rdf:type', `@schema:${type}`, refGraph);\n }\n return this.add_triple(id, 'rdf:type', `@schema:${type}`);\n};\n\nmodule.exports = WOQLQuery;\n","/* eslint-disable no-underscore-dangle */\n/* eslint-disable no-use-before-define */\n/* eslint-disable guard-for-in */\n/* eslint-disable no-restricted-syntax */\n/* eslint-disable no-unused-vars */\n/* eslint-disable consistent-return */\n/* eslint-disable camelcase */\n/* eslint-disable no-redeclare */\n/* eslint-disable no-plusplus */\n/* eslint-disable block-scoped-var */\n/* eslint-disable no-var */\n/* eslint-disable vars-on-top */\n/* eslint-disable no-param-reassign */\n/// /@ts-check\nconst UTILS = require('../utils');\nconst WOQLPrinter = require('./woqlPrinter');\nconst { Var, Vars, Doc } = require('./woqlDoc');\n\n// eslint-disable-next-line no-unused-vars\nconst typedef = require('../typedef');\n\n/**\n * defines the internal functions of the woql query object - the\n * language API is defined in WOQLQuery\n * @module WOQLQuery\n * @constructor\n * @param {object} [query] json-ld query for initialisation\n * @returns {WOQLQuery}\n */\n/* function WOQLQuery(query) {\n this.query = query || {};\n this.errors = [];\n this.cursor = this.query;\n this.chain_ended = false;\n this.contains_update = false;\n // operators which preserve global paging\n this.paging_transitive_properties = ['select', 'from', 'start', 'when', 'opt', 'limit'];\n\n this.update_operators = [\n 'AddTriple',\n 'DeleteTriple',\n 'AddQuad',\n 'DeleteQuad',\n 'InsertDocument',\n 'DeleteDocument',\n 'UpdateDocument',\n ];\n\n this.vocab = this.loadDefaultVocabulary();\n // object used to accumulate triples from fragments to support usage like node(\"x\").label(\"y\");\n this.tripleBuilder = false;\n return this;\n} */\n\nclass WOQLQuery {\n triple_builder_context = {};\n\n query = null;\n\n counter = 1;\n\n errors = [];\n\n cursor = {};\n\n chain_ended = false;\n\n contains_update = false;\n\n // operators which preserve global paging\n paging_transitive_properties = ['select', 'from', 'start', 'when', 'opt', 'limit'];\n\n update_operators = [\n 'AddTriple',\n 'DeleteTriple',\n 'AddQuad',\n 'DeleteQuad',\n 'InsertDocument',\n 'DeleteDocument',\n 'UpdateDocument',\n ];\n\n vocab = this.loadDefaultVocabulary();\n\n // object used to accumulate triples from fragments to support usage like node(\"x\").label(\"y\");\n tripleBuilder = false;\n /**\n * defines the internal functions of the woql query object - the\n * language API is defined in WOQLQuery\n * @module WOQLQuery\n * @constructor\n * @param {object} [query] json-ld query for initialisation\n * @returns {WOQLQuery}\n */\n\n constructor(query) {\n this.query = query || {};\n // this.errors = [];\n this.cursor = this.query;\n\n // eslint-disable-next-line no-constructor-return\n return this;\n }\n}\n\n/**\n * Basic Error handling\n */\nWOQLQuery.prototype.parameterError = function (msg) {\n this.errors.push({ type: this.cursor['@type'], message: msg });\n return this;\n};\n\nWOQLQuery.prototype.hasErrors = function () {\n return this.errors.length > 0;\n};\n\n/**\n * Internal library function which adds a subquery and sets the cursor\n */\nWOQLQuery.prototype.addSubQuery = function (Subq) {\n if (Subq) {\n this.cursor.query = this.jobj(Subq);\n } else {\n const nv = {};\n this.cursor.query = nv;\n this.cursor = nv;\n }\n return this;\n};\n\n/**\n * Does this query contain an update\n */\nWOQLQuery.prototype.containsUpdate = function (json) {\n json = json || this.query;\n if (this.update_operators.indexOf(json['@type']) !== -1) return true;\n if (json.consequent && this.containsUpdate(json.consequent)) return true;\n if (json.query) return this.containsUpdate(json.query);\n if (json.and) {\n for (var i = 0; i < json.and.length; i++) {\n if (this.containsUpdate(json.and[i])) return true;\n }\n }\n if (json.or) {\n for (var i = 0; i < json.or.length; i++) {\n if (this.containsUpdate(json.or[i])) return true;\n }\n }\n\n return false;\n};\n\n/**\n * Called to inidicate that this query will cause an update to the DB\n */\nWOQLQuery.prototype.updated = function () {\n this.contains_update = true;\n return this;\n};\n\n/**\n * A bunch of internal functions for formatting values for JSON-LD translation\n */\n\n/**\n * Wraps the passed value in a json-ld literal carriage\n */\nWOQLQuery.prototype.jlt = function (val, type) {\n if (!type) type = 'xsd:string';\n else type = type.indexOf(':') === -1 ? `xsd:${type}` : type;\n return { '@type': type, '@value': val };\n};\n\nWOQLQuery.prototype.varj = function (varb) {\n if (varb instanceof Var) varb = varb.name;\n if (varb.substring(0, 2) === 'v:') varb = varb.substring(2);\n if (typeof varb === 'string') {\n return {\n '@type': 'Value',\n variable: varb,\n };\n }\n return varb;\n};\n\nWOQLQuery.prototype.rawVar = function (varb) {\n if (varb instanceof Var) return varb.name;\n if (varb.substring(0, 2) === 'v:') varb = varb.substring(2);\n return varb;\n};\n\nWOQLQuery.prototype.rawVarList = function (vl) {\n const ret = [];\n for (let i = 0; i < vl.length; i++) {\n const co = this.rawVar(vl[i]);\n ret.push(co);\n }\n return ret;\n};\n\n/**\n * Transforms a javascript representation of a query into a json object if needs be\n */\nWOQLQuery.prototype.jobj = function (qobj) {\n if (qobj.json) {\n return qobj.json();\n }\n if (qobj === true) return { '@type': 'True' };\n return qobj;\n // return new WOQLQuery.json(qobj);\n};\n\n/**\n * Wraps the elements of an AS variable in the appropriate json-ld\n */\nWOQLQuery.prototype.asv = function (colname_or_index, variable, type) {\n const asvar = {};\n if (typeof colname_or_index === 'number') {\n asvar['@type'] = 'Column';\n asvar.indicator = { '@type': 'Indicator', index: colname_or_index };\n } else if (typeof colname_or_index === 'string') {\n asvar['@type'] = 'Column';\n asvar.indicator = { '@type': 'Indicator', name: colname_or_index };\n }\n if (variable instanceof Var) {\n asvar.variable = variable.name;\n } else if (variable.substring(0, 2) === 'v:') {\n asvar.variable = variable.substring(2);\n } else {\n asvar.variable = variable;\n }\n if (type) asvar.type = type;\n return asvar;\n};\n\n/**\n * JSON LD Format Descriptor\n * @param {object} opts\n */\nWOQLQuery.prototype.wform = function (opts) {\n if (opts && opts.type) {\n this.cursor.format = {\n '@type': 'Format',\n format_type: { '@value': opts.type, '@type': 'xsd:string' },\n };\n if (typeof opts.format_header !== 'undefined') {\n const h = !!opts.format_header;\n this.cursor.format.format_header = {\n '@value': h,\n '@type': 'xsd:boolean',\n };\n }\n }\n return this;\n};\n\n/**\n * Wraps arithmetic operators in the appropriate json-ld\n */\nWOQLQuery.prototype.arop = function (arg) {\n if (typeof arg === 'object') {\n return this.jobj(this.cleanArithmeticValue(arg));\n }\n return this.cleanArithmeticValue(arg, 'xsd:decimal');\n};\n\n/**\n * takes input that can be either a string (variable name)\n * or an array - each element of the array is a member of the list\n */\nWOQLQuery.prototype.dataList = function (wvar, string_only) {\n if (typeof wvar === 'string') return this.expandDataVariable(wvar, true);\n if (Array.isArray(wvar)) {\n const ret = [];\n for (let i = 0; i < wvar.length; i++) {\n const co = this.cleanDataValue(wvar[i]);\n ret.push(co);\n }\n return ret;\n }\n};\n\n/**\n * takes a list of input that can be any value\n */\nWOQLQuery.prototype.valueList = function (wvar, string_only) {\n if (typeof wvar === 'string') return this.expandValueVariable(wvar, true);\n if (Array.isArray(wvar)) {\n const ret = [];\n for (let i = 0; i < wvar.length; i++) {\n let co = this.cleanObject(wvar[i]);\n if (typeof co === 'string') co = { node: co };\n ret.push(co);\n }\n return ret;\n }\n};\n\n/**\n * creates an unadorned variable name list\n */\nWOQLQuery.prototype.vlist = function (list) {\n const vl = [];\n for (let i = 0; i < list.length; i++) {\n const v = this.expandValueVariable(list[i]);\n vl.push(v.variable);\n }\n return vl;\n};\n\n/**\n * Wraps data values\n */\nWOQLQuery.prototype.dataValueList = function (list) {\n const dvl = [];\n for (let i = 0; i < list.length; i++) {\n const o = this.cleanDataValue(list[i]);\n dvl.push(o);\n }\n return dvl;\n};\n\n/**\n * Transforms whatever is passed in as the subject into the appropriate json-ld for variable or id\n */\nWOQLQuery.prototype.cleanSubject = function (s) {\n /**\n * @type {any}\n */\n let subj = false;\n if (s instanceof Var) {\n return this.expandNodeVariable(s);\n } if (typeof s === 'object') {\n return s;\n } if (typeof s === 'string') {\n if (s.indexOf('v:') !== -1) subj = s;\n else subj = s;\n return this.expandNodeVariable(subj);\n }\n this.parameterError('Subject must be a URI string');\n return `${s}`;\n};\n\n/**\n * Transforms whatever is passed in as the predicate (id or variable) into the\n * appropriate json-ld form\n */\nWOQLQuery.prototype.cleanPredicate = function (p) {\n /**\n * @type {any}\n */\n let pred = false;\n if (p instanceof Var) return this.expandNodeVariable(p);\n if (typeof p === 'object') return p;\n if (typeof p !== 'string') {\n this.parameterError('Predicate must be a URI string');\n return `${p}`;\n }\n if (p.indexOf(':') !== -1) pred = p;\n else if (this.wellKnownPredicate(p)) pred = p;// this.vocab[p]\n else pred = p;// 'scm'\n // else pred = 'scm:' + p\n return this.expandNodeVariable(pred);\n};\n\nWOQLQuery.prototype.wellKnownPredicate = function (p, noxsd) {\n if (this.vocab && this.vocab[p]) {\n const full = this.vocab[p];\n const start = full.substring(0, 3);\n if (full === 'system:abstract' || start === 'xdd' || start === 'xsd') return false;\n return true;\n }\n return false;\n};\n\nWOQLQuery.prototype.cleanPathPredicate = function (p) {\n let pred = false;\n if (p.indexOf(':') !== -1) pred = p;\n else if (this.wellKnownPredicate(p)) pred = this.vocab[p];\n else pred = p; // 'scm:' + p\n return pred;\n};\n\n/**\n * Transforms whatever is passed in as the object of\n * a triple into the appropriate json-ld form (variable, literal or id)\n */\nWOQLQuery.prototype.cleanObject = function (o, t) {\n const obj = { '@type': 'Value' };\n if (o instanceof Var) {\n return this.expandValueVariable(o);\n } if (o instanceof Doc) {\n return o.encoded;\n } if (typeof o === 'string') {\n if (o.indexOf('v:') !== -1) {\n return this.expandValueVariable(o);\n }\n obj.node = o;\n } else if (typeof o === 'number') {\n t = t || 'xsd:decimal';\n obj.data = this.jlt(o, t);\n } else if (typeof o === 'boolean') {\n t = t || 'xsd:boolean';\n obj.data = this.jlt(o, t);\n } else if (typeof o === 'object' && o) {\n if (typeof o['@value'] !== 'undefined') obj.data = o;\n else return o;\n // eslint-disable-next-line no-dupe-else-if\n } else if (typeof o === 'boolean') {\n t = t || 'xsd:boolean';\n obj['woql:datatype'] = this.jlt(o, t);\n }\n return obj;\n};\n\nWOQLQuery.prototype.cleanDataValue = function (o, t) {\n const obj = { '@type': 'DataValue' };\n if (o instanceof Var) {\n return this.expandDataVariable(o);\n } if (o instanceof Doc) {\n return o.encoded;\n } if (typeof o === 'string') {\n if (o.indexOf('v:') !== -1) {\n return this.expandDataVariable(o);\n }\n obj.data = this.jlt(o, t);\n } else if (typeof o === 'number') {\n t = t || 'xsd:decimal';\n obj.data = this.jlt(o, t);\n } else if (typeof o === 'boolean') {\n t = t || 'xsd:boolean';\n obj.data = this.jlt(o, t);\n } else if (Array.isArray(o)) {\n const res = [];\n for (let i = 0; i < o.length; i++) {\n res.push(this.cleanDataValue(o[i]));\n }\n obj.list = res;\n } else if (typeof o === 'object' && o) {\n if (o['@value']) obj.data = o;\n else return o;\n }\n return obj;\n};\n\nWOQLQuery.prototype.cleanArithmeticValue = function (o, t) {\n const obj = { '@type': 'ArithmeticValue' };\n if (o instanceof Var) {\n return this.expandArithmeticVariable(o);\n } if (typeof o === 'string') {\n if (o.indexOf('v:') !== -1) {\n return this.expandArithmeticVariable(o);\n }\n obj.data = this.jlt(o, t);\n } else if (typeof o === 'number') {\n t = t || 'xsd:decimal';\n obj.data = this.jlt(o, t);\n } else if (typeof o === 'object' && o) {\n if (o['@value']) obj.data = o;\n else return o;\n }\n return obj;\n};\n\nWOQLQuery.prototype.cleanNodeValue = function (o, t) {\n const obj = { '@type': 'NodeValue' };\n if (o instanceof Var) {\n return this.expandNodeVariable(o);\n } if (typeof o === 'string') {\n if (o.indexOf('v:') !== -1) {\n return this.expandNodeVariable(o);\n }\n obj.node = o;\n } else if (typeof o === 'object' && o) {\n return o;\n }\n return obj;\n};\n\n/**\n * Transforms a graph filter or graph id into the proper json-ld form\n */\nWOQLQuery.prototype.cleanGraph = function (g) {\n return g;\n};\n\n/**\n * Transforms strings that start with v: into variable json-ld structures\n * @param varname - will be transformed if it starts with v:\n */\nWOQLQuery.prototype.expandVariable = function (varname, type, always) {\n if (varname instanceof Var) {\n return {\n '@type': type,\n variable: varname.name,\n };\n } if (varname.substring(0, 2) === 'v:' || always) {\n if (varname.substring(0, 2) === 'v:') varname = varname.substring(2);\n return {\n '@type': type,\n variable: varname,\n };\n }\n return {\n '@type': type,\n node: varname,\n };\n};\n\nWOQLQuery.prototype.expandValueVariable = function (varname, always) {\n return this.expandVariable(varname, 'Value', always);\n};\n\nWOQLQuery.prototype.expandNodeVariable = function (varname, always) {\n return this.expandVariable(varname, 'NodeValue', always);\n};\n\nWOQLQuery.prototype.expandDataVariable = function (varname, always) {\n return this.expandVariable(varname, 'DataValue', always);\n};\n\nWOQLQuery.prototype.expandArithmeticVariable = function (varname, always) {\n return this.expandVariable(varname, 'ArithmeticValue', always);\n};\n\nWOQLQuery.prototype.defaultContext = function (DB_IRI) {\n const def = {};\n for (const pref in UTILS.standard_urls) {\n def[pref] = UTILS.standard_urls[pref];\n }\n def.scm = `${DB_IRI}/schema#`;\n def.doc = `${DB_IRI}/data/`;\n return def;\n};\n\n/**\n * Retrieves the value of the current json-ld context\n */\nWOQLQuery.prototype.getContext = function (q) {\n q = q || this.query;\n for (const prop of Object.keys(q)) {\n if (prop === '@context') return q[prop];\n if (this.paging_transitive_properties.indexOf(prop) !== -1) {\n const nq = q[prop][1];\n const nc = this.getContext(nq);\n if (nc) return nc;\n }\n }\n};\n\n/**\n * sets the value of the current json-ld context on a full query scope\n */\nWOQLQuery.prototype.context = function (c) {\n this.query['@context'] = c;\n};\n\n/**\n * vocabulary elements that can be used without prefixes in woql.js queries\n */\nWOQLQuery.prototype.loadDefaultVocabulary = function () {\n const vocab = {};\n // vocab.type = 'rdf:type'\n // vocab.label = 'rdfs:label'\n vocab.Class = 'owl:Class';\n vocab.DatatypeProperty = 'owl:DatatypeProperty';\n vocab.ObjectProperty = 'owl:ObjectProperty';\n vocab.Document = 'system:Document';\n vocab.abstract = 'system:abstract';\n vocab.comment = 'rdfs:comment';\n vocab.range = 'rdfs:range';\n vocab.domain = 'rdfs:domain';\n vocab.subClassOf = 'rdfs:subClassOf';\n vocab.string = 'xsd:string';\n vocab.integer = 'xsd:integer';\n vocab.decimal = 'xsd:decimal';\n vocab.boolean = 'xdd:boolean';\n vocab.email = 'xdd:email';\n vocab.json = 'xdd:json';\n vocab.dateTime = 'xsd:dateTime';\n vocab.date = 'xsd:date';\n vocab.coordinate = 'xdd:coordinate';\n vocab.line = 'xdd:coordinatePolyline';\n vocab.polygon = 'xdd:coordinatePolygon';\n return vocab;\n};\n\n/**\n * Provides the query with a 'vocabulary' a list of well known predicates that can be used without\n * prefixes mapping: id: prefix:id ...\n */\nWOQLQuery.prototype.setVocabulary = function (vocab) {\n this.vocab = vocab;\n};\n\nWOQLQuery.prototype.getVocabulary = function (vocab) {\n return this.vocab;\n};\n\n/**\n * Use instead woqlclient.query('myWOQLQuery')\n * @deprecated\n * Executes the query using the passed client to connect to a server\n *\n */\nWOQLQuery.prototype.execute = function (client, commit_msg) {\n return client.query(this, commit_msg);\n};\n\n/**\n * converts back and forward from json\n * if the argument is present, the current query is set to it,\n * if the argument is not present, the current json version of this query is returned\n * @param {object} [json] a query in json format\n * @returns {object}\n */\nWOQLQuery.prototype.json = function (json) {\n if (json) {\n this.query = copyJSON(json);\n return this;\n }\n return copyJSON(this.query, true);\n};\n\n/**\n * Returns a script version of the query\n *\n * @param {string} [clang] - either \"js\" or \"python\"\n */\nWOQLQuery.prototype.prettyPrint = function (clang = 'js') {\n const printer = new WOQLPrinter(this.vocab, clang);\n return printer.printJSON(this.query);\n};\n\n/**\n * Finds the last woql element that has a subject in it and returns the json for that\n * used for triplebuilder to chain further calls - when they may be inside ands or ors or subqueries\n * @param {object} json\n */\nWOQLQuery.prototype.findLastSubject = function (json) {\n if (json && json.and) {\n for (var i = json.and.length - 1; i >= 0; i--) {\n const lqs = this.findLastSubject(json.and[i]);\n if (lqs) return lqs;\n }\n }\n if (json && json.or) {\n for (var i = json.or.length - 1; i >= 0; i--) {\n const lqs = this.findLastSubject(json.or[i]);\n if (lqs) return lqs;\n }\n }\n if (json && json.query) {\n const ls = this.findLastSubject(json.query);\n if (ls) return ls;\n }\n // check for cardinality here\n if (json && json.subject) {\n return json;\n }\n return false;\n};\n\n/**\n * Finds the last woql element that has a subject in that is a property id\n * used for triplebuilder to chain further calls - when they may be inside ands or ors or subqueries\n * @param {object} json\n */\nWOQLQuery.prototype.findLastProperty = function (json) {\n if (json && json.and) {\n for (var i = json.and.length - 1; i >= 0; i--) {\n const lqs = this.findLastProperty(json.and[i]);\n if (lqs) return lqs;\n }\n }\n if (json && json.or) {\n for (var i = json.or.length - 1; i >= 0; i--) {\n const lqs = this.findLastProperty(json.or[i]);\n if (lqs) return lqs;\n }\n }\n if (json && json.query) {\n const ls = this.findLastProperty(json.query);\n if (ls) return ls;\n }\n if (\n json\n && json.subject\n && this._is_property_triple(json.predicate, json.object)\n ) {\n return json;\n }\n return false;\n};\n\nWOQLQuery.prototype._is_property_triple = function (pred, obj) {\n const pred_str = pred.node ? pred.node : pred;\n const obj_str = obj.node ? obj.node : obj;\n if (obj_str === 'owl:ObjectProperty' || obj_str === 'owl:DatatypeProperty') return true;\n if (pred_str === 'rdfs:domain' || pred_str === 'rdfs:range') return true;\n return false;\n};\n\n/**\n * Turns a textual path pattern into a JSON-LD description\n */\nWOQLQuery.prototype.compilePathPattern = function (pat) {\n const toks = tokenize(pat);\n if (toks && toks.length) return tokensToJSON(toks, this);\n this.parameterError(`Pattern error - could not be parsed ${pat}`);\n};\n\n/**\n * Tokenizes the pattern into a sequence of tokens which may be clauses or operators\n * @param {string} pat\n */\nfunction tokenize(pat) {\n let parts = getClauseAndRemainder(pat);\n const seq = [];\n while (parts.length === 2) {\n seq.push(parts[0]);\n parts = getClauseAndRemainder(parts[1]);\n }\n seq.push(parts[0]);\n return seq;\n}\n\n/**\n * Breaks a graph pattern up into two parts - the next clause, and the remainder of the string\n * @param {string} pat - graph pattern fragment\n */\nfunction getClauseAndRemainder(pat) {\n pat = pat.trim();\n let open = 1;\n // if there is a parentheses, we treat it as a clause and go to the end\n if (pat.charAt(0) === '(') {\n for (var i = 1; i < pat.length; i++) {\n if (pat.charAt(i) === '(') open++;\n else if (pat.charAt(i) === ')') open--;\n if (open === 0) {\n const rem = pat.substring(i + 1).trim();\n if (rem) return [pat.substring(1, i), rem];\n // eslint-disable-next-line max-len\n return getClauseAndRemainder(pat.substring(1, i)); // whole thing surrounded by parentheses, strip them out and reparse\n }\n }\n return [];\n }\n if (pat[0] === '+' || pat[0] === ',' || pat[0] === '|' || pat[0] === '*') {\n const ret = [pat[0]];\n if (pat.substring(1)) ret.push(pat.substring(1));\n return ret;\n }\n if (pat.charAt(0) === '{') {\n const ret = [pat.substring(0, pat.indexOf('}') + 1)];\n if (pat.substring(pat.indexOf('}') + 1)) ret.push(pat.substring(pat.indexOf('}') + 1));\n return ret;\n }\n for (var i = 1; i < pat.length; i++) {\n if (pat[i] === ',' || pat[i] === '|' || pat[i] === '+' || pat[i] === '{' || pat[i] === '*') return [pat.substring(0, i), pat.substring(i)];\n }\n return [pat];\n}\n\nfunction compilePredicate(pp, q) {\n if (pp.indexOf('<') !== -1 && pp.indexOf('>') !== -1) {\n const pred = pp.slice(1, pp.length - 1);\n // eslint-disable-next-line no-multi-assign,no-constant-condition\n const cleaned = pred === '.' ? null : q.cleanPathPredicate(pred);\n return {\n '@type': 'PathOr',\n or: [{\n '@type': 'InversePathPredicate',\n predicate: cleaned,\n },\n {\n '@type': 'PathPredicate',\n predicate: cleaned,\n }],\n };\n } if (pp.indexOf('<') !== -1) {\n const pred = pp.slice(1, pp.length);\n const cleaned = pred === '.' ? null : q.cleanPathPredicate(pred);\n return { '@type': 'InversePathPredicate', predicate: cleaned };\n } if (pp.indexOf('>') !== -1) {\n const pred = pp.slice(0, pp.length - 1);\n const cleaned = pred === '.' ? null : q.cleanPathPredicate(pred);\n return { '@type': 'PathPredicate', predicate: cleaned };\n }\n const cleaned = pp === '.' ? null : q.cleanPathPredicate(pp);\n return { '@type': 'PathPredicate', predicate: cleaned };\n}\n\n/**\n * Turns a sequence of tokens into the appropriate JSON-LD\n * @param {Array} seq\n * @param {*} q\n */\nfunction tokensToJSON(seq, q) {\n if (seq.length === 1) {\n // may need to be further tokenized\n const ntoks = tokenize(seq[0]);\n if (ntoks.length === 1) {\n // only a single element in clause - cannot be further tokenised\n const tok = ntoks[0].trim();\n return compilePredicate(tok, q);\n }\n return tokensToJSON(ntoks, q);\n } if (seq.indexOf('|') !== -1) {\n // binds most loosely\n const left = seq.slice(0, seq.indexOf('|'));\n const right = seq.slice(seq.indexOf('|') + 1);\n return {\n '@type': 'PathOr',\n or: [tokensToJSON(left, q), tokensToJSON(right, q)],\n };\n } if (seq.indexOf(',') !== -1) {\n // binds tighter\n const first = seq.slice(0, seq.indexOf(','));\n const second = seq.slice(seq.indexOf(',') + 1);\n return {\n '@type': 'PathSequence',\n sequence: [tokensToJSON(first, q), tokensToJSON(second, q)],\n };\n } if (seq[1] === '+') {\n // binds tightest of all\n return {\n '@type': 'PathPlus',\n plus: tokensToJSON([seq[0]], q),\n };\n } if (seq[1] === '*') {\n // binds tightest of all\n return {\n '@type': 'PathStar',\n star: tokensToJSON([seq[0]], q),\n };\n } if (seq[1].charAt(0) === '{') {\n // binds tightest of all\n // we need a test here\n const meat = seq[1].substring(1, seq[1].length - 1).split(',');\n return {\n '@type': 'PathTimes',\n from: meat[0],\n to: meat[1],\n times: tokensToJSON([seq[0]], q),\n };\n }\n // shouldn't get here - error\n q.parameterError(`Pattern error - could not be parsed ${seq[0]}`);\n return {\n '@type': 'PathPredicate',\n 'rdfs:label': `failed to parse query ${seq[0]}`,\n };\n}\n\n/**\n * Creates a copy of the passed json representation of a woql query\n * Performing tidying up in doing so - strips out empty queries, rolls up\n * ands and ors with single entries\n *\n * @param {object} orig\n * @returns {object} copy of the passed json object\n */\nfunction copyJSON(orig, rollup) {\n if (Array.isArray(orig)) return orig;\n if (rollup) {\n if (orig['@type'] === 'And') {\n if (!orig.and || !orig.and.length) return {};\n if (orig.and.length === 1) return copyJSON(orig.and[0], rollup);\n } else if (orig['@type'] === 'Or') {\n if (!orig.or || !orig.or.length) return {};\n if (orig.or.length === 1) return copyJSON(orig.or[0], rollup);\n }\n\n if (typeof orig.query !== 'undefined' && orig['@type'] !== 'Comment') {\n if (!orig.query['@type']) return {};\n } else if (orig['@type'] === 'Comment' && orig.comment) {\n if (!orig.query || !orig.query['@type']) return { '@type': 'Comment', comment: orig.comment };\n }\n if (typeof orig.consequent !== 'undefined') {\n if (!orig.consequent['@type']) return {};\n }\n }\n const nuj = {};\n for (const k in orig) {\n const part = orig[k];\n if (Array.isArray(part)) {\n const nupart = [];\n for (let j = 0; j < part.length; j++) {\n if (typeof part[j] === 'object') {\n const sub = copyJSON(part[j], rollup);\n if (!sub || !UTILS.empty(sub)) nupart.push(sub);\n } else {\n nupart.push(part[j]);\n }\n }\n nuj[k] = nupart;\n } else if (part === null) {\n // do nothing\n } else if (typeof part === 'object') {\n const q = copyJSON(part, rollup);\n if (!q || !UTILS.empty(q)) nuj[k] = q;\n } else {\n nuj[k] = part;\n }\n }\n return nuj;\n}\n\nmodule.exports = WOQLQuery;\n","// eslint-disable-next-line consistent-return\nfunction convert(obj) {\n if (obj == null) {\n return null;\n } if (typeof (obj) === 'number') {\n return {\n '@type': 'Value',\n data: {\n '@type': 'xsd:decimal',\n '@value': obj,\n },\n };\n } if (typeof (obj) === 'boolean') {\n return {\n '@type': 'Value',\n data: {\n '@type': 'xsd:boolean',\n '@value': obj,\n },\n };\n } if (typeof (obj) === 'string') {\n if (obj.indexOf('v:') === -1) {\n return {\n '@type': 'Value',\n data: {\n '@type': 'xsd:string',\n '@value': obj,\n },\n };\n }\n\n return {\n '@type': 'Value',\n variable: obj.split(':')[1],\n };\n\n // eslint-disable-next-line no-use-before-define\n } if (obj instanceof Var) {\n return {\n '@type': 'Value',\n variable: obj.name,\n };\n } if (typeof (obj) === 'object' && !Array.isArray(obj)) {\n const pairs = [];\n // eslint-disable-next-line no-restricted-syntax\n for (const [key, value] of Object.entries(obj)) {\n pairs.push({\n '@type': 'FieldValuePair',\n field: key,\n value: convert(value),\n });\n }\n return {\n '@type': 'Value',\n dictionary: {\n '@type': 'DictionaryTemplate',\n data: pairs,\n },\n };\n } if (typeof (obj) === 'object' && Array.isArray(obj)) {\n const list = obj.map(convert);\n return {\n '@type': 'Value',\n list,\n };\n }\n}\n\n/**\n * @param {string} name\n * @returns\n */\nfunction Var(name) {\n this.name = name;\n this.json = function () {\n return {\n '@type': 'Value',\n variable: this.name,\n };\n };\n}\n\n/**\n * @param {object} name\n * @returns {object}\n */\nfunction Doc(obj) {\n this.doc = obj;\n this.encoded = convert(obj);\n return this.encoded;\n}\n\n/**\n* @param {...string} varNames\n* @returns {object<Var>}\n*/\nfunction Vars(...args) {\n const varObj = {};\n for (let i = 0, j = arguments.length; i < j; i += 1) {\n const argumentName = args[i];\n\n // this[argumentName] = new Var(argumentName);\n varObj[argumentName] = new Var(argumentName);\n }\n return varObj;\n}\n\nmodule.exports = { Vars, Var, Doc };\n","/// /@ts-check\n// we can not import woqlBuilder because woqlBuilder import WOQLLibrary\nconst WOQLQuery = require('./woqlBuilder');\n\n/**\n * @license Apache Version 2\n * @module WOQLLibrary\n * @constructor WOQLLibrary\n * @description Library Functions to manage the commits graph\n * @example\n * const woqlLib = WOQLLibrary()\n * woqlLib.branches()\n *\n * //or you can call this functions using WOQL Class\n * WOQL.lib().branches()\n * */\nclass WOQLLibrary {\n default_schema_resource = 'schema/main';\n\n default_commit_resource = '_commits';\n\n default_meta_resource = '_meta';\n\n masterdb_resource = '_system';\n\n empty = '';\n}\n\n/**\n * General Pattern 4: Retrieves Branches, Their ID, Head Commit ID, Head Commit Time\n * (if present, new branches have no commits)\n */\nWOQLLibrary.prototype.branches = function () { // values, variables, cresource) {\n const woql = new WOQLQuery().using('_commits').triple('v:Branch', 'rdf:type', '@schema:Branch')\n .triple('v:Branch', '@schema:name', 'v:Name')\n .opt()\n .triple('v:Branch', '@schema:head', 'v:Head')\n .triple('v:Head', '@schema:identifier', 'v:commit_identifier')\n .triple('v:Head', '@schema:timestamp', 'v:Timestamp');\n return woql;\n};\n\n/**\n * get all the commits of a specific branch\n * if a timestamp is given, gets all the commits before the specified timestamp\n * @param {string} [branch] - the branch name\n * @param {number} [limit] - the max number of result\n * @param {number} [start] - the start of the pagination\n * @param {number} [timestamp] - Unix timestamp in seconds\n */\n\nWOQLLibrary.prototype.commits = function (branch = 'main', limit = 0, start = 0, timestamp = 0) {\n const woql = new WOQLQuery().using('_commits');\n if (limit) woql.limit(limit);\n if (start) woql.start(start);\n woql.select('v:Parent ID', 'v:Commit ID', 'v:Time', 'v:Author', 'v:Branch ID', 'v:Message');\n\n const andArr = [new WOQLQuery().triple('v:Branch', 'name', new WOQLQuery().string(branch))\n .triple('v:Branch', 'head', 'v:Active Commit ID')\n .path('v:Active Commit ID', 'parent*', 'v:Parent', 'v:Path')\n .triple('v:Parent', 'timestamp', 'v:Time')];\n if (timestamp) {\n andArr.push(new WOQLQuery().less('v:Time', timestamp));\n }\n andArr.push(new WOQLQuery().triple('v:Parent', 'identifier', 'v:Commit ID')\n .triple('v:Parent', 'author', 'v:Author')\n .triple('v:Parent', 'message', 'v:Message')\n .opt()\n .triple('v:Parent', 'parent', 'v:Parent ID'));\n return woql.and(...andArr);\n};\n\n/**\n*get commits older than the specified commit id\n* @param {string} [commit_id] - the commit id\n* @param {number} [limit] - the max number of result\n*/\n// eslint-disable-next-line camelcase\nWOQLLibrary.prototype.previousCommits = function (commit_id, limit = 10) {\n return new WOQLQuery().using('_commits').limit(limit).select('v:Parent ID', 'v:Message', 'v:Commit ID', 'v:Time', 'v:Author')\n .and(\n new WOQLQuery().and(\n new WOQLQuery().triple('v:Active Commit ID', '@schema:identifier', new WOQLQuery().string(commit_id)),\n new WOQLQuery().path('v:Active Commit ID', '@schema:parent+', 'v:Parent', 'v:Path'),\n new WOQLQuery().triple('v:Parent', '@schema:identifier', 'v:Commit ID'),\n new WOQLQuery().triple('v:Parent', '@schema:timestamp', 'v:Time'),\n new WOQLQuery().triple('v:Parent', '@schema:author', 'v:Author'),\n new WOQLQuery().triple('v:Parent', '@schema:message', 'v:Message'),\n new WOQLQuery().triple('v:Parent', '@schema:parent', 'v:Parent ID'),\n new WOQLQuery().opt().triple('v:Parent', 'parent', 'v:Parent ID'),\n ),\n );\n};\n\n/**\n * Finds the id of the very first commit in a database's history\n *\n * This is useful for finding information about when, by who and why the database was created\n * The first commit is the only commit in the database that does not have a parent commit\n *\n */\nWOQLLibrary.prototype.first_commit = function () {\n const noparent = new WOQLQuery()\n .using('_commits').select('v:Any Commit IRI')\n .and(\n new WOQLQuery().triple('v:Branch', 'name', new WOQLQuery().string('main'))\n .triple('v:Branch', 'head', 'v:Active Commit ID')\n .path('v:Active Commit ID', 'parent*', 'v:Any Commit IRI', 'v:Path'),\n\n new WOQLQuery().triple(\n 'v:Any Commit IRI',\n '@schema:identifier',\n 'v:Commit ID',\n ),\n new WOQLQuery().triple(\n 'v:Any Commit IRI',\n '@schema:author',\n 'v:Author',\n ),\n new WOQLQuery().triple(\n 'v:Any Commit IRI',\n '@schema:message',\n 'v:Message',\n ),\n new WOQLQuery()\n .not()\n .triple(\n 'v:Any Commit IRI',\n '@schema:parent',\n 'v:Parent IRI',\n ),\n\n );\n return noparent;\n};\n\nmodule.exports = WOQLLibrary;\n","/* eslint-disable no-fallthrough */\n/* eslint-disable no-const-assign */\n/* eslint-disable block-scoped-var */\n/* eslint-disable no-case-declarations */\n/* eslint-disable no-var */\n/* eslint-disable no-redeclare */\n/* eslint-disable vars-on-top */\n/* eslint-disable no-restricted-syntax */\n/* eslint-disable no-unused-expressions */\n/* eslint-disable no-unused-vars */\n/* eslint-disable no-plusplus */\n/* eslint-disable camelcase */\n/* eslint-disable no-use-before-define */\n/* eslint-disable prefer-destructuring */\n/* eslint-disable no-console */\n/* eslint-disable no-param-reassign */\n/**\n * Class responsible for converting a JSON WOQL into a WOQL.js / WOQL.py string\n */\n\nfunction WOQLPrinter(vocab, language) {\n this.vocab = vocab;\n this.language = language;\n this.indent_spaces = 4;\n this.boxed_predicates = [\n 'variable',\n 'array_element',\n 'node',\n // 'woql:arithmetic_value',\n // 'woql:variable_name',\n ];\n this.subject_cleaned_predicates = ['subject', 'element'];\n this.schema_cleaned_predicates = [\n 'predicate',\n 'uri',\n 'of_type',\n ];\n this.list_operators = ['ValueList', 'Array', 'NamedAsVar', 'IndexedAsVar', 'AsVar'];\n this.query_list_operators = ['And', 'Or'];\n this.operator_maps = {\n IDGenerator: 'idgen',\n IsA: 'isa',\n PostResource: 'post',\n QueryResource: 'remote',\n AsVars: 'as',\n NamedAsVars: 'as',\n IndexedAsVars: 'as',\n DeletedTriple: 'removed_triple',\n };\n this.shortcuts = {\n optional: 'opt',\n substring: 'substr',\n regexp: 're',\n subsumption: 'sub',\n equals: 'eq',\n concatenate: 'concat',\n };\n this.pythonic = {\n and: 'woql_and',\n or: 'woql_or',\n as: 'woql_as',\n with: 'woql_with',\n from: 'woql_from',\n not: 'woql_not',\n };\n this.show_context = false;\n}\n// WOQL.triple(WOQL.node_value(\"Subject\"), WOQL.node_value(\"Predicate\"), WOQL.value(\"Object\"))\nWOQLPrinter.prototype.printJSON = function (json, level, fluent, newline) {\n level = level || 0;\n fluent = fluent || false;\n let str = '';\n if (!json['@type']) {\n console.log('Bad structure passed to print json, no type: ', json);\n return '';\n }\n\n // check for language\n if (['Value', 'NodeValue', 'DataValue', 'ArithmeticValue', 'OrderTemplate'].indexOf(json['@type']) > -1) {\n return this.pvar(json);\n }\n\n let operator = json['@type'];\n if (typeof json['@type'] === 'string' && operator.indexOf(':') > -1) {\n operator = json['@type'].split(':')[1];\n }\n\n if (operator === 'QueryResource') {\n return this.getQueryResourceStr(json, level, fluent, newline);\n }\n\n if (operator) {\n const ujson = this.unboxJSON(operator, json);\n if (ujson) {\n const meat = this.printArgument(\n operator,\n this.getBoxedPredicate(operator, json),\n ujson,\n level,\n fluent,\n );\n if (this.isListOperator(operator)) return `[${meat}]`;\n return meat;\n }\n if (this.isListOperator(operator)) {\n str += '[';\n } else {\n // get the function name from the @type field\n const call = this.getFunctionForOperator(operator, json);\n const indent = newline ? level * this.indent_spaces : 0;\n str += `${this.getWOQLPrelude(call, fluent, indent)}(`;\n }\n // below needs to be changed to have a specific ordering\n // get the list of the keys without the @type\n const args = this.getArgumentOrder(operator, json);\n // I have to review this\n const divlimit = args.indexOf('query') === -1 ? args.length - 1 : args.length - 2;\n // query argument when I have a subquery\n args.forEach((item, i) => { // && operator !== 'When'\n let nfluent = !!((item === 'query' && operator !== 'Put') || item === 'consequent'\n || item === 'resource');\n // to be review\n if (item === 'resource' && typeof json[item] === 'string') nfluent = false;\n str += this.printArgument(operator, item, json[item], level, nfluent);\n // something to review ??\n if (i < divlimit && operator !== 'Get') str += ', ';\n });\n if (this.isListOperator(operator)) str += ']';\n else {\n if (this.argumentTakesNewline(operator)) str += `\\n${nspaces(level * this.indent_spaces)}`;\n if (!fluent) str += ')';\n }\n } else {\n console.log('wrong structure passed to print json ', json);\n }\n return str;\n};\n// file or remote method\nWOQLPrinter.prototype.getQueryResourceStr = function (json, level, fluent, newline) {\n if (!json.source) {\n console.log('wrong structure passed to print json ', json);\n return '';\n }\n const functName = json.source.url ? 'remote' : 'file';\n const indent = newline ? level * this.indent_spaces : 0;\n let str = `${this.getWOQLPrelude(functName, fluent, indent)}(`;\n const source = json.source.file ? `\"${json.source.file}\"` : `\"${json.source.url}\"`;\n const format = json.format === 'csv' ? '' : json.format;\n str += source;\n if (format)str += `, ${format}`;\n return str;\n};\n// remove the @type from the keys\nWOQLPrinter.prototype.getArgumentOrder = function (operator, json) {\n const args = Object.keys(json);\n args.splice(args.indexOf('@type'), 1);\n return args;\n};\n\nWOQLPrinter.prototype.argumentTakesNewline = function (operator) {\n return this.isQueryListOperator(operator);\n};\n\nWOQLPrinter.prototype.argumentRequiresArray = function (predicate, entries) {\n if ((predicate === 'group_by' || predicate === 'list') && entries.length > 1) return true;\n return false;\n};\n// this is the list of the argument not @type\nWOQLPrinter.prototype.printArgument = function (operator, predicate, arg, level, fluent) {\n let str = '';\n if (fluent) str += ')';\n const newline = this.argumentTakesNewline(operator);\n if (newline) str += `\\n${nspaces((level + 1) * this.indent_spaces)}`;\n if (arg['@type'] === 'True') return 'true';\n\n if (predicate === 'document') return this.decompileDocument(arg);\n if (predicate === 'variables') return this.decompileVariables(arg);\n if (predicate === 'group_by' || predicate === 'template') return this.decompileVariables(arg, true);\n\n // list of .as in get or put function\n if (predicate === 'columns') return this.decompileAsVars(arg, level + 1);\n\n if (predicate === 'pattern') return this.decompileRegexPattern(arg, level + 1);\n if (Array.isArray(arg)) {\n const arr_entries = [];\n for (let j = 0; j < arg.length; j++) {\n const nlevel = newline ? level + 1 : level;\n arr_entries.push(this.printJSON(arg[j], nlevel, fluent, newline));\n }\n const jstr = newline ? `,\\n${nspaces(++level * this.indent_spaces)}` : ',';\n if (this.argumentRequiresArray(predicate, arr_entries)) {\n str += `[${arr_entries.join(jstr)}]`;\n } else str += arr_entries.join(jstr);\n } else if (typeof arg === 'object') {\n const reet = this.printJSON(arg, level, fluent);\n // if(newline) str += \"\\n\" + nspaces(level*this.indent_spaces)\n\n str += reet;\n } else if (typeof arg === 'string') {\n str += this.uncleanArgument(arg, operator, predicate);\n } else if (typeof arg === 'number') return arg;\n return str;\n};\n\n// to be review if array\nWOQLPrinter.prototype.decompileDocument = function (args) {\n const jsonDoc = {};\n this.decompileDictionary(jsonDoc, args);\n return `WOQL.doc(${JSON.stringify(jsonDoc)})`;\n};\n\nWOQLPrinter.prototype.decompileDictionary = function (jsonDoc, args) {\n if (args.dictionary && args.dictionary.data && Array.isArray(args.dictionary.data)) {\n args.dictionary.data.forEach((item) => {\n this.decompileFieldValuePair(jsonDoc, item);\n });\n }\n};\n\nWOQLPrinter.prototype.decompileFieldValuePair = function (jsonDoc, fieldValue) {\n const type = fieldValue.field || '';\n // eslint-disable-next-line max-len\n let value = false;\n if (fieldValue.value && fieldValue.value) {\n if (fieldValue.value.data) {\n value = fieldValue.value.data['@value'];\n } else if (fieldValue.value.dictionary && Array.isArray(fieldValue.value.dictionary.data)) {\n const valueDoc = {};\n this.decompileDictionary(valueDoc, fieldValue.value);\n value = valueDoc;\n }\n }\n jsonDoc[type] = value;\n};\n\nWOQLPrinter.prototype.decompileVariables = function (args, checkIsArray = false) {\n if (Array.isArray(args)) {\n let str = '';\n args.forEach((varName, index) => {\n str += `\"v:${varName}\"`;\n if (index < args.length - 1)str += ', ';\n });\n if (checkIsArray && args.length > 1)str = `[${str}]`;\n return str;\n }\n return '';\n};\n// woql:datatype in path\nWOQLPrinter.prototype.decompileRegexPattern = function (json) {\n if (typeof json === 'object' && json['@type'] === 'DataValue') {\n return this.pvar(json);\n } if ((json['@type']).startsWith('Path')) {\n return `\"${this.decompilePathPattern(json)}\"`;\n }\n const str = json;\n return `\"${str.replace('\\\\', '\\\\\\\\')}\"`;\n};\n\nWOQLPrinter.prototype.pvar = function (json) {\n // if (json['woql:variable_name'] && typeof json['woql:variable_name']['@value'] != 'undefined') {\n if (json.variable) {\n let varname = json.variable;\n const order = json.order ? json.order : '';\n if (varname.indexOf(':') === -1) {\n varname = `v:${varname}`;\n }\n return (order !== '' && order !== 'asc') ? `[\"${varname}\",\"${order}\"]` : `\"${varname}\"`;\n } if (json.node) {\n return `\"${json.node}\"`;\n } if (json.data) {\n return JSON.stringify(json.data);\n } if (json.list) {\n const listArr = json.list;\n if (Array.isArray(listArr)) {\n const listTmp = [];\n listArr.forEach((listItem, index) => {\n listTmp.push(this.pvar(listItem));\n });\n return `[${listTmp.join(', ')}]`;\n }\n return this.pvar(json.list);\n }\n // we have list to\n return false;\n};\n\n/**\n * Gets the starting characters for a WOQL query - varies depending on how the query\n * is invoked and how indented it is\n */\nWOQLPrinter.prototype.getWOQLPrelude = function (operator, fluent, inline) {\n if (operator === 'true' || operator === 'false') {\n if (this.language === 'python') {\n return operator.charAt(0).toUpperCase() + operator.slice(1);\n }\n return operator;\n }\n let prelude = 'WOQL.';\n if (this.language === 'python') {\n this.pythonic[operator] && (operator = this.pythonic[operator]);\n prelude = 'WOQLQuery().';\n }\n if (fluent) {\n return `.${operator}`;\n }\n return (inline ? `\\n${nspaces(inline)}` : '') + prelude + operator;\n};\n\nWOQLPrinter.prototype.uncleanArgument = function (arg, operator, predicate) {\n if (arg.indexOf(':') !== -1) {\n // is it a short cut?\n for (const s in this.vocab) {\n if (this.vocab[s] === arg) return `\"${s}\"`;\n }\n // is there a default reverse mapping\n /* if (this.subject_cleaned_predicates.indexOf(predicate) != -1) {\n if (arg.substring(0, 4) === 'doc:') arg = arg.substring(4)\n }\n if (this.schema_cleaned_predicates.indexOf(predicate) != -1) {\n if (arg.substring(0, 4) === 'scm:') arg = arg.substring(4)\n } */\n }\n return `\"${arg}\"`;\n};\n\nWOQLPrinter.prototype.isListOperator = function (operator) {\n return this.list_operators.indexOf(operator) !== -1;\n};\n\nWOQLPrinter.prototype.isQueryListOperator = function (operator) {\n return this.query_list_operators.indexOf(operator) !== -1;\n};\n\n/*\n* transform the operator in the function name\n* like \"@type\": \"Triple\" => WOQL.triple\n*/\nWOQLPrinter.prototype.getFunctionForOperator = function (operator, json) {\n if (this.operator_maps[operator]) return this.operator_maps[operator];\n\n // triple with the graph parameter is the old quad\n if (operator === 'Triple' && json.graph) return 'quad';\n const f = camelToSnake(operator);\n if (this.shortcuts[f]) return this.shortcuts[f];\n return f;\n};\n\nWOQLPrinter.prototype.getBoxedPredicate = function (operator, json) {\n for (let i = 0; i < this.boxed_predicates.length; i++) {\n if (json[this.boxed_predicates[i]]) {\n return this.boxed_predicates[i];\n }\n }\n if (operator === 'QueryListElement') {\n return 'woql:query';\n }\n return false;\n};\n\nWOQLPrinter.prototype.unboxJSON = function (operator, json) {\n const bp = this.getBoxedPredicate(operator, json);\n if (bp) {\n return json[bp];\n }\n return false;\n};\n\n// WOQL.as\nWOQLPrinter.prototype.decompileAsVars = function (asvs, level) {\n let str = '';\n if (!Array.isArray(asvs)) return '';\n asvs.forEach((wasv, i) => {\n str += `\\n${nspaces(level * this.indent_spaces)}${i === 0 ? 'WOQL' : ''}`;\n // old 'woql:NamedAsVar'\n if (wasv['@type'] === 'Column' && wasv.indicator) {\n const source = wasv.indicator.name || wasv.indicator.index;\n const target = `v:${wasv.variable}`;\n const { type } = wasv.indicator;\n str += `.as(\"${source}\", \"${target}\"`;\n if (type) str += `, \"${type}\")`;\n else str += ')';\n }\n });\n return str;\n};\n\nWOQLPrinter.prototype.decompilePathPattern = function (pstruct) {\n const t = pstruct['@type'];\n // eslint-disable-next-line default-case\n switch (t) {\n case 'InversePathPredicate':\n return pstruct.predicate ? `<${pstruct.predicate}` : '<.';\n case 'PathPredicate':\n return pstruct.predicate ? `${pstruct.predicate}` : '.';\n case 'PathPlus':\n var next = pstruct.plus;\n if (Array.isArray(next)) next = next[0];\n if (needsParentheses(next)) return `(${this.decompilePathPattern(next)})+`;\n return `${this.decompilePathPattern(next)}+`;\n case 'PathStar':\n var next = pstruct.star;\n if (Array.isArray(next)) next = next[0];\n if (needsParentheses(next)) return `(${this.decompilePathPattern(next)})*`;\n return `${this.decompilePathPattern(next)}*`;\n case 'PathTimes':\n var next = pstruct.times;\n var astr = ` {${\n pstruct.from\n },${\n pstruct.to\n }}`;\n if (Array.isArray(next)) next = next[0];\n if (needsParentheses(next)) return `(${this.decompilePathPattern(next)})${astr}`;\n return this.decompilePathPattern(next) + astr;\n case 'PathSequence':\n const sequenceArr = pstruct.sequence;\n if (Array.isArray(sequenceArr) && sequenceArr.length === 2) {\n let next1 = sequenceArr[0];// pstruct['woql:path_first']\n const next2 = sequenceArr[1];// pstruct['woql:path_second']\n\n if (Array.isArray(next1)) next1 = next1[0];\n var seqstr = '';\n if (needsParentheses(next1)) seqstr += '(';\n seqstr += this.decompilePathPattern(next1);\n if (needsParentheses(next1)) seqstr += ')';\n seqstr += ',';\n if (needsParentheses(next2)) seqstr += '(';\n seqstr += this.decompilePathPattern(next2);\n if (next1['@type'] === 'InversePathPredicate') {\n seqstr += '>';\n }\n if (needsParentheses(next2)) seqstr += ')';\n return seqstr;\n }\n // there is a problem in remap\n case 'PathOr':\n const orArr = pstruct.or;\n if (Array.isArray(orArr) && orArr.length === 2) {\n let next1 = orArr[0]; // pstruct['woql:path_left']\n const next2 = orArr[1]; // pstruct['woql:path_right']\n if (Array.isArray(next1)) next1 = next1[0];\n var seqstr = '';\n if (needsParentheses(next1)) seqstr += '(';\n seqstr += this.decompilePathPattern(next1);\n if (needsParentheses(next1)) seqstr += ')';\n seqstr += '|';\n if (needsParentheses(next2)) seqstr += '(';\n seqstr += this.decompilePathPattern(next2);\n if (needsParentheses(next2)) seqstr += ')';\n return seqstr;\n }\n }\n return 'error';\n};\n\nfunction needsParentheses(obj) {\n const noparens = ['PathPredicate', 'PathPlus', 'PathTimes', 'InversePathPredicate'];\n if (noparens.indexOf(obj['@type']) !== -1) return false;\n return true;\n}\n\nfunction camelToSnake(string) {\n return string\n .replace(/[\\w]([A-Z])/g, (m) => `${m[0]}_${m[1]}`)\n .toLowerCase();\n}\n\nfunction nspaces(n) {\n let spaces = '';\n for (let i = 0; i < n; i++) {\n spaces += ' ';\n }\n return spaces;\n}\n\nmodule.exports = WOQLPrinter;\n","/* eslint-disable class-methods-use-this */\n/* eslint-disable no-redeclare */\n/* eslint-disable block-scoped-var */\n/* eslint-disable no-var */\n/* eslint-disable vars-on-top */\n/* eslint-disable no-param-reassign */\n/* eslint-disable no-unused-vars */\n/* eslint-disable camelcase */\n/* eslint-disable no-plusplus */\n/* eslint-disable prefer-destructuring */\n/* eslint-disable guard-for-in */\n/* eslint-disable no-restricted-syntax */\n\n/// /@ts-check\n// WOQLQuery\n/**\n * defines the internal functions of the woql query object - the\n * language API is defined in WOQLQuery\n * @module WOQLQuery\n * @constructor\n * @param {object} [query] json-ld query for initialisation\n * @returns {WOQLQuery}\n */\n\nconst WOQLCore = require('./woqlCore');\nconst { Var, Vars, Doc } = require('./woqlDoc');\n// eslint-disable-next-line no-unused-vars\nconst typedef = require('../typedef');\n\n// I HAVE TO REVIEW THE Inheritance and the prototype chain\nclass WOQLQuery extends WOQLCore {\n/**\n * defines the internal functions of the woql query object - the\n * language API is defined in WOQLQuery\n * @module WOQLQuery\n * @constructor\n * @param {object} [query] json-ld query for initialisation\n * @returns {WOQLQuery}\n */\n\n /**\n * Update a pattern matching rule for the triple (Subject, Predicate, oldObjValue) with the\n * new one (Subject, Predicate, newObjValue)\n * @param {string|Var} subject - The IRI of a triple’s subject or a variable\n * @param {string|Var} predicate - The IRI of a property or a variable\n * @param {string|Var} newObjValue - The value to update or a literal\n * @param {string|Var} oldObjValue - The old value of the object\n * @returns {WOQLQuery} A WOQLQuery which contains the a Update Triple Statement\n */\n update_triple(subject, predicate, newObjValue, oldObjValue) { return this; }\n\n /**\n * Generates a query that by default matches all triples in a graph identified by \"graph\"\n * or in all the current terminusDB's graph\n * @param {string | boolean} [graph] - false or the resource identifier of a graph possible\n * value are schema/{main - myschema - *} | instance/{main - myschema - *} |\n * inference/{main - myschema - *}\n * @param {string|Var} [subject] - The IRI of a triple’s subject or a variable,\n * default value \"v:Subject\"\n * @param {string|Var} [predicate] - The IRI of a property or a variable,\n * default value \"v:Predicate\"\n * @param {string|Var} [object] - The IRI of a node or a variable, or a literal,\n * default value \"v:Object\"\n * @returns {WOQLQuery} A WOQLQuery which contains the pattern matching expression\n */\n star(graph, subject, predicate, object) { return this; }\n\n /**\n * Update a pattern matching rule for the quad [S, P, O, G] (Subject, Predicate, Object, Graph)\n * @param {string|Var} subject - The IRI of a triple’s subject or a variable\n * @param {string|Var} predicate - The IRI of a property or a variable\n * @param {string|Var} newObject - The value to update or a literal\n * @param {typedef.GraphRef} graphRef - A valid graph resource identifier string\n * @returns {WOQLQuery} A WOQLQuery which contains the a Update Quad Statement\n */\n update_quad(subject, predicate, newObject, graphRef) { return this; }\n\n /**\n * @param {string|Var} id - IRI string or variable containing\n * @param {string|Var} type - IRI string or variable containing the IRI of the\n * @param {typedef.GraphRef} [refGraph] - Optional Graph resource identifier\n * @returns {WOQLQuery} A WOQLQuery which contains the insert expression\n */\n insert(id, type, refGraph) { return this; }\n\n /**\n * Sets the graph resource ID that will be used for subsequent chained function calls\n * @param {typedef.GraphRef} [graphRef] Resource String identifying the graph which will\n * be used for subsequent chained schema calls\n * @returns {WOQLQuery} A WOQLQuery which contains the partial Graph pattern matching expression\n * @example\n */\n graph(graphRef) { return this; }\n\n /**\n * Specifies the identity of a node that can then be used in subsequent builder functions.\n * Note that node() requires subsequent chained functions to complete the triples / quads\n * that it produces - by itself it only generates the subject.\n * @param {string|Var} nodeid - The IRI of a node or a variable containing an IRI which will\n * be the subject of the builder functions\n * @param {typedef.FuntionType} [chainType] - Optional type of builder function to build\n * (default is triple)\n * @returns {WOQLQuery} - A WOQLQuery which contains the partial Node pattern matching expression\n */\n node(nodeid, chainType) { return this; }\n\n /**\n * Deletes all triples in the passed graph (defaults to instance/main)\n * @param {typedef.GraphRef} [graphRef] - Resource String identifying the graph from\n * which all triples will be removed\n * @returns {WOQLQuery} - A WOQLQuery which contains the deletion expression\n * @example\n * nuke(\"schema/main\")\n * //will delete everything from the schema/main graph\n */\n nuke(graphRef) { return this; }\n\n /**\n * @param {string|Var} [Subj] - The IRI of a triple’s subject or a variable\n * @param {string|Var} [Pred] - The IRI of a property or a variable\n * @param {string|Var} [Obj] - The IRI of a node or a variable, or a literal\n * @param {typedef.GraphRef} [Graph] - the resource identifier of a graph possible\n * @returns {WOQLQuery} - A WOQLQuery which contains the pattern matching expression\n */\n all(Subj, Pred, Obj, Graph) { return this; }\n\n /**\n * @param {boolean} tf\n * @returns {object}\n * @example\n */\n boolean(tf) { return {}; }\n\n /**\n * @param {string} s\n * @returns {object}\n * @example\n */\n string(s) { return {}; }\n\n /**\n * @param {any} s\n * @param {string} t\n * @returns {object}\n * @example\n */\n literal(s, t) { return {}; }\n\n /**\n * @param {string} s\n * @returns {object}\n * @example\n */\n\n iri(s) { return {}; }\n\n // eslint-disable-next-line no-underscore-dangle\n _set_context(ctxt) { return this; }\n\n /**\n * @param {WOQLQuery} Subq\n * @returns {WOQLQuery}\n */\n addSubQuery(Subq) {\n super.addSubQuery(Subq);\n return this;\n }\n\n /**\n * @param {string} msg\n * @returns {WOQLQuery}\n */\n parameterError(msg) {\n super.parameterError(msg);\n return this;\n }\n\n /**\n * @returns {WOQLQuery}\n */\n updated() {\n super.updated();\n return this;\n }\n\n // eslint-disable-next-line no-useless-constructor\n constructor(query) {\n super(query);\n }\n}\n\n/**\n * Read a node identified by an IRI as a JSON-LD document\n * @param {string} IRI - The document id or a variable to read\n * @param {string} output - Variable which will be bound to the document.\n * @return {WOQLQuery} WOQLQuery\n */\nWOQLQuery.prototype.read_document = function (IRI, output) {\n if (this.cursor['@type']) this.wrapCursorWithAnd();\n this.cursor['@type'] = 'ReadDocument';\n this.cursor.identifier = this.cleanNodeValue(IRI);\n this.cursor.document = this.expandValueVariable(output);\n return this;\n};\n\n/**\n * Insert a document in the graph.\n * @param {object} docjson - The document to insert. Must either have an '@id' or\n * have a class specified key.\n * @param {string} [IRI] - An optional identifier specifying the document location.\n * @return {WOQLQuery} WOQLQuery\n */\n\nWOQLQuery.prototype.insert_document = function (docjson, IRI) {\n if (this.cursor['@type']) this.wrapCursorWithAnd();\n this.cursor['@type'] = 'InsertDocument';\n if (typeof IRI !== 'undefined') this.cursor.identifier = this.cleanNodeValue(IRI);\n\n this.cursor.document = this.cleanObject(docjson);\n\n return this.updated();\n};\n\n/**\n * Update a document identified by an IRI\n * @param {object} docjson - The document to update. Must either have an '@id' or\n * have a class specified key.\n * @param {string} [IRI] - An optional identifier specifying the document location.\n * @return {WOQLQuery} WOQLQuery\n */\n\nWOQLQuery.prototype.update_document = function (docjson, IRI) {\n if (this.cursor['@type']) this.wrapCursorWithAnd();\n this.cursor['@type'] = 'UpdateDocument';\n if (typeof IRI !== 'undefined') this.cursor.identifier = this.cleanNodeValue(IRI);\n\n this.cursor.document = this.cleanObject(docjson);\n\n return this.updated();\n};\n\n/**\n * Delete a document from the graph.\n * @param {string} IRI - The document id or a variable\n * @return {WOQLQuery} WOQLQuery\n */\n\nWOQLQuery.prototype.delete_document = function (IRI) {\n if (this.cursor['@type']) this.wrapCursorWithAnd();\n this.cursor['@type'] = 'DeleteDocument';\n this.cursor.identifier = this.cleanNodeValue(IRI);\n return this.updated();\n};\n\n/**\n * Contains definitions of the WOQL functions which map directly to JSON-LD types\n * All other calls and queries can be composed from these\n */\n\n// moved from woqlCore\nWOQLQuery.prototype.wrapCursorWithAnd = function () {\n if (this.cursor && this.cursor['@type'] === 'And') {\n const newby = this.cursor.and.length;\n this.and({});\n this.cursor = this.cursor.and[newby];\n } else {\n const nj = new WOQLQuery().json(this.cursor);\n for (const k in this.cursor) delete this.cursor[k];\n // create an empty json for the new query\n this.and(nj, {});\n this.cursor = this.cursor.and[1];\n }\n};\n\n/**\n * Query running against any specific commit Id\n * @param {string} refPath - path to specific reference Id or commit Id\n * @param {WOQLQuery} [subquery] - subquery for the specific commit point\n * @returns {WOQLQuery}\n */\n\nWOQLQuery.prototype.using = function (refPath, subquery) {\n if (this.cursor['@type']) this.wrapCursorWithAnd();\n this.cursor['@type'] = 'Using';\n if (!refPath || typeof refPath !== 'string') {\n return this.parameterError('The first parameter to using must be a Collection ID (string)');\n }\n this.cursor.collection = refPath;\n return this.addSubQuery(subquery);\n};\n\n/**\n * Adds a text comment to a query - can also be used to wrap any part of a query to turn it off\n * @param {string} comment - text comment\n * @param {WOQLQuery} [subquery] - query that is \"commented out\"\n * @returns {WOQLQuery}\n */\n\nWOQLQuery.prototype.comment = function (comment, subquery) {\n // if (comment && comment === 'args')\n // return ['comment', 'query']\n if (this.cursor['@type']) this.wrapCursorWithAnd();\n this.cursor['@type'] = 'Comment';\n this.cursor.comment = this.jlt(comment);\n return this.addSubQuery(subquery);\n};\n\n/**\n * Filters the query so that only the variables included in [V1...Vn] are returned in the bindings\n * @param {...string|...Var} varNames - only these variables are returned\n * @returns {WOQLQuery}\n */\n\nWOQLQuery.prototype.select = function (...varNames) {\n if (this.cursor['@type']) this.wrapCursorWithAnd();\n this.cursor['@type'] = 'Select';\n if (!varNames || varNames.length <= 0) {\n return this.parameterError('Select must be given a list of variable names');\n }\n const last = varNames[varNames.length - 1];\n /**\n *@type {any}\n */\n let embedquery = false;\n if (typeof last === 'object' && !(last instanceof Var) && last.json) {\n embedquery = varNames.pop();\n } // else var embedquery = false\n this.cursor.variables = this.rawVarList(varNames);\n return this.addSubQuery(embedquery);\n};\n\n/**\n * Filter the query to return only results that are distinct in the given variables\n * @param {...string|...Var} varNames - these variables are guaranteed to be unique as a tuple\n * @returns {WOQLQuery}\n */\n\nWOQLQuery.prototype.distinct = function (...varNames) {\n // if (list && list[0] === 'args')\n // return ['variable_list', 'query']\n if (this.cursor['@type']) this.wrapCursorWithAnd();\n this.cursor['@type'] = 'Distinct';\n if (!varNames || varNames.length <= 0) {\n return this.parameterError('Distinct must be given a list of variable names');\n }\n const last = varNames[varNames.length - 1];\n /**\n * @type {any}\n */\n let embedquery = false;\n if (typeof last === 'object' && !(last instanceof Var) && last.json) {\n embedquery = varNames.pop();\n } // else var embedquery = false\n this.cursor.variables = this.rawVarList(varNames);\n return this.addSubQuery(embedquery);\n};\n\n/**\n* Logical conjunction of the contained queries - all queries must match or the entire clause fails\n* @param {...WOQLQuery} subqueries - A list of one or more woql queries to execute as a conjunction\n* @returns {WOQLQuery} - A WOQLQuery object containing the conjunction of queries\n*/\n\nWOQLQuery.prototype.and = function (...subqueries) {\n if (this.cursor['@type'] && this.cursor['@type'] !== 'And') {\n const nj = new WOQLQuery().json(this.cursor);\n for (const k in this.cursor) delete this.cursor[k];\n subqueries.unshift(nj);\n }\n this.cursor['@type'] = 'And';\n if (typeof this.cursor.and === 'undefined') this.cursor.and = [];\n for (let i = 0; i < subqueries.length; i++) {\n const onevar = this.jobj(subqueries[i]);\n if (\n onevar['@type'] === 'And'\n && onevar.and\n ) {\n for (let j = 0; j < onevar.and.length; j++) {\n const qjson = onevar.and[j];\n if (qjson) {\n const subvar = this.jobj(qjson);\n this.cursor.and.push(subvar);\n }\n }\n } else {\n this.cursor.and.push(onevar);\n }\n }\n return this;\n};\n\n/**\n * Creates a logical OR of the arguments\n * @param {...WOQLQuery} subqueries - A list of one or more woql queries\n * to execute as alternatives\n * @returns {WOQLQuery} - A WOQLQuery object containing the logical Or of the subqueries\n */\n\nWOQLQuery.prototype.or = function (...subqueries) {\n if (this.cursor['@type']) this.wrapCursorWithAnd();\n this.cursor['@type'] = 'Or';\n if (typeof this.cursor.or === 'undefined') this.cursor.or = [];\n for (let i = 0; i < subqueries.length; i++) {\n const onevar = this.jobj(subqueries[i]);\n this.cursor.or.push(onevar);\n }\n return this;\n};\n/**\n * Specifies the database URL that will be the default database for the enclosed query\n * @param {typedef.GraphRef} graphRef- A valid graph resource identifier string\n * @param {WOQLQuery} [query] - The query\n * @returns {WOQLQuery} A WOQLQuery object containing the from expression\n */\n\n/**\n * Specifies the database URL that will be the default database for the enclosed query\n * @param {typedef.GraphRef} graphRef- A valid graph resource identifier string\n * @param {WOQLQuery} [query] - The query\n * @returns {WOQLQuery} A WOQLQuery object containing the from expression\n */\n\nWOQLQuery.prototype.from = function (graphRef, query) {\n // if (graph && graph === 'args')\n // return ['graph', 'query']\n if (this.cursor['@type']) this.wrapCursorWithAnd();\n this.cursor['@type'] = 'From';\n if (!graphRef || typeof graph !== 'string') {\n return this.parameterError(\n 'The first parameter to from must be a Graph Filter Expression (string)',\n );\n }\n this.cursor.graph = graphRef;\n return this.addSubQuery(query);\n};\n\n/**\n * Specifies the graph resource to write the contained query into\n * @param {typedef.GraphRef} graphRef- A valid graph resource identifier string\n * @param {WOQLQuery} [subquery] - The query which will be written into the graph\n * @returns {WOQLQuery} A WOQLQuery which will be written into the graph in question\n */\n\nWOQLQuery.prototype.into = function (graphRef, subquery) {\n // if (graph_descriptor && graph_descriptor === 'args')\n // return ['graph', 'query']\n if (this.cursor['@type']) this.wrapCursorWithAnd();\n this.cursor['@type'] = 'Into';\n if (!graphRef || typeof graphRef !== 'string') {\n return this.parameterError(\n 'The first parameter to from must be a Graph Filter Expression (string)',\n );\n }\n this.cursor.graph = this.jlt(graphRef);\n return this.addSubQuery(subquery);\n};\n\n/**\n * Creates a triple pattern matching rule for the triple [S, P, O] (Subject, Predicate, Object)\n * @param {string|Var} subject - The IRI of a triple’s subject or a variable\n * @param {string|Var} predicate - The IRI of a property or a variable\n * @param {string|Var} object - The IRI of a node or a variable, or a literal\n * @returns {WOQLQuery}\n */\n\nWOQLQuery.prototype.triple = function (subject, predicate, object) {\n // if (a && a === 'args')\n // return ['subject', 'predicate', 'object']\n if (this.cursor['@type']) this.wrapCursorWithAnd();\n this.cursor['@type'] = 'Triple';\n this.cursor.subject = this.cleanSubject(subject);\n this.cursor.predicate = this.cleanPredicate(predicate);\n this.cursor.object = this.cleanObject(object);\n return this;\n};\n\n/**\n * Creates a triple pattern matching rule for the triple [S, P, O] (Subject, Predicate,\n * Object) added in the current layer\n * @param {string|Var} subject - The IRI of a triple’s subject or a variable\n * @param {string|Var} predicate - The IRI of a property or a variable\n * @param {string|Var} object - The IRI of a node or a variable, or a literal\n * @returns {WOQLQuery}\n */\n\nWOQLQuery.prototype.added_triple = function (subject, predicate, object) {\n // if (a && a === 'args')\n // return ['subject', 'predicate', 'object']\n if (this.cursor['@type']) this.wrapCursorWithAnd();\n this.cursor['@type'] = 'AddedTriple';\n this.cursor.subject = this.cleanSubject(subject);\n this.cursor.predicate = this.cleanPredicate(predicate);\n this.cursor.object = this.cleanObject(object);\n return this;\n};\n\n/**\n * Creates a triple pattern matching rule for the triple [S, P, O] (Subject, Predicate,\n * Object) added in the current commit\n * @param {string|Var} subject - The IRI of a triple’s subject or a variable\n * @param {string|Var} predicate - The IRI of a property or a variable\n * @param {string|Var} object - The IRI of a node or a variable, or a literal\n * @returns {WOQLQuery}\n */\n\nWOQLQuery.prototype.removed_triple = function (subject, predicate, object) {\n if (this.cursor['@type']) this.wrapCursorWithAnd();\n this.cursor['@type'] = 'DeletedTriple';\n this.cursor.subject = this.cleanSubject(subject);\n this.cursor.predicate = this.cleanPredicate(predicate);\n this.cursor.object = this.cleanObject(object);\n return this;\n};\n\n/**\n * Creates a pattern matching rule for triple [Subject, Predicate, Object]\n * @param {string|Var} subject - The IRI of a triple’s subject or a variable\n * @param {string|Var} predicate - The IRI of a property or a variable\n * @param {string|Var} object - The IRI of a node or a variable, or a literal\n * @returns {WOQLQuery} A WOQLQuery which contains the a quad or a triple Statement\n */\n\nWOQLQuery.prototype.link = function (subject, predicate, object) {\n if (this.cursor['@type']) this.wrapCursorWithAnd();\n this.cursor['@type'] = 'Triple';\n this.cursor.subject = this.cleanSubject(subject);\n this.cursor.predicate = this.cleanPredicate(predicate);\n this.cursor.object = this.cleanSubject(object);\n return this;\n};\n\n/**\n * Creates a pattern matching rule for triple [Subject, Predicate, Object]\n * add extra information about the type of the value object\n * @param {string|Var} subject - The IRI of a triple’s subject or a variable\n * @param {string|Var} predicate - The IRI of a property or a variable\n * @param {string | number | boolean | Var} objValue - an specific value\n * @returns {WOQLQuery} A WOQLQuery which contains the a quad or a triple Statement\n */\n\nWOQLQuery.prototype.value = function (subject, predicate, objValue) {\n if (this.cursor['@type']) this.wrapCursorWithAnd();\n this.cursor['@type'] = 'Triple';\n this.cursor.subject = this.cleanSubject(subject);\n this.cursor.predicate = this.cleanPredicate(predicate);\n this.cursor.object = this.cleanDataValue(objValue, 'xsd:string');\n return this;\n};\n\n/**\n * Creates a pattern matching rule for the quad [S, P, O, G] (Subject, Predicate, Object, Graph)\n * @param {string|Var} subject - The IRI of a triple’s subject or a variable\n * @param {string|Var} predicate - The IRI of a property or a variable\n * @param {string|Var} object - The IRI of a node or a variable, or a literal\n * @param {typedef.GraphRef} graphRef - A valid graph resource identifier string\n * @returns {WOQLQuery}\n */\n\nWOQLQuery.prototype.quad = function (subject, predicate, object, graphRef) {\n if (this.cursor['@type']) this.wrapCursorWithAnd();\n const args = this.triple(subject, predicate, object);\n // if (a && a === 'args')\n // return args.concat(['graph'])\n if (!graphRef) return this.parameterError('Quad takes four parameters, the last should be a graph filter');\n this.cursor['@type'] = 'Triple';\n this.cursor.graph = this.cleanGraph(graphRef);\n return this;\n};\n\n/**\n * Creates a pattern matching rule for the quad [S, P, O, G] (Subject, Predicate,\n * Object, Graph) removed from the current commit\n * @param {string|Var} subject - The IRI of a triple’s subject or a variable\n * @param {string|Var} predicate - The IRI of a property or a variable\n * @param {string|Var} object - The IRI of a node or a variable, or a literal\n * @param {typedef.GraphRef} graphRef- A valid graph resource identifier string\n * @returns {WOQLQuery}\n */\n\nWOQLQuery.prototype.added_quad = function (subject, predicate, object, graphRef) {\n if (this.cursor['@type']) this.wrapCursorWithAnd();\n const args = this.triple(subject, predicate, object);\n // if (a && a === 'args')\n // return args.concat(['graph'])\n if (!graphRef) return this.parameterError('Quad takes four parameters, the last should be a graph filter');\n this.cursor['@type'] = 'AddedQuad';\n this.cursor.graph = this.cleanGraph(graphRef);\n return this;\n};\n\n/**\n * Creates a pattern matching rule for the quad [S, P, O, G] (Subject, Predicate,\n * Object, Graph) removed from the current commit\n * @param {string|Var} subject - The IRI of a triple’s subject or a variable\n * @param {string|Var} predicate - The IRI of a property or a variable\n * @param {string|Var} object - The IRI of a node or a variable, or a literal\n * @param {typedef.GraphRef} graphRef- A valid graph resource identifier string\n * @returns {WOQLQuery}\n */\n\nWOQLQuery.prototype.removed_quad = function (subject, predicate, object, graphRef) {\n if (this.cursor['@type']) this.wrapCursorWithAnd();\n const args = this.triple(subject, predicate, object);\n // if (a && a === 'args')\n // return args.concat(['graph'])\n if (!graphRef) return this.parameterError('Quad takes four parameters, the last should be a graph filter');\n this.cursor['@type'] = 'RemovedQuad';\n this.cursor.graph = this.cleanGraph(graphRef);\n return this;\n};\n\n/**\n * Returns true if ClassA subsumes ClassB, according to the current DB schema\n * @param {string} classA - ClassA\n * @param {string} classB - ClassB\n * @returns {boolean} WOQLQuery\n */\nWOQLQuery.prototype.sub = function (classA, classB) {\n if (!classA || !classB) return this.parameterError('Subsumption takes two parameters, both URIs');\n if (this.cursor['@type']) this.wrapCursorWithAnd();\n this.cursor['@type'] = 'Subsumption';\n this.cursor.parent = this.cleanNodeValue(classA);\n this.cursor.child = this.cleanNodeValue(classB);\n return this;\n};\n\nWOQLQuery.prototype.subsumption = WOQLQuery.prototype.sub;\n\n/**\n * Matches if a is equal to b\n * @param {string|Var} varName - literal, variable or id\n * @param {string|Var} varValue - literal, variable or id\n * @returns {WOQLQuery}\n */\nWOQLQuery.prototype.eq = function (varName, varValue) {\n // if (a && a === 'args') return ['left', 'right']\n if (typeof varName === 'undefined' || typeof varValue === 'undefined') return this.parameterError('Equals takes two parameters');\n if (this.cursor['@type']) this.wrapCursorWithAnd();\n this.cursor['@type'] = 'Equals';\n this.cursor.left = this.cleanObject(varName);\n this.cursor.right = this.cleanObject(varValue);\n return this;\n};\n\nWOQLQuery.prototype.equals = WOQLQuery.prototype.eq;\n\n/**\n * Substring\n * @param {string|Var} string - String or variable\n * @param {number|Var} before - integer or variable (characters from start to begin)\n * @param {number|Var} [length] - integer or variable (length of substring)\n * @param {number|Var} [after] - integer or variable (number of characters after substring)\n * @param {string|Var} [subString] - String or variable\n * @returns {WOQLQuery}\n */\nWOQLQuery.prototype.substr = function (string, before, length, after, subString) {\n // if (String && String === 'args')\n // return ['string', 'before', 'length', 'after', 'substring']\n if (!subString) {\n subString = after;\n after = 0;\n }\n if (!subString) {\n subString = length;\n length = subString.length + before;\n }\n if (!string || !subString || typeof subString !== 'string') {\n return this.parameterError(\n 'Substr - the first and last parameters must be strings representing the full and substring variables / literals',\n );\n }\n if (this.cursor['@type']) this.wrapCursorWithAnd();\n this.cursor['@type'] = 'Substring';\n this.cursor.string = this.cleanDataValue(string, 'xsd:string');\n this.cursor.before = this.cleanDataValue(before, 'xsd:nonNegativeInteger');\n this.cursor.length = this.cleanDataValue(length, 'xsd:nonNegativeInteger');\n this.cursor.after = this.cleanDataValue(after, 'xsd:nonNegativeInteger');\n this.cursor.substring = this.cleanDataValue(subString, 'xsd:string');\n return this;\n};\n\nWOQLQuery.prototype.substring = WOQLQuery.prototype.substr;\n\n/**\n * Use the document inteface to import documents\n * @deprecated\n * Retrieves the exernal resource defined by QueryResource and copies values\n * from it into variables defined in AsVars\n * @param {Vars | array<Var>} asvars - an array of AsVar variable mappings (see as for format below)\n * @param {WOQLQuery} queryResource - an external resource (remote, file, post) to query\n * @returns {WOQLQuery} A WOQLQuery which contains the get expression\n */\nWOQLQuery.prototype.get = function (asvars, queryResource) {\n this.cursor['@type'] = 'Get';\n this.cursor.columns = asvars.json ? asvars.json() : new WOQLQuery().as(...asvars).json();\n if (queryResource) {\n this.cursor.resource = this.jobj(queryResource);\n } else {\n this.cursor.resource = {};\n }\n this.cursor = this.cursor.resource;\n return this;\n};\n\n/**\n * Use the document inteface to import documents\n * @deprecated\n * @put Outputs the results of a query to a file\n * @param {Vars | array<Var>} varsToExp - an array of AsVar variable\n * mappings (see as for format below)\n * @param {WOQLQuery} query - The query which will be executed to produce the results\n * @param {string} fileResource - an file resource local to the server\n * @returns {WOQLQuery} A WOQLQuery which contains the put expression\n */\nWOQLQuery.prototype.put = function (varsToExp, query, fileResource) {\n if (this.cursor['@type']) this.wrapCursorWithAnd();\n this.cursor['@type'] = 'Put';\n if (Array.isArray(varsToExp) && typeof varsToExp[0] !== 'object') {\n const nasvars = [];\n for (let i = 0; i < varsToExp.length; i++) {\n const iasv = this.asv(i, varsToExp[i]);\n nasvars.push(iasv);\n this.cursor.columns = nasvars;\n }\n } else {\n this.cursor.columns = varsToExp.json\n ? varsToExp.json()\n : new WOQLQuery().as(...varsToExp).json();\n }\n this.cursor.query = this.jobj(query);\n if (fileResource) {\n this.cursor.resource = this.jobj(fileResource);\n } else {\n this.cursor.resource = {};\n }\n this.cursor = this.cursor.resource;\n return this;\n};\n\n/**\n * @param {...(array|string|Var)} varList variable number of arguments\n * @returns WOQLQuery\n */\nWOQLQuery.prototype.as = function (...varList) {\n // if (varList && varList[0] == 'args')\n // return [['indexed_as_var', 'named_as_var']]\n if (!Array.isArray(this.query)) this.query = [];\n if (Array.isArray(varList[0])) {\n if (!varList[1]) {\n // indexed as vars\n for (var i = 0; i < varList[0].length; i++) {\n const iasv = this.asv(i, varList[0][i]);\n this.query.push(iasv);\n }\n } else {\n for (var i = 0; i < varList.length; i++) {\n const onemap = varList[i];\n if (Array.isArray(onemap) && onemap.length >= 2) {\n const type = onemap && onemap.length > 2 ? onemap[2] : false;\n const oasv = this.asv(onemap[0], onemap[1], type);\n this.query.push(oasv);\n }\n }\n }\n } else if (typeof varList[0] === 'number' || typeof varList[0] === 'string') {\n if (varList[2] && typeof varList[2] === 'string') {\n var oasv = this.asv(varList[0], varList[1], varList[2]);\n } else if (varList[1] && varList[1] instanceof Var) {\n var oasv = this.asv(varList[0], varList[1]);\n } else if (varList[1] && typeof varList[1] === 'string') {\n if (varList[1].substring(0, 4) === 'xsd:' || varList[1].substring(0, 4) === 'xdd:') {\n var oasv = this.asv(this.query.length, varList[0], varList[1]);\n } else {\n var oasv = this.asv(varList[0], varList[1]);\n }\n } else {\n var oasv = this.asv(this.query.length, varList[0]);\n }\n this.query.push(oasv);\n } else if (typeof varList[0] === 'object') {\n // check if it is an class object with an json method\n this.query.push(varList[0].json ? varList[0].json() : varList[0]);\n }\n return this;\n};\n\n/**\n * Identifies a remote resource by URL and specifies the format of the resource through the options\n * @param {object} remoteObj - The URL at which the remote resource can be accessed\n * @param {typedef.DataFormatObj} [formatObj] - The format of the resource data {}\n * @returns {WOQLQuery} A WOQLQuery which contains the remote resource identifier\n */\n\nWOQLQuery.prototype.remote = function (remoteObj, formatObj) {\n if (this.cursor['@type']) this.wrapCursorWithAnd();\n this.cursor['@type'] = 'QueryResource';\n this.cursor.source = { '@type': 'Source', url: remoteObj };\n this.cursor.format = 'csv'; // hard coded for now\n if (typeof opts !== 'undefined') this.cursor.options = formatObj;\n return this;\n};\n\n/**\n * Identifies a resource as a local path on the client, to be sent to the server through a\n * HTTP POST request, with the format defined through the options\n * @param {string} url - The Path on the server at which the file resource can be accessed\n * @param {typedef.DataFormatObj} [formatObj] - imput options, optional\n * @param {string} [source] - It defines the source of the file, it can be 'url','post'\n * @returns {WOQLQuery} A WOQLQuery which contains the Post resource identifier\n */\n\nWOQLQuery.prototype.post = function (url, formatObj, source = 'post') {\n // if (fpath && fpath == 'args') return ['file', 'format']\n if (this.cursor['@type']) this.wrapCursorWithAnd();\n this.cursor['@type'] = 'QueryResource';\n this.cursor.source = { '@type': 'Source', [source]: url };\n this.cursor.format = 'csv'; // hard coded for now\n this.cursor.options = formatObj;\n if (typeof formatObj !== 'undefined') this.cursor.options = formatObj;\n return this;\n};\n\n/**\n * Deletes a single triple from the default graph of the database\n * @param {string|Var} subject - The IRI of a triple’s subject or a variable\n * @param {string|Var} predicate - The IRI of a property or a variable\n * @param {string|Var} object - The IRI of a node or a variable, or a literal\n * @returns {WOQLQuery} - A WOQLQuery which contains the Triple Deletion statement\n */\n\nWOQLQuery.prototype.delete_triple = function (subject, predicate, object) {\n if (this.cursor['@type']) this.wrapCursorWithAnd();\n const args = this.triple(subject, predicate, object);\n this.cursor['@type'] = 'DeleteTriple';\n return this.updated();\n};\n\n/**\n * Adds triples according to the the pattern [subject,predicate,object]\n * @param {string|Var} subject - The IRI of a triple’s subject or a variable\n * @param {string|Var} predicate - The IRI of a property or a variable\n * @param {string|Var} object - The IRI of a node or a variable, or a literal\n * @returns {WOQLQuery}\n */\n\nWOQLQuery.prototype.add_triple = function (subject, predicate, object) {\n if (this.cursor['@type']) this.wrapCursorWithAnd();\n const args = this.triple(subject, predicate, object);\n this.cursor['@type'] = 'AddTriple';\n return this.updated();\n};\n\n/**\n * Deletes a single triple from the graph [Subject, Predicate, Object, Graph]\n * @param {string|Var} subject - The IRI of a triple’s subject or a variable\n * @param {string|Var} predicate - The IRI of a property or a variable\n * @param {string|Var} object - The IRI of a node or a variable, or a literal\n * @param {typedef.GraphRef} graphRef - A valid graph resource identifier string\n * @returns {WOQLQuery} - A WOQLQuery which contains the Delete Quad Statement\n */\nWOQLQuery.prototype.delete_quad = function (subject, predicate, object, graphRef) {\n if (this.cursor['@type']) this.wrapCursorWithAnd();\n const args = this.triple(subject, predicate, object);\n // if (a && a == 'args') return args.concat(['graph'])\n if (!graphRef) {\n return this.parameterError(\n 'Delete Quad takes four parameters, the last should be a graph id',\n );\n }\n this.cursor['@type'] = 'DeleteTriple';\n this.cursor.graph = this.cleanGraph(graphRef);\n return this.updated();\n};\n\n/**\n * Adds quads according to the pattern [S,P,O,G]\n * @param {string|Var} subject - The IRI of a triple’s subject or a variable\n * @param {string|Var} predicate - The IRI of a property or a variable\n * @param {string|Var} object - The IRI of a node or a variable, or a literal\n * @param {typedef.GraphRef} graphRef - A valid graph resource identifier string\n * @returns {WOQLQuery}\n */\n\nWOQLQuery.prototype.add_quad = function (subject, predicate, object, graphRef) {\n if (this.cursor['@type']) this.wrapCursorWithAnd();\n const args = this.triple(subject, predicate, object);\n if (!graphRef) return this.parameterError('Add Quad takes four parameters, the last should be a graph id');\n this.cursor['@type'] = 'AddTriple';\n this.cursor.graph = this.cleanGraph(graphRef);\n return this.updated();\n};\n\n/**\n * Remove whitespace from both sides of a string:\n * @param {string|Var} inputStr - A string or variable containing\n * the untrimmed version of the string\n * @param {string|Var} resultVarName - A string or variable\n * containing the trimmed version of the string\n * @returns {WOQLQuery} A WOQLQuery which contains the Trim pattern matching expression\n */\n\nWOQLQuery.prototype.trim = function (inputStr, resultVarName) {\n if (this.cursor['@type']) this.wrapCursorWithAnd();\n this.cursor['@type'] = 'Trim';\n this.cursor.untrimmed = this.cleanDataValue(inputStr);\n this.cursor.trimmed = this.cleanDataValue(resultVarName);\n return this;\n};\n\n/**\n * Evaluates the passed arithmetic expression and generates or matches the result value\n * @param {object| WOQLQuery | string} arithExp - query or JSON-LD representing the query\n * @param {string|Var} resultVarName - output variable\n * @returns {WOQLQuery}\n */\n\nWOQLQuery.prototype.eval = function (arithExp, resultVarName) {\n if (this.cursor['@type']) this.wrapCursorWithAnd();\n this.cursor['@type'] = 'Eval';\n this.cursor.expression = arithExp.json ? arithExp.json() : arithExp;\n this.cursor.result = this.cleanArithmeticValue(resultVarName);\n return this;\n};\n\n/**\n * Adds the numbers together\n * @param {...(string|number|Var)} args - a variable or numeric containing the values to add\n * @returns {WOQLQuery} A WOQLQuery which contains the addition expression\n */\n\nWOQLQuery.prototype.plus = function (...args) {\n // if (args && args[0] == 'args') return ['first', 'second']\n if (this.cursor['@type']) this.wrapCursorWithAnd();\n this.cursor['@type'] = 'Plus';\n this.cursor.left = this.arop(args.shift());\n if (args.length > 1) {\n this.cursor.right = this.jobj(new WOQLQuery().plus(...args.map(this.arop)));\n } else {\n this.cursor.right = this.arop(args[0]);\n }\n return this;\n};\n\n/**\n *\n * Subtracts Numbers N1..Nn\n * @param {...(string|number|Var)} args - variable or numeric containing the value that will be\n * subtracted from\n * @returns {WOQLQuery} A WOQLQuery which contains the subtraction expression\n */\nWOQLQuery.prototype.minus = function (...args) {\n // if (args && args[0] === 'args') return ['first', 'right']\n if (this.cursor['@type']) this.wrapCursorWithAnd();\n this.cursor['@type'] = 'Minus';\n this.cursor.left = this.arop(args.shift());\n if (args.length > 1) {\n this.cursor.right = this.jobj(new WOQLQuery().minus(...args.map(this.arop)));\n } else {\n this.cursor.right = this.arop(args[0]);\n }\n return this;\n};\n\n/**\n *\n * Multiplies numbers N1...Nn together\n * @param {...(string|number|Var)} args - a variable or numeric containing the value\n * @returns {WOQLQuery} A WOQLQuery which contains the multiplication expression\n */\nWOQLQuery.prototype.times = function (...args) {\n // if (args && args[0] === 'args') return ['first', 'right']\n if (this.cursor['@type']) this.wrapCursorWithAnd();\n this.cursor['@type'] = 'Times';\n this.cursor.left = this.arop(args.shift());\n if (args.length > 1) {\n this.cursor.right = this.jobj(new WOQLQuery().times(...args.map(this.arop)));\n } else {\n this.cursor.right = this.arop(args[0]);\n }\n return this;\n};\n\n/**\n * Divides numbers N1...Nn by each other left, to right precedence\n * @param {...(string|number|Var )} args - numbers to tbe divided\n * @returns {WOQLQuery} A WOQLQuery which contains the division expression\n */\nWOQLQuery.prototype.divide = function (...args) {\n // if (args && args[0] === 'args') return ['left', 'right']\n if (this.cursor['@type']) this.wrapCursorWithAnd();\n this.cursor['@type'] = 'Divide';\n this.cursor.left = this.arop(args.shift());\n if (args.length > 1) {\n this.cursor.right = this.jobj(new WOQLQuery().divide(...args.map(this.arop)));\n } else {\n this.cursor.right = this.arop(args[0]);\n }\n return this;\n};\n\n/**\n * Division - integer division - args are divided left to right\n * @param {...(string|number|Var)} args - numbers for division\n * @returns {WOQLQuery} A WOQLQuery which contains the division expression\n */\n\nWOQLQuery.prototype.div = function (...args) {\n // if (args && args[0] === 'args') return ['left', 'right']\n if (this.cursor['@type']) this.wrapCursorWithAnd();\n this.cursor['@type'] = 'Div';\n this.cursor.left = this.arop(args.shift());\n if (args.length > 1) {\n this.cursor.right = this.jobj(new WOQLQuery().div(...args.map(this.arop)));\n } else {\n this.cursor.right = this.arop(args[0]);\n }\n return this;\n};\n\n/**\n * Exponent - raises varNum01 to the power of varNum02\n * @param {string|number|Var} varNum - a variable or numeric containing the number to be\n * raised to the power of the second number\n * @param {number} expNum - a variable or numeric containing the exponent\n * @returns {WOQLQuery} A WOQLQuery which contains the exponent expression\n */\nWOQLQuery.prototype.exp = function (varNum, expNum) {\n // if (a && a === 'args') return ['left', 'right']\n if (this.cursor['@type']) this.wrapCursorWithAnd();\n this.cursor['@type'] = 'Exp';\n this.cursor.left = this.arop(varNum);\n this.cursor.right = this.arop(expNum);\n return this;\n};\n\n/**\n * Generates the nearest lower integer to the passed number\n * @param {string|number|Var} varNum - Variable or numeric containing the number to be floored\n * @returns {WOQLQuery} A WOQLQuery which contains the floor expression\n */\nWOQLQuery.prototype.floor = function (varNum) {\n // if (a && a === 'args') return ['argument']\n if (this.cursor['@type']) this.wrapCursorWithAnd();\n this.cursor['@type'] = 'Floor';\n this.cursor.argument = this.arop(varNum);\n return this;\n};\n\n/**\n * Tests whether a given instance IRI has type Class, according to the current state of the DB\n * @param {string|Var} instanceIRI - A string IRI or a variable that identify the class instance\n * @param {string|Var} classId - A Class IRI or a variable\n * @returns {WOQLQuery} A WOQLQuery object containing the type test\n */\nWOQLQuery.prototype.isa = function (instanceIRI, classId) {\n // if (a && a === 'args') return ['element', 'of_type']\n if (this.cursor['@type']) this.wrapCursorWithAnd();\n this.cursor['@type'] = 'IsA';\n this.cursor.element = this.cleanNodeValue(instanceIRI);\n this.cursor.type = this.cleanNodeValue(classId);\n return this;\n};\n\n/**\n * Generates a string Leverstein distance measure between stringA and stringB\n * @param {string|Var} stringA - string literal or variable representing a string to be compared\n * @param {string|Var } stringB - string literal or variable\n * representing the other string to be compared\n * @param {number|string|Var} distance - variable representing the distance between the variables\n * @returns {WOQLQuery} A WOQLQuery which contains the Like pattern matching expression\n */\nWOQLQuery.prototype.like = function (stringA, stringB, distance) {\n // if (a && a === 'args')\n // return ['left', 'right', 'like_similarity']\n if (this.cursor['@type']) this.wrapCursorWithAnd();\n this.cursor['@type'] = 'Like';\n this.cursor.left = this.cleanDataValue(stringA, 'xsd:string');\n this.cursor.right = this.cleanDataValue(stringB, 'xsd:string');\n if (distance) {\n this.cursor.similarity = this.cleanDataValue(distance, 'xsd:decimal');\n }\n return this;\n};\n\n/**\n * Compares the value of v1 against v2 and returns true if v1 is less than v2\n * @param {string|number|Var} varNum01 - a variable or numeric containing\n * the number to be compared\n * @param {string|number|Var} varNum02 - a variable or numeric containing the second comporator\n * @returns {WOQLQuery} A WOQLQuery which contains the comparison expression\n */\nWOQLQuery.prototype.less = function (varNum01, varNum02) {\n if (this.cursor['@type']) this.wrapCursorWithAnd();\n this.cursor['@type'] = 'Less';\n this.cursor.left = this.cleanDataValue(varNum01);\n this.cursor.right = this.cleanDataValue(varNum02);\n return this;\n};\n\n/**\n * Compares the value of v1 against v2 and returns true if v1 is greater than v2\n * @param {string|number|Var} varNum01 - a variable or numeric containing the number to be compared\n * @param {string|number|Var} varNum02 - a variable or numeric containing the second comporator\n * @returns {WOQLQuery} A WOQLQuery which contains the comparison expression\n */\nWOQLQuery.prototype.greater = function (varNum01, varNum02) {\n if (this.cursor['@type']) this.wrapCursorWithAnd();\n this.cursor['@type'] = 'Greater';\n this.cursor.left = this.cleanDataValue(varNum01);\n this.cursor.right = this.cleanDataValue(varNum02);\n return this;\n};\n\n/**\n * Specifies that the Subquery is optional - if it does not match the query will not fail\n * @param {WOQLQuery} [subquery] - A subquery which will be optionally matched\n * @returns {WOQLQuery} A WOQLQuery object containing the optional sub Query\n */\nWOQLQuery.prototype.opt = function (subquery) {\n if (this.cursor['@type']) this.wrapCursorWithAnd();\n this.cursor['@type'] = 'Optional';\n this.addSubQuery(subquery);\n return this;\n};\n\nWOQLQuery.prototype.optional = WOQLQuery.prototype.opt;\n\n/**\n * Generate a new IRI from the prefix and a hash of the variables which will be unique for any\n * given combination of variables\n * @param {string} prefix - A prefix for the IRI - typically formed of the doc prefix and the\n * classtype of the entity (“doc:Person”)\n * @param {array|string|Var} inputVarList - An array of variables and / or strings from which the\n * unique hash will be generated\n * @param {string|Var} resultVarName - Variable in which the unique ID is stored\n * @returns {WOQLQuery} A WOQLQuery object containing the unique ID generating function\n */\nWOQLQuery.prototype.unique = function (prefix, inputVarList, resultVarName) {\n if (this.cursor['@type']) this.wrapCursorWithAnd();\n this.cursor['@type'] = 'HashKey';\n this.cursor.base = this.cleanDataValue(prefix, 'xsd:string');\n this.cursor.key_list = this.cleanDataValue(inputVarList);\n this.cursor.uri = this.cleanNodeValue(resultVarName);\n return this;\n};\n\n/**\n * Generates the node's ID combined the variable list with a specific prefix (URL base).\n * If the input variables's values are the same, the output value will be the same.\n * @param {string} prefix\n * @param {string |array} inputVarList the variable input list for generate the id\n * @param {string} outputVar the output variable name\n */\n\nWOQLQuery.prototype.idgen = function (prefix, inputVarList, outputVar) {\n if (this.cursor['@type']) this.wrapCursorWithAnd();\n this.cursor['@type'] = 'LexicalKey';\n this.cursor.base = this.cleanDataValue(prefix, 'xsd:string');\n // this.cursor['base'] = this.cleanObject(this.string(prefix))\n this.cursor.key_list = this.dataValueList(inputVarList);\n this.cursor.uri = this.cleanNodeValue(outputVar);\n return this;\n};\n\nWOQLQuery.prototype.idgenerator = WOQLQuery.prototype.idgen;\n\n/**\n * Changes a string to upper-case\n * @param {string|Var} inputVarName - string or variable representing the uncapitalized string\n * @param {string|Var} resultVarName - variable that stores the capitalized string output\n * @returns {WOQLQuery} A WOQLQuery which contains the Upper case pattern matching expression\n */\nWOQLQuery.prototype.upper = function (inputVarName, resultVarName) {\n if (this.cursor['@type']) this.wrapCursorWithAnd();\n this.cursor['@type'] = 'Upper';\n this.cursor.mixed = this.cleanDataValue(inputVarName);\n this.cursor.upper = this.cleanDataValue(resultVarName);\n return this;\n};\n\n/**\n * Changes a string to lower-case\n * @param {string|Var} inputVarName - string or variable representing the non-lowercased string\n * @param {string|Var} resultVarName - variable that stores the lowercased string output\n * @returns {WOQLQuery} A WOQLQuery which contains the Lower case pattern matching expression\n */\n\nWOQLQuery.prototype.lower = function (inputVarName, resultVarName) {\n if (this.cursor['@type']) this.wrapCursorWithAnd();\n this.cursor['@type'] = 'Lower';\n this.cursor.mixed = this.cleanDataValue(inputVarName);\n this.cursor.lower = this.cleanDataValue(resultVarName);\n return this;\n};\n\n/**\n * Pads out the string input to be exactly len long by appending the pad character pad to\n * form output\n * @param {string|Var} inputVarName - The input string or variable in unpadded state\n * @param {string|Var} pad - The characters to use to pad the string or a variable representing them\n * @param {number | string | Var} len - The variable or integer value representing the length of\n * the output string\n * @param {string|Var} resultVarName - stores output\n * @returns {WOQLQuery} A WOQLQuery which contains the Pad pattern matching expression\n */\n\nWOQLQuery.prototype.pad = function (inputVarName, pad, len, resultVarName) {\n if (this.cursor['@type']) this.wrapCursorWithAnd();\n this.cursor['@type'] = 'Pad';\n this.cursor.string = this.cleanDataValue(inputVarName);\n this.cursor.char = this.cleanDataValue(pad);\n this.cursor.times = this.cleanDataValue(len, 'xsd:integer');\n this.cursor.result = this.cleanDataValue(resultVarName);\n return this;\n};\n\n/**\n * Splits a string (Input) into a list strings (Output) by removing separator\n * @param {string|Var} inputVarName - A string or variable representing the unsplit string\n * @param {string|Var} separator - A string or variable containing a sequence of charatcters\n * to use as a separator\n * @param {string|Var} resultVarName - variable that stores output list\n * @returns {WOQLQuery} A WOQLQuery which contains the Split pattern matching expression\n */\n\nWOQLQuery.prototype.split = function (inputVarName, separator, resultVarName) {\n if (this.cursor['@type']) this.wrapCursorWithAnd();\n this.cursor['@type'] = 'Split';\n this.cursor.string = this.cleanDataValue(inputVarName);\n this.cursor.pattern = this.cleanDataValue(separator);\n this.cursor.list = this.cleanDataValue(resultVarName);\n return this;\n};\n\n/**\n * Matches if List includes Element\n * @param {string|object|Var} element - Either a variable, IRI or any simple datatype\n * @param {string|array|Var} list - List ([string, literal] or string*) Either a variable\n * representing a list or a list of variables or literals\n * @returns {WOQLQuery} A WOQLQuery which contains the List inclusion pattern matching expression\n */\nWOQLQuery.prototype.member = function (element, list) {\n if (this.cursor['@type']) this.wrapCursorWithAnd();\n this.cursor['@type'] = 'Member';\n this.cursor.member = this.cleanObject(element);\n this.cursor.list = this.valueList(list);\n return this;\n};\n\n/**\n * takes a variable number of string arguments and concatenates them into a single string\n * @param {array|string|Var} varList - a variable representing a list or a list of variables or\n * strings - variables can be embedded in the string if they do not contain spaces\n * @param {string|Var} resultVarName - A variable or string containing the output string\n * @returns {WOQLQuery} A WOQLQuery which contains the Concatenation pattern matching expression\n */\n\nWOQLQuery.prototype.concat = function (varList, resultVarName) {\n if (typeof varList === 'string') {\n const slist = varList.split(/(v:)/);\n const nlist = [];\n if (slist[0]) nlist.push(slist[0]);\n for (let i = 1; i < slist.length; i += 2) {\n if (slist[i]) {\n if (slist[i] === 'v:') {\n const slist2 = slist[i + 1].split(/([^\\w_])/);\n const x = slist2.shift();\n nlist.push(`v:${x}`);\n const rest = slist2.join('');\n if (rest) nlist.push(rest);\n }\n }\n }\n varList = nlist;\n }\n if (Array.isArray(varList)) {\n if (this.cursor['@type']) this.wrapCursorWithAnd();\n this.cursor['@type'] = 'Concatenate';\n this.cursor.list = this.cleanDataValue(varList, true);\n this.cursor.result = this.cleanDataValue(resultVarName);\n }\n return this;\n};\n\nWOQLQuery.prototype.concatenate = WOQLQuery.prototype.concat;\n\n/**\n * Joins a list variable together (Input) into a string variable (Output) by glueing the strings\n * together with Glue\n * @param {string|array|Var} varList - a variable representing a list or a list of strings\n * and / or variables\n * @param {string|Var} glue - A variable (v:glue) or (glue) string representing the characters\n * to put in between the joined strings in input\n * @param {string|Var} resultVarName - A variable or string containing the output string\n * @returns {WOQLQuery} A WOQLQuery which contains the Join pattern matching expression\n */\nWOQLQuery.prototype.join = function (varList, glue, resultVarName) {\n if (this.cursor['@type']) this.wrapCursorWithAnd();\n this.cursor['@type'] = 'Join';\n this.cursor.list = this.cleanDataValue(varList);\n this.cursor.separator = this.cleanDataValue(glue);\n this.cursor.result = this.cleanDataValue(resultVarName);\n return this;\n};\n\n/**\n * computes the sum of the List of values passed. In contrast to other arithmetic functions,\n * sum self-evaluates - it does not have to be passed to evaluate()\n * @param {WOQLQuery} subquery - a subquery or ([string or numeric]) - a list variable, or a\n * list of variables or numeric literals\n * @param {string|Var} total - the variable name with the sum result of the values in List\n * @returns {WOQLQuery} - A WOQLQuery which contains the Sum expression\n */\nWOQLQuery.prototype.sum = function (subquery, total) {\n if (this.cursor['@type']) this.wrapCursorWithAnd();\n this.cursor['@type'] = 'Sum';\n this.cursor.list = this.cleanDataValue(subquery);\n this.cursor.result = this.cleanObject(total);\n return this;\n};\n\n/**\n *\n * Specifies an offset position in the results to start listing results from\n * @param {number|string|Var} start - A variable that refers to an interger or an integer literal\n * @param {WOQLQuery} [subquery] - WOQL Query object, you can pass a subquery as an argument\n * or a chained query\n * @returns {WOQLQuery} A WOQLQuery whose results will be returned starting from\n * the specified offset\n */\n\nWOQLQuery.prototype.start = function (start, subquery) {\n // if (start && start === 'args') return ['start', 'query']\n if (this.cursor['@type']) this.wrapCursorWithAnd();\n this.cursor['@type'] = 'Start';\n this.cursor.start = start;\n return this.addSubQuery(subquery);\n};\n\n/**\n * Specifies a maximum number of results that will be returned from the subquery\n * @param {number|string} limit - A variable that refers to an non-negative integer or a\n * non-negative integer\n * @param {WOQLQuery} [subquery] - A subquery whose results will be limited\n * @returns {WOQLQuery} A WOQLQuery whose results will be returned starting from\n * the specified offset\n */\n\nWOQLQuery.prototype.limit = function (limit, subquery) {\n if (this.cursor['@type']) this.wrapCursorWithAnd();\n this.cursor['@type'] = 'Limit';\n this.cursor.limit = limit;\n return this.addSubQuery(subquery);\n};\n\n/**\n * Matches the regular expression defined in Patern against the Test string, to produce\n * the matched patterns in Matches\n * @param {string} pattern - string or variable using normal PCRE regular expression syntax with\n * the exception that special characters have to be escaped twice (to enable transport in JSONLD)\n * @param {string|Var} inputVarName - string or variable containing the string to be tested for\n * patterns with the regex\n * @param {string|array|object|Var} resultVarList - variable representing the list of matches\n * or a list of strings or variables\n * @returns {WOQLQuery} A WOQLQuery which contains the Regular Expression pattern\n * matching expression\n */\n\nWOQLQuery.prototype.re = function (pattern, inputVarName, resultVarList) {\n if (this.cursor['@type']) this.wrapCursorWithAnd();\n this.cursor['@type'] = 'Regexp';\n this.cursor.pattern = this.cleanDataValue(pattern);\n this.cursor.string = this.cleanDataValue(inputVarName);\n this.cursor.result = this.cleanDataValue(resultVarList);\n return this;\n};\n\nWOQLQuery.prototype.regexp = WOQLQuery.prototype.re;\n\n/**\n * Calculates the length of the list in va and stores it in vb\n * @param {string|array} inputVarList - Either a variable representing a list or a list of\n * variables or literals\n * @param {string|Var} resultVarName - A variable in which the length of the list is stored or\n * the length of the list as a non-negative integer\n * @returns {WOQLQuery} A WOQLQuery which contains the Length pattern matching expression\n */\nWOQLQuery.prototype.length = function (inputVarList, resultVarName) {\n if (this.cursor['@type']) this.wrapCursorWithAnd();\n this.cursor['@type'] = 'Length';\n this.cursor.list = this.cleanDataValue(inputVarList);\n if (typeof vb === 'number') {\n this.cursor.length = this.cleanObject(resultVarName, 'xsd:nonNegativeInteger');\n } else if (typeof vb === 'string') {\n this.cursor.length = this.varj(resultVarName);\n }\n return this;\n};\n\n/**\n *\n * Logical negation of the contained subquery - if the subquery matches, the query\n * will fail to match\n * @param {string | WOQLQuery} [subquery] - A subquery which will be negated\n * @returns {WOQLQuery} A WOQLQuery object containing the negated sub Query\n */\nWOQLQuery.prototype.not = function (subquery) {\n if (this.cursor['@type']) this.wrapCursorWithAnd();\n this.cursor['@type'] = 'Not';\n return this.addSubQuery(subquery);\n};\n\n/**\n * Results in one solution of the subqueries\n * @param {string| WOQLQuery } [subquery] - WOQL Query objects\n * @returns {WOQLQuery} A WOQLQuery object containing the once sub Query\n */\nWOQLQuery.prototype.once = function (subquery) {\n // if (query && query === 'args') return ['query']\n if (this.cursor['@type']) this.wrapCursorWithAnd();\n this.cursor['@type'] = 'Once';\n return this.addSubQuery(subquery);\n};\n\n/**\n * Runs the query without backtracking on side-effects\n * @param {string| WOQLQuery } [subquery] - WOQL Query objects\n * @returns {WOQLQuery} A WOQLQuery object containing the immediately sub Query\n */\nWOQLQuery.prototype.immediately = function (query) {\n if (this.cursor['@type']) this.wrapCursorWithAnd();\n this.cursor['@type'] = 'Immediately';\n return this.addSubQuery(query);\n};\n\n/**\n * Creates a count of the results of the query\n * @param {string|number|Var} countVarName - variable or integer count\n * @param {WOQLQuery} [subquery]\n * @returns {WOQLQuery} A WOQLQuery object containing the count sub Query\n */\nWOQLQuery.prototype.count = function (countVarName, subquery) {\n if (this.cursor['@type']) this.wrapCursorWithAnd();\n this.cursor['@type'] = 'Count';\n this.cursor.count = this.cleanObject(countVarName);\n return this.addSubQuery(subquery);\n};\n\n/**\n * Casts the value of Input to a new value of type Type and stores the result in CastVar\n * @param {string|number|object|Var} varName - Either a single variable or a\n * literal of any basic type\n * @param {string|Var} varType - Either a variable or a basic datatype (xsd / xdd)\n * @param {string|Var} resultVarName - save the return variable\n * @returns {WOQLQuery} A WOQLQuery which contains the casting expression\n */\n\nWOQLQuery.prototype.typecast = function (varName, varType, resultVarName) {\n if (this.cursor['@type']) this.wrapCursorWithAnd();\n this.cursor['@type'] = 'Typecast';\n this.cursor.value = this.cleanObject(varName);\n this.cursor.type = this.cleanNodeValue(varType);\n this.cursor.result = this.cleanObject(resultVarName);\n return this;\n};\n\nWOQLQuery.prototype.cast = WOQLQuery.prototype.typecast;\n\n/**\n * Orders the results of the contained subquery by a precedence list of variables\n * @param {...string|...Var|...array} orderedVarlist - A sequence of variables,\n * by which to order the results,\n * each optionally followed by either “asc” or “desc” to represent order as a list, by default\n * it will sort the variable in ascending order\n * @returns {WOQLQuery} A WOQLQuery which contains the ordering expression\n */\nWOQLQuery.prototype.order_by = function (...orderedVarlist) {\n // if (orderedVarlist && orderedVarlist[0] === 'args')\n // return ['variable_ordering', 'query']\n if (this.cursor['@type']) this.wrapCursorWithAnd();\n this.cursor['@type'] = 'OrderBy';\n this.cursor.ordering = [];\n\n if (!orderedVarlist || orderedVarlist.length === 0) {\n return this.parameterError(\n 'Order by must be passed at least one variables to order the query',\n );\n }\n const embedquery = typeof orderedVarlist[orderedVarlist.length - 1] === 'object'\n && orderedVarlist[orderedVarlist.length - 1].json\n ? orderedVarlist.pop()\n : false;\n\n for (let i = 0; i < orderedVarlist.length; i++) {\n let obj;\n if ((typeof orderedVarlist[i] === 'string' || orderedVarlist[i] instanceof Var) && orderedVarlist[i] !== '') {\n obj = {\n '@type': 'OrderTemplate',\n variable: this.rawVar(orderedVarlist[i]),\n order: 'asc',\n };\n } else if (orderedVarlist[i].length === 2 && orderedVarlist[i][1] === 'asc') {\n obj = {\n '@type': 'OrderTemplate',\n variable: this.rawVar(orderedVarlist[i][0]),\n order: 'asc',\n };\n } else if (orderedVarlist[i].length === 2 && orderedVarlist[i][1] === 'desc') {\n obj = {\n '@type': 'OrderTemplate',\n variable: this.rawVar(orderedVarlist[i][0]),\n order: 'desc',\n };\n }\n\n if (obj) this.cursor.ordering.push(obj);\n }\n return this.addSubQuery(embedquery);\n};\n\n/**\n *\n * Groups the results of the contained subquery on the basis of identical values for Groupvars,\n * extracts the patterns defined in PatternVars and stores the results in GroupedVar\n * @param {array|string|Var} gvarlist - Either a single variable or an array of variables\n * @param {array|string|Var} groupedvar - Either a single variable or an array of variables\n * @param {string|Var} output - output variable name\n * @param {WOQLQuery} [groupquery] - The query whose results will be grouped\n * @returns {WOQLQuery} A WOQLQuery which contains the grouping expression\n */\n\nWOQLQuery.prototype.group_by = function (gvarlist, groupedvar, output, groupquery) {\n // if (gvarlist && gvarlist === 'args')\n // return ['group_by', 'group_template', 'grouped', 'query']\n if (this.cursor['@type']) this.wrapCursorWithAnd();\n this.cursor['@type'] = 'GroupBy';\n this.cursor.group_by = [];\n\n if (typeof gvarlist === 'string' || gvarlist instanceof Var) gvarlist = [gvarlist];\n this.cursor.group_by = this.rawVarList(gvarlist);\n if (typeof groupedvar === 'string' || groupedvar instanceof Var) groupedvar = [groupedvar];\n this.cursor.template = this.rawVarList(groupedvar);\n this.cursor.grouped = this.varj(output);\n return this.addSubQuery(groupquery);\n};\n\n/**\n * A function that always matches, always returns true\n * @returns {WOQLQuery} A WOQLQuery object containing the true value that will match any pattern\n */\nWOQLQuery.prototype.true = function () {\n this.cursor['@type'] = 'True';\n return this;\n};\n\n/**\n * Performs a path regular expression match on the graph\n * @param {string|Var} subject - An IRI or variable that refers to an IRI representing the subject,\n * i.e. the starting point of the path\n * @param {string} pattern -(string) - A path regular expression describing a pattern through\n * multiple edges of the graph (see: https://terminusdb.com/docs/path-query-reference-guide)\n * @param {string|Var} object - An IRI or variable that refers to an IRI representing the object,\n * i.e. ending point of the path\n * @param {string|Var} [resultVarName] - A variable in which the actual paths\n * traversed will be stored\n * @returns {WOQLQuery} - A WOQLQuery which contains the path regular expression matching expression\n */\n\nWOQLQuery.prototype.path = function (subject, pattern, object, resultVarName) {\n if (this.cursor['@type']) this.wrapCursorWithAnd();\n this.cursor['@type'] = 'Path';\n this.cursor.subject = this.cleanSubject(subject);\n if (typeof pattern === 'string') pattern = this.compilePathPattern(pattern);\n this.cursor.pattern = pattern;\n this.cursor.object = this.cleanObject(object);\n if (typeof resultVarName !== 'undefined') {\n this.cursor.path = this.varj(resultVarName);\n }\n return this;\n};\n\n/**\n * Extract the value of a key in a bound document.\n * @param {string|Var} document - Document which is being accessed.\n * @param {string|Var} field - The field from which the document which is being accessed.\n * @param {string|Var} value - The value for the document and field.\n * @returns {WOQLQuery} A WOQLQuery which contains the a dot Statement\n */\n\nWOQLQuery.prototype.dot = function (document, field, value) {\n if (this.cursor['@type']) this.wrapCursorWithAnd();\n this.cursor['@type'] = 'Dot';\n this.cursor.document = this.expandValueVariable(document);\n this.cursor.field = this.cleanDataValue(field, 'xsd:string');\n this.cursor.value = this.expandValueVariable(value);\n return this;\n};\n\n/**\n * Calculates the size in bytes of the contents of the resource identified in ResourceID\n * @param {string|Var} resourceId - A valid resource identifier string (can refer to any graph /\n * branch / commit / db)\n * @param {string|Var} resultVarName - The variable name\n */\n\nWOQLQuery.prototype.size = function (resourceId, resultVarName) {\n if (this.cursor['@type']) this.wrapCursorWithAnd();\n this.cursor['@type'] = 'Size';\n this.cursor.resource = this.cleanGraph(resourceId);\n this.cursor.size = this.varj(resultVarName);\n return this;\n};\n\n/**\n *\n * Calculates the number of triples of the contents of the resource identified in ResourceID\n * @param {string|Var} resourceId - A valid resource identifier string (can refer to any graph /\n * branch / commit / db)\n * @param {string|number|Var} tripleCount - An integer literal with the size in bytes or a\n * variable containing that integer\n * @returns {WOQLQuery} A WOQLQuery which contains the size expression\n */\nWOQLQuery.prototype.triple_count = function (resourceId, TripleCount) {\n if (this.cursor['@type']) this.wrapCursorWithAnd();\n this.cursor['@type'] = 'TripleCount';\n this.cursor.resource = this.cleanGraph(resourceId);\n this.cursor.count = this.varj(TripleCount);\n return this;\n};\n\n/**\n * Returns true if 'elementId' is of type 'elementType', according to the current DB schema\n * @param {string|Var} elementId - the id of a schema graph element\n * @param {string|Var} elementType - the element type\n * @returns {WOQLQuery} A WOQLQuery object containing the type_of pattern matching rule\n */\n\nWOQLQuery.prototype.type_of = function (elementId, elementType) {\n if (!elementId || !elementType) return this.parameterError('type_of takes two parameters, both values');\n if (this.cursor['@type']) this.wrapCursorWithAnd();\n this.cursor['@type'] = 'TypeOf';\n this.cursor.value = this.cleanObject(elementId);\n this.cursor.type = this.cleanSubject(elementType);\n return this;\n};\n\nmodule.exports = WOQLQuery;\n","/**\n * @module TypeDef\n * @description Type definitions\n * */\n/* eslint-disable no-unused-vars */\nconst Utils = require('./utils');\n\nconst { ACTIONS } = Utils.ACTIONS;\n\n/**\n *@typedef {Object} DocParamsGet - the GET document interface query parameters\n *@property {object} [query] - object that descrive the document query\n *@property {GraphType} [graph_type] - instance|schema, default value is instance.\n *Used to switch between getting documents from the instance or the schema graph.\n *@property {string} [type] - only documents of the given type are returned.\n *@property {string} [id] - only the document with the given ID is returned.\n *@property {boolean} [prefixed] - default is true, return IRIs using a prefixed notation wherever\n *possible. If false, full IRIs are used.\n *@property {boolean} [minimized] - default is false, return the documents with very\n little whitespace. Each json document will be on its own line.\n *@property {boolean} [unfold] - default is false, any subdocuments contained in the returned\n document are returned too. If false, these are referred to by their ID instead.\n *@property {number} [skip] - default is 0, How many results to skip\n *@property {number} [count] count - How many results to return. If this option is absent, all\n results are returned.\n *@property {boolean} [as_list] default is false, If true, don't return a stream of json objects,\n but a json list.\n *@property {string} [graph_type] - instance|schema default value is instance\n */\n\n/**\n *@typedef {Object} DocParamsPost - the POST document interface query parameters\n *@property {boolean} [raw_json] - default is false, If true, the input documents\n are treated as raw JSON, inserted as type sys:JSONDocument and are not subject\n to schema restrictions.\n *@property {GraphType} [graph_type] - default is instance instance|schema Used to switch between\n getting documents from the instance or the schema graph.\n *@property {boolean} [full_replace] - default is false, If true, all existing documents are deleted\n before inserting the posted documents. This allows the full replacement of the contents of a\n database. This is especially useful for replacing the schema.\n */\n\n/**\n *@typedef {Object} DocParamsPut - the PUT document interface query parameters\n *@property {boolean} [raw_json] - default is false, If true, the input documents\n are treated as raw JSON, inserted as type sys:JSONDocument and are not subject\n to schema restrictions.\n *@property {boolean} [create] - If true, the function will create\n a new document if it doesn't exist.\n *@property {GraphType} [graph_type] - default is instance, instance|schema Used to switch between\n getting documents from the instance or the schema graph.\n */\n\n/**\n *@typedef {Object} DocParamsDelete - the DELETE document interface query parameters\n *@property {GraphType} [graph_type] - default is instance, instance|schema Used to switch between\n getting documents from the instance or the schema graph.\n *@property {string|array} id - a single id or a list of ids to delete.\n *@property {boolean} [nuke] - default is false, If true, delete everything at this resource\n location (dangerous!).\n */\n\n/**\n * @typedef {\"schema/main\" | \"instance/main\" | string} GraphRef\n */\n/**\n * @typedef {Object} DataFormatObj (export/import)\n * @property {\"csv\"|\"turtle\"} [type] the format type\n * @property {string} [format_header] header format type\n */\n\n/**\n * @typedef {\"add_quad\" | \"delete_quad\" | \"add_triple\" | \"delete_triple\" | \"quad\" |\n * \"triple\"} FuntionType\n */\n\n/**\n * @typedef {\"commits\"|\"meta\"|\"branch\"|\"ref\"|\"repo\"|\"db\"} ResourceType\n */\n\n/**\n *@typedef {\"instance\" | \"schema\" } GraphType\n */\n\n/**\n * @typedef {Object} CredentialObj\n * @property {'basic'|'jwt'|'apikey'} type - the authorization type of an TerminusDB connection\n * @property {string | boolean} [user] - the user id | I don't need the user with the jwt token\n * @property {string} key - the connection key\n */\n\n/**\n * @typedef {'graph'|'db'|'clone'|'triples'|'woql'|'fetch'|'pull'|'rebase'|'branch'|'reset'|\n * 'push'|'squash'} ActionType\n */\n\n/**\n * @typedef {Object} ParamsObj\n * @property {string} [key] - api key for basic auth\n * @property {string} [jwt] - jwt token to connect with terminusX server\n * @property {string} [user] - the user id, we use this for basic authentication and for\n * identify the commits author\n * @property {string} [organization] - set organization to this id\n * @property {string} [db] - set cursor to this db\n * @property {RepoType | string} [repo] - set cursor to this repo\n * @property {string} [branch] - set branch to this id\n * @property {string} [ref] - set commit ref\n * @property {string} [default_branch_id] - set the default branch id\n * @property {string} [token] - Api token to connect with TerminusX\n */\n\n/**\n * @typedef {Object} RolesObj\n * @property {string} agent_name - the Authorization connection's type\n * @property {string} [database_name] - the user id | I don't need the user with the jwt token\n * @property {string} [organization_name] - the connection key\n * @property {array} [actions] - list of roles\n * @property {string} [invitation] -\n */\n\n/**\n * @typedef {\"database\"|\"organization\"} ScopeType\n */\n\n/**\n * @typedef {\"local\"|\"remote\"} RepoType\n */\n// sharing is a boolean\n/**\n * @typedef {Object} DbDetails\n * @property {string} label - \"Textual DB Name\"\n * @property {string} [comment] - \"Text description of DB\"\n * @property {boolean} [public] -\n * @property {boolean} [schema] - if set to true, a schema graph will be created\n */\n\n/**\n * @typedef {Object} DbDoc\n * @property {string} id - \"Database ID\"\n * @property {string} [label] - \"Textual DB Name\"\n * @property {string} [comment] - \"Text description of DB\"\n * @property {string} [organization] - \"Organization to which the db belongs\"\n * @property {boolean} [public] -\n * @property {boolean} [schema] - if set to true, a schema graph will be created\n */\n\n/**\n *@typedef {Object} RemoteRepoDetails - {remote: \"origin\", \"remote_branch\": \"main\", \"author\":\n \"admin\",\"message\": \"message\"}\n *@property {string} [remote] - remote server url\n *@property {string} remote_branch - remote branch name\n *@property {string} [author] - if it is undefined it get the current author\n *@property {string} [message] - the update commit message\n *\n */\n\n/**\n * @typedef {Object} CloneSourceDetails\n * @property {string} remote_url - the remote db source url\n * @property {string} [label]\n * @property {string} [comment]\n */\n\n/**\n* @typedef {\"grant\" | \"revoke\"} CapabilityCommand - the manage capability command type\n*/\n\n/**\n * @typedef {ACTIONS[]} RolesActions - [ACTIONS.CREATE_DATABASE | ACTIONS.DELETE_DATABASE]\n */\n\n/**\n * @typedef {Object} DocHistoryParams\n * @property {number} [start] - Index to start from, 0 is the default\n * @property {number} [count] - Amount of commits to show, 10 is the default\n * @property {boolean} [updated] - Last updated time (excludes history) false is the default\n * @property {boolean} [created] - Created date of object (excludes history) false is the default\n */\n\n/**\n * @typedef {Object} DiffObject\n * @property {Object} [keep] - Index to start from, 0 is the default\n * @property {number} [count] - Last updated time (excludes history) false is the default\n * @property {number} [start] - Amount of commits to show, 10 is the default\n */\n\nmodule.exports = {};\n","/* eslint-disable no-undef */\n/* eslint-disable guard-for-in */\n/* eslint-disable no-plusplus */\n/* eslint-disable no-shadow */\n/* eslint-disable camelcase */\n/* eslint-disable no-restricted-syntax */\n/* eslint-disable no-param-reassign */\n/**\n * @file Terminus Client Utility Functions\n * @license Apache Version 2\n * Object for bunding up common Terminus Utility Functions\n */\nconst Utils = {};\n\nUtils.checkValidName = function (str) {\n if (typeof str !== 'string' || str.trim() === '') return false;\n return /^[a-zA-Z0-9_]*$/.test(str);\n};\n\nUtils.ACTIONS = {\n CREATE_DATABASE: 'create_database',\n DELETE_DATABASE: 'delete_database',\n SCHEMA_READ_ACCESS: 'schema_read_access',\n SCHEMA_WRITE_ACCESS: 'schema_write_access',\n INSTANCE_READ_ACCESS: 'instance_read_access',\n INSTANCE_WRITE_ACCESS: 'instance_write_access',\n COMMIT_READ_ACCESS: 'commit_read_access',\n COMMIT_WRITE_ACCESS: 'commit_write_access',\n META_READ_ACCESS: 'meta_read_access',\n META_WRITE_ACCESS: 'meta_write_access',\n CLASS_FRAME: 'class_frame',\n BRANCH: 'branch',\n CLONE: 'clone',\n FETCH: 'fetch',\n PUSH: 'push',\n REBASE: 'rebase',\n /* MANAGE_CAPABILITIES: 'manage_capabilities', */\n};\n\n// encodeURI() will not encode: ~!@#$&*()=:/,;?+\n// =%25team =%team\n// terminusDB do not encode =@ too\nUtils.encodeURISegment = function (str) {\n if (typeof str !== 'string') return str;\n str = encodeURI(str);\n str = str.replace(/\\?/g, '%3F');\n // we not need = because the server does not encode it\n // str = str.replace(/=/g, '%3D');\n // str = str.replace(/@/g, '%40');\n str = str.replace(/&/g, '%26');\n str = str.replace(/\\+/g, '%2B');\n str = str.replace(/#/g, '%23');\n return str;\n};\n\nUtils.decodeURISegment = function (str) {\n if (typeof str !== 'string') return str;\n str = str.replace(/%3F/g, '?');\n // str = str.replace(/%3D/g, '=');\n // str = str.replace(/%26/g, '&');\n str = str.replace(/%2B/g, '+');\n str = str.replace(/%23/g, '#');\n // str = str.replace(/%40/g, '@');\n str = decodeURI(str);\n return str;\n};\n\nUtils.removeDocType = function (str) {\n if (typeof str === 'string' && str.lastIndexOf('/') > -1) {\n return str.substr(str.lastIndexOf('/') + 1);\n }\n return str;\n};\n\n// %253D%25team\n\n/**\n * default set of prefixes that will be used for URL compression\n * @type {object}\n */\nUtils.standard_urls = {\n rdf: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',\n rdfs: 'http://www.w3.org/2000/01/rdf-schema#',\n xsd: 'http://www.w3.org/2001/XMLSchema#',\n xdd: 'http://terminusdb.com/schema/xdd#',\n owl: 'http://www.w3.org/2002/07/owl#',\n system: 'http://terminusdb.com/schema/system#',\n vio: 'http://terminusdb.com/schema/vio#',\n repo: 'http://terminusdb.com/schema/repository#',\n layer: 'http://terminusdb.com/schema/layer#',\n woql: 'http://terminusdb.com/schema/woql#',\n ref: 'http://terminusdb.com/schema/ref#',\n api: 'http://terminusdb.com/schema/api#',\n};\n\n/**\n * Encode document payload for GET\n * @param {string | object} payload\n * @returns {string}\n */\nUtils.URIEncodePayload = function (payload) {\n if (typeof payload === 'string') return encodeURIComponent(payload);\n const payloadArr = [];\n for (const key of Object.keys(payload)) {\n if (typeof payload[key] === 'object') {\n for (const keyElement of Object.keys(payload[key])) {\n const valueElement = payload[key][keyElement];\n payloadArr.push(\n `${encodeURIComponent(keyElement)}=${encodeURIComponent(valueElement)}`,\n );\n }\n } else {\n payloadArr.push(`${encodeURIComponent(key)}=${encodeURIComponent(payload[key])}`);\n }\n }\n return payloadArr.join('&');\n};\n\n/**\n * Adds an entry to the list of known standard URL prefixes\n * @param {string} prefix\n * @param {string} url\n */\nUtils.addURLPrefix = function (prefix, url) {\n this.standard_urls[prefix] = url;\n};\n\n/**\n * is the object empty?\n * returns true if the json object is empty\n * @param {object|array} [obj]\n * @returns {boolean}\n */\nUtils.empty = function (obj) {\n // null and undefined are \"empty\"\n if (!obj) return true;\n // Assume if it has a length property with a non-zero value\n // that that property is correct.\n if (obj.length > 0) return false;\n if (obj.length === 0) return true;\n // Otherwise, does it have any properties of its own?\n // Note that this doesn't handle\n // toString and valueOf enumeration bugs in IE < 9\n // for (const key in obj) {\n if (typeof obj === 'object') {\n for (const key of Object.keys(obj)) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) return false;\n }\n }\n return true;\n};\n\n/**\n * Generates a unique node id\n * @param {string} [base]\n * @returns {string}\n */\nUtils.genBNID = function (base) {\n base = base || '';\n const r = Math.random()\n .toString(36)\n .substring(7);\n const d = new Date();\n const bnid = `${base}${r}${d.getTime()}`;// `doc:${base}${r}${d.getTime()}`\n return bnid;\n};\n\n/**\n * Returns the shorthand version (compressed to prefix:id ) of a url or\n * false if there is none known for that URL\n * @param {object | string} link\n * @returns {string | boolean}\n */\n\nUtils.getShorthand = function (link) {\n // eslint-disable-next-line prefer-destructuring\n if (typeof link === 'object' && link.length) link = link[0];\n if (link && typeof link === 'string') {\n for (const pref of Object.keys(this.standard_urls)) {\n const full = this.standard_urls[pref];\n if (link.substring(0, full.length) === full) {\n const sh = `${pref}:${link.substring(full.length)}`;\n return sh;\n }\n }\n }\n return false;\n};\n\n/**\n * Compares 2 IRIs for equality by checking compressed and expanded versions of both sides\n * @param {string} ida\n * @param {string} idb\n * @returns {boolean}\n */\nUtils.compareIDs = function (ida, idb) {\n if (ida === idb) return true;\n if (this.unshorten(ida) === idb) return true;\n if (this.shorten(ida) === idb) return true;\n if (this.unshorten(ida) === this.unshorten(idb)) return true;\n return false;\n};\n\n/**\n * Shortens a URL to its compressed format - returns the full URL if not possible\n * @param {string} [url]\n * @param {string} [prefixes]\n * @returns {string | undefined}\n */\n// we don't have any more visualize prefix\n// terminusdb://layer/data/Layer_44ce76721ebe179fdf2c015b0d38eadfa49de3ba\n// eslint-disable-next-line no-unused-vars\nUtils.shorten = function (url, prefixes) {\n if (!url) return undefined;\n if (url.indexOf('#') !== -1) {\n const urlArr = url.split('#');\n return urlArr.pop();\n }\n if (url.indexOf('terminusdb://') !== -1) {\n const urlArr = url.split('/');\n return urlArr.pop();\n }\n return url;\n\n /* if (!url) return undefined\n if (typeof url === 'function') return undefined\n prefixes = prefixes || Utils.standard_urls\n for (const pref in prefixes) {\n if (prefixes[pref] === url.substring(0, prefixes[pref].length)) {\n return `${pref}:${url.substring(prefixes[pref].length)}`\n }\n }\n return url */\n};\n\n/**\n * Expands a URL to its full URL format - returns the passed string if not possible to expand\n * @param {string} [url]\n * @returns {string | undefined}\n */\nUtils.unshorten = function (url) {\n if (!url) return undefined;\n if (this.validURL(url)) return url;\n if (!url) return url;\n const bits = url.split(':');\n if (bits[1]) {\n if (this.standard_urls[bits[0]]) {\n return this.standard_urls[bits[0]] + bits[1];\n }\n }\n return url;\n};\n\n/**\n * shortens a jsonld document to its prefixed form\n * @param {array|object|string} jsonld\n * @param {string} [prefixes]\n * @returns {string|array|object}\n */\n\nUtils.json_shorten = function (jsonld, prefixes) {\n const shorten_json_val = (val, prefixes) => {\n if (Array.isArray(val)) {\n const nvals = [];\n for (let i = 0; i < val.length; i++) {\n nvals.push(shorten_json_val(val[i], prefixes));\n }\n return nvals;\n } if (typeof val === 'object') {\n return this.json_shorten(val, prefixes);\n } if (typeof val === 'string') {\n return this.shorten(val, prefixes);\n }\n return val;\n };\n prefixes = prefixes || jsonld['@context'];\n const nujson = {};\n for (const key in jsonld) {\n const nkey = key[0] === '@' ? key : this.shorten(key, prefixes);\n const nval = shorten_json_val(jsonld[key], prefixes);\n nujson[nkey] = nval;\n }\n return nujson;\n};\n\n/**\n * Unshortens a jsonld document to its full form\n * @param {array|object|string} jsonld\n * @param {string} [prefixes]\n * @returns {string|array|object}\n */\n\nUtils.json_unshorten = function (jsonld, prefixes) {\n const unshorten_json_val = (val, prefixes) => {\n if (Array.isArray(val)) {\n const nvals = [];\n for (let i = 0; i < val.length; i++) {\n nvals.push(unshorten_json_val(val[i], prefixes));\n }\n return nvals;\n } if (typeof val === 'object') {\n return this.json_unshorten(val, prefixes);\n } if (typeof val === 'string') {\n return this.unshorten(val, prefixes);\n }\n return val;\n };\n prefixes = prefixes || jsonld['@context'];\n const nujson = {};\n for (const key in jsonld) {\n const nkey = key[0] === '@' ? key : this.unshorten(key, prefixes);\n const nval = unshorten_json_val(jsonld[key], prefixes);\n nujson[nkey] = nval;\n }\n return nujson;\n};\n\n/**\n * Tests a string to see if it is a valid URL -\n * Valid URLs are those that start with http:// or https://\n */\nUtils.validURL = function (str) {\n if (str && typeof str !== 'string') str = `${str}`;\n if (str && (str.substring(0, 7) === 'http://' || str.substring(0, 8) === 'https://')) return true;\n return false;\n};\n\n/**\n * Tests a string to see if it is a valid URL -\n * Valid URLs are those that start with http:// or https://\n * @param {string} str\n * @param {string | object} [context]\n * @param {boolean} [allow_shorthand]\n * @returns {boolean}\n */\nUtils.isIRI = function (str, context, allow_shorthand) {\n if (!str) return false;\n if (allow_shorthand && context && context[str.split(':')[0]]) return true;\n if (context) {\n for (pref in context) {\n if (str.substring(0, context[pref].length) === context[pref]) return true;\n }\n }\n const prot = str.split(':')[0];\n const valids = ['http', 'https', 'terminusdb'];\n if (valids.indexOf(prot) !== -1) return true;\n return false;\n};\n\n/**\n * Generates a text label from a URL\n * @param {string} url\n * @returns {string}\n */\nUtils.labelFromURL = function (url) {\n let nurl = this.urlFragment(url);\n nurl = nurl || url;\n if (nurl.lastIndexOf('/') < nurl.length - 1) {\n nurl = nurl.substring(nurl.lastIndexOf('/') + 1);\n }\n nurl = nurl.replace(/_/g, ' ');\n return nurl.charAt(0).toUpperCase() + nurl.slice(1);\n};\n\n/**\n * Generates a text label from a URL\n */\nUtils.labelFromVariable = function (v) {\n v = v.replace(/_/g, ' ');\n return v.charAt(0).toUpperCase() + v.slice(1);\n};\n\n/**\n * returns the fragment part of a URL (whether compressed or not)\n */\nUtils.urlFragment = function (url) {\n url = typeof url !== 'string' ? window.location.href : url;\n let bits = url.split('#');\n if (bits.length <= 1) {\n if (!this.validURL(url)) {\n bits = url.split(':');\n }\n }\n if (bits.length >= 1) {\n const [, urlStr] = bits;\n\n if (urlStr) {\n const [baseUrl] = urlStr.split('?');\n url = baseUrl;\n }\n }\n return url;\n};\n\n/**\n * returns the last part of a URL after the last /\n */\nUtils.lastURLBit = function (url) {\n url = typeof url === 'undefined' ? window.location.href : url;\n const [urlFirst] = url.split('#');\n const [urlTmp] = urlFirst.split('?');\n url = urlTmp.substring(url.lastIndexOf('/') + 1);\n return url;\n};\n\n/**\n * returns the a standard URL associated with a given prefix and extension\n */\nUtils.getStdURL = function (pref, ext, url) {\n if (this.standard_urls[pref]) {\n if (url) {\n if (url === this.standard_urls[pref] + ext) return url;\n } else {\n return this.standard_urls[pref] + ext;\n }\n }\n return false;\n};\n\n/*\n * Utility function adds v: to variables...\n */\nUtils.addNamespacesToVariables = function (vars) {\n const nvars = [];\n for (let i = 0; i < vars.length; i++) {\n if (vars[i]) nvars.push(this.addNamespaceToVariable(vars[i]));\n }\n return nvars;\n};\n\nUtils.addNamespaceToVariable = function (v) {\n if (typeof v === 'string' && v.substring(0, 2) !== 'v:') return `v:${v}`;\n return v;\n};\n\n/*\n * Utility function removes v: prefix from a variable...\n */\nUtils.removeNamespaceFromVariable = function (mvar) {\n if (mvar.substring(0, 2) === 'v:') return mvar.substring(2);\n return mvar;\n};\n\n/*\n * Utility function removes v: prefix from an array of variables\n */\nUtils.removeNamespacesFromVariables = function (vars) {\n const nvars = [];\n for (let i = 0; i < vars.length; i++) {\n nvars.push(this.removeNamespaceFromVariable(vars[i]));\n }\n return nvars;\n};\n\n/*\n * Utility function to extract a value from a config rule - if the value is a variable,\ntake the value of that variable instead\n */\nUtils.getConfigValue = function (val, row) {\n if (typeof val === 'string') val = this.removeNamespaceFromVariable(val);\n if (typeof val === 'string' && row[val]) {\n const rad = row[val];\n if (rad && rad['@value']) return rad['@value'];\n return rad;\n }\n return val;\n};\n\n/**\n * TypeHelper bundles together utility functions dealing with datatypes\n */\nUtils.TypeHelper = {};\n\n/**\n * Returns true if the passed type is an xsd:string (compressed or not)\n */\nUtils.TypeHelper.isStringType = function (stype) {\n if (stype === 'http://www.w3.org/2001/XMLSchema#string') return true;\n if (stype === 'xsd:string') return true;\n return false;\n};\n\nUtils.TypeHelper.isDatatype = function (stype) {\n const sh = Utils.shorten(stype);\n if ((sh && sh.substring(0, 4) === 'xsd:') || sh.substring(0, 4) === 'xdd:') return true;\n return false;\n};\n\n/**\n * Adds 3 order magnitude separators ( default ,) into big numbers for legibility\n */\nUtils.TypeHelper.numberWithCommas = function (value, separator) {\n separator = separator || ',';\n if (value >= 1000 || value <= -1000) {\n const parts = value.toString().split('.');\n if (value <= -1000) parts[0] = parts[0].substring(1);\n parts[0] = parts[0].replace(/\\B(?=(\\d{3})+(?!\\d))/g, separator);\n if (value <= -1000) value = `-${parts.join('.')}`;\n else value = parts.join('.');\n }\n return value;\n};\n\nUtils.TypeHelper.formatBytes = function (bytes, decimals = 2) {\n if (bytes === 0) return '0 Bytes';\n const k = 1024;\n const dm = decimals < 0 ? 0 : decimals;\n const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];\n const i = Math.floor(Math.log(bytes) / Math.log(k));\n return `${parseFloat((bytes / k ** i).toFixed(dm))} ${sizes[i]}`;\n};\n\n/**\n * List of supported datatypes\n */\nUtils.TypeHelper.datatypes = [\n 'xdd:coordinate',\n 'xdd:coordinatePolyline',\n 'xdd:coordinatePolygon',\n 'xdd:dateRange',\n 'xdd:gYearRange',\n 'xdd:integerRange',\n 'xdd:decimalRange',\n 'xdd:cc',\n 'xdd:email',\n 'xdd:html',\n 'xdd:url',\n 'xsd:anySimpleType',\n 'xsd:string',\n 'xsd:boolean',\n 'xsd:decimal',\n 'xsd:double',\n 'xsd:float',\n 'xsd:time',\n 'xsd:date',\n 'xsd:dateTime',\n 'xsd:dateTimeStamp',\n 'xsd:gYear',\n 'xsd:gMonth',\n 'xsd:gDay',\n 'xsd:gYearMonth',\n 'xsd:gMonthDay',\n 'xsd:duration',\n 'xsd:yearMonthDuration',\n 'xsd:dayTimeDuration',\n 'xsd:byte',\n 'xsd:short',\n 'xsd:integer',\n 'xsd:long',\n 'xsd:unsignedByte',\n 'xsd:unsignedInt',\n 'xsd:unsignedLong',\n 'xsd:nonNegativeInteger',\n 'xsd:positiveInteger',\n 'xsd:negativeInteger',\n 'xsd:nonPositiveInteger',\n 'xsd:base64Binary',\n 'xsd:anyURI',\n 'xsd:language',\n 'xsd:normalizedString',\n 'xsd:token',\n 'xsd:NMTOKEN',\n 'xsd:Name',\n 'xsd:NCName',\n 'xsd:NOTATION',\n 'xsd:QName',\n 'xsd:ID',\n 'xsd:IDREF',\n 'xsd:ENTITY',\n 'rdf:XMLLiteral',\n 'rdf:PlainLiteral',\n 'rdfs:Literal',\n 'xdd:json',\n];\n\nUtils.TypeHelper.parseRangeValue = function (val, dividor) {\n dividor = dividor || ',';\n let vals = [];\n if (typeof val === 'object' && val.length) {\n vals = val;\n } else if (val) {\n if (typeof val !== 'string') {\n val = `${val}`;\n }\n if (val.length && val.charAt(0) === '[' && val.charAt(val.length - 1) === ']') {\n vals.push(val.substring(1, val.indexOf(dividor)));\n vals.push(val.substring(val.indexOf(dividor) + 1, val.length - 1));\n } else {\n vals.push(val);\n }\n }\n return vals;\n};\n\n/**\n * DateHelper bundles together utility functions dealing with xsd date types\n */\nUtils.DateHelper = {};\n\n/**\n * Takes an xsd time string and returns a structure {hour: HH, minute: MM,\n * second ss.ssssss, timezone: tz}\n */\nUtils.DateHelper.parseXsdTime = function (val) {\n if (!val) return {};\n const tz = this.extractXsdTimezone(val);\n if (tz) {\n val = val.substring(0, val.length - tz.length);\n }\n const parsed = {\n hour: val.substring(0, 2),\n minute: val.substring(3, 5),\n second: val.substring(6),\n timezone: tz,\n };\n return parsed;\n};\n\n/**\n * Takes an xsd time string and returns a structure {year: [-]YYYY, month: MM, day: dd}\n */\nUtils.DateHelper.parseXsdDate = function (val) {\n const tz = this.extractXsdTimezone(val);\n if (tz) {\n val = val.substring(0, val.length - tz.length);\n }\n let year;\n if (val.substring(0, 1) === '-') {\n year = val.substring(0, 5);\n } else {\n year = val.substring(0, 4);\n }\n let parsed;\n if (year && Math.abs(year) < 10000) {\n let month = val.substring(year.length + 1, year.length + 3);\n if (month) {\n month = parseInt(month, 10);\n } else return false;\n let day = val.substring(year.length + 4);\n if (day) day = parseInt(day, 10);\n else return false;\n parsed = {\n year,\n month,\n day,\n timezone: tz,\n };\n }\n return parsed;\n};\n\n/**\n * Parses a date string of type ty\n */\nUtils.DateHelper.parseDate = function (ty, value) {\n let parsed;\n if (ty === 'xsd:date') {\n parsed = this.parseXsdDate(value);\n } else if (ty === 'xsd:time') {\n parsed = this.parseXsdTime(value);\n } else if (ty === 'xsd:dateTime') {\n parsed = this.parseXsdDateTime(value);\n } else if (ty === 'xsd:gYear') {\n parsed = { year: value };\n } else if (ty === 'xsd:gYearRange') {\n parsed = { year: value };\n } else if (ty === 'xsd:gMonth') {\n parsed = { month: value.substring(2) };\n } else if (ty === 'xsd:gDay') {\n parsed = { day: value };\n } else if (ty === 'xsd:gYearMonth') {\n const bits = value.split('-');\n while (bits.length < 2) bits.push('');\n parsed = { year: bits[0], month: bits[1] };\n } else if (ty === 'xsd:gMonthDay') {\n const bits = value.split('-');\n while (bits.length < 2) bits.push('');\n parsed = { month: bits[0], day: bits[1] };\n } else if (ty === 'xsd:dateTimeStamp') {\n parsed = this.parseXsdDateTime(value);\n }\n return parsed;\n};\n\n/**\n * adds appropriate padding to date type for xsd rules\n */\nUtils.DateHelper.addXsdPadding = function (parsed) {\n const nparsed = {};\n if (typeof parsed.year !== 'undefined' && parsed.year !== false && parsed.year < 1000) {\n if (Math.abs(parsed.year) < 10) nparsed.year = parsed.year < 0 ? `-000${Math.abs(parsed.year)}` : `000${parsed.year}`;\n else if (Math.abs(parsed.year) < 100) nparsed.year = parsed.year < 0 ? `-00${Math.abs(parsed.year)}` : `00${parsed.year}`;\n else nparsed.year = parsed.year < 0 ? `-0${Math.abs(parsed.year)}` : `0${parsed.year}`;\n } else if (parsed.year) {\n nparsed.year = parsed.year;\n }\n if (typeof parsed.month !== 'undefined' && parsed.month !== false && parsed.month < 10) {\n nparsed.month = `0${parsed.month}`;\n } else if (parsed.month) {\n nparsed.month = parsed.month;\n }\n if (typeof parsed.day !== 'undefined' && parsed.day !== false && parsed.day < 10) {\n nparsed.day = `0${parsed.day}`;\n } else if (parsed.day) {\n nparsed.day = parsed.day;\n }\n if (typeof parsed.hour !== 'undefined' && parsed.hour !== false && parsed.hour < 10) {\n nparsed.hour = `0${parsed.hour}`;\n } else if (parsed.hour) {\n nparsed.hour = parsed.hour;\n }\n if (typeof parsed.minute !== 'undefined' && parsed.minute !== false && parsed.minute < 10) {\n nparsed.minute = `0${parsed.minute}`;\n } else if (parsed.minute) {\n nparsed.minute = parsed.minute;\n }\n if (typeof parsed.second !== 'undefined' && parsed.second !== false && parsed.second < 10) {\n nparsed.second = `0${parsed.second}`;\n } else if (parsed.second) {\n nparsed.second = parsed.second;\n }\n return nparsed;\n};\n\n/**\n * generates an xsd string of type ty for the passed parsed structure (year, month, day, hour,\n * minute, second, timezone)\n */\nUtils.DateHelper.xsdFromParsed = function (parsed, ty) {\n const xparsed = this.addXsdPadding(parsed);\n let ret;\n if (ty === 'xsd:gYear') {\n ret = xparsed.year ? xparsed.year : false;\n } else if (ty === 'xsd:time') {\n return xparsed.hour && xparsed.minute && xparsed.second\n ? `${xparsed.hour}:${xparsed.minute}:${xparsed.second}`\n : false;\n } else if (ty === 'xsd:date') {\n return xparsed.year && xparsed.month && xparsed.day\n ? `${xparsed.year}-${xparsed.month}-${xparsed.day}`\n : false;\n } else if (ty === 'xsd:dateTime' || ty === 'xsd:dateTimeStamp') {\n ret = xparsed.year && xparsed.month && xparsed.day\n ? `${xparsed.year}-${xparsed.month}-${xparsed.day}T`\n : false;\n if (ret) {\n ret += `${xparsed.hour ? xparsed.hour : '12'}:${\n xparsed.minute ? xparsed.minute : '00'\n }:${xparsed.second ? xparsed.second : '00'}`;\n }\n } else if (ty === 'xsd:gMonth') {\n ret = xparsed.month ? `--${xparsed.month}` : false;\n } else if (ty === 'xsd:gDay') {\n ret = xparsed.day ? `---${xparsed.day}` : false;\n } else if (ty === 'xsd:gYearMonth') {\n ret = xparsed.year && xparsed.month ? `${xparsed.year}-${xparsed.month}` : false;\n } else if (ty === 'xsd:gMonthDay') {\n ret = xparsed.day && xparsed.month ? `--${xparsed.month}-${xparsed.day}` : false;\n }\n if (xparsed.timezone) {\n ret += xparsed.timezone;\n }\n return ret;\n};\n\n/**\n * Converts between a unix timestamp and a parsed structure\n */\nUtils.DateHelper.convertTimestampToXsd = function (val) {\n const a = new Date(val * 1000);\n const parsed = {\n year: a.getFullYear(),\n month: a.getMonth() + 1,\n day: a.getDate(),\n hour: a.getHours(),\n minute: a.getMinutes(),\n second: a.getSeconds(),\n };\n return parsed;\n};\n\n/**\n * Parses an xsd date time into a structure\n */\nUtils.DateHelper.parseXsdDateTime = function (val) {\n if (!val) return {};\n if (typeof val === 'number') {\n return this.convertTimestampToXsd(val);\n }\n const tz = this.extractXsdTimezone(val);\n if (tz) {\n val = val.substring(0, val.length - tz.length);\n }\n const datetime = this.parseXsdDate(val);\n const ptime = this.parseXsdTime(val.substring(val.indexOf('T') + 1));\n\n for (const i of Object.keys(ptime)) {\n datetime[i] = ptime[i];\n }\n datetime.timezone = tz;\n return datetime;\n};\n\n/**\n * Extracts the timezone data from an xsd date string\n */\nUtils.DateHelper.extractXsdTimezone = function (val) {\n if (typeof val === 'string' && val.endsWith('Z')) {\n return 'Z';\n }\n if (typeof val === 'string' && (val.charAt(val.length - 6) === '+' || val.charAt(val.length - 6) === '-')) {\n val.substring(val.length - 6);\n }\n return false;\n};\n\nmodule.exports = Utils;\n","/* eslint-disable no-underscore-dangle */\n/* eslint-disable no-use-before-define */\n/// /@ts-check\nconst Config = require('./viewConfig');\n// eslint-disable-next-line no-unused-vars\nconst WOQLChart = require('./woqlChart');\n\nfunction WOQLChartConfig() {\n Config.ViewConfig.call(this);\n this.type = 'chart';\n}\n\nObject.setPrototypeOf(WOQLChartConfig.prototype, Config.ViewConfig.prototype);\n\nWOQLChartConfig.prototype.prettyPrint = function () {\n let str = 'view = View.chart();\\n';\n // eslint-disable-next-line no-plusplus\n for (let i = 0; i < this.rules.length; i++) {\n str += `view.${this.rules[i].prettyPrint()}\\n`;\n }\n if (typeof this.margin() !== 'undefined') {\n str += `view.margin(${this.margin()})\\n`;\n }\n if (typeof this.title() !== 'undefined') {\n str += `view.title('${this.title()}')\\n`;\n }\n if (typeof this.description() !== 'undefined') {\n str += `view.description('${this.description()}')\\n`;\n }\n if (typeof this.layout() !== 'undefined') {\n str += `view.layout('${this.layout()}')\\n`;\n }\n if (typeof this.align() !== 'undefined') {\n str += `view.align('${this.align()}')\\n`;\n }\n\n str += this.getBasicPrettyPrint();\n return str;\n};\n\nWOQLChartConfig.prototype.json = function () {\n /*\n *general properties\n */\n const conf = {};\n if (typeof this.margin() !== 'undefined') {\n conf.margin = this.margin();\n }\n if (typeof this.title() !== 'undefined') {\n conf.title = this.title();\n }\n if (typeof this.description() !== 'undefined') {\n conf.description = this.description();\n }\n if (typeof this.layout() !== 'undefined') {\n conf.layout = this.layout();\n }\n if (typeof this.align() !== 'undefined') {\n conf.align = this.align();\n }\n\n const mj = { chart: conf, rules: this.getRulesJSON() };\n return mj;\n};\n\nWOQLChartConfig.prototype.loadJSON = function (config, rules) {\n this.loadBasicJSON(config);\n const jr = [];\n // eslint-disable-next-line no-plusplus\n for (let i = 0; i < rules.length; i++) {\n const nr = new WOQLChartRule();\n nr.json(rules[i]);\n jr.push(nr);\n }\n this.rules = jr;\n if (typeof config.margin !== 'undefined') {\n this.margin(config.margin);\n }\n if (typeof config.title !== 'undefined') {\n this.title(config.title);\n }\n if (typeof config.description !== 'undefined') {\n this.description(config.description);\n }\n if (typeof config.layout !== 'undefined') {\n this.layout(config.layout);\n }\n if (typeof config.align !== 'undefined') {\n this.align(config.align);\n }\n};\n\nWOQLChartConfig.prototype.title = function (title) {\n if (typeof title === 'undefined') {\n return this._title;\n }\n this._title = title;\n return this;\n};\n\nWOQLChartConfig.prototype.description = function (description) {\n if (description) {\n this._description = description;\n return this;\n }\n return this._description;\n};\n\n// legend layout \"vertical\" | \"horizontal\"\nWOQLChartConfig.prototype.layout = function (layout) {\n if (layout) {\n this._layout = layout;\n return this;\n }\n return this._layout;\n};\n// legend align'left', 'center', 'right'\nWOQLChartConfig.prototype.align = function (align) {\n if (align) {\n this._align = align;\n return this;\n }\n return this._align;\n};\n// default is { top: 10, right: 30, left: 0, bottom: 80 }\nWOQLChartConfig.prototype.margin = function (marginObj) {\n if (marginObj) {\n this._margin = marginObj;\n return this;\n }\n\n return this._margin;\n};\n\nWOQLChartConfig.prototype.create = function (client) {\n const wqt = new WOQLChartConfig(client, this);\n return wqt;\n};\n\n/*\n{\"XAxis\":{dataKey:\"date_i\",type:'number'}\n ,\"chartObj\":\n [{'label':'Confident','dataKey':'conf',\"chartType\":\"Area\",\n \"style\":{\"stroke\":\"#82ca9d\", \"fillOpacity\":1, \"fill\":\"#82ca9d\"}},\n {'label':'Predictions','dataKey':'predictions',\"chartType\":\"Line\",\n \"style\":{\"strokeWidth\":2, \"stroke\":\"#ff8000\"}},\n {'label':'Picks','dataKey':'picks',\"chartType\":\"Point\",\"style\":\n {\"stroke\": '#8884d8', \"fill\": '#8884d8'}},\n {'label':'Stock','dataKey':'stock',\"chartType\":\"Line\",\"style\":\n {\"stroke\": '#0000ff', \"fill\": '#0000ff'}}]}\n\n{\"XAxis\":{dataKey:\"v:Date\",\"label\":{rotate:\"-50\"}},\"chartObj\":\n [{'dot':true, 'label':'Quantity','dataKey':'v:Quantity',\"chartType\":\"Line\",\n \"style\": {\"stroke\": '#FF9800', \"fill\": '#FF9800'}}]\n }\n*/\n\nWOQLChartConfig.prototype.xAxis = function (...vars) {\n const woqlRule = new WOQLChartRule().scope('XAxis');\n woqlRule.setVariables(vars);\n this.rules.push(woqlRule);\n return woqlRule;\n};\n\nWOQLChartConfig.prototype.legend = function (...vars) {\n const woqlRule = new WOQLChartRule().scope('Legend');\n woqlRule.setVariables(vars);\n this.rules.push(woqlRule);\n return woqlRule;\n};\n\nWOQLChartConfig.prototype.yAxis = function (...vars) {\n const woqlRule = new WOQLChartRule().scope('YAxis');\n woqlRule.setVariables(vars);\n this.rules.push(woqlRule);\n return woqlRule;\n};\n\nWOQLChartConfig.prototype.bar = function (...vars) {\n const woqlRule = new WOQLChartRule().scope('Bar');\n woqlRule.setVariables(vars);\n this.rules.push(woqlRule);\n return woqlRule;\n};\n\nWOQLChartConfig.prototype.line = function (...vars) {\n const woqlRule = new WOQLChartRule().scope('Line');\n woqlRule.setVariables(vars);\n this.rules.push(woqlRule);\n return woqlRule;\n};\n\nWOQLChartConfig.prototype.point = function (...vars) {\n const woqlRule = new WOQLChartRule().scope('Point');\n woqlRule.setVariables(vars);\n this.rules.push(woqlRule);\n return woqlRule;\n};\n\nWOQLChartConfig.prototype.area = function (...vars) {\n const woqlRule = new WOQLChartRule().scope('Area');\n woqlRule.setVariables(vars);\n this.rules.push(woqlRule);\n return woqlRule;\n};\n\n// fillOpacity\n/**\n *\n * @param {Chart} scope\n */\nfunction WOQLChartRule() {\n Config.WOQLViewRule.call(this);\n}\n\nObject.setPrototypeOf(WOQLChartRule.prototype, Config.WOQLViewRule.prototype);\n\nWOQLChartRule.prototype.style = function (key, value) {\n if (value) {\n this.rule[key] = value;\n return this;\n }\n return this.rule[key];\n};\n\nWOQLChartRule.prototype.label = function (label) {\n if (label) {\n this.rule.label = label;\n return this;\n }\n return this.rule.label;\n};\n\n/*\n *line is the default value\n * 'line' | 'square' | 'rect'| 'circle' | 'cross' | 'diamond' | 'square' | 'star' |\n * 'triangle' | 'wye' | 'none'\n */\n\nWOQLChartRule.prototype.legendType = function (legendType) {\n if (legendType) {\n this.rule.legendType = legendType;\n return this;\n }\n return this.rule.legendType;\n};\n\nWOQLChartRule.prototype.fillOpacity = function (fillOpacity) {\n if (fillOpacity || fillOpacity === 0) {\n this.rule.fillOpacity = fillOpacity;\n return this;\n }\n return this.rule.fillOpacity;\n};\n\nWOQLChartRule.prototype.fill = function (color) {\n if (color) {\n this.rule.fill = color;\n return this;\n }\n return this.rule.fill;\n};\n\nWOQLChartRule.prototype.stroke = function (color) {\n if (color) {\n this.rule.stroke = color;\n return this;\n }\n return this.rule.stroke;\n};\n\nWOQLChartRule.prototype.strokeWidth = function (size) {\n if (typeof size !== 'undefined') {\n this.rule.strokeWidth = size;\n return this;\n }\n return this.rule.strokeWidth;\n};\n\nWOQLChartRule.prototype.dot = function (isVisible) {\n if (typeof isVisible !== 'undefined') {\n this.rule.dot = isVisible;\n return this;\n }\n return this.rule.dot;\n};\n\nWOQLChartRule.prototype.labelRotate = function (angle) {\n if (angle !== undefined) {\n this.rule.labelRotate = angle;\n return this;\n }\n return this.rule.labelRotate;\n};\n\n// Specify the padding of x-axis. DEFAULT: { left: 0, right: 0 }\nWOQLChartRule.prototype.padding = function (paddingObj) {\n if (paddingObj) {\n this.rule.padding = paddingObj;\n return this;\n }\n\n return this.rule.padding;\n};\n\n/*\n *\n */\n\nWOQLChartRule.prototype.labelDateInput = function (labelDateInput) {\n if (labelDateInput) {\n this.rule.labelDateInput = labelDateInput;\n return this;\n }\n return this.rule.labelDateInput;\n};\n\n/*\n * output date example 'YYYY-MM-DD' : 2020:03:11 or ''YYYY [text] YYYY', 2020 mytext 2020'\n */\n\nWOQLChartRule.prototype.labelDateOutput = function (labelDateOutput) {\n if (labelDateOutput) {\n this.rule.labelDateOutput = labelDateOutput;\n return this;\n }\n return this.rule.labelDateOutput;\n};\n\nWOQLChartRule.prototype.stackId = function (stackId) {\n if (stackId) {\n this.rule.stackId = stackId;\n return this;\n }\n return this.rule.stackId;\n};\n\n/*\n * The type of xAxis 'number' | 'category' default is 'category'\n * The type of yAxis 'number' | 'category' default is 'number'\n * The type of line chart 'basis'|'basisClosed'|'basisOpen'|'linear'|'linearClosed'|'natural'|\n * 'monotoneX'|'monotoneY'|'monotone' | 'step' | 'stepBefore' | 'stepAfter' |\n */\n\nWOQLChartRule.prototype.type = function (type) {\n if (type) {\n this.rule.type = type;\n return this;\n }\n return this.rule.type;\n};\n/*\n * works only if type is number\n * domainArr =[min,max];\n */\nWOQLChartRule.prototype.axisDomain = function (domainArr) {\n if (domainArr) {\n this.rule.domain = domainArr;\n return this;\n }\n return this.rule.domain;\n};\n\n/*\n *\n * @param {string} name of the variable for the custom color\n */\n\nWOQLChartRule.prototype.colorEntry = function (propValue) {\n if (propValue) {\n this.rule.colorEntry = propValue;\n return this;\n }\n return this.rule.colorEntry;\n};\n\n/*\n *\n * @param {object} an object of possible value and color {\"value1\":\"#ff0000\"...}\n */\n\nWOQLChartRule.prototype.customColors = function (colorsObj) {\n if (colorsObj) {\n this.rule.customColors = colorsObj;\n return this;\n }\n return this.rule.customColors;\n};\n\n/*\n * @param {array} payload array of the object for descrive the legend\n [{value:\"legend label\",color:\"#ff0000\",type:\"rect\",\"id\":'element id'}]\n */\n\nWOQLChartRule.prototype.payload = function (payloadArr) {\n if (payloadArr) {\n this.rule.payload = payloadArr;\n return this;\n }\n return this.rule.payload;\n};\n\nWOQLChartRule.prototype.barSize = function (barSize) {\n if (barSize) {\n this.rule.barSize = barSize;\n return this;\n }\n return this.rule.barSize;\n};\n\nmodule.exports = WOQLChartConfig;\n","/* eslint-disable no-param-reassign */\n/* eslint-disable no-use-before-define */\nconst Config = require('./viewConfig');\nconst WOQLChooser = require('./woqlChooser');\nconst UTILS = require('../utils');\n\nfunction WOQLChooserConfig() {\n Config.ViewConfig.call(this);\n this.type = 'chooser';\n}\n\nObject.setPrototypeOf(WOQLChooserConfig.prototype, Config.ViewConfig.prototype);\n\nWOQLChooserConfig.prototype.create = function (client) {\n const wqt = new WOQLChooser(client, this);\n return wqt;\n};\n\nWOQLChooserConfig.prototype.prettyPrint = function () {\n let str = 'view = View.chooser();\\n';\n str += this.getBasicPrettyPrint();\n if (typeof this.change() !== 'undefined') {\n str += `view.change(${this.change()})\\n`;\n }\n if (typeof this.show_empty() !== 'undefined') {\n str += `view.show_empty('${this.show_empty()}')\\n`;\n }\n if (typeof this.values() !== 'undefined') {\n str += `view.values('${UTILS.removeNamespaceFromVariable(this.values())}')\\n`;\n }\n if (typeof this.labels() !== 'undefined') {\n str += `view.labels('${UTILS.removeNamespaceFromVariable(this.labels())}')\\n`;\n }\n if (typeof this.titles() !== 'undefined') {\n str += `view.titles('${UTILS.removeNamespaceFromVariable(this.titles())}')\\n`;\n }\n if (typeof this.sort() !== 'undefined') {\n str += `view.sort(${this.sort()})\\n`;\n }\n if (typeof this.direction() !== 'undefined') {\n str += `view.direction('${this.direction()}')\\n`;\n }\n // eslint-disable-next-line no-plusplus\n for (let i = 0; i < this.rules.length; i++) {\n str += `view.${this.rules[i].prettyPrint('chooser')}\\n`;\n }\n return str;\n};\n\nWOQLChooserConfig.prototype.json = function () {\n const conf = this.getBasicJSON();\n if (typeof this.change() !== 'undefined') {\n conf.change = this.change();\n }\n if (typeof this.show_empty() !== 'undefined') {\n conf.show_empty = this.show_empty();\n }\n if (typeof this.values() !== 'undefined') {\n conf.values = this.values();\n }\n if (typeof this.labels() !== 'undefined') {\n conf.labels = this.labels();\n }\n if (typeof this.titles() !== 'undefined') {\n conf.titles = this.titles();\n }\n if (typeof this.sort() !== 'undefined') {\n conf.sort = this.sort();\n }\n if (typeof this.direction() !== 'undefined') {\n conf.direction = this.direction();\n }\n const mj = { chooser: conf, rules: this.getRulesJSON() };\n return mj;\n};\n\nWOQLChooserConfig.prototype.loadJSON = function (config, rules) {\n const jr = [];\n // eslint-disable-next-line no-plusplus\n for (let i = 0; i < rules.length; i++) {\n const nr = new WOQLChooserRule();\n nr.json(rules[i]);\n jr.push(nr);\n }\n this.rules = jr;\n this.loadBasicJSON(config);\n if (typeof config.change !== 'undefined') {\n this.change(config.change);\n }\n if (typeof config.show_empty !== 'undefined') {\n this.show_empty(config.show_empty);\n }\n if (typeof config.values !== 'undefined') {\n this.values(config.values);\n }\n if (typeof config.labels !== 'undefined') {\n this.labels(config.labels);\n }\n if (typeof config.titles !== 'undefined') {\n this.titles(config.titles);\n }\n if (typeof config.sort !== 'undefined') {\n this.sort(config.sort);\n }\n if (typeof config.direction !== 'undefined') {\n this.direction(config.direction);\n }\n};\n\nWOQLChooserConfig.prototype.change = function (v) {\n if (typeof v !== 'undefined') {\n this.onChange = v;\n return this;\n }\n return this.onChange;\n};\n\nWOQLChooserConfig.prototype.show_empty = function (p) {\n if (typeof p !== 'undefined') {\n this.placeholder = p;\n return this;\n }\n return this.placeholder;\n};\n\nWOQLChooserConfig.prototype.rule = function (v) {\n const nr = new WOQLChooserRule().scope('row');\n this.rules.push(nr);\n if (v) nr.vars(v);\n // if(v) nr.v(v);\n return nr;\n};\n\nWOQLChooserConfig.prototype.values = function (v) {\n if (typeof v !== 'undefined') {\n if (v.substring(0, 2) === 'v:') v = v.substring(2);\n this.value_variable = v;\n return this;\n }\n return this.value_variable;\n};\n\nWOQLChooserConfig.prototype.labels = function (v) {\n if (v) {\n if (v.substring(0, 2) === 'v:') v = v.substring(2);\n this.label_variable = v;\n return this;\n }\n return this.label_variable;\n};\n\nWOQLChooserConfig.prototype.titles = function (v) {\n if (v) {\n if (v.substring(0, 2) === 'v:') v = v.substring(2);\n this.title_variable = v;\n return this;\n }\n return this.title_variable;\n};\n\nWOQLChooserConfig.prototype.sort = function (v) {\n if (v) {\n if (v.substring(0, 2) === 'v:') v = v.substring(2);\n this.sort_variable = v;\n return this;\n }\n return this.sort_variable;\n};\n\nWOQLChooserConfig.prototype.direction = function (v) {\n if (v) {\n this.sort_direction = v;\n return this;\n }\n return this.sort_direction;\n};\n\nfunction WOQLChooserRule(scope) {\n Config.WOQLViewRule.call(this, scope);\n}\n\nObject.setPrototypeOf(WOQLChooserRule.prototype, Config.WOQLViewRule.prototype);\n\nWOQLChooserRule.prototype.label = function (l) {\n if (l) {\n this.rule.label = l;\n return this;\n }\n return this.rule.label;\n};\n\nWOQLChooserRule.prototype.title = function (l) {\n if (l) {\n this.rule.title = l;\n return this;\n }\n return this.rule.title;\n};\n\nWOQLChooserRule.prototype.values = function (l) {\n if (l) {\n this.rule.values = l;\n return this;\n }\n return this.rule.values;\n};\n\nWOQLChooserRule.prototype.selected = function (s) {\n if (typeof s !== 'undefined') {\n this.rule.selected = s;\n return this;\n }\n return this.rule.selected;\n};\n\nWOQLChooserRule.prototype.prettyPrint = function () {\n // eslint-disable-next-line no-undef\n let str = WOQLViewRule.prototype.prettyPrint.apply(this);\n if (typeof this.selected() !== 'undefined') {\n str += `.selected(${this.selected()})`;\n }\n if (typeof this.label() !== 'undefined') {\n str += `.label(\"${this.label()}\")`;\n }\n if (typeof this.title() !== 'undefined') {\n str += `.title(\"${this.title()}\")`;\n }\n if (typeof this.values() !== 'undefined') {\n str += `.values(\"${this.values()}\")`;\n }\n return str;\n};\n\nmodule.exports = WOQLChooserConfig;\n","/* eslint-disable no-unused-vars */\n/* eslint-disable consistent-return */\n/* eslint-disable no-unused-expressions */\n/* eslint-disable no-param-reassign */\nconst ObjectFrame = require('./objectFrame');\nconst FrameConfig = require('./frameConfig');\nconst FrameHelper = require('../utils');\n\n/**\n * @file Document Frame\n * @license Apache Version 2\n */\n\nfunction DocumentFrame(client, config) {\n this.client = client;\n this.config = (config || new FrameConfig());\n this.load_schema = false;\n}\n\nDocumentFrame.prototype.options = function (opts) {\n this.config = opts;\n return this;\n};\n\nDocumentFrame.prototype.db = function (dburl) {\n this.client.db(dburl);\n return this;\n};\n\n/**\n * @param {String} url - loads the document frame from the document API in frame form\n * - loads the frame encapsulates more meta-data in the json and reduces the\n * number of api calls we need to make\n * @returns {Promise}\n */\nDocumentFrame.prototype.loadDocument = function (url, encoding) {\n encoding = encoding || 'system:frame';\n return this.client.getDocument(url, { 'system:encoding': encoding })\n .then((response) => {\n (encoding === 'system:frame' ? this.loadDataFrames(response) : this.loadJSON(response));\n });\n};\n\nDocumentFrame.prototype.loadSchema = function (cls, dbURL) {\n const ncls = FrameHelper.unshorten(cls);\n return this.client.getClassFrame(dbURL, ncls)\n .then((response) => this.loadSchemaFrames(response, ncls));\n};\n\n/**\n * @param {String} url - loads the document frame along with its class frame\n * @param {String} [cls] - optional class id of the document - if absent class frames\n * will be loaded from the document class once it is loaded\n * @returns {Promise}\n * - loads a document frame and it's class frame in unison\n */\n\nDocumentFrame.prototype.loadComplete = function (url, cls) {\n if (cls) {\n return Promise.all([this.loadDocument(url), this.loadDocumentSchema(cls)]);\n }\n\n return this.loadDocument(url)\n .then(() => {\n this.loadSchema(this.document.cls);\n });\n};\n\nDocumentFrame.prototype.loadJSON = function (json, type) {\n if (this.docid) {\n return this.loadDocument(this.docid);\n }\n if (this.clsid) {\n return this.loadDocumentSchema(this.clsid);\n }\n // eslint-disable-next-line no-console\n console.error('Either docid or clid must be set before load is called');\n};\n\nDocumentFrame.prototype.loadData = function (jsonld, cls, classframes) {\n if (!cls) {\n if (this.document) cls = this.document.cls;\n else if (jsonld && jsonld['@type']) {\n cls = jsonld['@type'];\n }\n }\n if (cls) {\n if (!this.document) {\n this.document = new ObjectFrame(cls, jsonld, classframes);\n } else {\n this.document.loadJSONLDDocument(jsonld);\n }\n } else {\n // eslint-disable-next-line no-console\n console.log('Missing Class Failed to add dataframes due to missing class');\n }\n};\n\nDocumentFrame.prototype.load = function (classframes, doc) {\n this.document = new ObjectFrame(doc['@type'], doc, classframes);\n};\n\nDocumentFrame.prototype.loadSchemaFrames = function (classframes, cls) {\n if (!cls) {\n if (classframes && classframes.length && classframes[0] && classframes[0].domain) {\n cls = classframes[0].domain;\n }\n }\n if (cls) {\n if (!this.document) {\n this.document = new ObjectFrame(cls);\n }\n if (classframes) {\n this.document.loadClassFrames(classframes);\n if (!this.document.subjid) {\n this.document.newDoc = true;\n this.document.fillFromSchema(FrameHelper.genBNID(`${FrameHelper.urlFragment(cls)}_`));\n }\n }\n } else {\n // eslint-disable-next-line no-console\n console.log('Missing Class', 'Failed to add class frames due to missing both class and classframes');\n }\n};\n\nDocumentFrame.prototype.filterFrame = function (loadRenderer) {\n const myfilt = function (frame, rule) {\n if (typeof rule.render() !== 'undefined') {\n frame.render = rule.render();\n }\n /* else {\n if(rule.renderer()){\n var renderer = loadRenderer(rule.renderer(), frame, rule.args);\n }\n if(renderer){\n frame.render = function(fframe){\n return renderer(fframe);\n }\n }\n } */\n if (rule.compare()) {\n frame.compare = rule.compare();\n }\n if (rule.errors()) {\n frame.errors = frame.errors ? frame.errors.concat(rule.errors()) : rule.errors();\n } else if (rule.errors() === false) delete frame.errors;\n };\n this.applyRules(false, false, myfilt);\n};\n\nDocumentFrame.prototype.setErrors = function (errors, frameconf) {\n this.clearErrors(frameconf);\n // eslint-disable-next-line no-plusplus\n for (let i = 0; i < errors.length; i++) {\n // eslint-disable-next-line no-use-before-define\n addRuleForVio(frameconf, errors[i]);\n }\n const myfilt = function (frame, rule) {\n if (rule.errors()) {\n frame.errors = frame.errors ? frame.errors.concat(rule.errors()) : rule.errors();\n }\n };\n this.applyRules(false, frameconf, myfilt);\n};\n\nDocumentFrame.prototype.clearErrors = function (frameconf) {\n frameconf.all();\n const myfilt = function (frame, rule) {\n if (frame.errors) delete (frame.errors);\n };\n this.applyRules(false, frameconf, myfilt);\n frameconf.rules = [];\n};\n\nfunction addRuleForVio(docview, error) {\n const prop = (error['vio:property'] ? error['vio:property']['@value'] : false);\n const subj = (error['vio:subject'] ? error['vio:subject']['@value'] : false);\n const msg = (error['vio:message'] ? error['vio:message']['@value'] : false);\n let val = (error['api:value'] ? error['api:value'] : false);\n if (val && val[0] === '\"' && val[val.length - 1] === '\"') val = val.substring(1, val.length - 1);\n const type = (error['api:type'] ? error['api:type'] : false);\n if (type && val) { // api:BadCast\n docview.data().value(val).type(type).errors([error]);\n }\n if (prop && subj) { // untypedInstanceViolation\n const shrt = FrameHelper.shorten(subj);\n if (shrt.substring(0, 5) === 'woql:') shrt === shrt.substring(5);\n docview.data().property(prop).value(shrt, subj).errors([error]);\n }\n}\n\n/* \"\n * adds render and compare functions to object frames\n */\nDocumentFrame.prototype.applyRules = function (doc, config, mymatch) {\n doc = doc || this.document;\n if (!doc) return;\n config = (config || this.config);\n const onmatch = function (frame, rule) {\n config.setFrameDisplayOptions(frame, rule);\n if (mymatch) mymatch(frame, rule);\n };\n doc.mfilter(config.rules, onmatch);\n};\n\nmodule.exports = DocumentFrame;\n","/* eslint-disable no-undef */\n/* eslint-disable no-redeclare */\n/* eslint-disable block-scoped-var */\n/* eslint-disable no-var */\n/* eslint-disable vars-on-top */\n/* eslint-disable guard-for-in */\n/* eslint-disable no-restricted-syntax */\n/* eslint-disable no-param-reassign */\n/* eslint-disable no-use-before-define */\n/* eslint-disable no-plusplus */\n/* eslint-disable import/extensions */\nconst Config = require('./viewConfig.js');\nconst { FrameRule } = require('./frameRule.js');\nconst DocumentFrame = require('./documentFrame.js');\n\n/**\n * @file Frame Config\n * @license Apache Version 2\n */\nfunction FrameConfig() {\n Config.ViewConfig.call(this);\n this.type = 'document';\n}\n\nObject.setPrototypeOf(FrameConfig.prototype, Config.ViewConfig.prototype);\n\nFrameConfig.prototype.create = function (client) {\n const tf = new DocumentFrame(client, this);\n return tf;\n};\n\nFrameConfig.prototype.prettyPrint = function () {\n let str = 'view = View.document();\\n';\n str += this.getBasicPrettyPrint();\n if (typeof this.load_schema() !== 'undefined') {\n str += `view.load_schema(${this.load_schema()})\\n`;\n }\n for (let i = 0; i < this.rules.length; i++) {\n str += `view.${this.rules[i].prettyPrint()}\\n`;\n }\n return str;\n};\n\nFrameConfig.prototype.json = function () {\n const conf = this.getBasicJSON();\n if (typeof this.load_schema() !== 'undefined') {\n conf.load_schema = this.load_schema();\n }\n const mj = { frame: conf, rules: this.getRulesJSON() };\n return mj;\n};\n\nFrameConfig.prototype.loadJSON = function (config, rules) {\n const jr = [];\n for (let i = 0; i < rules.length; i++) {\n const nr = new DocumentRule();\n nr.json(rules[i]);\n jr.push(nr);\n }\n this.rules = jr;\n this.loadBasicJSON(config);\n if (typeof config.load_schema !== 'undefined') {\n this.load_schema(config.load_schema);\n }\n return this;\n};\n\nFrameConfig.prototype.json_rules = function () {\n const jr = [];\n for (let i = 0; i < this.rules.length; i++) {\n jr.push(this.rules[i].json());\n }\n return jr;\n};\n\nFrameConfig.prototype.load_schema = function (tf) {\n if (typeof tf === 'undefined') return this.get_schema;\n this.get_schema = tf;\n return this;\n};\n\nFrameConfig.prototype.show_all = function (r) {\n this.all().renderer(r);\n return this;\n};\n\nFrameConfig.prototype.show_parts = function (o, p, d) {\n this.object().renderer(o);\n this.property().renderer(p);\n this.data().renderer(d);\n return this;\n};\n\nFrameConfig.prototype.object = function () {\n const fp = new DocumentRule().scope('object');\n this.rules.push(fp);\n return fp;\n};\n\nFrameConfig.prototype.property = function () {\n const fp = new DocumentRule().scope('property');\n this.rules.push(fp);\n return fp;\n};\n\nFrameConfig.prototype.scope = function (scope) {\n const fp = new DocumentRule().scope(scope);\n this.rules.push(fp);\n return fp;\n};\n\nFrameConfig.prototype.data = function () {\n const fp = new DocumentRule().scope('data');\n this.rules.push(fp);\n return fp;\n};\n\nFrameConfig.prototype.all = function () {\n const fp = new DocumentRule().scope('*');\n this.rules.push(fp);\n return fp;\n};\n\n/**\n * Attaches display options to frames from matching rules\n */\nFrameConfig.prototype.setFrameDisplayOptions = function (frame, rule) {\n if (typeof frame.display_options === 'undefined') frame.display_options = {};\n if (typeof rule.mode() !== 'undefined') { frame.display_options.mode = rule.mode(); }\n if (typeof rule.view() !== 'undefined') frame.display_options.view = rule.view();\n if (typeof rule.showDisabledButtons() !== 'undefined') frame.display_options.show_disabled_buttons = rule.showDisabledButtons();\n if (typeof rule.hidden() !== 'undefined') frame.display_options.hidden = rule.hidden();\n if (typeof rule.collapse() !== 'undefined') frame.display_options.collapse = rule.collapse();\n if (typeof rule.style() !== 'undefined') frame.display_options.style = rule.style();\n if (typeof rule.headerStyle() !== 'undefined') frame.display_options.header_style = rule.headerStyle();\n if (typeof rule.features() !== 'undefined') { frame.display_options.features = this.setFrameFeatures(frame.display_options.features, rule.features()); }\n if (typeof rule.headerFeatures() !== 'undefined') frame.display_options.header_features = this.setFrameFeatures(frame.display_options.header_features, rule.headerFeatures());\n if (typeof rule.header() !== 'undefined') frame.display_options.header = rule.header();\n if (typeof rule.showEmpty() !== 'undefined') frame.display_options.show_empty = rule.showEmpty();\n if (typeof rule.dataviewer() !== 'undefined') frame.display_options.dataviewer = rule.dataviewer();\n if (typeof rule.args() !== 'undefined') frame.display_options.args = this.setFrameArgs(frame.display_options.args, rule.args());\n};\n\n/*\nConsolidates properties of features sent in in different rules\n*/\nFrameConfig.prototype.setFrameFeatures = function (existing, fresh) {\n // preserve order of existing\n if (!existing || !existing.length) return fresh;\n if (!fresh || !fresh.length) return existing;\n const got = [];\n for (let i = 0; i < existing.length; i++) {\n const key = (typeof existing[i] === 'string' ? existing[i] : Object.keys(existing[i])[0]);\n got.push(key);\n }\n for (let j = 0; j < fresh.length; j++) {\n const fkey = (typeof fresh[j] === 'string' ? fresh[j] : Object.keys(fresh[j])[0]);\n const rep = got.indexOf(fkey);\n if (rep === -1) existing.push(fresh[j]);\n else if (typeof fresh[j] === 'object') {\n const val = existing[rep];\n if (typeof val === 'string') existing[rep] = fresh[j];\n else if (typeof val === 'object') {\n const props = fresh[j][fkey];\n // eslint-disable-next-line no-restricted-syntax\n for (const p in props) {\n existing[rep][fkey][p] = props[p];\n }\n }\n }\n }\n return existing;\n};\n\nFrameConfig.prototype.setFrameArgs = function (existing, fresh) {\n if (!existing) return fresh;\n if (!fresh) return existing;\n for (const k in fresh) {\n existing[k] = fresh[k];\n }\n return existing;\n};\n\n/**\n * @file Document Rule\n * @license Apache Version 2\n */\n\nfunction DocumentRule() {\n FrameRule.call(this);\n this.rule = {};\n}\n\nObject.setPrototypeOf(DocumentRule.prototype, FrameRule.prototype);\n\nDocumentRule.prototype.renderer = function (rend) {\n if (typeof rend === 'undefined') {\n return this.rule.renderer;\n }\n this.rule.renderer = rend;\n return this;\n};\n\nDocumentRule.prototype.compare = function (func) {\n if (typeof func === 'undefined') {\n return this.rule.compare;\n }\n this.rule.compare = func;\n return this;\n};\n\nDocumentRule.prototype.mode = function (mode) {\n if (typeof mode === 'undefined') {\n return this.rule.mode;\n }\n this.rule.mode = mode;\n return this;\n};\n\nDocumentRule.prototype.collapse = function (func) {\n if (typeof func === 'undefined') {\n return this.rule.collapse;\n }\n this.rule.collapse = func;\n return this;\n};\n\nDocumentRule.prototype.view = function (m) {\n if (!m) return this.rule.view;\n this.rule.view = m;\n return this;\n};\n\n/**\n * Should actions which are disabled in the given context be displayed?\n */\nDocumentRule.prototype.showDisabledButtons = function (m) {\n if (typeof m === 'undefined') return this.rule.show_disabled_buttons;\n this.rule.show_disabled_buttons = m;\n return this;\n};\n\nDocumentRule.prototype.header = function (m) {\n if (!m) return this.rule.header;\n this.rule.header = m;\n return this;\n};\n\nDocumentRule.prototype.errors = function (errs) {\n if (!errs) return this.rule.errors;\n this.rule.errors = errs;\n return this;\n};\n\nDocumentRule.prototype.headerStyle = function (m) {\n if (!m) return this.rule.headerStyle;\n this.rule.headerStyle = m;\n return this;\n};\n\nDocumentRule.prototype.showEmpty = function (m) {\n if (!m) return this.rule.show_empty;\n this.rule.show_empty = m;\n return this;\n};\n\nDocumentRule.prototype.dataviewer = function (m) {\n if (!m) return this.rule.dataviewer;\n this.rule.dataviewer = m;\n return this;\n};\n\nDocumentRule.prototype.features = function (...m) {\n if (typeof m === 'undefined' || m.length === 0) return this.rule.features;\n this.rule.features = m;\n return this;\n};\n\nDocumentRule.prototype.headerFeatures = function (...m) {\n if (typeof m === 'undefined' || m.length === 0) return this.rule.header_features;\n this.rule.header_features = m;\n return this;\n};\n\nDocumentRule.prototype.render = function (func) {\n if (!func) return this.rule.render;\n const hf = this.headerFeatures();\n const f = this.features();\n if (hf && hf.length) {\n var feats = this.applyFeatureProperty(hf, 'render', func);\n this.headerFeatures(...feats);\n } else if (f && f.length) {\n // eslint-disable-next-line no-redeclare\n var feats = this.applyFeatureProperty(f, 'render', func);\n this.features(...feats);\n } else {\n this.rule.render = func;\n }\n return this;\n};\n\nDocumentRule.prototype.style = function (style) {\n if (typeof style === 'undefined') return this.rule.style;\n const hf = this.headerFeatures();\n const f = this.features();\n if (hf && hf.length) {\n var feats = this.applyFeatureProperty(hf, 'style', style);\n this.headerFeatures(...feats);\n } else if (f && f.length) {\n var feats = this.applyFeatureProperty(f, 'style', style);\n this.features(...feats);\n } else {\n this.rule.style = style;\n }\n return this;\n};\n\n/**\n * The frame or feature will be hidden or unhidden (boolean)\n */\nDocumentRule.prototype.hidden = function (m) {\n if (typeof m === 'undefined') return this.rule.hidden;\n const hf = this.headerFeatures();\n const f = this.features();\n if (hf && hf.length) {\n var feats = this.applyFeatureProperty(hf, 'hidden', m);\n this.headerFeatures(...feats);\n } else if (f && f.length) {\n var feats = this.applyFeatureProperty(f, 'hidden', m);\n this.features(...feats);\n } else {\n this.rule.hidden = m;\n }\n return this;\n};\n\n/**\n * Specifies arguments to a renderer\n */\nDocumentRule.prototype.args = function (json) {\n if (!json) return this.rule.args;\n const hf = this.headerFeatures();\n const f = this.features();\n if (hf && hf.length) {\n var feats = this.applyFeatureProperty(hf, 'args', json);\n this.headerFeatures(...feats);\n } else if (f && f.length) {\n var feats = this.applyFeatureProperty(f, 'args', json);\n this.features(...feats);\n } else {\n this.rule.args = json;\n }\n return this;\n};\n\n/**\n * Adds a property to a feature array\n */\nDocumentRule.prototype.applyFeatureProperty = function (feats, prop, val) {\n const nfeats = [];\n for (let i = 0; i < feats.length; i++) {\n if (typeof feats[i] === 'string') {\n var nfeat = {};\n nfeat[feats[i]] = {};\n nfeat[feats[i]][prop] = val;\n nfeats.push(nfeat);\n } else if (typeof feats[i] === 'object') {\n const fkey = Object.keys(feats[i])[0];\n if (fkey) {\n var nfeat = feats[i];\n nfeat[fkey][prop] = val;\n nfeats.push(nfeat);\n }\n }\n }\n return nfeats;\n};\n\nDocumentRule.prototype.unpackFeatures = function (feats) {\n const extensions = {};\n let fstr = '';\n for (let i = 0; i < feats.length; i++) {\n if (typeof feats[i] === 'string') {\n fstr += `\"${feats[i]}\"`;\n } else if (typeof feats[i] === 'object') {\n const fid = Object.keys(feats[i])[0];\n fstr += `\"${fid}\"`;\n for (const prop in feats[i][fid]) {\n extensions[prop] = feats[i][fid][prop];\n }\n }\n if (i < feats.length - 1) {\n fstr += ', ';\n }\n }\n for (let k = 0; k < Object.keys(extensions).length; k++) {\n const ext = Object.keys(extensions)[k];\n const val = extensions[ext];\n fstr += `).${ext}(`;\n if (typeof val === 'function') {\n fstr += val;\n } else if (typeof val === 'string') {\n fstr += `\"${val}\"`;\n } else if (typeof val === 'object') {\n fstr += JSON.stringify(val);\n }\n }\n return fstr;\n};\n\nDocumentRule.prototype.prettyPrint = function () {\n if (this.pattern) {\n str = this.pattern.prettyPrint();\n }\n if (typeof this.renderer() !== 'undefined') {\n str += `.renderer('${this.renderer()}')`;\n }\n if (typeof this.render() !== 'undefined') {\n str += `.render(${this.render})`;\n }\n if (typeof this.compare() !== 'undefined') {\n str += `.compare(${this.compare()})`;\n }\n if (typeof this.mode() !== 'undefined') {\n str += `.mode('${this.mode()}')`;\n }\n if (typeof this.collapse() !== 'undefined') {\n str += `.collapse(${this.collapse()})`;\n }\n if (typeof this.hidden() !== 'undefined') {\n str += `.hidden(${this.hidden()})`;\n }\n if (typeof this.view() !== 'undefined') {\n str += `.view('${this.view()}')`;\n }\n if (typeof this.showDisabledButtons() !== 'undefined') {\n str += `.showDisabledButtons(${this.showDisabledButtons()})`;\n }\n if (typeof this.header() !== 'undefined') {\n str += `.header(${this.header()})`;\n }\n if (typeof this.style() !== 'undefined') {\n str += `.style(\"${this.style()}\")`;\n }\n if (typeof this.headerStyle() !== 'undefined') {\n str += `.headerStyle(\"${this.headerStyle()}\")`;\n }\n if (typeof this.args() !== 'undefined') {\n str += `.args(${JSON.stringify(this.args())})`;\n }\n if (typeof this.errors() !== 'undefined') {\n str += `.errors(${JSON.stringify(this.errors())})`;\n }\n if (typeof this.showEmpty() !== 'undefined') {\n str += `.showEmpty(${this.show_empty()})`;\n }\n if (typeof this.dataviewer() !== 'undefined') {\n str += `.dataviewer(\"${this.dataviewer()}\")`;\n }\n if (typeof this.features() !== 'undefined') {\n str += `.features(${this.unpackFeatures(this.features())})`;\n }\n if (typeof this.headerFeatures() !== 'undefined') {\n str += `.headerFeatures(${this.unpackFeatures(this.headerFeatures())})`;\n }\n return str;\n};\n\nmodule.exports = FrameConfig;\n","/* eslint-disable no-continue */\n/* eslint-disable no-restricted-syntax */\n/* eslint-disable block-scoped-var */\n/* eslint-disable no-var */\n/* eslint-disable vars-on-top */\n/* eslint-disable no-plusplus */\n/* eslint-disable camelcase */\n/* eslint-disable no-use-before-define */\nconst TerminusRule = require('./terminusRule');\n\n/**\n * @file Frame Rule\n * @license Apache Version 2\n */\n\nfunction FrameRule() {\n TerminusRule.TerminusRule.call(this);\n this.pattern = new FramePattern();\n}\n\nObject.setPrototypeOf(FrameRule.prototype, TerminusRule.TerminusRule.prototype);\n\n/**\n * Returns an array of rules that match the paased frame\n * @param {[FrameRule]} rules - array of rules to be tested\n * @param {Frame} frame - object frame, property frame or data from to be tested\n * @param {function} [onmatch] - optional function to be called with args (frame, rule)\n * on each match\n */\nFrameRule.prototype.testRules = function (rules, frame, onmatch) {\n const matched_rules = [];\n if (rules && rules.length) {\n for (let i = 0; i < rules.length; i++) {\n const match = (!rules[i].pattern || this.patternMatchesFrame(rules[i].pattern, frame));\n if (match) {\n matched_rules.push(rules[i]);\n if (onmatch && typeof onmatch === 'function') {\n onmatch(frame, rules[i]);\n }\n }\n }\n }\n return matched_rules;\n};\n\n/**\n * Determines whether a given pattern matches a given frame\n */\nFrameRule.prototype.patternMatchesFrame = function (pattern, frame) {\n if (pattern.checkFrame) {\n return pattern.checkFrame(frame);\n }\n\n const fp = new FramePattern().setPattern(pattern);\n return fp.checkFrame(frame);\n};\n\n/**\n * Specifies that only one from among the list of properties will match\n */\nFrameRule.prototype.property = function (...prop) {\n if (!prop || prop.length === 0) return this.pattern.property;\n this.pattern.property = prop;\n return this;\n};\n\n/**\n * Specifies that only one from among the list of frame_types will match\n * frame_types are: data, oneOf, document, object?\n */\nFrameRule.prototype.frame_type = function (...frame_type) {\n if (!frame_type || frame_type.length === 0) return this.pattern.frame_type;\n this.pattern.frame_type = frame_type;\n return this;\n};\n\n/**\n * Specifies that only one from among the list of labels will match\n */\nFrameRule.prototype.label = function (...prop) {\n if (!prop || prop.length === 0) return this.pattern.label;\n this.pattern.label = prop;\n return this;\n};\n\n/**\n * Specifies that only one from among the list of subject ids will match\n */\nFrameRule.prototype.subject = function (...prop) {\n if (!prop || prop.length === 0) return this.pattern.subject;\n this.pattern.subject = prop;\n return this;\n};\n\n/**\n * Specifies that only one from among the list of subject classes will match\n */\nFrameRule.prototype.subjectClass = function (...prop) {\n if (!prop || prop.length === 0) return this.pattern.subjectClass;\n this.pattern.subjectClass = prop;\n return this;\n};\n\n/**\n * Specifies that only one from among the list of range types will match\n */\nFrameRule.prototype.range = function (...prop) {\n if (!prop || prop.length === 0) return this.pattern.range;\n this.pattern.range = prop;\n return this;\n};\n\n/**\n * Specifies that only one from among the list of range types will match\n */\nFrameRule.prototype.value = function (...prop) {\n if (!prop || prop.length === 0) return this.pattern.value;\n this.pattern.value = prop;\n return this;\n};\n\n/**\n * Specifies that only frames of the specified depth will match the rule\n */\nFrameRule.prototype.depth = function (depth) {\n if (typeof depth === 'undefined') return this.pattern.depth;\n this.pattern.depth = depth;\n return this;\n};\n\n/**\n * Specifies that only frames of the specified index will match the rule (index is the order of a\n * value in the property frame)\n */\nFrameRule.prototype.index = function (...index) {\n if (!index || index.length === 0) return this.pattern.index;\n this.pattern.index = index;\n return this;\n};\n\n/**\n * Specifies that only frames with the given statuses will match the rule\n */\nFrameRule.prototype.status = function (...status) {\n if (!status || status.length === 0) return this.pattern.status;\n this.pattern.status = status;\n return this;\n};\n\n/**\n * Specifies that the frame will only match if its parent matches the pattern passed as par\n */\nFrameRule.prototype.parent = function (par) {\n if (!par) return this.pattern.parent;\n this.pattern.parent = par;\n return this;\n};\n\nFrameRule.prototype.children = function (...children) {\n if (typeof children === 'undefined' || children.length === 0) return this.pattern.children;\n if (typeof this.pattern.children === 'undefined') {\n this.pattern.children = [];\n }\n for (let i = 0; i < children.length; i++) {\n this.pattern.children.push(children[i]);\n }\n return this;\n};\n\n/**\n * @file Frame Pattern\n * A frame pattern can have the following variables\n * scope : object, property, data, * - matches a specific part of the frame\n * label : matches the label of a property\n * frame_type: object, data, document, id, oneOf\n * subject: id of the subject\n * subjectClass: class of the subject\n * range: type of a property (applies to property and data)\n * property: property id or list of property ids (parent property if it is an object or data)\n * value: value of the property\n * parent: a pattern relating to the parent of this frame\n * children: patterns for matching on the children of a frame\n * depth: how deep are we in the document? starts from 0\n * index: the index of a value in an array\n * status: updated, error, new, ok,\n */\n\nfunction FramePattern() {\n TerminusRule.TerminusPattern.call(this);\n}\n\nObject.setPrototypeOf(FramePattern.prototype, TerminusRule.TerminusPattern.prototype);\n\nFramePattern.prototype.setPattern = function (pattern) {\n if (pattern.scope) this.scope = pattern.scope;\n if (typeof pattern.literal !== 'undefined') this.literal = pattern.literal;\n if (typeof pattern.type !== 'undefined') this.type = pattern.type;\n if (typeof pattern.label !== 'undefined') this.label = pattern.label;\n if (typeof pattern.frame_type !== 'undefined') this.frame_type = pattern.frame_type;\n if (typeof pattern.subject !== 'undefined') this.subject = pattern.subject;\n if (typeof pattern.subjectClass !== 'undefined') this.subjectClass = pattern.subjectClass;\n if (typeof pattern.range !== 'undefined') this.range = pattern.range;\n if (typeof pattern.property !== 'undefined') this.property = pattern.property;\n if (typeof pattern.value !== 'undefined') this.value = pattern.value;\n if (typeof pattern.parent !== 'undefined') {\n let { parent } = pattern;\n if (typeof parent.json !== 'function') {\n parent = new FramePattern().setPattern(parent);\n }\n this.parent = parent;\n }\n if (pattern.children) {\n this.children = [];\n for (let i = 0; i < pattern.children.length; i++) {\n let kid = pattern.children[i];\n if (typeof kid.json !== 'function') {\n kid = new FramePattern().setPattern(kid);\n }\n this.children.push(kid);\n }\n }\n if (typeof pattern.depth !== 'undefined') this.depth = pattern.depth;\n if (typeof pattern.index !== 'undefined') this.index = pattern.index;\n if (typeof pattern.status !== 'undefined') this.status = pattern.status;\n};\n\nFramePattern.prototype.json = function () {\n const json = {};\n if (typeof this.literal !== 'undefined') json.literal = this.literal;\n if (this.type) json.type = this.type;\n if (this.scope) json.scope = this.scope;\n if (typeof this.value !== 'undefined') json.value = this.value;\n if (typeof this.label !== 'undefined') json.label = this.label;\n if (typeof this.frame_type !== 'undefined') json.frame_type = this.frame_type;\n if (typeof this.subject !== 'undefined') json.subject = this.subject;\n if (typeof this.subjectClass !== 'undefined') json.subjectClass = this.subjectClass;\n if (typeof this.range !== 'undefined') json.range = this.range;\n if (typeof this.property !== 'undefined') json.property = this.property;\n if (typeof this.parent !== 'undefined') json.parent = (this.parent.json ? this.parent.json() : this.parent);\n if (typeof this.children !== 'undefined') {\n json.children = [];\n for (let i = 0; i < this.children.length; i++) {\n json.children.push((this.children[i].json ? this.children[i].json() : this.children[i]));\n }\n }\n if (typeof this.depth !== 'undefined') json.depth = this.depth;\n if (typeof this.index !== 'undefined') json.index = this.index;\n if (typeof this.status !== 'undefined') json.status = this.status;\n return json;\n};\n\nFramePattern.prototype.checkFrame = function (frame) {\n const rtype = this.getRendererType(frame);\n if (!rtype) return false;\n if (this.scope && (this.scope !== rtype) && (this.scope !== '*')) return false;\n if (this.illegalRuleType(rtype)) return false;\n if (this.frame_type && !this.checkFrameType(rtype, frame)) return false;\n if (this.label && !this.checkLabel(rtype, frame)) return false;\n if (this.subject && !this.checkSubject(rtype, frame)) return false;\n if (this.subjectClass && !this.checkSubjectClass(rtype, frame)) return false;\n if (this.property && !this.checkProperty(rtype, frame)) return false;\n if (typeof this.depth !== 'undefined' && !this.checkDepth(rtype, frame)) return false;\n if (this.range && !this.checkRange(rtype, frame)) return false;\n if (typeof this.value !== 'undefined' && !this.checkValue(rtype, frame)) return false;\n if (this.type && !this.checkType(rtype, frame)) return false;\n if (typeof this.literal !== 'undefined' && !this.checkLiteral(rtype, frame)) return false;\n if (this.parent && !this.checkParent(rtype, frame)) return false;\n if (this.children && this.children.length && !this.checkChildren(rtype, frame)) return false;\n if (this.index && !this.checkIndex(rtype, frame)) return false;\n if (this.status && !this.checkStatus(rtype, frame)) return false;\n return true;\n};\n\nFramePattern.prototype.prettyPrint = function () {\n // starts with obj. ...\n if (this.scope === '*') {\n var str = 'all()';\n } else {\n // eslint-disable-next-line no-redeclare\n var str = `${this.scope}()`;\n }\n if (typeof this.literal !== 'undefined') {\n str += `.literal(${this.literal})`;\n }\n if (typeof this.type !== 'undefined') {\n str += `.type(${this.unpack(this.type)})`;\n }\n if (typeof this.range !== 'undefined') {\n str += `.range(${this.unpack(this.range)})`;\n }\n if (typeof this.frame_type !== 'undefined') {\n str += `.frame_type(${this.unpack(this.frameType)})`;\n }\n if (typeof this.label !== 'undefined') {\n str += `.label(${this.unpack(this.label)})`;\n }\n if (typeof this.subject !== 'undefined') {\n str += `.subject(${this.unpack(this.subject)})`;\n }\n if (typeof this.subjectClass !== 'undefined') {\n str += `.subjectClass(${this.unpack(this.subjectClass)})`;\n }\n if (typeof this.property !== 'undefined') {\n str += `.property(${this.unpack(this.property)})`;\n }\n if (typeof this.value !== 'undefined') {\n str += `.value(${this.unpack(this.value, true)})`;\n }\n if (typeof this.children !== 'undefined' && this.children.length > 0) {\n str += '.children(\\n';\n const kids = this.children;\n for (let i = 0; i < kids.length; i++) {\n str += `View.pattern().${kids[i].prettyPrint()}`;\n if (i < kids.length - 1) str += ',';\n str += '\\n';\n }\n str += ')';\n }\n if (typeof this.parent !== 'undefined') {\n str += `.parent(View.pattern().${this.parent.prettyPrint()})`;\n }\n if (typeof this.depth !== 'undefined') {\n str += `.depth(${this.unpack(this.depth, true)})`;\n }\n if (typeof this.index !== 'undefined') {\n str += `.index(${this.unpack(this.index, true)})`;\n }\n if (typeof this.status !== 'undefined') {\n str += `.status(${this.unpack(this.status)})`;\n }\n return str;\n};\n\nFramePattern.prototype.illegalRuleType = function (rtype) {\n // data frames have no children\n if (rtype === 'data' && this.children && this.children.length) return true;\n // object frames have no range\n if (rtype === 'object' && this.range) return true;\n return false;\n};\n\n/* subject is an id or an array of ids,\n/* match is positive if the renderer's subject appears in the array or is the id\n */\nFramePattern.prototype.checkSubject = function (subject, frame) {\n if (typeof this.subject !== 'object' || !this.subject.length) this.subject = [this.subject];\n const rsubj = frame.subject();\n for (let i = 0; i < this.subject.length; i++) {\n if (this.IDsMatch(subject[i], rsubj)) {\n return true;\n }\n }\n return false;\n};\n\n// at least one child must match all child rules\nFramePattern.prototype.checkChildren = function (rtype, frame) {\n for (let i = 0; i < this.children.length; i++) {\n let found = false;\n if (rtype === 'object') {\n for (const prop in frame.properties) {\n if (this.children[i].checkFrame(frame.properties[prop])) {\n found = true;\n continue;\n }\n }\n } else if (rtype === 'property') {\n // eslint-disable-next-line no-undef\n for (let j = 0; j <= renderer.values.length; j++) {\n if (this.children[j].checkFrame(frame.values[j])) {\n found = true;\n continue;\n }\n }\n }\n if (!found) return false;\n }\n return true;\n};\n\nFramePattern.prototype.checkStatus = function (rtype, frame) {\n if (typeof this.status !== 'object' || this.status.length === 0) this.status = [this.status];\n for (let i = 0; i < this.status.length; i++) {\n if (this.status[i] === 'updated' && !frame.isUpdated()) return false;\n if (this.status[i] === 'new' && !frame.isNew()) return false;\n if (this.status[i] === 'unchanged' && frame.isUpdated()) return false;\n }\n return true;\n};\n\nFramePattern.prototype.checkDepth = function (rtype, frame) {\n return this.numberMatch(this.depth, frame.depth());\n};\n\nFramePattern.prototype.checkParent = function (rtype, frame) {\n return this.parent.checkFrame(frame.parent);\n};\n\nFramePattern.prototype.checkIndex = function (rtype, frame) {\n if (rtype === 'data') {\n return this.index === frame.index;\n }\n return false;\n};\n\nFramePattern.prototype.checkProperty = function (rtype, frame) {\n if (typeof this.property !== 'object' || !this.property.length) this.property = [this.property];\n for (let i = 0; i < this.property.length; i++) {\n if (this.propertyIDsMatch(frame.property(), this.property[i])) {\n return true;\n }\n }\n return false;\n};\n\n/**\n * Checks to make sure the frame is among the specified types\n */\nFramePattern.prototype.checkType = function (rtype, frame) {\n if (rtype === 'object') var vs = frame.subjectClass();\n // eslint-disable-next-line no-redeclare\n else var vs = typeof frame.range === 'function' ? frame.range() : frame.range;\n if (!Array.isArray(this.type)) this.type = [this.type];\n if (this.type.indexOf(vs) === -1) return false;\n return true;\n};\n\nFramePattern.prototype.checkLiteral = function (rtype, frame) {\n if (rtype === 'object') return false;\n if (rtype === 'property') return false;\n if (rtype === 'data') return frame.isDatatypeProperty();\n return true;\n};\n\n// returns true if any of the values are found\nFramePattern.prototype.checkValue = function (rtype, frame) {\n if (typeof this.value !== 'object' || !this.value.length) this.value = [this.value];\n for (let i = 0; i < this.value.length; i++) {\n if (rtype === 'data') {\n if (this.valuesMatch(frame.get(), this.value[i])) {\n return true;\n }\n } else if (rtype === 'property') {\n for (let j = 0; j <= frame.values.length; j++) {\n if (this.getRendererType(frame.values[i]) === 'data'\n && this.valuesMatch(frame.values[i].get(), this.value[i])) {\n return true;\n }\n }\n } else if (rtype === 'object') {\n for (const prop in frame.properties) {\n if (this.checkValue(this.getRendererType(frame.properties[prop]), frame.properties[prop])) {\n return true;\n }\n }\n }\n }\n return false;\n};\n\nFramePattern.prototype.checkRange = function (rtype, frame) {\n if (typeof this.range !== 'object' || !this.range.length) this.range = [this.range];\n for (let i = 0; i < this.range.length; i++) {\n if (this.rangeIDsMatch(frame.range(), this.range[i])) {\n return true;\n }\n }\n return false;\n};\n\nFramePattern.prototype.checkSubjectClass = function (rtype, frame) {\n if (typeof this.subjectClass !== 'object' || !this.subjectClass.length) this.subjectClass = [this.subjectClass];\n const rcls = frame.subjectClass();\n for (let i = 0; i < this.subjectClass.length; i++) {\n if (this.classIDsMatch(this.subjectClass[i], rcls)) {\n return true;\n }\n }\n return false;\n};\n\n// eslint-disable-next-line consistent-return\nFramePattern.prototype.checkFrameType = function (rtype, frame) {\n if (rtype === 'object') return (this.frame_type.indexOf('object') !== -1);\n if (rtype === 'data') {\n if (frame.frame) {\n return (this.frame_type.indexOf(frame.frame.ftype()) !== -1);\n }\n }\n if (rtype === 'property') return false;\n};\n\nFramePattern.prototype.checkLabel = function (rtype, frame) {\n if (typeof frame.getLabel !== 'function') {\n // eslint-disable-next-line no-console\n console.log(new Error('Rule passed to check label with broken renderer object - no getLabel'));\n return false;\n }\n for (let i = 0; i < this.label.length; i++) {\n if (this.stringMatch(this.label[i], frame.getLabel())) return true;\n }\n return false;\n};\n\nFramePattern.prototype.getRendererType = function (frame) {\n if (frame.isProperty()) return 'property';\n if (frame.isObject()) return 'object';\n if (frame.isData()) return 'data';\n if (frame.renderer_type) return frame.renderer_type;\n // eslint-disable-next-line no-console\n console.log(frame, new Error(`frame configuration passed non-renderer type ${frame.constructor.name}`));\n return false;\n};\n\nmodule.exports = { FrameRule, FramePattern };\n","/* eslint-disable block-scoped-var */\n/* eslint-disable no-var */\n/* eslint-disable vars-on-top */\n/* eslint-disable no-plusplus */\n/* eslint-disable no-use-before-define */\n/* eslint-disable import/extensions */\nconst Config = require('./viewConfig.js');\nconst WOQLGraph = require('./woqlGraph.js');\nconst UTILS = require('../utils.js');\n\nfunction WOQLGraphConfig() {\n Config.ViewConfig.call(this);\n this.type = 'graph';\n}\n\nObject.setPrototypeOf(WOQLGraphConfig.prototype, Config.ViewConfig.prototype);\n\nWOQLGraphConfig.prototype.create = function (client) {\n const wqt = new WOQLGraph(client, this);\n return wqt;\n};\n\nWOQLGraphConfig.prototype.literals = function (v) {\n if (typeof v !== 'undefined') {\n this.show_literals = v;\n return this;\n }\n return this.show_literals;\n};\n\nWOQLGraphConfig.prototype.source = function (v) {\n if (v) {\n // if(v.substring(0, 2) != \"v:\") v = \"v:\" + v;\n this.source_variable = UTILS.removeNamespaceFromVariable(v);\n return this;\n }\n return this.source_variable;\n};\n\nWOQLGraphConfig.prototype.fontfamily = function (v) {\n if (typeof v !== 'undefined') {\n this.fontfam = v;\n return this;\n }\n // return 'Font Awesome 5 Free';\n return this.fontfam;\n};\n\nWOQLGraphConfig.prototype.show_force = function (v) {\n if (typeof v !== 'undefined') {\n this.force = v;\n return this;\n }\n return this.force;\n};\n\nWOQLGraphConfig.prototype.fix_nodes = function (v) {\n if (typeof v !== 'undefined') {\n this.fixed = v;\n return this;\n }\n return this.fixed;\n};\n\nWOQLGraphConfig.prototype.explode_out = function (v) {\n if (typeof v !== 'undefined') {\n this.explode = v;\n return this;\n }\n return this.explode;\n};\n\nWOQLGraphConfig.prototype.selected_grows = function (v) {\n if (typeof v !== 'undefined') {\n this.bigsel = v;\n return this;\n }\n return this.bigsel;\n};\n\n/**\n * no parameter get the graph width or\n * set the graph width and return the WOQLGraphConfig\n * @param {size} Number\n */\n\nWOQLGraphConfig.prototype.width = function (size) {\n if (typeof size !== 'undefined') {\n this.gwidth = size;\n return this;\n }\n return this.gwidth;\n};\n\n/**\n * no parameter get the graph height or\n * set the graph height and return the WOQLGraphConfig\n * @param {size} Number\n */\n\nWOQLGraphConfig.prototype.height = function (size) {\n if (typeof size !== 'undefined') {\n this.gheight = size;\n return this;\n }\n return this.gheight;\n};\n\n/**\n *\n * @param {...any} edges\n * @returns {any[][]}\n */\nWOQLGraphConfig.prototype.edges = function (...edges) {\n if (edges && edges.length) {\n const nedges = [];\n for (let i = 0; i < edges.length; i++) {\n nedges.push(UTILS.removeNamespacesFromVariables(edges[i]));\n }\n this.show_edges = nedges;\n return this;\n }\n return this.show_edges;\n};\n\nWOQLGraphConfig.prototype.edge = function (source, target) {\n const nr = new WOQLGraphRule().edge(source, target);\n this.rules.push(nr);\n return nr;\n};\n\nWOQLGraphConfig.prototype.node = function (...cols) {\n const nr = new WOQLGraphRule();\n if (cols && cols.length) {\n nr.scope('node').setVariables(cols);\n } else {\n nr.scope('row');\n }\n this.rules.push(nr);\n return nr;\n};\n\nWOQLGraphConfig.prototype.loadJSON = function (config, rules) {\n const jr = [];\n for (let i = 0; i < rules.length; i++) {\n const nr = new WOQLGraphRule();\n nr.json(rules[i]);\n jr.push(nr);\n }\n this.rules = jr;\n if (typeof config.literals !== 'undefined') {\n this.literals(config.literals);\n }\n if (typeof config.source !== 'undefined') {\n this.source(config.source);\n }\n if (typeof config.fontfamily !== 'undefined') {\n this.fontfamily(config.fontfamily);\n }\n if (typeof config.show_force !== 'undefined') {\n this.show_force(config.show_force);\n }\n if (typeof config.fix_nodes !== 'undefined') {\n this.fix_nodes(config.fix_nodes);\n }\n if (typeof config.explode_out !== 'undefined') {\n this.explode_out(config.explode_out);\n }\n if (typeof config.selected_grows !== 'undefined') {\n this.selected_grows(config.selected_grows);\n }\n if (typeof config.width !== 'undefined') {\n this.width(config.width);\n }\n if (typeof config.height !== 'undefined') {\n this.height(config.height);\n }\n if (typeof config.edges !== 'undefined') {\n this.edges(...config.edges);\n }\n};\n\nWOQLGraphConfig.prototype.prettyPrint = function () {\n let str = 'view = View.graph();\\n';\n if (typeof this.literals() !== 'undefined') {\n str += `view.literals('${this.literals()}')\\n`;\n }\n if (typeof this.source() !== 'undefined') {\n str += `view.source('${UTILS.removeNamespaceFromVariable(this.source())}')\\n`;\n }\n if (typeof this.fontfamily() !== 'undefined') {\n str += `view.fontfamily('${this.fontfamily()}')\\n`;\n }\n if (typeof this.show_force() !== 'undefined') {\n str += `view.show_force('${this.show_force()}')\\n`;\n }\n if (typeof this.fix_nodes() !== 'undefined') {\n str += `view.fix_nodes('${this.fix_nodes()}')\\n`;\n }\n if (typeof this.explode_out() !== 'undefined') {\n str += `view.explode_out('${this.explode_out()}')\\n`;\n }\n if (typeof this.selected_grows() !== 'undefined') {\n str += `view.selected_grows('${this.selected_grows()}')\\n`;\n }\n if (typeof this.width() !== 'undefined') {\n str += `view.width('${this.width()}')\\n`;\n }\n if (typeof this.height() !== 'undefined') {\n str += `view.height('${this.height()}')\\n`;\n }\n if (typeof this.edges() !== 'undefined') {\n const nedges = this.edges();\n const estrs = [];\n for (var i = 0; i < nedges.length; i++) {\n estrs.push(`['${nedges[i][0]}, ${nedges[i][1]}']`);\n }\n str += `view.edges('${estrs.join(', ')}')\\n`;\n }\n // eslint-disable-next-line no-redeclare\n for (var i = 0; i < this.rules.length; i++) {\n const x = this.rules[i].prettyPrint();\n if (x) str += `view.${x}\\n`;\n }\n return str;\n};\n\nWOQLGraphConfig.prototype.json = function () {\n const jr = [];\n for (let i = 0; i < this.rules.length; i++) {\n jr.push(this.rules[i].json());\n }\n const json = {};\n if (typeof this.literals() !== 'undefined') {\n json.literals = this.literals();\n }\n if (typeof this.source() !== 'undefined') {\n json.source = this.source();\n }\n if (typeof this.fontfamily() !== 'undefined') {\n json.fontfamily = this.fontfamily();\n }\n if (typeof this.show_force() !== 'undefined') {\n json.show_force = this.show_force();\n }\n if (typeof this.fix_nodes() !== 'undefined') {\n json.fix_nodes = this.fix_nodes();\n }\n if (typeof this.explode_out() !== 'undefined') {\n json.explode_out = this.explode_out();\n }\n if (typeof this.selected_grows() !== 'undefined') {\n json.selected_grows = this.selected_grows();\n }\n if (typeof this.width() !== 'undefined') {\n json.width = this.width();\n }\n if (typeof this.height() !== 'undefined') {\n json.height = this.height();\n }\n if (typeof this.edges() !== 'undefined') {\n json.edges = this.edges();\n }\n const mj = { graph: json, rules: jr };\n return mj;\n};\n\nfunction WOQLGraphRule(scope) {\n Config.WOQLViewRule.call(this, scope);\n}\n\nObject.setPrototypeOf(WOQLGraphRule.prototype, Config.WOQLViewRule.prototype);\n\nWOQLGraphRule.prototype.charge = function (v) {\n if (typeof v === 'undefined') {\n return this.rule.charge;\n }\n this.rule.charge = v;\n return this;\n};\n\nWOQLGraphRule.prototype.collisionRadius = function (v) {\n if (typeof v === 'undefined') {\n return this.rule.collisionRadius;\n }\n this.rule.collisionRadius = v;\n return this;\n};\n\nWOQLGraphRule.prototype.arrow = function (json) {\n if (json) {\n this.rule.arrow = json;\n return this;\n }\n return this.rule.arrow;\n};\n\nWOQLGraphRule.prototype.distance = function (d) {\n if (typeof d !== 'undefined') {\n this.rule.distance = d;\n return this;\n }\n return this.rule.distance;\n};\n\nWOQLGraphRule.prototype.symmetric = function (d) {\n if (typeof d !== 'undefined') {\n this.rule.symmetric = d;\n return this;\n }\n return this.rule.symmetric;\n};\n\nWOQLGraphRule.prototype.weight = function (w) {\n if (typeof w !== 'undefined') {\n this.rule.weight = w;\n return this;\n }\n return this.rule.weight;\n};\n\nWOQLGraphRule.prototype.prettyPrint = function () {\n let str = Config.WOQLViewRule.prototype.prettyPrint.apply(this);\n if (typeof this.charge() !== 'undefined') {\n str += `.charge('${this.charge()}')`;\n }\n if (typeof this.distance() !== 'undefined') {\n str += `.distance('${this.distance()}')`;\n }\n if (typeof this.weight() !== 'undefined') {\n str += `.weight('${this.weight()}')`;\n }\n if (typeof this.symmetric() !== 'undefined') {\n str += `.symmetric(${this.symmetric()})`;\n }\n if (typeof this.collisionRadius() !== 'undefined') {\n str += `.collisionRadius(${this.collisionRadius()})`;\n }\n if (typeof this.arrow() !== 'undefined') {\n str += `.arrow(${JSON.stringify(this.arrow())})`;\n }\n return str;\n};\n\nmodule.exports = WOQLGraphConfig;\n","/* eslint-disable consistent-return */\n/* eslint-disable prefer-destructuring */\n/* eslint-disable guard-for-in */\n/* eslint-disable max-len */\n/* eslint-disable no-redeclare */\n/* eslint-disable block-scoped-var */\n/* eslint-disable no-var */\n/* eslint-disable vars-on-top */\n/* eslint-disable no-plusplus */\n/* eslint-disable no-unused-vars */\n/* eslint-disable no-shadow */\n/* eslint-disable no-param-reassign */\n/* eslint-disable no-continue */\n/* eslint-disable no-console */\n/* eslint-disable no-restricted-syntax */\n/* eslint-disable no-use-before-define */\nconst FrameHelper = require('../utils');\nconst { FrameRule } = require('./frameRule');\nconst WOQL = require('../woql');\n\n/**\n * @file Javascript Terminus Document Classes\n * @license Apache Version 2\n * Helper classes for accessing documents returned by the Terminus DB API programmatically\n *\n * @example\n * let doc = new TerminusDocument(client);\n *\n * //These set the objects document property and return promises:\n *\n * doc.loadDocument(URL).then(() => console.log(this.document));\n * doc.loadComplete(URL, CLS).then(() => console.log(this.document))\n * doc.loadSchema(cls).then(() => console.log(this.document))\n *\n * //These just set the object's document property\n * doc.loadJSON(json_frames, cls) //console.log(this.document)\n * doc.loadDataFrames(json_frames, cls)\n * doc.loadClassFrames(json_frames, cls)\n * @example\n *\n * @description Represents a frame for programmatic access to object frame,\n * anywhere within a document\n * Recursive data structure where this.children contains an indexed array of object frames\n * and this.dataframes contains a property indexed array of data frames\n * Every object frame carries a reference to its classframe\n * This gives us instructions as to how to create new frames according to the schema\n * After that it's turtles all the way down.\n * @param cls - ID of the class (URL)\n * @param classframe - an array of frames representing a class\n * @param archetypes list of class frames\n * @param parent parent object\n * @returns\n */\n\nfunction ObjectFrame(cls, jsonld, classframes, parent) {\n // the class of the frame - mandatory\n this.empty();\n this.cls = FrameHelper.unshorten(cls);\n\n // array of frames representing the full class frame\n // (optional - required to be able to safely add missing properties)\n if (classframes && typeof classframes === 'object') {\n this.loadClassFrames(classframes);\n }\n // console.log(\"this\", this)\n if (jsonld && typeof jsonld === 'object' && Object.keys(jsonld).length) {\n this.originalDocument = jsonld;\n this.loadJSONLDDocument(jsonld);\n // console.log(\"this after jsonld doc call\", this)\n } else {\n this.originalDocument = false;\n }\n // parent object frame\n this.parent = parent;\n // set to true if this is a newly created document\n this.newDoc = false;\n}\n\n/**\n * Loads class frames for the object's class - the instructions about how to put an object together\n */\nObjectFrame.prototype.loadClassFrames = function (classframes) {\n for (let j = 0; j < classframes.length; j += 1) {\n if (classframes[j]['@context']) this.jsonld_context = classframes[j]['@context'];\n\n const cf = new ClassFrame(classframes[j], this);\n if (cf.isValid()) {\n if (!this.classframes) this.classframes = {};\n this.classframes[classframes[j].property] = cf;\n if (cf.isObject() && this.properties[classframes[j].property]) {\n for (let i = 0; i < this.properties[classframes[j].property].values.length; i += 1) {\n this.properties[classframes[j].property].values[i].loadClassFrames(classframes[j].frame);\n }\n }\n } else {\n // eslint-disable-next-line no-console\n console.log('Invalid classframe', cf);\n }\n }\n return this;\n};\n\n/**\n * Does this object have a schema loaded?\n */\nObjectFrame.prototype.hasSchema = function () {\n return !FrameHelper.empty(this.classframes);\n};\n\n/*\n * Loads an array of data frames into the object's internal index\n * {property: [frames]}\n */\n/* ObjectFrame.prototype.loadDataFrames = function (frames) {\n if (typeof frames !== 'object' || !frames.length) return undefined;\n if (!this.originalFrames) this.originalFrames = frames;\n if (!this.subjid && frames[0].domainValue) this.subjid = frames[0].domainValue;\n for (let i = 0; i < frames.length; i += 1) {\n if (frames[i]['@context']) this.jsonld_context = frames[i]['@context'];\n let cframe = this.getPropertyClassFrame(frames[i].property, frames[i]);\n if (cframe && cframe.isClassChoice()) {\n cframe = cframe.getChosenClassFrame(frames[i].range);\n if (!cframe) {\n console.log(`no choice frame ${frames[i].range}`);\n }\n } else if (cframe && cframe.isLogic()) {\n cframe = cframe.getChosenFrame(frames[i]);\n }\n if (cframe) {\n if (typeof this.properties[frames[i].property] === 'undefined') {\n this.properties[frames[i].property] = new PropertyFrame(frames[i].property, cframe, this);\n }\n this.properties[frames[i].property].addFrame(frames[i]);\n }\n }\n return this;\n}; */\n\nObjectFrame.prototype.loadJSONLDDocument = function (rdoc) { // KItty check herer\n if (typeof rdoc !== 'object') return undefined;\n const doc = FrameHelper.json_unshorten(rdoc);\n if (!this.originalDocument) this.originalDocument = doc;\n if (!this.subjid && doc['@id']) {\n this.subjid = FrameHelper.unshorten(doc['@id']);\n }\n if (doc['@context']) this.jsonld_context = doc['@context'];\n for (const prop in doc) {\n if (prop[0] === '@' || (typeof doc[prop] === 'object' && Object.keys(doc[prop]).length === 0)) continue;\n let cframe = this.getPropertyClassFrame(prop, doc);\n if (cframe && cframe.isClassChoice()) {\n // cframe = cframe.getChosenClassFrame(FrameHelper.unshorten(doc[prop][\"@type\"]),cframe.parent)\n if (!cframe) {\n console.log(`no choice frame ${doc[prop]['@type']}`);\n }\n } else if (cframe && cframe.isLogic()) {\n cframe = cframe.getChosenFrame(doc[prop]);\n }\n if (cframe) {\n if (typeof this.properties[prop] === 'undefined') {\n this.properties[prop] = new PropertyFrame(prop, cframe, this);\n }\n this.properties[prop].addJSONLDDocument(doc[prop]);\n }\n }\n return this;\n};\n\n/*\n * Serialises the javascript object as an array of frames\n */\nObjectFrame.prototype.getAsFrame = function (prop, parent) {\n prop = FrameHelper.unshorten(prop);\n if (this.parentframe) return this.parentframe;\n const ff = { type: 'objectProperty', property: prop };\n ff.range = this.cls;\n ff.domain = parent.cls;\n ff.domainValue = parent.subjid;\n ff.frame = [];\n for (const prop of Object.keys(this.properties)) {\n ff.frame = ff.frame.concat(ff.frame, this.properties[prop].getAsFrames());\n }\n return ff;\n};\n\nObjectFrame.prototype.getAsFrames = function (prop, parent) {\n let frames = [];\n for (const prop of Object.keys(this.properties)) {\n frames = frames.concat(frames, this.properties[prop].getAsFrames());\n }\n return frames;\n};\n\n/**\n * Cleans out object and sets everything empty\n */\nObjectFrame.prototype.empty = function () {\n // all indexed by property\n this.properties = {};\n this.restrictions = {};\n this.subjid = false;\n this.cls = false;\n};\n\n/*\n * Resets object state to original state\n */\nObjectFrame.prototype.reset = function (prop) {\n if (prop) {\n prop = FrameHelper.unshorten(prop);\n const props = [];\n for (let i = 0; i < this.originalFrames.length; i += 1) {\n if (this.originalFrames[i].property === prop) {\n props.push(this.originalFrames[i]);\n }\n }\n if (this.properties[prop]) this.properties[prop] = [];\n this.loadDataFrames(props);\n } else {\n this.restrictions = {};\n this.properties = {};\n this.loadDataFrames(this.originalFrames);\n }\n};\n\n/*\n * Clears out any specific information from a tree\n */\nObjectFrame.prototype.clear = function () {\n for (const prop of Object.keys(this.properties)) {\n this.properties[prop].clear();\n }\n return this;\n};\n\n/*\n * Filters the frame and its children\n */\nObjectFrame.prototype.mfilter = function (rules, onmatch) {\n const hits = new FrameRule().testRules(rules, this, onmatch);\n for (const prop of Object.keys(this.properties)) {\n if (!this.properties[prop].mfilter) {\n console.log(prop, this.properties[prop]);\n } else {\n this.properties[prop].mfilter(rules, onmatch);\n }\n }\n return this;\n};\n\n/**\n * If a class frame is present, it is returned for the given property\n * If no class frame is present and an instance frame is passed in the\n * this enables make it up as you go along editing\n * second argument a class frame will be created from the instance frame.\n */\nObjectFrame.prototype.getPropertyClassFrame = function (prop, jsonlddoc) {\n if (typeof prop === 'object') {\n return new ClassFrame(prop);\n }\n\n prop = FrameHelper.unshorten(prop);\n\n if (this.classframes && typeof this.classframes === 'object' && typeof this.classframes[prop] === 'object') {\n // console.log(\"returning \" + prop, this.classframes[prop])\n return this.classframes[prop];\n }\n if (jsonlddoc) {\n const cf = new ClassFrame();\n cf.loadFromJSONLD(jsonlddoc, prop);\n return cf;\n }\n if (this.properties[prop]) {\n return new ClassFrame(this.properties[prop].values[0]);\n }\n return false;\n};\n\n/*\n * Returns a list of properties - type can be filled|missing|all\n */\nObjectFrame.prototype.getProperties = function (type) {\n if (type === 'filled' || !this.classframes) {\n return Object.keys(this.properties);\n }\n if (type === 'missing') {\n const filled = Object.keys(this.properties).map((item) => FrameHelper.unshorten(item));\n const all = Object.keys(this.classframes).map((item) => FrameHelper.unshorten(item));\n const missing = [];\n for (let i = 0; i < all.length; i++) {\n if (filled.indexOf(all[i]) === -1 && missing.indexOf(all[i]) === -1) {\n missing.push(all[i]);\n }\n }\n return missing;\n }\n return Object.keys(this.classframes);\n};\n\n/**\n * Missing properties are those that are present in the classframe,\n * but not instantiated in the current object frame\n * for this to work we need to load the frame with the associated classframe\n */\nObjectFrame.prototype.getMissingPropertyList = function () {\n const missing = this.getProperties('missing');\n const nmissing = [];\n for (let i = 0; i < missing.length; i++) {\n const cframe = this.getPropertyClassFrame(missing[i]);\n if (cframe) {\n var newb = { label: cframe.getLabel(), value: missing[i] };\n } else {\n var newb = { label: missing[i], value: missing[i] };\n }\n nmissing.push(newb);\n }\n return nmissing;\n};\n\n/**\n * Returns a list of all the classes that can show up in the frame\n */\nObjectFrame.prototype.getPossibleContainedClasses = function () {\n const cls = [];\n function efcf(frames) {\n if (frames.type && frames.type === 'class_choice') {\n efcf(frames.operands);\n }\n if (!Array.isArray(frames)) frames = [frames];\n for (let i = 0; i < frames.length; i++) {\n if (frames[i].domain && cls.indexOf(frames[i].domain) === -1) cls.push(frames[i].domain);\n if (frames[i].frame) {\n efcf(frames[i].frame);\n }\n }\n }\n efcf(Object.values(this.classframes));\n return cls;\n};\n\nObjectFrame.prototype.getDocumentLinks = function () {\n const vals = [];\n const props = this.getProperties('filled');\n for (let i = 0; i < props.length; i++) {\n const mprop = this.properties[props[i]];\n for (let k = 0; k < mprop.values.length; k++) {\n const dval = mprop.values[k];\n if (dval.isObject() && dval.getDocumentLinks) {\n const nvals = dval.getDocumentLinks();\n for (let l = 0; l < nvals.length; l++) {\n if (vals.indexOf(nvals[l]) === -1) {\n vals.push(nvals[l]);\n }\n }\n } else if (dval.isDocument()) {\n const nv = dval.get();\n if (vals.indexOf(nv) === -1) {\n vals.push(nv);\n }\n }\n }\n }\n return vals;\n};\n\n/**\n * List of properties that are filled in the object\n */\nObjectFrame.prototype.getFilledPropertyList = function () {\n const props = this.getProperties('filled');\n const filled = [];\n for (let i = 0; i < props.length; i++) {\n const cframe = this.getPropertyClassFrame(props[i]);\n if (cframe) {\n var newb = { label: cframe.getLabel(), value: props[i] };\n } else {\n var newb = { label: props[i], value: props[i] };\n }\n filled.push(newb);\n }\n return filled;\n};\n\n/*\n * Fills the object frame from the schema - adding all the necessary property\n * frames, etc to make it complete\n */\nObjectFrame.prototype.fillFromSchema = function (newid) {\n if (newid) this.subjid = newid;\n newid = (newid || FrameHelper.genBNID(`${FrameHelper.urlFragment(this.cls)}_`));\n const properties = {};\n if (this.classframes) {\n for (const prop of Object.keys(this.classframes)) {\n const pf = this.getPropertyClassFrame(prop);\n properties[prop] = new PropertyFrame(prop, pf, this);\n properties[prop].fillFromSchema(newid);\n }\n }\n this.properties = properties;\n this.originalFrames = [];\n for (const prop of Object.keys(this.properties)) {\n this.originalFrames.push(this.properties[prop].getAsFrames());\n }\n return this;\n};\n\n/*\n * Clones an object frame to be a copy of the current frame\n */\nObjectFrame.prototype.clone = function (newid) {\n const properties = {};\n const cloned = new ObjectFrame(this.cls, false, false, this.parent);\n cloned.classframes = this.classframes;\n cloned.subjid = newid;\n for (const prop of Object.keys(this.properties)) {\n properties[prop] = this.properties[prop].clone();\n }\n cloned.properties = properties;\n return cloned;\n};\n\n/**\n * Returns a child frame with a particular id\n * If the second parameter is included, it will only look in that specific property\n * Otherwise searches all properties for the child\n */\nObjectFrame.prototype.getChild = function (childid, prop) {\n let pframe = this.getProperty(prop);\n for (let i = 0; i < pframe.values.length; pframe++) {\n if (pframe.values[i].isObject() && pframe.values[i].subject === childid) return pframe.values[i];\n }\n if (!prop) {\n for (const key of Object.keys(this.properties)) {\n for (let i = 0; i < this.properties[key].values.length; i += 1) {\n if (this.properties[key].values[i].subject() === childid) return this.properties[key].values[i];\n }\n }\n }\n return false;\n};\n\nObjectFrame.prototype.addProperty = function (prop, cls) {\n if (typeof prop !== 'object') prop = FrameHelper.unshorten(prop);\n const cframe = this.getPropertyClassFrame(prop);\n let ndata = false;\n if (cframe) {\n const nprop = new PropertyFrame(prop, cframe, this);\n if (cframe.isObject()) {\n if (!cframe.isClassChoice()) {\n ndata = cframe.createEmpty(FrameHelper.genBNID(`${FrameHelper.urlFragment(cframe.range)}_`));\n }\n if (cls) {\n ndata = cframe.createEmptyChoice(cls, FrameHelper.genBNID(`${FrameHelper.urlFragment(cls)}_`));\n }\n const clss = cframe.getClassChoices();\n if (clss && clss.length) {\n ndata = cframe.createEmptyChoice(clss[0], FrameHelper.genBNID(`${FrameHelper.urlFragment(clss[0])}_`));\n }\n } else {\n ndata = cframe.createEmpty();\n }\n if (ndata) {\n nprop.addValueFrame(ndata);\n }\n if (typeof this.properties[prop] === 'undefined') {\n if (typeof prop === 'object') var p = prop.property;\n else var p = prop;\n this.properties[p] = nprop;\n // this.properties[prop] = nprop;\n }\n // else {\n // this.properties[prop].push(nprop);\n // }\n nprop.status = 'new';\n return nprop;\n }\n return false;\n};\n\nObjectFrame.prototype.addPropertyValue = function (prop, value) {\n prop = FrameHelper.unshorten(prop);\n if (this.properties[prop]) return this.properties[prop].addValue(value);\n return null;\n};\n\nObjectFrame.prototype.removeProperty = function (prop) {\n prop = FrameHelper.unshorten(prop);\n if (typeof this.properties[prop] !== 'undefined') {\n delete (this.properties[prop]);\n }\n};\n\nObjectFrame.prototype.removePropertyValue = function (prop, value, index) {\n prop = FrameHelper.unshorten(prop);\n const pframe = this.properties[prop];\n pframe.removeValue(value, index);\n if (pframe.values.length === 0) {\n this.removeProperty(prop);\n }\n};\n\nObjectFrame.prototype.error = function (msg) {\n if (!this.errors) this.errors = [];\n this.errors.push({ type: 'Internal Object Frame Error', msg });\n};\n\nObjectFrame.prototype.extract = function () {\n const extracts = {};\n for (const prop in this.properties) {\n const extracted = this.properties[prop].extract();\n if (!FrameHelper.empty(extracted)) {\n if (typeof extracts[prop] === 'undefined') extracts[prop] = [];\n extracts[prop] = extracts[prop].concat(extracted);\n }\n if (extracts[prop] && extracts[prop].length === 1) extracts[prop] = extracts[prop][0];\n }\n if (FrameHelper.empty(extracts) && this.parent) {\n return false;\n }\n\n const ext = this.extractJSONLD(extracts);\n return ext;\n};\n\nObjectFrame.prototype.extractJSONLD = function (extracts) {\n extracts['@type'] = this.cls;\n if (this.subject() !== '_:') extracts['@id'] = this.subject();\n if (this.jsonld_context) extracts['@context'] = this.jsonld_context;\n return extracts;\n};\n\nObjectFrame.prototype.subject = function () {\n return this.subjid || '';\n};\n\nObjectFrame.prototype.get = ObjectFrame.prototype.subject;\nObjectFrame.prototype.set = function (val) {\n this.subjid = val;\n};\n\nObjectFrame.prototype.isObject = function () { return true; };\nObjectFrame.prototype.isProperty = function () { return false; };\nObjectFrame.prototype.isData = function () { return false; };\nObjectFrame.prototype.isClassChoice = function () {\n return (this.frame && this.frame.type === 'class_choice');\n};\n\nObjectFrame.prototype.subjectClass = function () {\n return this.cls;\n};\n\nObjectFrame.prototype.depth = function () {\n if (this.parent) return (this.parent.depth() + 1);\n return 0;\n};\n\nObjectFrame.prototype.getProperty = function (prop) {\n return this.properties[prop];\n};\n\nObjectFrame.prototype.first = function (prop) {\n if (this.properties && this.properties[prop]) {\n return this.properties[prop].first();\n }\n};\n\nObjectFrame.prototype.property = function (prop) {\n if (this.parent) return this.parent.property();\n return false;\n};\n\nObjectFrame.prototype.parentObject = function () {\n if (this.parent && this.parent.parent) {\n return this.parent.parent;\n }\n return false;\n};\n\nObjectFrame.prototype.root = function () {\n if (this.parent) return false;\n return true;\n};\n\nObjectFrame.prototype.renderProperties = function () {\n const props = this.sortProperties();\n const nprops = [];\n for (let i = 0; i < props.length; i++) {\n if (this.properties[props[i]].render) {\n const rend = this.properties[props[i]].render(this.properties[props[i]]);\n if (rend) nprops.push(rend);\n }\n }\n return nprops;\n};\n\nObjectFrame.prototype.sortProperties = function () {\n const unsorted = Object.keys(this.properties);\n if (this.compare) {\n return unsorted.sort((a, b) => this.compare(a, b, this));\n }\n return unsorted.sort((a, b) => this.standardCompare(a, b, this));\n};\n\n/*\n * Label first, then datatype properties, then object properties\n */\nObjectFrame.prototype.standardCompare = function (a, b, doc) {\n if (FrameHelper.shorten(a) === 'rdfs:label') return -1;\n if (FrameHelper.shorten(b) === 'rdfs:label') return 1;\n if (FrameHelper.shorten(a) === 'rdfs:comment') return -1;\n if (FrameHelper.shorten(b) === 'rdfs:comment') return 1;\n if (doc.properties[a].isData() && doc.properties[b].isObject()) return -1;\n if (doc.properties[b].isData() && doc.properties[a].isObject()) return 1;\n return 0;\n};\n\nObjectFrame.prototype.cardControlAllows = function (action) {\n if (!this.parent) return true;\n if (this.parent.cframe.hasRestriction()) {\n const rest = this.parent.cframe.restriction;\n const currentnum = this.parent.values.length;\n if (action === 'add' || action === 'clone') {\n if (rest.max && currentnum >= rest.max) {\n return false;\n }\n }\n if (action === 'delete' && (rest.min && currentnum <= rest.min)) {\n return false;\n }\n }\n return true;\n};\n\nObjectFrame.prototype.isUpdated = function () {\n let i = 0;\n for (const prop in this.properties) {\n if (this.originalFrames[i] !== prop) return true;\n if (this.properties[prop].isUpdated()) return true;\n i++;\n }\n if (i !== this.originalFrames.length) return true;\n return false;\n};\n\nObjectFrame.prototype.isNew = function () {\n return (this.subject().substring(0, 2) === '_:');\n};\n\nObjectFrame.prototype.getSummary = function () {\n const ret = { status: 'ok' };\n if (this.isUpdated()) ret.status = 'updated';\n if (this.isNew()) ret.status = 'new';\n ret.propcount = 0;\n for (const prop in this.properties) {\n ret.propcount++;\n }\n ret.long = `${ret.propcount} properties`;\n return ret;\n};\n\nObjectFrame.prototype.saveQuery = function () {\n const q = WOQL.update_object(this.extract());\n this.pathToDoc(q);\n return q;\n};\n\nObjectFrame.prototype.pathToDoc = function (q) {\n q.add_triple(this.subjid, 'type', this.cls);\n if (this.parent) {\n q.add_triple(this.parent.subject(), 'type', this.parent.subjectClass());\n q.add_triple(this.parent.subject(), this.parent.predicate, this.subjid);\n if (this.parent.parent) {\n this.parent.parent.pathToDoc(q);\n }\n }\n};\n\nObjectFrame.prototype.deleteQuery = function () {\n const q = WOQL.delete_object(this.subjid);\n if (this.parent) {\n q.delete_triple(this.parent.subject(), this.parent.predicate, this.subjid);\n }\n return q;\n};\n\nfunction PropertyFrame(property, cframe, parent) {\n this.predicate = property;\n this.cframe = cframe;\n this.parent = parent;\n this.values = [];\n}\n\nPropertyFrame.prototype.addJSONLDDocument = function (jsonld) {\n if (this.cframe.isData()) {\n if (Array.isArray(jsonld)) {\n for (var i = 0; i < jsonld.length; i++) {\n var df = new DataFrame(jsonld[i], this, this.values.length);\n this.values.push(df);\n }\n } else {\n var df = new DataFrame(jsonld, this, this.values.length);\n this.values.push(df);\n }\n } else if (Array.isArray(jsonld)) {\n for (var i = 0; i < jsonld.length; i++) {\n const kid = new ObjectFrame(FrameHelper.unshorten(jsonld[i]['@type']), jsonld[i], this.cframe.frame, this);\n this.values.push(kid);\n }\n } else {\n const kid = new ObjectFrame(jsonld['@type'], jsonld, this.cframe.frame, this);\n this.values.push(kid);\n }\n};\n\nPropertyFrame.prototype.addFrame = function (frame) {\n if (this.cframe.isData()) {\n const df = new DataFrame(frame, this, this.values.length);\n this.values.push(df);\n } else {\n const kid = new ObjectFrame(this.range(), this.cframe.frame, frame.frame, this, frame);\n this.values.push(kid);\n }\n};\n\nPropertyFrame.prototype.addValueFrame = function (oframe) {\n if (oframe) {\n oframe.parent = this;\n oframe.index = this.values.length;\n this.values.push(oframe);\n }\n};\n\nPropertyFrame.prototype.addValue = function (val) {\n const nu = this.createEmpty();\n if (val) nu.set(val);\n this.addValueFrame(nu);\n return nu;\n};\n\nPropertyFrame.prototype.fillFromSchema = function (newid) {\n if (this.isData() || (this.isObject() && !this.isClassChoice())) {\n const values = [];\n if (this.cframe.hasRestriction() && this.cframe.restriction.min) {\n for (let i = 0; i < this.cframe.restriction.min; i += 1) {\n var nframe = this.createEmpty(newid);\n nframe.parent = this;\n values.push(nframe);\n }\n } else {\n var nframe = this.createEmpty(newid);\n nframe.parent = this;\n values.push(nframe);\n }\n this.values = values;\n } else if (this.isClassChoice()) {\n const clss = this.cframe.getClassChoices();\n if (clss && clss.length) {\n const empty = this.cframe.createEmptyChoice(clss[0], FrameHelper.genBNID(`${FrameHelper.urlFragment(clss[0])}_`));\n empty.parent = this;\n this.values = [empty];\n }\n }\n};\n\nPropertyFrame.prototype.isData = function () {\n return this.cframe.isData();\n};\n\nPropertyFrame.prototype.isObject = function () {\n return this.cframe.isObject();\n};\n\nPropertyFrame.prototype.isProperty = function () {\n return true;\n};\n\nPropertyFrame.prototype.property = function () {\n return this.predicate;\n};\n\nPropertyFrame.prototype.extract = function () {\n const extracts = [];\n const hasVal = (val) => {\n if (val['@value']) {\n for (var i = 0; i < extracts.length; i++) {\n if (extracts[i]['@value'] && extracts[i]['@value'] === val['@value']\n && extracts[i]['@type'] && extracts[i]['@type'] === val['@type']) return true;\n }\n return false;\n }\n if (val['@id']) {\n for (var i = 0; i < extracts.length; i++) {\n if (extracts[i]['@id'] && extracts[i]['@id'] === val['@id']) return true;\n }\n return false;\n }\n };\n\n for (let i = 0; i < this.values.length; i++) {\n const val = this.values[i].extract();\n if (val !== '' && val !== false && typeof val !== 'undefined' && !hasVal(val)) extracts.push(val);\n }\n return extracts;\n};\n\nPropertyFrame.prototype.subject = function () {\n return (this.parent ? this.parent.subject() : false);\n};\nPropertyFrame.prototype.subjectClass = function () {\n return (this.parent ? this.parent.subjectClass() : false);\n};\nPropertyFrame.prototype.depth = function () {\n return (this.parent ? this.parent.depth() : false);\n};\nPropertyFrame.prototype.updated = function () {\n return (this.parent ? this.parent.childUpdated() : false);\n};\nPropertyFrame.prototype.range = function () {\n return (this.cframe ? this.cframe.range : '');\n};\nPropertyFrame.prototype.getLabel = function () {\n return (\n // this.cframe ? this.cframe.getLabel() : '');\n this.cframe ? this.cframe.getLabel() : this.predicate.getLabel());\n};\nPropertyFrame.prototype.getComment = function () {\n return (this.cframe ? this.cframe.getComment() : false);\n};\nPropertyFrame.prototype.hasCardinalityRestriction = function () {\n return (this.cframe ? this.cframe.hasRestriction() : false);\n};\nPropertyFrame.prototype.getRestriction = function () {\n return (this.cframe ? this.cframe.restriction : false);\n};\nPropertyFrame.prototype.isClassChoice = function () {\n return (this.cframe ? this.cframe.isClassChoice() : false);\n};\n\nPropertyFrame.prototype.deletePropertyValue = function (value, index) {\n this.parent.removePropertyValue(this.property(), value, index);\n};\n\nPropertyFrame.prototype.removeValue = function (value, index) {\n const nvals = [];\n for (let i = 0; i < this.values.length; i++) {\n if (this.values[i].index !== value.index) {\n nvals.push(this.values[i]);\n }\n }\n this.values = nvals;\n /* let nvals = [] //trial\n for(var i = 0; i<this.values.length; i++){\n if(this.values[i].get() != value){\n nvals.push(this.values[i])\n }\n }\n this.values = nvals */\n};\n\nPropertyFrame.prototype.get = function () {\n const gets = [];\n for (let i = 0; i < this.values.length; i++) {\n if (this.values[i]) {\n const x = this.values[i].get();\n if (x) gets.push(x);\n }\n }\n return gets;\n};\n\nPropertyFrame.prototype.set = function (val) {\n for (let i = 0; i < this.values.length; i++) {\n if (this.values[i]) {\n this.values[i].set(val);\n }\n }\n};\n\nPropertyFrame.prototype.clear = function () {\n for (let i = 0; i < this.values.length; i++) {\n this.values[i].clear();\n }\n};\n\nPropertyFrame.prototype.clone = function () {\n const cvalues = [];\n const cloned = new PropertyFrame(this.predicate, this.cframe, this.parent);\n for (let i = 0; i < this.values.length; i++) {\n cvalues.push(this.values[i].clone());\n }\n cloned.values = cvalues;\n return cloned;\n //\n};\n\nPropertyFrame.prototype.getAsFrames = function () {\n let fs = [];\n for (let i = 0; i < this.values.length; i++) {\n if (this.values[i]) {\n if (this.isData()) {\n fs.push(this.values[i].getAsFrame());\n } else {\n fs = fs.concat(this.values[i].getAsFrames());\n }\n }\n }\n return fs;\n};\n\nPropertyFrame.prototype.createEmpty = function () {\n if (this.cframe.isData()) {\n const df = this.cframe.copy(this.subject());\n df.set('');\n df.status = 'new';\n return df;\n }\n if (this.cframe.isObject()) {\n if (!this.cframe.isClassChoice()) {\n const df = this.cframe.createEmpty(FrameHelper.genBNID(`${FrameHelper.urlFragment(this.cframe.range)}_`));\n df.status = 'new';\n return df;\n }\n\n const df = new ClassFrame(this.cframe);\n df.status = 'new';\n return df;\n }\n};\n\nPropertyFrame.prototype.mfilter = function (rules, onmatch) {\n const hits = new FrameRule().testRules(rules, this, onmatch);\n for (let i = 0; i < this.values.length; i++) {\n this.values[i].mfilter(rules, onmatch);\n }\n return this;\n};\n\n/*\n * Shorthand functions to make it easier to access the underlying data\n */\n\nPropertyFrame.prototype.first = function () {\n if (this.values && this.values[0]) {\n return this.values[0].get();\n }\n};\n\nPropertyFrame.prototype.renderValues = function () {\n const sortedVals = this.sortValues();\n const vals = [];\n for (let i = 0; i < sortedVals.length; i++) {\n if (sortedVals[i] && sortedVals[i].render) {\n const rend = sortedVals[i].render(sortedVals[i]);\n if (rend) vals.push(rend);\n }\n }\n return vals;\n};\n\nPropertyFrame.prototype.sortValues = function () {\n if (this.compare) {\n return this.values.sort((a, b) => this.compare(a, b, this));\n }\n return this.values;\n};\n\nPropertyFrame.prototype.cardControlAllows = function (action) {\n if (this.cframe.hasRestriction()) {\n const rest = this.cframe.restriction;\n const currentnum = this.values.length;\n if (action === 'add' || action === 'clone') {\n if (rest.max && currentnum >= rest.max) {\n return false;\n }\n }\n if (action === 'delete' && (rest.min)) {\n return false;\n }\n }\n return true;\n};\n\nPropertyFrame.prototype.isUpdated = function () {\n return true;\n // eslint-disable-next-line no-unreachable\n if (this.values.length !== this.originalValues.length) return true;\n for (let i = 0; i < this.values.length; i++) {\n if (this.cframe && this.cframe.isData()) {\n if (this.values[i].value() !== this.originalValues[i]) {\n return true;\n }\n } else {\n if (this.values[i].subject() !== this.originalValues[i]) {\n return true;\n }\n if (this.values[i].isUpdated()) {\n return true;\n }\n }\n }\n return false;\n};\n\nPropertyFrame.prototype.saveQuery = function () {\n const q = WOQL.query();\n for (let i = 0; i < this.values.length; i++) {\n q.and(this.values[i].saveQuery());\n }\n this.parent.pathToDoc(q);\n return q;\n};\n\nPropertyFrame.prototype.deleteQuery = function () {\n const q = WOQL.query();\n for (let i = 0; i < this.values.length; i++) {\n q.and(this.values[i].deleteQuery());\n }\n return q;\n};\n\nfunction DataFrame(jsonld, parent, index) {\n this.err = false;\n this.index = index;\n if (parent) {\n this.loadParent(parent);\n }\n if (jsonld) {\n this.rangeValue = jsonld;\n if (jsonld['@type']) this.range = jsonld['@type'];\n if (jsonld['@language']) this.language = jsonld['@language'];\n if (!this.type) this.type = (jsonld['@value'] ? 'datatypeProperty' : 'objectProperty');\n }\n return this;\n}\n\nDataFrame.prototype.loadParent = function (parent, index) {\n this.parent = parent;\n this.type = parent.type;\n // the id of the object that owns this dataframe\n this.domainValue = parent.subject();\n this.subjid = (parent.subject() || false);\n this.domain = parent.cframe ? parent.cframe.domain : parent.subjectClass();\n this.predicate = parent.cframe ? parent.cframe.predicate : parent.property();\n this.frame = parent.cframe ? parent.cframe.frame : false;\n this.label = parent.getLabel();\n this.comment = parent.getComment();\n this.range = ((parent && parent.cframe) ? parent.cframe.range : false);\n const restriction = (parent.cframe ? parent.cframe.restriction : false);\n this.restriction = false;\n if (restriction && typeof restriction === 'object') {\n this.restriction = new Restriction(restriction);\n }\n};\n\nDataFrame.prototype.copy = function (newid) {\n const copy = new DataFrame();\n copy.parent = this.parent;\n copy.range = this.range;\n copy.rangeValue = this.rangeValue;\n copy.index = this.index;\n copy.type = this.type;\n copy.domain = this.domain;\n copy.domainValue = newid || this.domainValue;\n copy.predicate = this.predicate;\n copy.frame = this.frame;\n copy.label = this.label;\n copy.comment = this.comment;\n if (this.restriction) copy.restriction = this.restriction;\n if (this.language) copy.language = this.language;\n return copy;\n};\n\nDataFrame.prototype.mfilter = function (rules, onmatch) {\n const hits = new FrameRule().testRules(rules, this, onmatch);\n return this;\n};\n\nDataFrame.prototype.reset = function () {\n this.set(this.originalValue);\n // this.redraw();\n};\n\nDataFrame.prototype.clone = function () {\n const newb = this.parent.addPropertyValue(this.get());\n};\n\nDataFrame.prototype.depth = function () { return (this.parent ? this.parent.depth() : false); };\nDataFrame.prototype.property = function () { return (this.parent ? this.parent.property() : false); };\nDataFrame.prototype.subject = function () { return (this.parent ? this.parent.subject() : false); };\nDataFrame.prototype.subjectClass = function () { return (this.parent ? this.parent.subjectClass() : false); };\nDataFrame.prototype.type = function () { return (this.range ? this.range : false); };\n\nDataFrame.prototype.isValidType = function (dt) {\n const vtypes = ['datatypeProperty', 'objectProperty', 'restriction '];\n if (vtypes.indexOf(dt) === -1) return false;\n return true;\n};\n\nDataFrame.prototype.getAsFrame = function () {\n const ff = { type: this.type, property: this.property() };\n if (this.range) ff.range = this.range;\n if (this.rangeValue) ff.rangeValue = this.rangeValue;\n if (this.domain) ff.domain = this.domain;\n if (this.domainValue) ff.domainValue = this.domainValue;\n if (this.frame) ff.frame = this.frame;\n if (this.label) ff.label = this.label;\n if (this.comment) ff.comment = this.comment;\n return ff;\n};\n\nDataFrame.prototype.hasRestriction = function () {\n if (this.restriction) {\n return this.restriction.hasCardRestriction();\n }\n return false;\n};\n\nDataFrame.prototype.getLabel = function () {\n let lab = '';\n if (FrameHelper.shorten(this.predicate) === 'rdfs:label') return 'Name';\n if (FrameHelper.shorten(this.predicate) === 'rdfs:comment') return 'Description';\n if (this.label && typeof this.label === 'object') lab = this.label['@value'];\n if (this.label && typeof this.label === 'string') lab = this.label;\n // always return something\n if (!lab && this.predicate) {\n lab = FrameHelper.labelFromURL(this.predicate);\n }\n if (!lab) lab = FrameHelper.labelFromURL(this.cls);\n return lab;\n};\n\nDataFrame.prototype.getType = function () {\n if (this.range) return this.range;\n if (this.rangeValue && this.rangeValue['@type']) return this.rangeValue['@type'];\n return false;\n};\n\nObjectFrame.prototype.getLabel = DataFrame.prototype.getLabel;\n\nDataFrame.prototype.getComment = function () {\n let comment = '';\n if (this.comment && typeof this.comment === 'object') comment = this.comment['@value'];\n if (this.comment && typeof this.comment === 'string') comment = this.comment;\n return comment;\n};\n\nObjectFrame.prototype.getComment = DataFrame.prototype.getComment;\n\nDataFrame.prototype.error = function (msg) {\n if (msg) this.err = msg;\n if (!this.errors) this.errors = [];\n this.errors.push({ type: 'Internal Data Frame Error', msg });\n return this.err;\n};\n\nDataFrame.prototype.isValid = function () {\n if (!(this.type && this.isValidType(this.type))) {\n this.error(`Missing or Illegal Frame Type ${this.type}`);\n return false;\n }\n if (!(this.predicate)) {\n this.error('Missing Frame Property');\n return false;\n }\n if (!(this.domain)) {\n this.error('Missing Frame Domain');\n return false;\n }\n if (!(this.range)) {\n this.error('Missing Frame Range');\n return false;\n }\n if (this.isObjectProperty() && !(this.frame && typeof this.frame === 'object')) {\n this.error('Missing Object Frame');\n return false;\n }\n return true;\n};\n\nDataFrame.prototype.isObjectProperty = function () {\n return this.type === 'objectProperty';\n};\n\nDataFrame.prototype.isData = function () {\n return true;\n};\n\nDataFrame.prototype.isDatatypeProperty = function () {\n return this.type === 'datatypeProperty';\n};\n\nDataFrame.prototype.isLogic = function () {\n if (this.type === 'and' || this.type === 'or' || this.type === 'xor') {\n return true;\n }\n return false;\n};\n\nDataFrame.prototype.isRestriction = function () {\n return this.type === 'restriction';\n};\n\nDataFrame.prototype.ftype = function () {\n if (this.isDocument()) return 'document';\n if (this.isDatatypeProperty()) return 'data';\n if (this.isChoice()) return 'oneOf';\n if (this.isObject()) return 'object';\n if (this.isLogic()) return 'logic';\n if (this.isClassChoice()) return 'class_choice';\n return undefined;\n};\n\nDataFrame.prototype.isClassChoice = function () {\n return (this.frame && this.frame.type === 'class_choice');\n};\n\nDataFrame.prototype.isString = function () {\n if (this.range === FrameHelper.getStdURL('xsd', 'string')) {\n return true;\n }\n return false;\n};\n\nDataFrame.prototype.getChoiceOptions = function () {\n const opts = [];\n for (let i = 0; i < this.frame.elements.length; i += 1) {\n const option = {};\n if (this.frame.elements[i].label) {\n option.label = this.frame.elements[i].label['@value'];\n } else {\n option.label = FrameHelper.labelFromURL(this.frame.elements[i].class);\n }\n option.value = this.frame.elements[i].class;\n opts.push(option);\n }\n return opts;\n};\n\nDataFrame.prototype.lang = function () {\n return this.language || 'en';\n};\n\nDataFrame.prototype.isChoice = function () {\n return (this.frame && this.frame.type === 'oneOf');\n};\n\nDataFrame.prototype.isDocument = function () {\n return (this.frame && this.frame.type === 'document');\n};\n\nDataFrame.prototype.isObject = function () {\n return (this.isObjectProperty() && this.frame && !(this.isChoice() || this.isDocument()));\n};\n\nDataFrame.prototype.isProperty = function () {\n return false;\n};\n\nDataFrame.prototype.getTypeShorthand = function () {\n if (this.isDocument()) return 'document';\n if (this.isChoice()) return 'choice';\n const sh = FrameHelper.getShorthand(this.getType());\n return (sh || this.getType());\n};\n\nDataFrame.prototype.get = function () {\n if (this.contents) {\n return this.contents;\n }\n if (this.isDatatypeProperty() && this.rangeValue && typeof this.rangeValue['@value'] !== 'undefined') {\n return this.rangeValue['@value'];\n }\n if (this.isChoice() || this.isDocument()) {\n return (this.rangeValue && this.rangeValue['@id'] ? this.rangeValue['@id'] : '');\n }\n return '';\n};\n\nDataFrame.prototype.set = function (value, normalizer) {\n if (normalizer) value = normalizer(value, this);\n this.contents = value;\n if (this.isChoice() || this.isDocument()) {\n this.frame.domainValue = value;\n }\n if (this.isDatatypeProperty()) {\n if (!this.rangeValue) this.rangeValue = { '@type': this.range };\n this.rangeValue['@value'] = value;\n }\n};\n\nDataFrame.prototype.clear = function () {\n if (this.isDocument() || this.isChoice() || this.isDatatypeProperty()) {\n this.set('');\n }\n};\n\nDataFrame.prototype.cardControlAllows = function (action) {\n if (this.parent.cframe.hasRestriction()) {\n const rest = this.parent.cframe.restriction;\n const currentnum = this.parent.values.length;\n if (action === 'add' || action === 'clone') {\n if (rest.max && currentnum >= rest.max) {\n return false;\n }\n }\n if (action === 'delete' && (rest.min && currentnum <= rest.min)) {\n return false;\n }\n }\n return true;\n};\n\nDataFrame.prototype.extract = function () {\n const val = this.get();\n if (val !== '' && val !== false) {\n const objlit = {};\n if (!this.isDocument()) {\n objlit['@type'] = this.getType();\n }\n if (this.isChoice() || this.isDocument()) {\n objlit['@id'] = val;\n } else {\n objlit['@value'] = val;\n }\n if (this.language) {\n objlit['@language'] = this.language;\n }\n return objlit;\n }\n return val;\n};\n\nDataFrame.prototype.saveQuery = function (newval, ntype, nlang) {\n let upd;\n if (newval === '') return false;\n if (this.isDocument() || this.isChoice()) {\n upd = WOQL.iri(newval);\n } else {\n upd = { '@value': newval };\n upd['@type'] = ntype || this.range;\n if (nlang || this.language) upd['@language'] = nlang || this.language;\n }\n let q;\n if (this.get() !== '') {\n q = WOQL.update_triple(this.parent.subject(), this.predicate, upd, this.extract());\n } else {\n q = WOQL.add_triple(this.parent.subject(), this.predicate, upd);\n }\n\n if (this.parent.parent) {\n this.parent.parent.pathToDoc(q);\n }\n return q;\n};\n\nDataFrame.prototype.deleteQuery = function () {\n const q = WOQL.delete_triple(this.subject(), this.predicate, this.extract());\n return q;\n};\n\n/*\n * Class frames represent the archetypal version of a property frame as returned by the class frame api\n */\nfunction ClassFrame(frame, parent, label) {\n this.err = false;\n this.parent = parent;\n // the id of the object that owns this dataframe\n this.subjid = (parent ? parent.subjid : false);\n if (frame) {\n if (frame.label) {\n const dl = label || '';\n if (frame.label['@value']) this.label = frame.label['@value'];\n else if (frame.label) this.label = frame.label;\n else this.label = dl;\n }\n this.load(frame);\n }\n}\n\nClassFrame.prototype = DataFrame.prototype;\n\nClassFrame.prototype.load = function (frame) {\n if (typeof frame !== 'object') {\n this.error('No frame passed to load');\n return;\n }\n this.domainValue = frame.domainValue;\n this.subjid = (frame.domainValue ? frame.domainValue : false);\n this.type = frame.type;\n this.domain = frame.domain;\n this.predicate = frame.property;\n this.frame = frame.frame;\n this.comment = frame.comment ? frame.comment['@value'] : '';\n this.range = frame.range;\n\n // all the meta-data carried in frames:\n this.rangeValue = frame.rangeValue;\n};\n\nClassFrame.prototype.loadFromJSONLD = function (jsonld, prop) {\n if (jsonld[prop]) {\n this.predicate = FrameHelper.unshorten(prop);\n this.type = (jsonld[prop]['@value'] ? 'datatypeProperty' : 'objectProperty');\n this.range = FrameHelper.unshorten(jsonld[prop]['@type']);\n this.rangeValue = jsonld[prop]['@id'] ? jsonld[prop]['@id'] : jsonld[prop];\n }\n this.domain = FrameHelper.unshorten(jsonld['@type']);\n this.domainValue = FrameHelper.unshorten(jsonld['@id']);\n this.label = FrameHelper.labelFromURL(this.predicate);\n this.comment = '';// this.getComment()\n};\n\nClassFrame.prototype.isClassChoice = function () {\n return (this.frame && this.frame.type === 'class_choice');\n};\n\nClassFrame.prototype.loadFromObjectFrame = function (par, child) {\n // all the meta-data carried in frames:\n this.type = 'objectProperty';\n this.predicate = par.property;\n this.range = par.range;\n this.rangeValue = child.subjid;\n this.domain = par.cls;\n this.domainValue = par.subjid;\n this.label = par.getLabel();\n this.comment = par.getComment();\n this.restriction = par.restriction;\n};\n\nClassFrame.prototype.createEmptyChoice = function (cls, newid) {\n const cf = this.getChosenClassFrames(cls);\n const objframe = new ObjectFrame(cls);\n if (newid) objframe.subjid = newid;\n objframe.loadClassFrames(cf);\n const fframe = objframe.fillFromSchema();\n fframe.status = 'new';\n return fframe;\n};\n\nClassFrame.prototype.getChosenClassFrames = function (chosen) {\n let nc = [];\n for (let i = 0; i < this.frame.operands.length; i += 1) {\n for (let j = 0; j < this.frame.operands[i].length; j += 1) {\n if (chosen === this.frame.operands[i][j].domain) {\n nc = nc.concat(this.frame.operands[i][j]);\n }\n }\n }\n return nc;\n};\n\nClassFrame.prototype.createEmpty = function (newid) {\n let objframe;\n if (this.isObject()) {\n if (this.isClassChoice()) {\n // objframe=new ObjectFrame(this.predicate, {}, this)\n objframe = new ObjectFrame(this.predicate);\n } else {\n objframe = new ObjectFrame(this.range);\n }\n if (newid) objframe.subjid = newid;\n objframe.loadClassFrames(this.frame);\n const fframe = objframe.fillFromSchema();\n fframe.status = 'new';\n return fframe;\n }\n if (this.isData()) {\n const dataframe = this.copy(newid);\n dataframe.set('');\n dataframe.status = 'new';\n return dataframe;\n }\n return undefined;\n};\n\nClassFrame.prototype.cloneDataFrame = function (newid, other) {\n return other;\n};\n\nClassFrame.prototype.clone = function (newid, other) {\n if (this.isObject()) {\n console.log('cannot clone class frame');\n } else if (this.isData()) {\n return this.cloneDataFrame(newid, other);\n }\n return undefined;\n};\n\nClassFrame.prototype.getClassChoices = function () {\n const choices = [];\n // if (this.frame.operands) {\n /* for (let i = 0; i < this.frame.operands.length; i += 1) {\n for (let j = 0; j < this.frame.operands[i].length; j += 1) {\n const domcls = this.frame.operands[i][j].domain;\n if (domcls && choices.indexOf(domcls) === -1) {\n choices.push(domcls);\n }\n }\n } */\n // }\n return choices;\n};\n\nClassFrame.prototype.getChosenClassFrame = function (chosen, parent) {\n for (let i = 0; i < this.frame.operands.length; i += 1) {\n const operand = this.frame.operands[i];\n if (operand.class && chosen === operand.class) {\n const cf = new ClassFrame(operand, parent, this.label);\n return cf;\n }\n }\n return false;\n};\n\nClassFrame.prototype.getChosenFrame = function (dataframe) {\n return dataframe;\n};\n\nClassFrame.prototype.isData = function () {\n return (this.isDocument() || this.isChoice() || this.isDatatypeProperty());\n};\n\nfunction Restriction(restriction) {\n this.min = 0;\n this.max = 0;\n if (restriction) this.loadRestriction(restriction);\n}\n\nRestriction.prototype.hasCardRestriction = function () {\n if (this.min === 0 && this.max === 0) return false;\n return true;\n};\n\nRestriction.prototype.loadRestriction = function (restriction) {\n if (typeof restriction.cardinality !== 'undefined') {\n this.max = restriction.cardinality;\n this.min = restriction.cardinality;\n } else if (typeof restriction.maxCardinality !== 'undefined') {\n this.max = restriction.maxCardinality;\n } else if (typeof restriction.minCardinality !== 'undefined') {\n this.min = restriction.minCardinality;\n } else if (typeof restriction.type !== 'undefined' && restriction.type === 'and' && typeof restriction.operands === 'object') {\n for (let i = 0; i < restriction.operands.length; i += 1) {\n const nrest = new Restriction(restriction.operands[i]);\n if (this.max === 0 && nrest.max > 0) this.max = nrest.max;\n else if (this.max > 0 && nrest.max > 0 && nrest.max < this.max) this.max = nrest.max;\n if (this.min === 0 && nrest.min > 0) this.min = nrest.min;\n else if (this.min > 0 && nrest.min > 0 && nrest.min > this.min) this.min = nrest.min;\n }\n }\n};\n\nmodule.exports = ObjectFrame;\n","const Config = require('./viewConfig');\nconst WOQLStream = require('./woqlStream');\n\nfunction WOQLStreamConfig() {\n Config.ViewConfig.call(this);\n this.type = 'stream';\n}\n\nObject.setPrototypeOf(WOQLStreamConfig.prototype, Config.ViewConfig.prototype);\n\nWOQLStreamConfig.prototype.create = function (client) {\n const wqt = new WOQLStream(client, this);\n return wqt;\n};\n\nWOQLStreamConfig.prototype.row = function () {\n // eslint-disable-next-line no-use-before-define\n const wqt = new WOQLStreamRule().scope('row');\n this.rules.push(wqt);\n return wqt;\n};\n\nWOQLStreamConfig.prototype.template = function (template) {\n if (!template) return this.mtemplate;\n this.mtemplate = template;\n return this;\n};\n\nWOQLStreamConfig.prototype.prettyPrint = function () {\n let str = 'view = View.stream();\\n';\n if (typeof this.template() !== 'undefined') {\n str += `view.template(${JSON.stringify(this.template())})\\n`;\n }\n // eslint-disable-next-line no-plusplus\n for (let i = 0; i < this.rules.length; i++) {\n str += `view.${this.rules[i].prettyPrint()}\\n`;\n }\n return str;\n};\n\nWOQLStreamConfig.prototype.loadJSON = function (config, rules) {\n const jr = [];\n // eslint-disable-next-line no-plusplus\n for (let i = 0; i < rules.length; i++) {\n // eslint-disable-next-line no-use-before-define\n const nr = new WOQLStreamRule();\n nr.json(rules[i]);\n jr.push(nr);\n }\n this.rules = jr;\n if (config.template) {\n this.mtemplate = config.template;\n }\n};\n\nWOQLStreamConfig.prototype.json = function () {\n const jr = [];\n // eslint-disable-next-line no-plusplus\n for (let i = 0; i < this.rules.length; i++) {\n jr.push(this.rules[i].json());\n }\n const conf = {};\n if (this.mtemplate) {\n conf.template = this.mtemplate;\n }\n const mj = { stream: conf, rules: jr };\n return mj;\n};\n\nfunction WOQLStreamRule() {\n Config.WOQLViewRule.call(this);\n}\n\nObject.setPrototypeOf(WOQLStreamRule.prototype, Config.WOQLViewRule.prototype);\n\nWOQLStreamRule.prototype.template = function (template) {\n if (!template) return this.rule.template;\n this.rule.template = template;\n return this;\n};\n\nmodule.exports = WOQLStreamConfig;\n","/* eslint-disable no-use-before-define */\n/* eslint-disable no-plusplus */\nconst Config = require('./viewConfig');\nconst WOQLTable = require('./woqlTable');\nconst UTILS = require('../utils');\n\nfunction WOQLTableConfig() {\n Config.ViewConfig.call(this);\n this.type = 'table';\n}\n\nObject.setPrototypeOf(WOQLTableConfig.prototype, Config.ViewConfig.prototype);\n\nWOQLTableConfig.prototype.create = function (client) {\n const wqt = new WOQLTable(client, this);\n return wqt;\n};\n\nWOQLTableConfig.prototype.json = function () {\n const jr = [];\n for (let i = 0; i < this.rules.length; i++) {\n jr.push(this.rules[i].json());\n }\n const conf = {};\n if (typeof this.column_order() !== 'undefined') {\n conf.column_order = this.column_order();\n }\n if (typeof this.pagesize() !== 'undefined') {\n conf.pagesize = this.pagesize();\n }\n if (typeof this.renderer() !== 'undefined') {\n conf.renderer = this.renderer();\n }\n if (typeof this.filter() !== 'undefined') {\n conf.filter = this.filter();\n }\n if (typeof this.filterable() !== 'undefined') {\n conf.filterable = this.filterable();\n }\n if (typeof this.pager() !== 'undefined') {\n conf.pager = this.pager();\n }\n if (typeof this.bindings() !== 'undefined') {\n conf.bindings = this.bindings();\n }\n if (typeof this.page() !== 'undefined') {\n conf.page = this.page();\n }\n if (typeof this.changesize() !== 'undefined') {\n conf.changesize = this.changesize();\n }\n const mj = { table: conf, rules: jr };\n return mj;\n};\n\nWOQLTableConfig.prototype.loadJSON = function (config, rules) {\n const jr = [];\n if (Array.isArray(rules)) {\n for (let i = 0; i < rules.length; i++) {\n // eslint-disable-next-line no-use-before-define\n const nr = new WOQLTableRule();\n nr.json(rules[i]);\n jr.push(nr);\n }\n }\n this.rules = jr;\n if (!config) return this;\n if (typeof config.column_order !== 'undefined') {\n this.column_order(...config.column_order);\n }\n if (typeof config.pagesize !== 'undefined') {\n this.pagesize(config.pagesize);\n }\n if (typeof config.renderer !== 'undefined') {\n this.renderer(config.renderer);\n }\n if (typeof config.filter !== 'undefined') {\n this.filter(config.filter);\n }\n if (typeof config.filterable !== 'undefined') {\n this.filterable(config.filterable);\n }\n if (typeof config.bindings !== 'undefined') {\n this.bindings(config.bindings);\n }\n if (typeof config.pager !== 'undefined') {\n this.pager(config.pager);\n }\n if (typeof config.page !== 'undefined') {\n this.page(config.page);\n }\n if (typeof config.changesize !== 'undefined') {\n this.changesize(config.changesize);\n }\n return this;\n};\n\nWOQLTableConfig.prototype.prettyPrint = function () {\n let str = 'view = View.table();\\n';\n if (typeof this.column_order() !== 'undefined') {\n str += `view.column_order('${this.column_order()}')\\n`;\n }\n if (typeof this.pagesize() !== 'undefined') {\n str += `view.pagesize(${this.pagesize()})\\n`;\n }\n if (typeof this.renderer() !== 'undefined') {\n str += `view.renderer('${this.renderer()}')\\n`;\n }\n if (typeof this.pager() !== 'undefined') {\n str += `view.pager(${this.pager()})\\n`;\n }\n if (typeof this.page() !== 'undefined') {\n str += `view.page(${this.page()})\\n`;\n }\n if (typeof this.changesize() !== 'undefined') {\n str += `view.changesize(${this.changesize()})\\n`;\n }\n\n for (let i = 0; i < this.rules.length; i++) {\n const x = this.rules[i].prettyPrint();\n if (x) str += `view.${x}\\n`;\n }\n return str;\n};\n\n/**\n * @param {boolean} canfilter\n * @returns WOQLTableConfig\n */\n\nWOQLTableConfig.prototype.filterable = function (canfilter) {\n if (!canfilter && canfilter !== false) return this.tfilterable;\n this.tfilterable = canfilter;\n return this;\n};\n\n/*\n* default is string\n* filter type number | list | date\n*/\nWOQLTableConfig.prototype.filter = function (filter) {\n if (!filter) return this.tfilter;\n this.tfilter = filter;\n return this;\n};\n\nWOQLTableConfig.prototype.renderer = function (rend) {\n if (!rend) return this.trenderer;\n this.trenderer = rend;\n return this;\n};\n\nWOQLTableConfig.prototype.header = function (theader) {\n if (typeof theader === 'undefined') return this.theader;\n this.theader = theader;\n return this;\n};\n\n/**\n * @param {...any} val\n * @returns {object}\n */\nWOQLTableConfig.prototype.column_order = function (...val) {\n if (typeof val === 'undefined' || val.length === 0) {\n return this.order;\n }\n this.order = UTILS.removeNamespacesFromVariables(val);\n return this;\n};\n\nWOQLTableConfig.prototype.pager = function (val) {\n if (typeof val === 'undefined') {\n return this.show_pager;\n }\n this.show_pager = val;\n return this;\n};\n\nWOQLTableConfig.prototype.changesize = function (val) {\n if (typeof val === 'undefined') return this.change_pagesize;\n this.change_pagesize = val;\n return this;\n};\n\nWOQLTableConfig.prototype.pagesize = function (val) {\n if (typeof val === 'undefined') {\n return this.show_pagesize;\n }\n this.show_pagesize = val;\n return this;\n};\n\nWOQLTableConfig.prototype.page = function (val) {\n if (typeof val === 'undefined') {\n return this.show_pagenumber;\n }\n this.show_pagenumber = val;\n return this;\n};\n\nWOQLTableConfig.prototype.column = function (...cols) {\n const nr = new WOQLTableRule().scope('column');\n nr.setVariables(cols);\n this.rules.push(nr);\n return nr;\n};\n\nWOQLTableConfig.prototype.row = function () {\n const nr = new WOQLTableRule().scope('row');\n this.rules.push(nr);\n return nr;\n};\n\n/*\n * Table\n */\n\nfunction WOQLTableRule() {\n Config.WOQLViewRule.call(this);\n}\n\nObject.setPrototypeOf(WOQLTableRule.prototype, Config.WOQLViewRule.prototype);\n\nWOQLTableRule.prototype.header = function (hdr) {\n if (typeof hdr === 'undefined') {\n return this.rule.header;\n }\n this.rule.header = hdr;\n return this;\n};\n\nWOQLTableRule.prototype.filter = function (hdr) {\n if (typeof hdr === 'undefined') {\n return this.rule.filter;\n }\n this.rule.filter = hdr;\n return this;\n};\n\nWOQLTableRule.prototype.filterable = function (hdr) {\n if (typeof hdr === 'undefined') {\n return this.rule.filterable;\n }\n this.rule.filterable = hdr;\n return this;\n};\n\nWOQLTableRule.prototype.width = function (wid) {\n if (typeof wid === 'undefined') {\n return this.rule.width;\n }\n this.rule.width = wid;\n return this;\n};\n\nWOQLTableRule.prototype.maxWidth = function (wid) {\n if (typeof wid === 'undefined') {\n return this.rule.maxWidth;\n }\n this.rule.maxWidth = wid;\n return this;\n};\n\nWOQLTableRule.prototype.minWidth = function (wid) {\n if (typeof wid === 'undefined') {\n return this.rule.minWidth;\n }\n this.rule.minWidth = wid;\n return this;\n};\n\nWOQLTableRule.prototype.unsortable = function (unsortable) {\n if (typeof unsortable === 'undefined') {\n return this.rule.unsortable;\n }\n this.rule.unsortable = unsortable;\n return this;\n};\n\nWOQLTableRule.prototype.uncompressed = function (uncompressed) {\n if (typeof uncompressed === 'undefined') {\n return this.rule.uncompressed;\n }\n this.rule.uncompressed = uncompressed;\n return this;\n};\n\nWOQLTableRule.prototype.prettyPrint = function () {\n let str = Config.WOQLViewRule.prototype.prettyPrint.apply(this);\n if (typeof this.header() !== 'undefined') {\n str += `.header(${this.header()})`;\n }\n if (this.sortable()) {\n str += '.sortable(true)';\n }\n if (typeof this.width() !== 'undefined') {\n str += `.width(${this.width()})`;\n }\n if (typeof this.maxWidth() !== 'undefined') {\n str += `.maxWidth(${this.maxWidth()})`;\n }\n if (typeof this.minWidth() !== 'undefined') {\n str += `.minWidth(${this.minWidth()})`;\n }\n return str;\n};\n\nmodule.exports = WOQLTableConfig;\n","const UTILS = require('../utils');\n\n/**\n * @file Terminus Rules\n * @license Apache Version 2\n * Abstract object to support applying matching rules to result sets and documents\n * sub-classes are FrameRule and WOQLRule - this just has common functions\n */\nfunction TerminusRule() {}\n\n/**\n * @param {Boolean} tf - the rule will match all literals or all non-literals\n */\nTerminusRule.prototype.literal = function (tf) {\n if (typeof tf === 'undefined') {\n return this.pattern.literal;\n }\n this.pattern.literal = tf;\n return this;\n};\n\n/**\n * @param {[TYPE_URLS]} list - parameters are types identified by prefixed URLS (xsd:string...)\n */\nTerminusRule.prototype.type = function (...list) {\n if (typeof list === 'undefined' || list.length === 0) {\n return this.pattern.type;\n }\n this.pattern.type = list;\n return this;\n};\n\n/**\n * Specifies the scope of a rule - row / cell / object / property / * .. what part\n * of the result does the rule apply to\n */\nTerminusRule.prototype.scope = function (scope) {\n if (typeof scope === 'undefined') {\n return this.pattern.scope;\n }\n this.pattern.scope = scope;\n return this;\n};\n\n/**\n * Specifies that the rule matches a specific value\n */\nTerminusRule.prototype.value = function (...val) {\n if (typeof val === 'undefined') {\n return this.pattern.value;\n }\n this.pattern.value = val;\n return this;\n};\n\n/**\n * Produces a canonical json format to represent the rule\n */\nTerminusRule.prototype.json = function (mjson) {\n if (!mjson) {\n const njson = {};\n if (this.pattern) njson.pattern = this.pattern.json();\n if (this.rule) njson.rule = this.rule;\n return njson;\n }\n\n if (mjson.pattern) this.pattern.setPattern(mjson.pattern);\n if (mjson.rule) this.rule = mjson.rule;\n\n return this;\n};\n\n/**\n * Contained Pattern Object to encapsulate pattern matching\n * @param {Object} pattern\n */\n// eslint-disable-next-line no-unused-vars\nfunction TerminusPattern(pattern) {}\n\nTerminusPattern.prototype.setPattern = function (pattern) {\n if (typeof pattern.literal !== 'undefined') this.literal = pattern.literal;\n if (pattern.type) this.type = pattern.type;\n if (pattern.scope) this.scope = pattern.scope;\n if (pattern.value) this.value = pattern.value;\n};\n\nTerminusPattern.prototype.json = function () {\n const json = {};\n if (typeof this.literal !== 'undefined') json.literal = this.literal;\n if (this.type) json.type = this.type;\n if (this.scope) json.scope = this.scope;\n if (this.value) json.value = this.value;\n return json;\n};\n\n/**\n * Tests whether the passed values matches the basic pattern\n */\nTerminusPattern.prototype.testBasics = function (scope, value) {\n if (this.scope && scope && this.scope !== scope) return false;\n if (this.type) {\n const dt = value['@type'];\n if (!dt || !this.testValue(dt, this.type)) return false;\n }\n if (typeof this.literal !== 'undefined') {\n if (!(this.literal === !(typeof value['@type'] === 'undefined'))) return false;\n }\n if (typeof this.value !== 'undefined') {\n if (!this.testValue(value, this.value)) return false;\n }\n return true;// passed all tests\n};\n\nTerminusPattern.prototype.testValue = function (value, constraint) {\n if (!value) return null;\n const vundertest = (value['@value'] ? value['@value'] : value);\n if (typeof constraint === 'function') return constraint(vundertest);\n // eslint-disable-next-line no-param-reassign\n if (constraint && !Array.isArray(constraint)) constraint = [constraint];\n // eslint-disable-next-line no-plusplus\n for (let i = 0; i < constraint.length; i++) {\n const nc = constraint[i];\n if (typeof vundertest === 'string') {\n if (this.stringMatch(nc, vundertest)) return true;\n } else if (typeof vundertest === 'number') {\n if (this.numberMatch(nc, vundertest)) return true;\n }\n }\n return false;\n};\n\n/**\n * Unpacks an array into a list of arguments\n * @param {Boolean} nonstring - if set, the values will be double-quoted only when\n * they are strings, otherwise, all will be quoted as strings\n */\nTerminusPattern.prototype.unpack = function (arr, nonstring) {\n let str = '';\n if (nonstring) {\n // eslint-disable-next-line no-plusplus\n for (let i = 0; i < arr.length; i++) {\n if (typeof arr[i] === 'string') {\n str += `\"${arr[i]}\"`;\n } else {\n str += arr[i];\n }\n if (i < (arr.length - 1)) str += ', ';\n }\n } else {\n str = `\"${arr.join('\",\"')}\"`;\n }\n return str;\n};\n\nTerminusPattern.prototype.IDsMatch = function (ida, idb) {\n return UTILS.compareIDs(ida, idb);\n};\n\nTerminusPattern.prototype.classIDsMatch = function (ida, idb) {\n return this.IDsMatch(ida, idb);\n};\n\nTerminusPattern.prototype.propertyIDsMatch = function (ida, idb) {\n const match = this.IDsMatch(ida, idb);\n return match;\n};\n\nTerminusPattern.prototype.rangeIDsMatch = function (ida, idb) {\n return this.IDsMatch(ida, idb);\n};\n\nTerminusPattern.prototype.valuesMatch = function (vala, valb) {\n return vala === valb;\n};\nTerminusPattern.prototype.numberMatch = function (vala, valb) {\n if (typeof vala === 'string') {\n try {\n // eslint-disable-next-line no-eval\n return eval(valb + vala);\n } catch (e) {\n return false;\n }\n }\n return vala === valb;\n};\n\nTerminusPattern.prototype.stringMatch = function (vala, valb) {\n if (vala.substring(0, 1) === '/') {\n const pat = new RegExp(vala.substring(1));\n return pat.test(valb);\n }\n\n return vala === valb;\n};\n\nmodule.exports = { TerminusRule, TerminusPattern };\n","/// /@ts-check\nconst { WOQLRule } = require('./woqlRule');\n\n/**\n * Generic functions / configs that are available to all config types\n * @module ViewConfig\n * @constructor\n */\nfunction ViewConfig() {\n this.rules = [];\n}\n\nViewConfig.prototype.render = function (func) {\n if (func) this.view_render = func;\n return this.view_render;\n};\n\nViewConfig.prototype.renderer = function (val) {\n if (val) this.view_renderer = val;\n return this.view_renderer;\n};\n\nViewConfig.prototype.getRulesJSON = function () {\n const jr = [];\n // eslint-disable-next-line no-plusplus\n for (let i = 0; i < this.rules.length; i++) {\n jr.push(this.rules[i].json());\n }\n return jr;\n};\n\nViewConfig.prototype.getBasicJSON = function () {\n const jr = {};\n if (this.view_render) jr.render = this.view_render;\n if (this.view_renderer) jr.renderer = this.view_renderer;\n if (this.vbindings) jr.bindings = this.vbindings;\n return jr;\n};\n\nViewConfig.prototype.loadBasicJSON = function (json) {\n if (json.render) this.view_render = json.view_render;\n if (json.renderer) this.view_renderer = json.view_renderer;\n if (json.bindings) this.vbindings = json.bindings;\n};\n\nViewConfig.prototype.getBasicprettyPrint = function () {\n let str = '';\n if (typeof this.render() !== 'undefined') {\n str += `view.render(${this.render()})\\n`;\n }\n if (typeof this.renderer() !== 'undefined') {\n str += `view.renderer('${this.renderer()}')\\n`;\n }\n if (typeof this.bindings() !== 'undefined') {\n str += `view.bindings('${this.bindings()}')\\n`;\n }\n return str;\n};\n\nViewConfig.prototype.bindings = function (bindings) {\n if (typeof bindings !== 'undefined') {\n this.vbindings = bindings;\n }\n return this.vbindings;\n};\n\n/**\n * @module WOQLViewRule\n * @constructor\n */\nfunction WOQLViewRule() {\n WOQLRule.call(this);\n this.rule = {};\n}\n\nObject.setPrototypeOf(WOQLViewRule.prototype, WOQLRule.prototype);\n\nWOQLViewRule.prototype.prettyPrint = function (type) {\n let str = '';\n if (this.pattern) {\n str = this.pattern.prettyPrint(type);\n }\n if (typeof this.color() !== 'undefined') {\n str += `.color([${this.color().join(',')}])`;\n }\n if (typeof this.hidden() !== 'undefined') {\n str += `.hidden(${this.hidden()})`;\n }\n if (typeof this.size() !== 'undefined') {\n str += `.size('${this.size()}')`;\n }\n if (typeof this.icon() !== 'undefined') {\n str += `.icon(${JSON.stringify(this.icon())})`;\n }\n if (typeof this.text() !== 'undefined') {\n str += `.text(${JSON.stringify(this.text())})`;\n }\n if (typeof this.border() !== 'undefined') {\n str += `.border(${JSON.stringify(this.border())})`;\n }\n if (typeof this.args() !== 'undefined') {\n str += `.args(${JSON.stringify(this.args())})`;\n }\n if (typeof this.renderer() !== 'undefined') {\n str += `.renderer('${this.renderer()}')`;\n }\n if (typeof this.render() !== 'undefined') {\n str += `.render(${this.render()})`;\n }\n if (typeof this.click() !== 'undefined') {\n str += `.click(${this.click()})`;\n }\n if (typeof this.hover() !== 'undefined') {\n str += `.hover(${this.hover()})`;\n }\n return str;\n};\n\nWOQLViewRule.prototype.json = function (mjson) {\n if (!mjson) {\n const json = {};\n if (this.pattern) json.pattern = this.pattern.json();\n json.rule = this.rule;\n return json;\n }\n this.rule = mjson.rule || {};\n if (mjson.pattern) this.pattern.setPattern(mjson.pattern);\n return this;\n};\n\nWOQLViewRule.prototype.size = function (size) {\n if (typeof size === 'undefined') {\n return this.rule.size;\n }\n this.rule.size = size;\n return this;\n};\n\nWOQLViewRule.prototype.color = function (color) {\n if (typeof color === 'undefined') {\n return this.rule.color;\n }\n this.rule.color = color;\n return this;\n};\n\nWOQLViewRule.prototype.icon = function (json) {\n if (json) {\n this.rule.icon = json;\n return this;\n }\n return this.rule.icon;\n};\n\nWOQLViewRule.prototype.text = function (json) {\n if (json) {\n this.rule.text = json;\n return this;\n }\n return this.rule.text;\n};\n\nWOQLViewRule.prototype.border = function (json) {\n if (json) {\n this.rule.border = json;\n return this;\n }\n return this.rule.border;\n};\n\nWOQLViewRule.prototype.renderer = function (rend) {\n if (typeof rend === 'undefined') {\n return this.rule.renderer;\n }\n this.rule.renderer = rend;\n return this;\n};\n\nWOQLViewRule.prototype.render = function (func) {\n if (typeof func === 'undefined') {\n return this.rule.render;\n }\n this.rule.render = func;\n return this;\n};\n\nWOQLViewRule.prototype.click = function (onClick) {\n if (onClick) {\n this.rule.click = onClick;\n return this;\n }\n return this.rule.click;\n};\n\nWOQLViewRule.prototype.hover = function (onHover) {\n if (onHover) {\n this.rule.hover = onHover;\n return this;\n }\n return this.rule.hover;\n};\n\nWOQLViewRule.prototype.hidden = function (hidden) {\n if (typeof hidden === 'undefined') {\n return this.rule.hidden;\n }\n this.rule.hidden = hidden;\n return this;\n};\n\nWOQLViewRule.prototype.args = function (args) {\n if (typeof args === 'undefined') {\n return this.rule.args;\n }\n this.rule.args = args;\n return this;\n};\n\nmodule.exports = { WOQLViewRule, ViewConfig };\n","const WOQLChartConfig = require('./chartConfig');\n\nfunction WOQLChart(client, config) {\n this.client = client;\n this.config = (config || new WOQLChartConfig());\n return this;\n}\n\nWOQLChart.prototype.options = function (config) {\n this.config = config;\n return this;\n};\n\nWOQLChart.prototype.setResult = function (res) {\n this.result = res;\n return this;\n};\n","/* eslint-disable consistent-return */\n/* eslint-disable no-plusplus */\n/* eslint-disable camelcase */\n/* eslint-disable no-undef */\nconst WOQLChooserConfig = require('./chooserConfig');\nconst UTILS = require('../utils');\nconst { WOQLRule } = require('./woqlRule');\n\n/**\n * Very simple implementation of a WOQL backed chooser\n * Makes a drop down from a WOQL query - configuration tells it which columns to use...\n * @param {WOQLClient} client\n * @param {WOQLChooserConfig} config\n * @returns {WOQLChooser}\n */\nfunction WOQLChooser(client, config) {\n this.client = client;\n this.config = (config || new WOQLChooserConfig());\n this.selected = false;\n this.cursor = 0;\n return this;\n}\n\nWOQLChooser.prototype.options = function (config) {\n this.config = config;\n return this;\n};\n\nWOQLChooser.prototype.set = function (id) {\n if (this.selected !== id) {\n this.selected = id;\n const ch = this.config.change;\n if (ch) ch(id);\n }\n};\n\n/*\n * Sets up the required variables from the result / config\n */\nWOQLChooser.prototype.setResult = function (result) {\n this.result = result;\n this.choices = [];\n let rows = 0;\n const variables = result.getVariableList();\n if (!this.config.values() && variables.length) {\n this.config.values(variables[0]);\n }\n // sort it\n if (this.config.sort()) {\n this.result.sort(this.config.sort(), this.config.direction());\n }\n // eslint-disable-next-line no-cond-assign\n while (row = this.result.next()) {\n if (row && this.includeRow(row, this.result.cursor)) {\n this.choices.push(this.rowToChoice(row, rows++));\n }\n }\n return this;\n};\n\nWOQLChooser.prototype.includeRow = function (row, index) {\n const matched_rules = new WOQLRule().matchRow(this.config.rules, row, index, 'hidden');\n for (let i = 0; i < matched_rules.length; i++) {\n if (matched_rules[i].rule.hidden) return false;\n }\n return true;\n};\n\nWOQLChooser.prototype.rowToChoice = function (row, rownum) {\n const choice = {\n id: this.getRowID(row),\n };\n choice.label = this.getLabelFromBinding(row, rownum);\n choice.title = this.getTitleFromBinding(row, rownum);\n choice.selected = this.getSelectedFromBinding(row, rownum);\n return choice;\n};\n\nWOQLChooser.prototype.getRowID = function (row) {\n const rval = row[this.config.values()];\n if (rval['@value']) return rval['@value'];\n return rval;\n};\n\nWOQLChooser.prototype.getLabelFromBinding = function (row, rownum) {\n const sp = this.getSpecialRenderer(row, rownum, 'label');\n if (sp) return this.renderSpecial(sp, row, rownum);\n if (this.config.labels()) {\n if (row[this.config.labels()]) {\n let lab = row[this.config.labels()];\n if (lab['@value']) lab = lab['@value'];\n if (lab !== 'system:unknown') return lab;\n }\n }\n return UTILS.labelFromURL(this.getRowID(row));\n};\n\nWOQLChooser.prototype.getTitleFromBinding = function (row, rownum) {\n const sp = this.getSpecialRenderer(row, rownum, 'title');\n if (sp) return this.renderSpecial(sp, row, rownum);\n if (this.config.titles()) {\n if (row[this.config.titles()]) {\n let lab = row[this.config.titles()];\n if (lab['@value']) lab = lab['@value'];\n if (lab !== 'system:unknown') return lab;\n }\n }\n return false;\n};\n\nWOQLChooser.prototype.getSelectedFromBinding = function (row, rownum) {\n const matched_rules = new WOQLRule().matchRow(this.config.rules, row, rownum, 'selected');\n if (matched_rules && matched_rules.length) {\n return matched_rules[matched_rules.length - 1].rule.selected;\n }\n return false;\n};\n\nWOQLChooser.prototype.render = function () {\n if (this.renderer) return this.renderer.render(this);\n};\n\nWOQLChooser.prototype.setRenderer = function (rend) {\n this.renderer = rend;\n return this;\n};\n\nWOQLChooser.prototype.getSpecialRenderer = function (row, index, type) {\n const matched_rules = new WOQLRule().matchRow(this.config.rules, row, index, type);\n for (let i = 0; i < matched_rules.length; i++) {\n if (matched_rules[i].rule[type]) return matched_rules[i].rule[type];\n }\n return false;\n};\n\nWOQLChooser.prototype.renderSpecial = function (rule, row) {\n if (rule && typeof rule === 'function') {\n return rule(row);\n }\n if (rule && typeof rule === 'string') {\n return rule;\n }\n};\n\nWOQLChooser.prototype.count = function () {\n return this.result.count();\n};\n\nWOQLChooser.prototype.first = function () {\n this.cursor = 0;\n return this.choices[this.cursor];\n};\n\nWOQLChooser.prototype.next = function () {\n const res = this.choices[this.cursor];\n this.cursor++;\n return res;\n};\n\nWOQLChooser.prototype.prev = function () {\n if (this.cursor > 0) {\n this.cursor--;\n return this.choices[this.cursor];\n }\n};\n\nmodule.exports = WOQLChooser;\n","/* eslint-disable guard-for-in */\n/* eslint-disable no-continue */\n/* eslint-disable no-redeclare */\n/* eslint-disable block-scoped-var */\n/* eslint-disable no-var */\n/* eslint-disable vars-on-top */\n/* eslint-disable camelcase */\n/* eslint-disable no-param-reassign */\n/* eslint-disable no-restricted-syntax */\n/* eslint-disable no-plusplus */\nconst WOQLGraphConfig = require('./graphConfig');\nconst UTILS = require('../utils');\nconst { WOQLRule } = require('./woqlRule');\n\nfunction WOQLGraph(client, config) {\n this.client = client;\n this.config = (config || new WOQLGraphConfig());\n this.nodes = [];\n this.edges = [];\n}\n\n/* \"nodes\": [\n {\n \"id\": 1,\n \"name\": \"A\"\n },\n {\n \"id\": 2,\n \"name\": \"B\"\n },\n {\n \"id\": 3,\n \"name\": \"C\"\n }\n]\n\n\"link\" :[\n {\n \"source\": 1,\n \"target\": 2\n }\n] */\n\nWOQLGraph.prototype.options = function (config) {\n this.config = config;\n return this;\n};\n\nWOQLGraph.prototype.setResult = function (result) {\n this.result = result;\n this.calculateVariableTypes(result);\n};\n\nWOQLGraph.prototype.calculateVariableTypes = function () {\n // var bindings = this.result.getBindings();\n const bindings = this.result;\n if (bindings && bindings.length) {\n for (let i = 0; i < bindings.length; i++) {\n this.extractFromBinding(bindings[i], i);\n }\n }\n this.edges = this.combineEdges(this.edges);\n this.nodes = this.combineNodes(this.nodes);\n};\n\nWOQLGraph.prototype.extractFromBinding = function (row, rownum) {\n /*\n * check if I have to add the row\n */\n if (this.includeRow(row, rownum)) {\n // get all the nodes (ids - non literals) //\n // see which nodes are excluded ...\n const nodes = [];\n // eslint-disable-next-line no-unused-vars\n const lits = [];\n for (const k in row) {\n if (typeof row[k] === 'string') {\n if (row[k] && row[k] !== 'system:unknown' && this.includeNode(k, row)) {\n nodes.push(k);\n }\n } else if (row[k]['@value'] && this.includeLiteralNode(k, row)) {\n nodes.push(k);\n }\n }\n if (nodes.length === 0) return;\n this.createEdgesFromIDs(nodes, row);\n for (let i = 0; i < nodes.length; i++) {\n let ndid = row[nodes[i]];\n ndid = (ndid['@value'] ? ndid['@value'] : ndid);\n this.addAdornedNode(ndid, nodes[i], row);\n }\n }\n};\n\nWOQLGraph.prototype.addAdornedEdge = function (source, target, ks, kt, row) {\n source = (source['@value'] ? source['@value'] : source);\n target = (target['@value'] ? target['@value'] : target);\n const edge = {\n type: 'link', target, source, text: target,\n };\n const matched_rules = new WOQLRule().matchEdge(this.config.rules, row, ks, kt);\n let hid = false;\n for (let i = 0; i < matched_rules.length; i++) {\n const { rule } = matched_rules[i];\n if (typeof rule.hidden !== 'undefined') {\n hid = rule.hidden;\n }\n if (rule.size) {\n edge.size = UTILS.getConfigValue(rule.size, row);\n }\n if (rule.text) {\n edge.text = UTILS.getConfigValue(rule.text, row);\n }\n if (rule.color) {\n edge.color = UTILS.getConfigValue(rule.color, row);\n }\n if (rule.icon) {\n edge.icon = UTILS.getConfigValue(rule.icon, row);\n }\n if (rule.distance) {\n edge.distance = UTILS.getConfigValue(rule.distance, row);\n }\n if (rule.arrow) {\n edge.arrow = UTILS.getConfigValue(rule.arrow, row);\n }\n if (rule.symmetric) {\n edge.symmetric = UTILS.getConfigValue(rule.symmetric, row);\n }\n if (rule.weight) {\n edge.weight = UTILS.getConfigValue(rule.weight, row);\n }\n }\n if (!hid) this.edges.push(edge);\n};\n\n/*\n* the rules' order are important\n*/\n\nWOQLGraph.prototype.addAdornedNode = function (nid, k, row) {\n const node = { type: 'node', id: nid, nodetype: k };\n const matched_rules = new WOQLRule().matchNode(this.config.rules, row, k, nid);\n for (let i = 0; i < matched_rules.length; i++) {\n const { rule } = matched_rules[i];\n if (rule.size) {\n node.radius = UTILS.getConfigValue(rule.size, row);\n }\n if (rule.color) {\n node.color = UTILS.getConfigValue(rule.color, row);\n }\n if (rule.charge) {\n node.charge = UTILS.getConfigValue(rule.charge, row);\n }\n if (rule.collisionRadius) {\n node.collisionRadius = UTILS.getConfigValue(rule.collisionRadius, row);\n }\n if (rule.icon) {\n node.icon = UTILS.getConfigValue(rule.icon, row);\n }\n if (rule.text) {\n node.text = UTILS.getConfigValue(rule.text, row);\n }\n if (rule.border) {\n node.border = UTILS.getConfigValue(rule.border, row);\n }\n }\n if (!node.text) {\n if (typeof row[k] === 'string') node.text = row[k];\n else if (row[k]['@value']) node.text = row[k]['@value'];\n }\n this.nodes.push(node);\n};\n\nWOQLGraph.prototype.getLiteralOwner = function (nodes, v, row) {\n const cs = this.config.source();\n if (cs && row[cs]) {\n return cs;\n }\n const edges = this.config.edges();\n if (edges) {\n for (let i = 0; i < edges.length; i++) {\n if (edges[i][1] === v) {\n return edges[i][0];\n }\n }\n return false;\n }\n return nodes[0];\n};\n\nWOQLGraph.prototype.createEdgesFromIDs = function (nodes, row) {\n if (nodes.length < 2) return;\n const cs = this.config.source();\n const es = this.config.edges();\n if (!cs && es && es.length) {\n for (var i = 0; i < es.length; i++) {\n if (nodes.indexOf(es[i][0]) !== -1 && nodes.indexOf(es[i][1]) !== -1) {\n this.addAdornedEdge(row[es[i][0]], row[es[i][1]], es[i][0], es[i][1], row);\n }\n }\n return;\n }\n const s = (cs && nodes.indexOf(cs) !== -1) ? cs : nodes[0];\n for (var i = 0; i < nodes.length; i++) {\n if (nodes[i] === s) continue;\n this.addAdornedEdge(row[s], row[nodes[i]], s, nodes[i], row);\n }\n};\n\nWOQLGraph.prototype.getEdges = function () {\n return this.edges;\n};\n\nWOQLGraph.prototype.combineNodes = function (nodes) {\n const nnodes = {};\n for (let i = 0; i < nodes.length; i++) {\n const n = nodes[i];\n if (this.nodes_referenced_by_edges.indexOf(n.id) === -1) continue;\n if (typeof nnodes[n.id] === 'undefined') {\n nnodes[n.id] = n;\n } else {\n for (const k in n) {\n if (typeof nnodes[n.id][k] === 'undefined') {\n nnodes[n.id][k] = n[k];\n }\n }\n }\n }\n return Object.values(nnodes);\n};\n\nWOQLGraph.prototype.combineEdges = function (edges) {\n this.nodes_referenced_by_edges = [];\n const nedges = {};\n for (let i = 0; i < edges.length; i++) {\n const e = edges[i];\n if (typeof nedges[e.source] === 'undefined') {\n nedges[e.source] = {};\n }\n if (typeof nedges[e.source][e.target] === 'undefined') {\n nedges[e.source][e.target] = e;\n } else {\n for (var k in e) {\n if (typeof nedges[e.source][e.target][k] === 'undefined') nedges[e.source][e.target][k] = e[k];\n }\n }\n if (this.nodes_referenced_by_edges.indexOf(e.source) === -1) {\n this.nodes_referenced_by_edges.push(e.source);\n }\n if (this.nodes_referenced_by_edges.indexOf(e.target) === -1) {\n this.nodes_referenced_by_edges.push(e.target);\n }\n }\n const fedges = [];\n for (var k in nedges) {\n for (const k2 in nedges[k]) {\n fedges.push(nedges[k][k2]);\n }\n }\n return fedges;\n};\n\nWOQLGraph.prototype.getNodes = function () {\n return this.nodes;\n};\n\nWOQLGraph.prototype.includeNode = function (v, row) {\n const matched_rules = new WOQLRule().matchNode(this.config.rules, row, v, false, 'hidden');\n for (let i = 0; i < matched_rules.length; i++) {\n if (matched_rules[i].rule.hidden) return false;\n }\n return true;\n};\n\n/*\n* check if I have to visualise literals node\n*/\nWOQLGraph.prototype.includeLiteralNode = function (variableName, row) {\n if (this.config.literals() === false) return false;\n const matched_rules = new WOQLRule().matchNode(this.config.rules, row, variableName, false, 'hidden');\n for (let i = 0; i < matched_rules.length; i++) {\n if (matched_rules[i].rule.hidden) return false;\n }\n return true;\n};\n\nWOQLGraph.prototype.includeRow = function (row, num) {\n const matched_rules = new WOQLRule().matchRow(this.config.rules, row, num, 'hidden');\n for (let i = 0; i < matched_rules.length; i++) {\n if (matched_rules[i].rule.hidden) return false;\n }\n return true;\n};\n\nmodule.exports = WOQLGraph;\n","/* eslint-disable consistent-return */\n/* eslint-disable no-param-reassign */\n/* eslint-disable no-restricted-syntax */\n/* eslint-disable no-unused-vars */\nconst WOQLQuery = require('../query/woqlCore');\nconst UTILS = require('../utils');\n\n/**\n * Functions to manipulate and check the paging related properties of a query\n */\n\nWOQLQuery.prototype.getLimit = function () {\n return this.getPagingProperty('limit');\n};\n\nWOQLQuery.prototype.setLimit = function (l) {\n return this.setPagingProperty('limit', l);\n};\n\nWOQLQuery.prototype.isPaged = function (q) {\n q = (q || this.query);\n for (const prop of Object.keys(q)) {\n if (prop === 'limit') return true;\n if (this.paging_transitive_properties.indexOf(prop) !== -1) {\n return this.isPaged(q[prop][q[prop].length - 1]);\n }\n }\n return false;\n};\n\nWOQLQuery.prototype.getPage = function () {\n if (this.isPaged()) {\n const psize = this.getLimit();\n if (this.hasStart()) {\n const s = this.getStart();\n // eslint-disable-next-line radix\n return (parseInt(s / psize) + 1);\n }\n return 1;\n }\n return false;\n};\n\nWOQLQuery.prototype.setPage = function (pagenum) {\n const pstart = (this.getLimit() * (pagenum - 1));\n if (this.hasStart()) {\n this.setStart(pstart);\n } else {\n this.addStart(pstart);\n }\n return this;\n};\n\nWOQLQuery.prototype.nextPage = function () {\n return this.setPage(this.getPage() + 1);\n};\n\nWOQLQuery.prototype.firstPage = function () {\n return this.setPage(1);\n};\n\nWOQLQuery.prototype.previousPage = function () {\n const npage = this.getPage() - 1;\n if (npage > 0) this.setPage(npage);\n return this;\n};\n\nWOQLQuery.prototype.setPageSize = function (size) {\n this.setPagingProperty('limit', size);\n if (this.hasStart()) {\n this.setStart(0);\n } else {\n this.addStart(0);\n }\n return this;\n};\n\nWOQLQuery.prototype.hasSelect = function () {\n return (!!this.getPagingProperty('select'));\n};\n\nWOQLQuery.prototype.getSelectVariables = function (q) {\n q = (q || this.query);\n for (const prop of Object.keys(q)) {\n if (prop === 'select') {\n const vars = q[prop].slice(0, q[prop].length - 1);\n return vars;\n }\n if (this.paging_transitive_properties.indexOf(prop) !== -1) {\n const val = this.getSelectVariables(q[prop][q[prop].length - 1]);\n if (typeof val !== 'undefined') {\n return val;\n }\n }\n }\n};\n\nWOQLQuery.prototype.hasStart = function () {\n return (typeof this.getPagingProperty('start') !== 'undefined');\n};\n\nWOQLQuery.prototype.getStart = function () {\n return this.getPagingProperty('start');\n};\n\nWOQLQuery.prototype.setStart = function (start) {\n return this.setPagingProperty('start', start);\n};\n\nWOQLQuery.prototype.addStart = function (s) {\n if (this.hasStart()) this.setStart(s);\n else {\n const nq = { start: [s, this.query] };\n this.query = nq;\n }\n return this;\n};\n\n/**\n * Returns the value of one of the 'paging' related properties (limit, start,...)\n */\nWOQLQuery.prototype.getPagingProperty = function (pageprop, q) {\n q = (q || this.query);\n for (const prop of Object.keys(q)) {\n if (prop === pageprop) return q[prop][0];\n if (this.paging_transitive_properties.indexOf(prop) !== -1) {\n const val = this.getPagingProperty(pageprop, q[prop][q[prop].length - 1]);\n if (typeof val !== 'undefined') {\n return val;\n }\n }\n }\n};\n\n/**\n * Sets the value of one of the paging_transitive_properties properties\n */\nWOQLQuery.prototype.setPagingProperty = function (pageprop, val, q) {\n q = (q || this.query);\n for (const prop of Object.keys(q)) {\n if (prop === pageprop) {\n q[prop][0] = val;\n } else if (this.paging_transitive_properties.indexOf(prop) !== -1) {\n this.setPagingProperty(pageprop, val, q[prop][q[prop].length - 1]);\n }\n }\n return this;\n};\n","/* eslint-disable camelcase */\n/* eslint-disable consistent-return */\n/* eslint-disable no-restricted-syntax */\n/* eslint-disable no-plusplus */\n/* eslint-disable no-param-reassign */\n/* eslint-disable no-unused-vars */\n/// /@ts-check\nconst UTILS = require('../utils');\nconst WOQL = require('../woql');\nconst WOQLQ = require('./woqlPaging');\n/**\n * @module WOQLResult\n * @license Apache Version 2\n * Object representing the result of a WOQL Query\n * @param {object} results result JSON object as returned by WOQL query\n * @param {WOQLQuery} query the query object that generated the result\n * @param {object} [config] optional result configuration options object\n * [config.no_compress] by default all URLs are compressed where possible (v:X rather than http://.../variable/x) set to true to return non-compressed values\n * [config.context] specify the JSON-LD context to use for compressing results - by default\n * the query context will be used\n */\nfunction WOQLResult(results, query, config) {\n this.bindings = results ? results.bindings : [];\n this.insert_count = results ? results.inserts : 0;\n this.delete_count = results ? results.deletes : 0;\n this.transaction_retry_count = results ? results.transaction_retry_count : 0;\n /**\n * @type {array | boolean}\n */\n this.variable_names = results ? results['api:variable_names'] : false;\n // console.log(results, this.variable_names)\n this.query = query || WOQL.query();\n this.cursor = 0;\n // if (!(config && config.no_compress)) {\n // const context = results && results.prefixes ? results.prefixes : false\n // this.compress(context)\n // }\n}\n\nWOQLResult.prototype.formatter = function (context) {\n context = context || this.query.getContext();\n const formatted = [];\n if (this.bindings && this.bindings.length > 0) {\n this.bindings.forEach((row) => {\n const rowObj = {};\n Object.keys(row).forEach((propName) => {\n const propValue = row[propName];\n\n if (typeof propValue === 'string') {\n if (propValue !== 'system:unknown') {\n rowObj[propName] = UTILS.shorten(propValue, context);\n } else {\n rowObj[propName] = '';\n }\n } else {\n rowObj[propName] = propValue['@value'];\n }\n });\n formatted.push(rowObj);\n });\n }\n return formatted;\n};\n\n/**\n * @param {object} [context] optional context to use for compression -\n * if ommitted query context is used\n * @returns {WOQLResult}\n */\nWOQLResult.prototype.compress = function (context) {\n context = context || this.query.getContext();\n if (context) {\n for (let i = 0; i < this.bindings.length; i++) {\n for (const prop of Object.keys(this.bindings[i])) {\n const nprop = UTILS.shorten(prop, context);\n let nval = this.bindings[i][prop];\n if (typeof this.bindings[i][prop] === 'string') {\n nval = UTILS.shorten(this.bindings[i][prop], context);\n } else if (Array.isArray(this.bindings[i][prop])) {\n nval = [];\n for (let j = 0; j < this.bindings[i][prop].length; j++) {\n let oval = this.bindings[i][prop][j];\n if (typeof oval === 'string') oval = UTILS.shorten(oval, context);\n else if (Array.isArray(oval)) {\n const noval = [];\n for (let k = 0; k < oval.length; k++) {\n let kval = oval[k];\n if (typeof kval === 'string') kval = UTILS.shorten(kval, context);\n noval.push(kval);\n }\n oval = noval;\n }\n nval.push(oval);\n }\n }\n delete this.bindings[i][prop];\n this.bindings[i][nprop] = nval;\n }\n }\n }\n // console.log(this.bindings)\n return this;\n};\n\n/**\n * Returns true if there are any results\n * @returns {boolean}\n */\nWOQLResult.prototype.hasBindings = function () {\n if (this.bindings && this.count()) return true;\n return false;\n};\n\n/**\n * Returns true if there are any results\n * @returns {boolean}\n */\nWOQLResult.prototype.hasUpdates = function () {\n if (this.inserts() > 0 || this.deletes() > 0) return true;\n return false;\n};\n\n/**\n * Returns original array of bindings returned by API\n * @returns {array} the data result\n */\nWOQLResult.prototype.getBindings = function () {\n return this.bindings;\n};\n/**\n * Returns original array of bindings returned by API\n * @returns {array} the data result\n */\nWOQLResult.prototype.rows = function () {\n return this.bindings;\n};\n\n/**\n * Returns list of variables returned in bindings from API\n * @returns {array|boolean}\n */\nWOQLResult.prototype.getVariableList = function () {\n if (this.variable_names) {\n return this.variable_names;\n }\n if (this.bindings && this.bindings[0]) {\n return Object.keys(this.bindings[0]);\n }\n return [];\n};\n\n/**\n * Number of rows in bound results\n * @returns {number}\n */\nWOQLResult.prototype.count = function () {\n return this.bindings.length;\n};\n\n/**\n * Number of reported inserts\n * @returns {number}\n */\nWOQLResult.prototype.inserts = function () {\n return this.insert_count;\n};\n\n/**\n * Number of reported inserts\n * @returns {number}\n */\nWOQLResult.prototype.deletes = function () {\n return this.delete_count;\n};\n\n/**\n * Get the first object record from the result set\n * @returns {object}\n */\nWOQLResult.prototype.first = function () {\n this.cursor = 0;\n return this.bindings[0];\n};\n\n/**\n * Get the last object record from the result set\n * @returns {object}\n */\n\nWOQLResult.prototype.last = function () {\n this.cursor = this.bindings.length - 1;\n return this.bindings[this.bindings.length - 1];\n};\n\n/**\n * @returns {object}\n */\n\nWOQLResult.prototype.next = function () {\n if (this.cursor >= this.bindings.length) return false;\n const res = this.bindings[this.cursor];\n this.cursor++;\n return res;\n};\n\n/**\n * @returns {object}\n */\n\n// eslint-disable-next-line consistent-return\nWOQLResult.prototype.prev = function () {\n if (this.cursor > 0) {\n this.cursor--;\n return this.bindings[this.cursor];\n }\n};\n\n/**\n * Normally sorting of results is the job of the query - this is just in case you\n * want to resort results according to some key (variable)\n * @param {string} key\n * @param {string} asc_or_desc\n * @returns {WOQLResult}\n */\n// eslint-disable-next-line camelcase\nWOQLResult.prototype.sort = function (key, asc_or_desc) {\n this.bindings.sort((a, b) => this.compareValues(a[key], b[key], asc_or_desc));\n // eslint-disable-next-line no-unused-expressions\n this;\n};\n\n/**\n * Compares results a, b according to \"asc\" or \"desc\" order\n * @param {object} a\n * @param {object} b\n * @param {string} [asc_or_desc]\n * @returns {number}\n */\nWOQLResult.prototype.compareValues = function (a, b, asc_or_desc = 'asc') {\n if (!a || !b) return 0;\n if (typeof a['@value'] !== 'undefined' && typeof b['@value'] !== 'undefined') {\n a = a['@value'];\n b = b['@value'];\n }\n if (a > b) {\n return asc_or_desc && asc_or_desc === 'asc' ? 1 : -1;\n }\n if (b > a) {\n return asc_or_desc && asc_or_desc === 'asc' ? -1 : 1;\n }\n};\n\nmodule.exports = WOQLResult;\n","/* eslint-disable guard-for-in */\n/* eslint-disable no-restricted-syntax */\n/* eslint-disable valid-typeof */\n/* eslint-disable no-continue */\n/* eslint-disable no-plusplus */\n/* eslint-disable no-use-before-define */\nconst TerminusRule = require('./terminusRule');\nconst UTILS = require('../utils');\n\n/**\n * @file WOQL Rules\n * @license Apache Version 2\n * WOQL Rules support pattern matching on results of WOQL Queries\n */\n\nfunction WOQLRule() {\n TerminusRule.TerminusRule.call(this);\n this.pattern = new WOQLPattern();\n}\nObject.setPrototypeOf(WOQLRule.prototype, TerminusRule.TerminusRule.prototype);\n\n/**\n * Specifies that the rule only applies to specific variables returned by the WOQL query\n * @param {[String]} - array of strings, each representing a variable name, variable prefixes\n * (\"v:\") are added automatically if absent\n */\nWOQLRule.prototype.setVariables = function (vars) {\n if (vars && vars.length) {\n this.pattern.variables = UTILS.removeNamespacesFromVariables(vars);\n this.current_variable = this.pattern.variables[this.pattern.variables.length - 1];\n }\n return this;\n};\n\n/**\n * Shorthand to the above using spread operator\n */\nWOQLRule.prototype.vars = function (...varlist) {\n return this.setVariables(varlist);\n};\n\n/**\n * Specifies that the rule applies to a specific variable, variable prefix (\"v:\")\n * is added automatically if absent\n */\nWOQLRule.prototype.v = function (v) {\n if (v) {\n this.current_variable = UTILS.removeNamespaceFromVariable(v);\n return this;\n }\n return this.current_variable;\n};\n\n/**\n * Specifies that the rule applies to a specific edge, a source -> target pair of variables\n */\nWOQLRule.prototype.edge = function (source, target) {\n this.scope('edge');\n if (source) {\n const vs = UTILS.removeNamespaceFromVariable(source);\n this.setVariables([vs]);\n this.pattern.source = vs;\n }\n if (target) {\n const vs = UTILS.removeNamespaceFromVariable(target);\n if (!source) this.setVariables([vs]);\n this.pattern.target = vs;\n }\n return this;\n};\n\n/**\n * Specifies that the rule applies to a specific edge, a source -> target pair of variables\n */\nWOQLRule.prototype.rownum = function (rownum) {\n if (typeof rownum === 'undefined') return this.pattern.rownum;\n this.pattern.rownum = rownum;\n return this;\n};\n\n/**\n * Specifies that the value of a variable must be one of the values contained in the list\n * @param {[String|Number]} list - parameters are any atomic value (string | number) -\n * the rule will match only cells that have one of these values\n */\nWOQLRule.prototype.in = function (...list) {\n if (this.current_variable) {\n if (!this.pattern.constraints) this.pattern.constraints = {};\n if (!this.pattern.constraints[this.current_variable]) {\n this.pattern.constraints[this.current_variable] = [];\n }\n this.pattern.constraints[this.current_variable].push(list);\n }\n return this;\n};\n\n/**\n * Specifies a filter function to apply to each element - only those values that\n * return true when this filter is invoked will be matched\n * @param {function} tester - test function that will be used to filter values\n */\nWOQLRule.prototype.filter = function (tester) {\n if (this.current_variable) {\n if (!this.pattern.constraints) this.pattern.constraints = {};\n if (!this.pattern.constraints[this.current_variable]) {\n this.pattern.constraints[this.current_variable] = [];\n }\n this.pattern.constraints[this.current_variable].push(tester);\n }\n return this;\n};\n\nWOQLRule.prototype.matchRow = function (rules, row, rownum, action) {\n const matches = [];\n for (let i = 0; i < rules.length; i++) {\n if (action && this.rule && typeof this.rule[action] === 'undefined') continue;\n if (rules[i].pattern.matchRow(row, rownum)) {\n matches.push(rules[i]);\n }\n }\n return matches;\n};\n\nWOQLRule.prototype.matchCell = function (rules, row, key, rownum, action) {\n const matches = [];\n for (let i = 0; i < rules.length; i++) {\n if (action && this.rule && typeof this.rule[action] === 'undefined') continue;\n if (rules[i].pattern.matchCell(row, key, rownum)) {\n matches.push(rules[i]);\n }\n }\n return matches;\n};\n\n/**\n *\n * @param {array} rules\n * @param {string} key - column name\n * @param {string} ruleName - the rule name like header, width etc...\n * @returns {array}\n */\nWOQLRule.prototype.matchColumn = function (rules, key, ruleName) {\n const matches = [];\n for (let i = 0; i < rules.length; i++) {\n if (ruleName && this.rule && typeof this.rule[ruleName] === undefined) continue;\n const ruleRow = rules[i];\n /*\n * if it is not the rule that I'm looking for\n */\n if (ruleName && ruleRow.rule[ruleName] === undefined) {\n continue;\n }\n if (ruleRow.pattern.matchColumn(key)) {\n matches.push(ruleRow);\n }\n }\n return matches;\n};\n\nWOQLRule.prototype.matchNode = function (rules, row, key, nid, action) {\n const matches = [];\n for (let i = 0; i < rules.length; i++) {\n if (action && this.rule && typeof this.rule[action] === 'undefined') continue;\n if (rules[i].pattern.matchNode(row, key, nid)) {\n matches.push(rules[i]);\n }\n }\n return matches;\n};\n\nWOQLRule.prototype.matchPair = function (rules, row, keya, keyb, action) {\n const matches = [];\n for (let i = 0; i < rules.length; i++) {\n if (action && this.rule && typeof this.rule[action] === 'undefined') continue;\n if (rules[i].pattern.matchPair(row, keya, keyb)) {\n matches.push(rules[i]);\n }\n }\n return matches;\n};\n\n// alias\nWOQLRule.prototype.matchEdge = WOQLRule.prototype.matchPair;\n\n/**\n * Object to encapsulate the matching of woql result patterns - inherits from TerminusRule\n * @param {Object} pattern\n */\nfunction WOQLPattern(pattern) {\n TerminusRule.TerminusPattern.call(this, pattern);\n}\nObject.setPrototypeOf(WOQLPattern.prototype, TerminusRule.TerminusPattern.prototype);\n\nWOQLPattern.prototype.prettyPrint = function () {\n // starts with obj. ...\n let str = `${this.scope}('`;\n if (this.variables) {\n str += this.variables.join(\"', '\");\n }\n str += \"')\";\n if (typeof this.literal !== 'undefined') {\n str += `.literal(${this.literal})`;\n }\n if (typeof this.type !== 'undefined') {\n str += `.type(${this.unpack(this.type)})`;\n }\n if (typeof this.value !== 'undefined') {\n str += `.value(${this.unpack(this.value, true)})`;\n }\n for (const v in this.constraints) {\n str += `.v('${v}')`;\n for (let i = 0; i < this.constraints[v].length; i++) {\n if (typeof this.constraints[v][i] === 'function') {\n str += `.filter(${this.constraints[v][i]})`;\n } else {\n // eslint-disable-next-line no-undef\n str += `.in(${json.unpack(this.constraints[v][i])})`;\n }\n }\n }\n return str;\n};\n\n/**\n * @param {String|Object} data\n * @param {String|[String, String]} [key] - a variable or an array of two variables\n * (in the case of edge scope) which constitutes the key being tested\n * @param {String} [scope] - the scope in which the test is being carried out (row, column, cell)\n */\n\nWOQLPattern.prototype.matchRow = function (row, rownum) {\n if (typeof this.rownum !== 'undefined' && typeof rownum !== 'undefined') {\n if (!this.numberMatch(this.rownum, rownum)) return false;\n }\n if (this.scope && this.scope !== 'row') return false;\n if (!this.testVariableConstraints(row)) return false;\n return true;\n};\n\nWOQLPattern.prototype.matchCell = function (row, key, rownum) {\n if (typeof this.rownum !== 'undefined' && typeof rownum !== 'undefined') {\n if (!this.numberMatch(this.rownum, rownum)) return false;\n }\n if (!this.testBasics('column', row[key])) return false;\n if (this.variables && this.variables.length && this.variables.indexOf(key) === -1) return false;\n if (!this.testVariableConstraints(row)) return false;\n return true;\n};\n\nWOQLPattern.prototype.matchNode = function (row, key) {\n if (!this.testBasics('node', row[key])) return false;\n if (this.variables && this.variables.length && this.variables.indexOf(key) === -1) return false;\n if (!this.testVariableConstraints(row)) return false;\n return true;\n};\n\nWOQLPattern.prototype.matchColumn = function (key) {\n if (this.scope && this.scope !== 'column') return false;\n if (this.variables && this.variables.length && this.variables.indexOf(key) === -1) return false;\n return true;\n};\n\nWOQLPattern.prototype.matchPair = function (row, keya, keyb) {\n if (this.scope && this.scope !== 'edge') return false;\n if (this.source && this.source !== keya) return false;\n if (this.target && this.target !== keyb) return false;\n if (!this.testVariableConstraints(row)) return false;\n return true;\n};\n\nWOQLPattern.prototype.testVariableConstraints = function (row) {\n for (const k in this.constraints) {\n if (!this.testVariableConstraint(k, row[k])) return false;\n }\n return true;\n};\n\nWOQLPattern.prototype.testVariableConstraint = function (name, val) {\n if (!this.constraints[name]) return true;\n for (let i = 0; i < this.constraints[name].length; i++) {\n if (!this.testValue(val, this.constraints[name][i])) {\n return false;\n }\n }\n return true;\n};\n\nWOQLPattern.prototype.setPattern = function (pattern) {\n for (const key in pattern) {\n this[key] = pattern[key];\n }\n};\n\nWOQLPattern.prototype.json = function () {\n const json = {};\n if (this.scope) {\n json.scope = this.scope;\n }\n if (this.value) {\n json.value = this.value;\n }\n if (this.rownum) json.rownum = this.rownum;\n if (this.variables) json.variables = this.variables;\n if (this.literal) json.literal = this.literal;\n if (this.type) json.type = this.type;\n if (this.constraints) json.constraints = this.constraints;\n if (this.source) json.source = this.source;\n if (this.target) json.target = this.target;\n return json;\n};\n\nmodule.exports = { WOQLRule, WOQLPattern };\n","const WOQLStreamConfig = require('./streamConfig');\n\n/**\n * @param {WOQLClient} client\n * @param {WOQLStreamConfig} config\n * @returns {WOQLStream}\n */\nfunction WOQLStream(client, config) {\n this.client = client;\n this.config = (config || new WOQLStreamConfig());\n return this;\n}\n\nWOQLStream.prototype.options = function (config) {\n this.config = config;\n return this;\n};\n\nWOQLStream.prototype.setResult = function (wqrs) {\n this.result = wqrs;\n};\n\nmodule.exports = WOQLStream;\n","/* eslint-disable no-use-before-define */\n/* eslint-disable camelcase */\n/* eslint-disable no-undef */\n/* eslint-disable no-param-reassign */\n/* eslint-disable no-redeclare */\n/* eslint-disable block-scoped-var */\n/* eslint-disable no-var */\n/* eslint-disable vars-on-top */\n/* eslint-disable no-unused-vars */\nconst WOQLTableConfig = require('./tableConfig');\nconst UTILS = require('../utils');\nconst { WOQLRule } = require('./woqlRule');\nconst WOQLResult = require('./woqlResult');\nconst WOQLClient = require('../woqlClient');\n\n/**\n * @module WOQLTable\n * @license Apache Version 2\n * @param {WOQLClient} [client] we need an client if we do a server side pagination,sorting etc...\n * @param {WOQLTableConfig} [config]\n * @returns {WOQLTable}\n */\n\nfunction WOQLTable(client, config) {\n this.client = client;\n this.config = config || new WOQLTableConfig();\n return this;\n}\n\n/**\n * set the WOQLTableConfig for this table\n * @param {WOQLTableConfig} config\n * @returns {WOQLTable}\n */\n\nWOQLTable.prototype.options = function (config) {\n this.config = config;\n return this;\n};\n\n/**\n * Set the query result using the WOQLResult object\n * @param {WOQLResult} result - the WOQLResult object\n * @returns {WOQLTable}\n */\n\nWOQLTable.prototype.setResult = function (result) {\n this.result = result;\n return this;\n};\n\n/**\n * @returns {number} the total result\n */\nWOQLTable.prototype.count = function () {\n return this.result.count();\n};\n\n/**\n * Get the first object record from the result set\n * @returns {object}\n */\nWOQLTable.prototype.first = function () {\n return this.result.first();\n};\n\n/**\n * Get the preview object record from the result set\n * @returns {object}\n */\n\nWOQLTable.prototype.prev = function () {\n return this.result.prev();\n};\n\n/**\n * Get the next object record from the result set\n * @returns {object}\n */\n\nWOQLTable.prototype.next = function () {\n return this.result.next();\n};\n\n/**\n * @returns {boolean}\n */\n\nWOQLTable.prototype.canAdvancePage = function () {\n return this.result.count() === this.result.query.getLimit();\n};\n\nWOQLTable.prototype.canChangePage = function () {\n return this.canAdvancePage() || this.canRetreatPage();\n};\n\nWOQLTable.prototype.canRetreatPage = function () {\n return this.result.query.getPage() > 1;\n};\n\nWOQLTable.prototype.getPageSize = function () {\n return this.result.query.getLimit();\n};\n\nWOQLTable.prototype.setPage = function (l) {\n return this.result.query.setPage(l);\n};\n\nWOQLTable.prototype.getPage = function () {\n return this.result.query.getPage();\n};\n\nWOQLTable.prototype.setPageSize = function (l) {\n return this.update(this.result.query.setPageSize(l));\n};\n\nWOQLTable.prototype.nextPage = function () {\n return this.update(this.result.query.nextPage());\n};\n\nWOQLTable.prototype.firstPage = function () {\n return this.update(this.result.query.firstPage());\n};\n\nWOQLTable.prototype.previousPage = function () {\n return this.update(this.result.query.previousPage());\n};\n\nWOQLTable.prototype.getColumnsToRender = function () {\n if (this.hasColumnOrder()) {\n var cols = this.getColumnOrder();\n } else {\n var cols = this.result.getVariableList();\n }\n const self = this;\n return cols ? cols.filter((col) => !self.hidden(col)) : [];\n};\n\nWOQLTable.prototype.getColumnHeaderContents = function (colid) {\n colid = UTILS.removeNamespaceFromVariable(colid);\n const rules = new WOQLRule().matchColumn(this.config.rules, colid, 'header');\n // hr is an array header in not always the last item\n if (rules.length) {\n const header = rules[rules.length - 1].rule ? rules[rules.length - 1].rule.header : null;\n if (typeof header === 'string') {\n return header;\n } if (typeof header === 'function') {\n return header(colid);\n } return header;\n }\n if (colid[0] === '_') return ' ';\n return UTILS.labelFromVariable(colid);\n // return document.createTextNode(clab);\n};\n\nWOQLTable.prototype.hidden = function (col) {\n colid = UTILS.removeNamespaceFromVariable(col);\n const matched_rules = new WOQLRule().matchColumn(this.config.rules, colid, 'hidden');\n if (matched_rules.length) {\n return matched_rules[matched_rules.length - 1].rule.hidden;\n }\n return false;\n};\n\n/**\n * Called when you want to change the query associated with the table.\n */\nWOQLTable.prototype.update = function (nquery) {\n return nquery.execute(this.client).then((results) => {\n const nresult = new WOQLResult(results, nquery);\n this.setResult(nresult);\n if (this.notify) this.notify(nresult);\n return nresult;\n });\n};\n\nWOQLTable.prototype.hasDefinedEvent = function (row, key, scope, action, rownum) {\n if (scope === 'row') {\n var matched_rules = new WOQLRule().matchRow(this.config.rules, row, rownum, action);\n } else {\n var matched_rules = new WOQLRule().matchCell(this.config.rules, row, key, rownum, action);\n }\n if (matched_rules && matched_rules.length) return true;\n return false;\n};\n\n// eslint-disable-next-line consistent-return\nWOQLTable.prototype.getDefinedEvent = function (row, key, scope, action, rownum) {\n if (scope === 'row') {\n var matched_rules = new WOQLRule().matchRow(this.config.rules, row, rownum, action);\n } else {\n var matched_rules = new WOQLRule().matchCell(this.config.rules, row, key, rownum, action);\n }\n // I get more than one rule it is not always the last\n if (Array.isArray(matched_rules) && matched_rules.length > 0) {\n // if I have only one rule\n if (matched_rules.length === 1) return matched_rules[0].rule[action];\n // eslint-disable-next-line max-len\n const findRule = matched_rules.find((item) => item.rule[action] !== undefined || item.rule[action] === false);\n return findRule && findRule.rule ? findRule.rule[action] : undefined;\n }\n return undefined;\n};\n\nWOQLTable.prototype.getRowClick = function (row) {\n const re = this.getDefinedEvent(row, false, 'row', 'click');\n return re;\n};\n\nWOQLTable.prototype.uncompressed = function (row, col) {\n const re = this.getDefinedEvent(row, col, 'row', 'uncompressed');\n return re;\n};\n\nWOQLTable.prototype.getCellClick = function (row, col) {\n const cc = this.getDefinedEvent(row, col, 'column', 'click');\n return cc;\n};\n\nWOQLTable.prototype.getRowHover = function (row) {\n return this.getDefinedEvent(row, false, 'row', 'hover');\n};\n\nWOQLTable.prototype.getCellHover = function (row, key) {\n return this.getDefinedEvent(row, key, 'column', 'hover');\n};\n\nWOQLTable.prototype.getColumnOrder = function () {\n return this.config.column_order();\n};\n\nWOQLTable.prototype.bindings = function () {\n return this.config.bindings();\n};\n\nWOQLTable.prototype.getColumnFilter = function (colid) {\n const filter = new WOQLRule().matchColumn(this.config.rules, colid, 'filter');\n // console.log('getColumnFilter', filter);\n if (Array.isArray(filter) && filter.length > 0 && filter[0].rule) {\n return filter[0].rule.filter;\n }\n return null;\n};\n\nWOQLTable.prototype.getColumnDimensions = function (key) {\n const cstyle = {};\n const w = new WOQLRule().matchColumn(this.config.rules, key, 'width');\n if (w && w.length && w[w.length - 1].rule.width) {\n cstyle.width = w[w.length - 1].rule.width;\n }\n const max = new WOQLRule().matchColumn(this.config.rules, key, 'maxWidth');\n if (max && max.length) cstyle.maxWidth = max[max.length - 1].rule.maxWidth;\n const min = new WOQLRule().matchColumn(this.config.rules, key, 'minWidth');\n if (min && min.length) cstyle.minWidth = min[min.length - 1].rule.minWidth;\n return cstyle;\n};\n\nWOQLTable.prototype.hasColumnOrder = WOQLTable.prototype.getColumnOrder;\nWOQLTable.prototype.hasCellClick = WOQLTable.prototype.getCellClick;\nWOQLTable.prototype.hasRowClick = WOQLTable.prototype.getRowClick;\nWOQLTable.prototype.hasCellHover = WOQLTable.prototype.getCellHover;\nWOQLTable.prototype.hasRowHover = WOQLTable.prototype.getRowHover;\n\nWOQLTable.prototype.getRenderer = function (key, row, rownum) {\n return this.getDefinedEvent(row, key, 'column', 'renderer', rownum);\n // let args = this.getDefinedEvent(row, key, \"column\", \"args\", rownum);\n // eslint-disable-next-line no-unreachable\n if (!renderer) {\n const r = this.getRendererForDatatype(row[key]);\n renderer = r.name;\n if (!args) args = r.args;\n }\n if (renderer) {\n return this.datatypes.createRenderer(renderer, args);\n }\n};\n\nWOQLTable.prototype.isSortableColumn = function (key) {\n if (this.getDefinedEvent(false, key, 'column', 'unsortable')) return false;\n return true;\n};\n\nWOQLTable.prototype.isFilterableColumn = function (key) {\n if (this.getDefinedEvent(false, key, 'column', 'filterable') === false) return false;\n return true;\n};\n\nWOQLTable.prototype.renderValue = function (renderer, val, key, row) {\n if (val && val['@type']) {\n renderer.type = val['@type'];\n var dv = new DataValue(val['@value'], val['@type'], key, row);\n } else if (val && val['@language']) {\n renderer.type = 'xsd:string';\n var dv = new DataValue(val['@value'], renderer.type, key, row);\n } else if (val && typeof val === 'string') {\n renderer.type = 'id';\n var dv = new DataValue(val, 'id', key, row);\n }\n if (dv) return renderer.renderValue(dv);\n return '';\n};\n\nfunction DataValue(val, type) {\n this.datavalue = val === 'system:unknown' ? '' : val;\n this.datatype = type;\n}\n\nDataValue.prototype.value = function (nvalue) {\n if (nvalue) {\n this.datavalue = nvalue;\n return this;\n }\n return this.datavalue;\n};\n\nWOQLTable.prototype.getRendererForDatatype = function (val) {\n if (val && val['@type']) {\n return this.datatypes.getRenderer(val['@type'], val['@value']);\n } if (val && val['@language']) {\n return this.datatypes.getRenderer('xsd:string', val['@value']);\n } if (val && typeof val === 'string') {\n return this.datatypes.getRenderer('id', val);\n }\n return false;\n};\n\nWOQLTable.prototype.getSpecificRender = function (key, row) {\n const rend = this.getDefinedEvent(row, key, 'column', 'render');\n return rend;\n};\n\nmodule.exports = WOQLTable;\n","const WOQLTableConfig = require('./tableConfig');\nconst WOQLChooserConfig = require('./chooserConfig');\nconst WOQLGraphConfig = require('./graphConfig');\nconst WOQLChartConfig = require('./chartConfig');\nconst WOQLStreamConfig = require('./streamConfig');\nconst FrameConfig = require('./frameConfig');\nconst { WOQLRule } = require('./woqlRule');\nconst { FrameRule } = require('./frameRule');\n\n/**\n * We bundle the useful functions in a View object and just export that for ease of consumption\n * @constructor\n * View\n */\nconst View = {};\n\nView.table = function () { return new WOQLTableConfig(); };\nView.chart = function () { return new WOQLChartConfig(); };\nView.graph = function () { return new WOQLGraphConfig(); };\nView.chooser = function () { return new WOQLChooserConfig(); };\nView.stream = function () { return new WOQLStreamConfig(); };\nView.document = function () { return new FrameConfig(); };\nView.loadConfig = function (config) {\n let view;\n if (config.table) {\n view = new WOQLTableConfig();\n view.loadJSON(config.table, config.rules);\n } else if (config.chooser) {\n view = new WOQLChooserConfig();\n view.loadJSON(config.chooser, config.rules);\n } else if (config.graph) {\n view = new WOQLGraphConfig();\n view.loadJSON(config.graph, config.rules);\n } else if (config.chart) {\n view = new WOQLChartConfig();\n view.loadJSON(config.chart, config.rules);\n } else if (config.stream) {\n view = new WOQLStreamConfig();\n view.loadJSON(config.stream, config.rules);\n } else if (config.frame) {\n view = new FrameConfig();\n view.loadJSON(config.frame, config.rules);\n }\n return view;\n};\n\n/**\n * Shorthand functions for accessing the pattern matching capabilities\n */\nView.rule = function (type) {\n if (type && type === 'frame') return new FrameRule();\n return new WOQLRule();\n};\n\nView.pattern = function (type) {\n if (type && type === 'woql') return new WOQLRule().pattern;\n return new FrameRule().pattern;\n};\n\n/**\n * Called to match an entire row of results is matched by a set of rules\n * returns array of rules that matched\n */\nView.matchRow = function (rules, row, rownum, action) {\n return new WOQLRule().matchRow(rules, row, rownum, action);\n};\n\n/**\n * Called to test whether an entire column of results is matched by a set of rules\n * returns array of rules that matched\n */\nView.matchColumn = function (rules, key, action) {\n return new WOQLRule().matchColumn(rules, key, action);\n};\n\n/**\n * Called to test whether a specific cell is matched by a set of rules\n * returns array of rules that matched\n */\nView.matchCell = function (rules, row, key, rownum, action) {\n return new WOQLRule().matchCell(rules, row, key, rownum, action);\n};\n\n/**\n * Called to test whether a specific node is matched by a set of rules\n * returns array of rules that matched\n */\nView.matchNode = function (rules, row, key, nid, action) {\n return new WOQLRule().matchNode(rules, row, key, nid, action);\n};\n\n/**\n * Called to test whether a specific edge (source -> target) is matched by a set of rules\n * returns array of rules that matched\n */\nView.matchEdge = function (rules, row, keya, keyb, action) {\n return new WOQLRule().matchPair(rules, row, keya, keyb, action);\n};\n\n/**\n * Called to test whether a specific frame is matched by a set of rules\n */\nView.matchFrame = function (rules, frame, onmatch) {\n return new FrameRule().testRules(rules, frame, onmatch);\n};\n\nmodule.exports = View;\n","/* eslint-disable camelcase */\n/* eslint-disable no-underscore-dangle */\n/// /@ts-check\n// I HAVE TO REVIEW THE Inheritance and the prototype chain\nconst WOQLQuery = require('./query/woqlBuilder');\nconst WOQLLibrary = require('./query/woqlLibrary');\nconst { Vars, Var, Doc } = require('./query/woqlDoc');\n// eslint-disable-next-line no-unused-vars\nconst typedef = require('./typedef');\n// eslint-disable-next-line no-unused-vars\nconst WOQLClient = require('./woqlClient');\n\n/**\n * @license Apache Version 2\n * @module WOQL\n * @constructor WOQL\n * @description The WOQL object is a wrapper around the WOQLQuery object\n * Syntactic sugar to allow writing WOQL.triple()... instead of new WOQLQuery().triple()\n * Every function matches one of the public api functions of the woql query object\n */\nconst WOQL = {};\n\n/**\n * WOQL primitives are WOQL.js functions which directly map onto words in\n * the underlying JSON-LD language. All other WOQL.js functions are compound functions\n * which translate into multiple WOQL primitives, or are helper functions which reduce\n * the need to write verbose JSON-LD directly.\n */\n\n/**\n * WOQL Literals, Prefixes & IRI Constant\n */\n\n/*\n * We expose all the real woql predicates via the WOQL object,\n * for ease of typing all return a WOQL query object\n */\n\n/**\n * Query running against any specific commit Id\n * @param {string} refPath - path to specific reference Id or commit Id\n * @param {WOQLQuery} [subquery] - subquery for the specific commit point\n * @returns {WOQLQuery}\n * @example\n * let [a, b, c] = vars(\"a\", \"b\", \"c\")\n * WOQL.using(\"userName/dbName/local/commit|branch/commitID\").triple(a, b, c)\n */\nWOQL.using = function (refPath, subquery) {\n return new WOQLQuery().using(refPath, subquery);\n};\n\n/**\n * Adds a text comment to a query - can also be used to wrap any part of a query to turn it off\n * @param {string} comment - text comment\n * @param {WOQLQuery} [subquery] - query that is \"commented out\"\n * @returns {WOQLQuery}\n */\nWOQL.comment = function (comment, subquery) {\n return new WOQLQuery().comment(comment, subquery);\n};\n\n/**\n * @example\n * let [a, b, c] = vars(\"a\", \"b\", \"c\")\n * WOQL.select(a, triple(a, b, c))\n * Filters the query so that only the variables included in [V1...Vn] are returned in the bindings\n * @param {...string|...Var} varNames - only these variables are returned\n * @returns {WOQLQuery}\n */\nWOQL.select = function (...varNames) {\n return new WOQLQuery().select(...varNames);\n};\n\n/**\n * Filter the query to return only results that are distinct in the given variables\n * @param {...string|...Var} varNames - these variables are guaranteed to be unique as a tuple\n * @returns {WOQLQuery}\n */\nWOQL.distinct = function (...varNames) {\n return new WOQLQuery().distinct(...varNames);\n};\n\n/**\n * Logical conjunction of the contained queries - all queries must match or the entire clause fails\n * @param {...WOQLQuery} subqueries - A list of one or more woql queries to execute as a conjunction\n * @returns {WOQLQuery} - A WOQLQuery object containing the conjunction of queries\n * @example\n * //find triples that are of type scm:Journey, and have\n * //a start_station Start, and that start_station is labeled Start_Label\n * let [Journey, Start, Start_Label] = vars(\"Journey\", \"Start\", \"Start_Label\")\n * WOQL.and(\n * WOQL.triple(Journey, \"rdf:type\", \"@schema:Journey\"),\n * WOQL.triple(Journey, \"start_station\", Start),\n * WOQL.triple(Start, \"label\", Start_Label))\n *\n */\n\nWOQL.and = function (...subqueries) {\n return new WOQLQuery().and(...subqueries);\n};\n\n/**\n * Use {@link #read_document|read_document} instead.\n * @deprecated\n */\n\nWOQL.read_object = function (IRI, output, formatObj) {\n return new WOQLQuery().read_document(IRI, output, formatObj);\n};\n\n/**\n * Read a node identified by an IRI as a JSON-LD document\n * @param {string} IRI - The document id or a variable to read\n * @param {string} output - Variable which will be bound to the document.\n * @return {object} WOQLQuery\n * @example\n * let [person] = vars(\"Person\")\n * const query = WOQL.read_document(\n * \"Person/0b4feda109d9d13c9da809090b342ad9e4d8185545ce05f7cd20b97fe458f547\",\n * person\n * );\n * const res = await client.query(query);\n */\n\nWOQL.read_document = function (IRI, output) {\n return new WOQLQuery().read_document(IRI, output);\n};\n\n/**\n * Insert a document in the graph.\n * @param {object} docjson - The document to insert. Must either have an '@id' or\n * have a class specified key.\n * @param {string} [IRI] - An optional identifier specifying the document location.\n * @return {object} WOQLQuery\n * @example\n * const res = await client.query(\n * WOQL.insert_document(WOQL.doc({ \"@type\" : \"Person\", \"label\": \"John\" }))\n * )\n */\n\nWOQL.insert_document = function (docjson, IRI) {\n return new WOQLQuery().insert_document(docjson, IRI);\n};\n\n/**\n * Update a document identified by an IRI\n * @param {object} docjson - The document to update. Must either have an '@id' or\n * have a class specified key.\n * @param {string} [IRI] - An optional identifier specifying the document location.\n * @return {object} WOQLQuery\n */\n\nWOQL.update_document = function (docjson, IRI) {\n return new WOQLQuery().update_document(docjson, IRI);\n};\n\n/**\n * Delete a document from the graph.\n * @param {string} IRI - The document id or a variable\n * @return {object} WOQLQuery\n */\n\nWOQL.delete_document = function (IRI) {\n return new WOQLQuery().delete_document(IRI);\n};\n\n/**\n * Creates a logical OR of the arguments\n * @param {...WOQLQuery} subqueries - A list of one or more woql queries\n * to execute as alternatives\n * @returns {WOQLQuery} - A WOQLQuery object containing the logical Or of the subqueries\n * @example\n * let [Subject] = vars(\"Subject\")\n * or(\n * triple(Subject, 'label', \"A\"),\n * triple(Subject, \"label\", \"a\")\n * )\n */\nWOQL.or = function (...subqueries) {\n return new WOQLQuery().or(...subqueries);\n};\n\n/**\n * Specifies the database URL that will be the default database for the enclosed query\n * @param {typedef.GraphRef} graphRef- A valid graph resource identifier string\n * @param {WOQLQuery} [query] - The query\n * @returns {WOQLQuery} A WOQLQuery object containing the from expression\n */\n\nWOQL.from = function (graphRef, query) {\n return new WOQLQuery().from(graphRef, query);\n};\n\n/**\n * Specifies the graph resource to write the contained query into\n * @param {typedef.GraphRef} graphRef- A valid graph resource identifier string\n * @param {WOQLQuery} [subquery] - The query which will be written into the graph\n * @returns {WOQLQuery} A WOQLQuery which will be written into the graph in question\n * @example\n * //Subq is an argument or a chained query\n * using(\"admin/minecraft\").into(\"instance/main\").add_triple(\"a\", \"rdf:type\", \"@schema:X\")\n * //writes a single tripe (doc:a, rdf:type, scm:X) into the main instance graph\n *\n */\nWOQL.into = function (graphRef, subquery) {\n return new WOQLQuery().into(graphRef, subquery);\n};\n\n/**\n * Creates a triple pattern matching rule for the triple [S, P, O] (Subject, Predicate, Object)\n * @param {string|Var} subject - The IRI of a triple’s subject or a variable\n * @param {string|Var} predicate - The IRI of a property or a variable\n * @param {string|Var} object - The IRI of a node or a variable, or a literal\n * @returns {WOQLQuery}\n */\nWOQL.triple = function (subject, predicate, object) {\n return new WOQLQuery().triple(subject, predicate, object);\n};\n\n/**\n * Creates a triple pattern matching rule for the triple [S, P, O] (Subject, Predicate,\n * Object) added in the current layer\n * @param {string|Var} subject - The IRI of a triple’s subject or a variable\n * @param {string|Var} predicate - The IRI of a property or a variable\n * @param {string|Var} object - The IRI of a node or a variable, or a literal\n * @returns {WOQLQuery}\n */\nWOQL.added_triple = function (subject, predicate, object) {\n return new WOQLQuery().added_triple(subject, predicate, object);\n};\n\n/**\n * Creates a triple pattern matching rule for the triple [S, P, O] (Subject, Predicate,\n * Object) added in the current commit\n * @param {string|Var} subject - The IRI of a triple’s subject or a variable\n * @param {string|Var} predicate - The IRI of a property or a variable\n * @param {string|Var} object - The IRI of a node or a variable, or a literal\n * @returns {WOQLQuery}\n */\nWOQL.removed_triple = function (subject, predicate, object) {\n return new WOQLQuery().removed_triple(subject, predicate, object);\n};\n\n/**\n * Creates a pattern matching rule for the quad [S, P, O, G] (Subject, Predicate, Object, Graph)\n * @param {string|Var} subject - The IRI of a triple’s subject or a variable\n * @param {string|Var} predicate - The IRI of a property or a variable\n * @param {string|Var} object - The IRI of a node or a variable, or a literal\n * @param {typedef.GraphRef} graphRef - A valid graph resource identifier string\n * @returns {WOQLQuery}\n */\nWOQL.quad = function (subject, predicate, object, graphRef) {\n return new WOQLQuery().quad(subject, predicate, object, graphRef);\n};\n\n/**\n * Creates a pattern matching rule for the quad [S, P, O, G] (Subject, Predicate,\n * Object, Graph) removed from the current commit\n * @param {string|Var} subject - The IRI of a triple’s subject or a variable\n * @param {string|Var} predicate - The IRI of a property or a variable\n * @param {string|Var} object - The IRI of a node or a variable, or a literal\n * @param {typedef.GraphRef} graphRef- A valid graph resource identifier string\n * @returns {WOQLQuery}\n */\nWOQL.added_quad = function (subject, predicate, object, graphRef) {\n return new WOQLQuery().added_quad(subject, predicate, object, graphRef);\n};\n\n/**\n * Creates a pattern matching rule for the quad [S, P, O, G] (Subject, Predicate,\n * Object, Graph) removed from the current commit\n * @param {string|Var} subject - The IRI of a triple’s subject or a variable\n * @param {string|Var} predicate - The IRI of a property or a variable\n * @param {string|Var} object - The IRI of a node or a variable, or a literal\n * @param {typedef.GraphRef} graphRef- A valid graph resource identifier string\n * @returns {WOQLQuery}\n */\nWOQL.removed_quad = function (subject, predicate, object, graphRef) {\n return new WOQLQuery().removed_quad(subject, predicate, object, graphRef);\n};\n\n/**\n * Returns true if ClassA subsumes ClassB, according to the current DB schema\n * @param {string} classA - ClassA\n * @param {string} classB - ClassB\n * @returns {boolean} WOQLQuery\n */\nWOQL.sub = function (classA, classB) {\n return new WOQLQuery().sub(classA, classB);\n};\n\nWOQL.subsumption = function (classA, classB) {\n return new WOQLQuery().sub(classA, classB);\n};\n\n/**\n * Matches if a is equal to b\n * @param {string|Var} varName - literal, variable or id\n * @param {string|Var} varValue - literal, variable or id\n * @returns {WOQLQuery}\n *\n *\n */\nWOQL.eq = function (varName, varValue) {\n return new WOQLQuery().eq(varName, varValue);\n};\n\nWOQL.equals = function (varName, varValue) {\n return new WOQLQuery().eq(varName, varValue);\n};\n\n/**\n * Substring\n * @param {string|Var} string - String or variable\n * @param {number|Var} before - integer or variable (characters from start to begin)\n * @param {number|Var} [length] - integer or variable (length of substring)\n * @param {number|Var} [after] - integer or variable (number of characters after substring)\n * @param {string|Var} [substring] - String or variable\n * @returns {WOQLQuery}\n */\n\nWOQL.substr = function (string, before, length, after, substring) {\n return new WOQLQuery().substr(string, before, length, after, substring);\n};\nWOQL.substring = function (string, before, length, after, substring) {\n return new WOQLQuery().substr(string, before, length, after, substring);\n};\n\n/**\n * Use the document inteface to import documents\n * @deprecated\n * Retrieves the exernal resource defined by QueryResource and copies values\n * from it into variables defined in AsVars\n * @param {Vars | array<Var>} asvars - an array of AsVar variable mappings (see as for format below)\n * @param {WOQLQuery} queryResource - an external resource (remote, file, post) to query\n * @returns {WOQLQuery} A WOQLQuery which contains the get expression\n * @example\n * let [a, b] = vars(\"a\", \"b\")\n * get(as(\"a\", a).as(\"b\", b)).remote(\"http://my.url.com/x.csv\")\n * //copies the values from column headed \"a\" into a variable a and from column\n * //\"b\" into a variable b from remote CSV\n */\nWOQL.get = function (asvars, queryResource) {\n return new WOQLQuery().get(asvars, queryResource);\n};\n\n/**\n * Use the document inteface to import documents\n * @deprecated\n * @put Outputs the results of a query to a file\n * @param {Vars | array<Var>} varsToExp - an array of AsVar variable\n * mappings (see as for format below)\n * @param {WOQLQuery} query - The query which will be executed to produce the results\n * @param {string} fileResource - an file resource local to the server\n * @returns {WOQLQuery} A WOQLQuery which contains the put expression\n */\nWOQL.put = function (varsToExp, query, fileResource) {\n return new WOQLQuery().put(varsToExp, query, fileResource);\n};\n\n/**\n * Imports the value identified by Source to a Target variable\n * @param {string | number | Var} source - Source\n * @param {string | Var} target - Target\n * @param {string} [type] - type to cast value to string|number etc...\n * @returns {WOQLQuery}\n * @example\n * let [First_Var, Second_Var] = vars('First_Var', 'Second_Var')\n * WOQL.as(\"first var\", First_Var, \"string\").as(\"second var\", Second_Var)\n * WOQL.as([\"first var\", First_Var, \"string\"], [\"second var\", Second_Var])\n */\n\nWOQL.as = function (source, target, type) {\n return new WOQLQuery().as(source, target, type);\n};\n\n/**\n * Identifies a remote resource by URL and specifies the format of the resource through the options\n * @param {object} remoteObj - The URL at which the remote resource can be accessed\n * @param {typedef.DataFormatObj} [formatObj] - The format of the resource data {}\n * @returns {WOQLQuery} A WOQLQuery which contains the remote resource identifier\n * @example\n * remote({url:\"http://url.of.resource\"}, {type: \"csv\"})\n */\n//\nWOQL.remote = function (remoteObj, formatObj) {\n return new WOQLQuery().remote(remoteObj, formatObj);\n};\n\n/**\n * Identifies a resource as a local path on the client, to be sent to the server through a\n * HTTP POST request, with the format defined through the options\n * @param {string} url - The Path on the server at which the file resource can be accessed\n * @param {typedef.DataFormatObj} [formatObj] - imput options, optional\n * @param {string} [source] - It defines the source of the file, it can be 'url','post'\n * @returns {WOQLQuery} A WOQLQuery which contains the Post resource identifier\n * @example\n * post(\"/.../.../\", {type:'csv'})\n */\nWOQL.post = function (url, formatObj, source) {\n return new WOQLQuery().post(url, formatObj, source);\n};\n\n/**\n * Deletes a single triple from the default graph of the database\n * @param {string|Var} subject - The IRI of a triple’s subject or a variable\n * @param {string|Var} predicate - The IRI of a property or a variable\n * @param {string|Var} object - The IRI of a node or a variable, or a literal\n * @returns {WOQLQuery} - A WOQLQuery which contains the Triple Deletion statement\n * @example\n * delete_triple(\"john\", \"age\", 42)\n */\nWOQL.delete_triple = function (subject, predicate, object) {\n return new WOQLQuery().delete_triple(subject, predicate, object);\n};\n\n/**\n * Deletes a single triple from the graph [Subject, Predicate, Object, Graph]\n * @param {string|Var} subject - The IRI of a triple’s subject or a variable\n * @param {string|Var} predicate - The IRI of a property or a variable\n * @param {string|Var} object - The IRI of a node or a variable, or a literal\n * @param {typedef.GraphRef} graphRef - A valid graph resource identifier string\n * @returns {WOQLQuery} - A WOQLQuery which contains the Delete Quad Statement\n * @example remove the class Person from the schema graph\n * WOQL.delete_quad(\"Person\", \"rdf:type\", \"sys:Class\", \"schema\")\n */\nWOQL.delete_quad = function (subject, predicate, object, graphRef) {\n return new WOQLQuery().delete_quad(subject, predicate, object, graphRef);\n};\n\n/**\n * Adds triples according to the the pattern [subject,predicate,object]\n * @param {string|Var} subject - The IRI of a triple’s subject or a variable\n * @param {string|Var} predicate - The IRI of a property or a variable\n * @param {string|Var} object - The IRI of a node or a variable, or a literal\n * @returns {WOQLQuery}\n */\nWOQL.add_triple = function (subject, predicate, object) {\n return new WOQLQuery().add_triple(subject, predicate, object);\n};\n\n/**\n * Adds quads according to the pattern [S,P,O,G]\n * @param {string|Var} subject - The IRI of a triple’s subject or a variable\n * @param {string|Var} predicate - The IRI of a property or a variable\n * @param {string|Var} object - The IRI of a node or a variable, or a literal\n * @param {typedef.GraphRef} graphRef- A valid graph resource identifier string\n * @returns {WOQLQuery}\n */\nWOQL.add_quad = function (subject, predicate, object, graphRef) {\n return new WOQLQuery().add_quad(subject, predicate, object, graphRef);\n};\n\n/**\n *\n * When the subquery is met, the update query is executed\n * @param {WOQLQuery} subquery - the condition query\n * @param {WOQLQuery} [updateQuery]\n * @returns {WOQLQuery} - A WOQLQuery which contains the when expression\n * @example\n * when(true()).triple(\"a\", \"b\", \"c\")\n */\n\n// Functions which take a query as an argument advance the cursor to make the chaining\n// of queries fall into the corrent place in the encompassing json.\n/* WOQL.when = function(subquery, updateQuery) {\n return new WOQLQuery().when(subquery, updateQuery)\n} */\n\n/**\n *\n * Remove whitespace from both sides of a string:\n * @param {string|Var} inputStr - A string or variable containing\n * the untrimmed version of the string\n * @param {string|Var} resultVarName - A string or variable\n * containing the trimmed version of the string\n * @returns {WOQLQuery} A WOQLQuery which contains the Trim pattern matching expression\n * @example\n * let [trimmed] = vars(\"trimmed\")\n * trim(\"hello \", trimmed)\n * //trimmed contains \"hello\"\n */\nWOQL.trim = function (inputStr, resultVarName) {\n return new WOQLQuery().trim(inputStr, resultVarName);\n};\n\n/**\n *\n * Evaluates the passed arithmetic expression and generates or matches the result value\n * @param {object| WOQLQuery | string} arithExp - A WOQL query containing a valid WOQL Arithmetic\n * Expression, which is evaluated by the function\n * @param {string|number|Var} resultVarName - Either a variable, in which the result of the\n * expression will be stored, or a numeric literal which will be used as a test of result of\n * the evaluated expression\n * @returns {WOQLQuery} A WOQLQuery which contains the Arithmetic function\n * @example\n * let [result] = vars(\"result\")\n * evaluate(plus(2, minus(3, 1)), result)\n */\nWOQL.evaluate = function (arithExp, resultVarName) {\n return new WOQLQuery().eval(arithExp, resultVarName);\n};\n\n/**\n *\n * Evaluates the passed arithmetic expression and generates or matches the result value\n * @param {object| WOQLQuery | string} arithExp - A WOQL query containing a valid WOQL Arithmetic\n * Expression, which is evaluated by the function\n * @param {string|number|Var} resultVarName - Either a variable, in which the result of the\n * expression will be stored, or a numeric literal which will be used as a test of result of\n * the evaluated expression\n * @returns {WOQLQuery} A WOQLQuery which contains the Arithmetic function\n * @example\n * let [result] = vars(\"result\")\n * eval(plus(2, minus(3, 1)), result)\n */\nWOQL.eval = function (arithExp, resultVarName) {\n return new WOQLQuery().eval(arithExp, resultVarName);\n};\n\n/**\n *\n * Adds the numbers together\n * @param {...(string|number|Var)} args - a variable or numeric containing the values to add\n * @returns {WOQLQuery} A WOQLQuery which contains the addition expression\n * @example\n * let [result] = vars(\"result\")\n * evaluate(plus(2, plus(3, 1)), result)\n */\nWOQL.plus = function (...args) {\n return new WOQLQuery().plus(...args);\n};\n\n/**\n *\n * Subtracts Numbers N1..Nn\n * @param {...(string|number|Var)} args - variable or numeric containing the value that will be\n * subtracted from\n * @returns {WOQLQuery} A WOQLQuery which contains the subtraction expression\n * @example\n * let [result] = vars(\"result\")\n * evaluate(minus(2.1, plus(0.2, 1)), result)\n */\nWOQL.minus = function (...args) {\n return new WOQLQuery().minus(...args);\n};\n\n/**\n *\n * Multiplies numbers N1...Nn together\n * @param {...(string|number|Var)} args - a variable or numeric containing the value\n * @returns {WOQLQuery} A WOQLQuery which contains the multiplication expression\n * @example\n * let [result] = vars(\"result\")\n * evaluate(times(10, minus(2.1, plus(0.2, 1))), result)\n * //result contains 9.000000000000002y\n */\nWOQL.times = function (...args) {\n return new WOQLQuery().times(...args);\n};\n\n/**\n *\n * Divides numbers N1...Nn by each other left, to right precedence\n * @param {...(string|number|Var )} args - numbers to tbe divided\n * @returns {WOQLQuery} A WOQLQuery which contains the division expression\n * let [result] = vars(\"result\")\n * evaluate(divide(times(10, minus(2.1, plus(0.2, 1))), 10), result)\n * //result contains 0.9000000000000001\n */\nWOQL.divide = function (...args) {\n return new WOQLQuery().divide(...args);\n};\n\n/**\n *\n * Division - integer division - args are divided left to right\n * @param {...(string|number|Var)} args - numbers for division\n * @returns {WOQLQuery} A WOQLQuery which contains the division expression\n * @example\n * let [result] = vars(\"result\")\n * evaluate(div(10, 3), result)\n * //result contains 3\n */\nWOQL.div = function (...args) {\n return new WOQLQuery().div(...args);\n};\n\n/*\n * @param {integer or double} a - base number\n * @param {integer or double} b - power of\n * @returns {object} WOQLQuery */\n\n/**\n *\n * Exponent - raises varNum01 to the power of varNum02\n * @param {string|number|Var} varNum - a variable or numeric containing the number to be\n * raised to the power of the second number\n * @param {number} expNum - a variable or numeric containing the exponent\n * @returns {WOQLQuery} A WOQLQuery which contains the exponent expression\n * @example\n * let [result] = vars(\"result\")\n * evaluate(exp(3, 2), result)\n * //result contains 9\n */\nWOQL.exp = function (varNum, expNum) {\n return new WOQLQuery().exp(varNum, expNum);\n};\n\n/**\n *\n * Generates the nearest lower integer to the passed number\n * @param {string|number|Var} varNum - Variable or numeric containing the number to be floored\n * @returns {WOQLQuery} A WOQLQuery which contains the floor expression\n * @example\n * let [result] = vars(\"result\")\n * evaluate(divide(floor(times(10, minus(2.1, plus(0.2, 1)))), 10), result)\n * //result contains 0.9 - floating point error removed\n */\nWOQL.floor = function (varNum) {\n return new WOQLQuery().floor(varNum);\n};\n\n/**\n *\n * Tests whether a given instance IRI has type Class, according to the current state of the DB\n * @param {string|Var} instanceIRI - A string IRI or a variable that identify the class instance\n * @param {string|Var} classId - A Class IRI or a variable\n * @returns {WOQLQuery} A WOQLQuery object containing the type test\n * @example\n * let [subject] = vars(\"subject\")\n * isa(subject, \"Person\")\n */\nWOQL.isa = function (instanceIRI, classId) {\n return new WOQLQuery().isa(instanceIRI, classId);\n};\n\n/**\n *\n * Generates a string Leverstein distance measure between stringA and stringB\n * @param {string|Var} stringA - string literal or variable representing a string to be compared\n * @param {string|Var } stringB - string literal or variable\n * representing the other string to be compared\n * @param {number|string|Var} distance - variable representing the distance between the variables\n * @returns {WOQLQuery} A WOQLQuery which contains the Like pattern matching expression\n * @example\n * let [dist] = vars('dist')\n * like(\"hello\", \"hallo\", dist)\n * //dist contains 0.7265420560747664\n */\nWOQL.like = function (stringA, stringB, distance) {\n return new WOQLQuery().like(stringA, stringB, distance);\n};\n\n/**\n *\n * Compares the value of v1 against v2 and returns true if v1 is less than v2\n * @param {string|number|Var} varNum01 - a variable or numeric containing\n * the number to be compared\n * @param {string|number|Var} varNum02 - a variable or numeric containing the second comporator\n * @returns {WOQLQuery} A WOQLQuery which contains the comparison expression\n * @example\n * let [result] = vars(\"result\")\n * less(1, 1.1).eq(result, literal(true, \"boolean\"))\n * //result contains true\n */\nWOQL.less = function (varNum01, varNum02) {\n return new WOQLQuery().less(varNum01, varNum02);\n};\n\n/**\n *\n * Compares the value of v1 against v2 and returns true if v1 is greater than v2\n * @param {string|number|Var} varNum01 - a variable or numeric containing the number to be compared\n * @param {string|number|Var} varNum02 - a variable or numeric containing the second comporator\n * @returns {WOQLQuery} A WOQLQuery which contains the comparison expression\n * @example\n * let [result] = vars(\"result\")\n * greater(1.2, 1.1).eq(result, literal(true, \"boolean\"))\n * //result contains true\n */\nWOQL.greater = function (varNum01, varNum02) {\n return new WOQLQuery().greater(varNum01, varNum02);\n};\n\n/**\n *\n * Specifies that the Subquery is optional - if it does not match the query will not fail\n * @param {WOQLQuery} [subquery] - A subquery which will be optionally matched\n * @returns {WOQLQuery} A WOQLQuery object containing the optional sub Query\n * @example\n * let [subject] = vars(\"subject\")\n * opt(triple(subject, 'label', \"A\"))\n * //Subq is an argument or a chained query\n * opt().triple(subject, 'label', \"A\")\n */\nWOQL.opt = function (subquery) {\n return new WOQLQuery().opt(subquery);\n};\n\nWOQL.optional = function (subquery) {\n return new WOQLQuery().opt(subquery);\n};\n\n/**\n *\n * Generate a new IRI from the prefix and a hash of the variables which will be unique for any\n * given combination of variables\n * @param {string} prefix - A prefix for the IRI - typically formed of the doc prefix and the\n * classtype of the entity (“doc:Person”)\n * @param {array|string|Var} inputVarList - An array of variables and / or strings from which the\n * unique hash will be generated\n * @param {string|Var} resultVarName - Variable in which the unique ID is stored\n * @returns {WOQLQuery} A WOQLQuery object containing the unique ID generating function\n * @example\n * let [newid] = vars(\"newid\")\n * unique(\"doc:Person\", [\"John\", \"Smith\"], newid)\n */\nWOQL.unique = function (prefix, inputVarList, resultVarName) {\n return new WOQLQuery().unique(prefix, inputVarList, resultVarName);\n};\n\n/**\n *\n * Generate a new IRI from the prefix and concatention of the variables\n * @param {string} prefix - A prefix for the IRI - typically formed of the doc prefix and the\n * classtype of the entity (“doc:Person”)\n * @param {array|string|Var} inputVarList - An array of variables and / or strings from which the\n * unique hash will be generated\n * @param {string|Var} resultVarName - Variable in which the unique ID is stored\n * @returns {WOQLQuery} A WOQLQuery object containing the ID generating function\n * @example\n * let [newid] = vars(\"newid\")\n * idgen(\"doc:Person\", [\"John\", \"Smith\"], newid)\n */\nWOQL.idgen = function (prefix, inputVarList, resultVarName) {\n return new WOQLQuery().idgen(prefix, inputVarList, resultVarName);\n};\nWOQL.idgenerator = function (prefix, inputVarList, resultVarName) {\n return new WOQLQuery().idgen(prefix, inputVarList, resultVarName);\n};\n\n/**\n *\n * Changes a string to upper-case\n * @param {string|Var} inputVarName - string or variable representing the uncapitalized string\n * @param {string|Var} resultVarName - variable that stores the capitalized string output\n * @returns {WOQLQuery} A WOQLQuery which contains the Upper case pattern matching expression\n * @example\n * let [allcaps] = vars(\"allcaps\")\n * upper(\"aBCe\", allcaps)\n * //upper contains \"ABCE\"\n */\nWOQL.upper = function (inputVarName, resultVarName) {\n return new WOQLQuery().upper(inputVarName, resultVarName);\n};\n\n/**\n *\n * Changes a string to lower-case\n * @param {string|Var} inputVarName - string or variable representing the non-lowercased string\n * @param {string|Var} resultVarName - variable that stores the lowercased string output\n * @returns {WOQLQuery} A WOQLQuery which contains the Lower case pattern matching expression\n * @example\n * let [lower] = var(\"l\")\n * lower(\"aBCe\", lower)\n * //lower contains \"abce\"\n */\nWOQL.lower = function (inputVarName, resultVarName) {\n return new WOQLQuery().lower(inputVarName, resultVarName);\n};\n\n/**\n *\n * Pads out the string input to be exactly len long by appending the pad character pad to\n * form output\n * @param {string|Var} inputVarName - The input string or variable in unpadded state\n * @param {string|Var} pad - The characters to use to pad the string or a variable representing them\n * @param {number | string | Var} len - The variable or integer value representing the length of\n * the output string\n * @param {string|Var} resultVarName - stores output\n * @returns {WOQLQuery} A WOQLQuery which contains the Pad pattern matching expression\n * @example\n * let [fixed] = vars(\"fixed length\")\n * pad(\"joe\", \" \", 8, fixed)\n * //fixed contains \"joe \"\n */\nWOQL.pad = function (inputVarName, pad, len, resultVarName) {\n return new WOQLQuery().pad(inputVarName, pad, len, resultVarName);\n};\n\n/**\n * Splits a string (Input) into a list strings (Output) by removing separator\n * @param {string|Var} inputVarName - A string or variable representing the unsplit string\n * @param {string|Var} separator - A string or variable containing a sequence of charatcters\n * to use as a separator\n * @param {string|Var} resultVarName - variable that stores output list\n * @returns {WOQLQuery} A WOQLQuery which contains the Split pattern matching expression\n * @example\n * let [words] = vars(\"words\")\n * split(\"joe has a hat\", \" \", words)\n */\nWOQL.split = function (inputVarName, separator, resultVarName) {\n return new WOQLQuery().split(inputVarName, separator, resultVarName);\n};\n\n/**\n * Matches if List includes Element\n * @param {string|object|Var} element - Either a variable, IRI or any simple datatype\n * @param {string|array|Var} list - List ([string, literal] or string*) Either a variable\n * representing a list or a list of variables or literals\n * @returns {WOQLQuery} A WOQLQuery which contains the List inclusion pattern matching expression\n * @example\n * let [name] = vars(\"name\")\n * member(name, [\"john\", \"joe\", \"frank\"])\n */\nWOQL.member = function (element, list) {\n return new WOQLQuery().member(element, list);\n};\n\n/**\n *\n * takes a variable number of string arguments and concatenates them into a single string\n * @param {array|string|Var} varList - a variable representing a list or a list of variables or\n * strings - variables can be embedded in the string if they do not contain spaces\n * @param {string|Var} resultVarName - A variable or string containing the output string\n * @returns {WOQLQuery} A WOQLQuery which contains the Concatenation pattern matching expression\n * @example\n * let [first_name, last_name, full_name] = vars(\"first_name\", \"last_name\", \"full_name\")\n * concat([first_name, \" \", last_name], full_name)\n */\nWOQL.concat = function (varList, resultVarName) {\n return new WOQLQuery().concat(varList, resultVarName);\n};\n\n/**\n *\n * Joins a list variable together (Input) into a string variable (Output) by glueing the strings\n * together with Glue\n * @param {string|array|Var} varList - a variable representing a list or a list of strings\n * and / or variables\n * @param {string|Var} glue - A variable (v:glue) or (glue) string representing the characters\n * to put in between the joined strings in input\n * @param {string|Var} resultVarName - A variable or string containing the output string\n * @returns {WOQLQuery} A WOQLQuery which contains the Join pattern matching expression\n * @example\n * let [sentence] = vars(\"sentence\")\n * join([\"joe\", \"has\", \"a\", \"hat\", \" \", sentence)\n */\nWOQL.join = function (varList, glue, resultVarName) {\n return new WOQLQuery().join(varList, glue, resultVarName);\n};\n\n/**\n * computes the sum of the List of values passed. In contrast to other arithmetic functions,\n * sum self-evaluates - it does not have to be passed to evaluate()\n * @param {WOQLQuery} subquery - a subquery or ([string or numeric]) - a list variable, or a\n * list of variables or numeric literals\n * @param {string|Var} total - the variable name with the sum result of the values in List\n * @returns {WOQLQuery} - A WOQLQuery which contains the Sum expression\n * @example\n * let [total] = vars(\"total\")\n * sum([2, 3, 4, 5], total)\n */\nWOQL.sum = function (subquery, total) {\n return new WOQLQuery().sum(subquery, total);\n};\n\n/**\n *\n * Specifies an offset position in the results to start listing results from\n * @param {number|string|Var} start - A variable that refers to an interger or an integer literal\n * @param {WOQLQuery} [subquery] - WOQL Query object, you can pass a subquery as an argument\n * or a chained query\n * @returns {WOQLQuery} A WOQLQuery whose results will be returned starting from\n * the specified offset\n * @example\n * let [a, b, c] = vars(\"a\", \"b\", \"c\")\n * start(100).triple(a, b, c)\n */\nWOQL.start = function (start, subquery) {\n return new WOQLQuery().start(start, subquery);\n};\n\n/**\n *\n * Specifies a maximum number of results that will be returned from the subquery\n * @param {number|string} limit - A variable that refers to an non-negative integer or a\n * non-negative integer\n * @param {WOQLQuery} [subquery] - A subquery whose results will be limited\n * @returns {WOQLQuery} A WOQLQuery whose results will be returned starting from\n * the specified offset\n * @example\n * let [a, b, c] = vars(\"a\", \"b\", \"c\")\n * limit(100).triple(a, b, c)\n * //subquery is an argument or a chained query\n * limit(100,triple(a, b, c))\n */\nWOQL.limit = function (limit, subquery) {\n return new WOQLQuery().limit(limit, subquery);\n};\n\n/**\n *\n * Matches the regular expression defined in Patern against the Test string, to produce\n * the matched patterns in Matches\n * @param {string} pattern - string or variable using normal PCRE regular expression syntax with\n * the exception that special characters have to be escaped twice (to enable transport in JSONLD)\n * @param {string|Var} inputVarName - string or variable containing the string to be tested for\n * patterns with the regex\n * @param {string|array|object|Var} resultVarList - variable representing the list of matches\n * or a list of strings or variables\n * @returns {WOQLQuery} A WOQLQuery which contains the Regular Expression pattern\n * matching expression\n * @example\n * let [All, Sub] = vars(\"All\", \"Sub\")\n * WOQL.re(\"h(.).*\", \"hello\", [All, Sub])\n * //e contains 'e', llo contains 'llo'\n * //p is a regex pattern (.*) using normal regular expression syntax, the only unusual\n * thing is that special characters have to be escaped twice, s is the string to be matched\n * and m is a list of matches:\n */\nWOQL.re = function (pattern, inputVarName, resultVarList) {\n return new WOQLQuery().re(pattern, inputVarName, resultVarList);\n};\nWOQL.regexp = function (pattern, inputVarName, resultVarList) {\n return new WOQLQuery().re(pattern, inputVarName, resultVarList);\n};\n\n/**\n *\n * Calculates the length of the list in va and stores it in vb\n * @param {string|array} inputVarList - Either a variable representing a list or a list of\n * variables or literals\n * @param {string|Var} resultVarName - A variable in which the length of the list is stored or\n * the length of the list as a non-negative integer\n * @returns {WOQLQuery} A WOQLQuery which contains the Length pattern matching expression\n * @example\n * let [count] = vars(\"count\")\n * length([\"john\", \"joe\", \"frank\"], count)\n */\nWOQL.length = function (inputVarList, resultVarName) {\n return new WOQLQuery().length(inputVarList, resultVarName);\n};\n\n/**\n *\n * Logical negation of the contained subquery - if the subquery matches, the query\n * will fail to match\n * @param {string | WOQLQuery} [subquery] - A subquery which will be negated\n * @returns {WOQLQuery} A WOQLQuery object containing the negated sub Query\n * @example\n * let [subject, label] = vars(\"subject\", \"label\")\n * not().triple(subject, 'label', label)\n */\nWOQL.not = function (subquery) {\n return new WOQLQuery().not(subquery);\n};\n\n/**\n * Results in one solution of the subqueries\n * @param {string| WOQLQuery } [subquery] - WOQL Query objects\n * @returns {WOQLQuery} A WOQLQuery object containing the once sub Query\n */\nWOQL.once = function (subquery) {\n return new WOQLQuery().once(subquery);\n};\n\n/**\n * Runs the query without backtracking on side-effects\n * @param {string| WOQLQuery } [subquery] - WOQL Query objects\n * @returns {WOQLQuery} A WOQLQuery object containing the immediately sub Query\n */\nWOQL.immediately = function (subquery) {\n return new WOQLQuery().immediately(subquery);\n};\n\n/**\n * Creates a count of the results of the query\n * @param {string|number|Var} countVarName - variable or integer count\n * @param {WOQLQuery} [subquery]\n * @returns {WOQLQuery} A WOQLQuery object containing the count sub Query\n * @example\n * let [count, Person] = vars(\"count\", \"Person\")\n * WOQL.count(count).triple(Person, \"rdf:type\", \"@schema:Person\")\n */\nWOQL.count = function (countVarName, subquery) {\n return new WOQLQuery().count(countVarName, subquery);\n};\n\n/**\n *\n * Casts the value of Input to a new value of type Type and stores the result in CastVar\n * @param {string|number|object|Var} varName - Either a single variable or a\n * literal of any basic type\n * @param {string|Var} varType - Either a variable or a basic datatype (xsd / xdd)\n * @param {string|Var} resultVarName - save the return variable\n * @returns {WOQLQuery} A WOQLQuery which contains the casting expression\n * @example\n * let [time] = vars(\"time\")\n * cast(\"22/3/98\", \"xsd:dateTime\", time)\n */\nWOQL.typecast = function (varName, varType, resultVarName) {\n return new WOQLQuery().typecast(varName, varType, resultVarName);\n};\nWOQL.cast = function (varName, varType, resultVarName) {\n return new WOQLQuery().typecast(varName, varType, resultVarName);\n};\n\n/**\n * Orders the results of the contained subquery by a precedence list of variables\n * @param {...string|...Var|...array} varNames - A sequence of variables,\n * by which to order the results,\n * each optionally followed by either “asc” or “desc” to represent order as a list, by default\n * it will sort the variable in ascending order\n * @returns {WOQLQuery} A WOQLQuery which contains the ordering expression\n * @example\n * let [A, B, C] = vars(\"A\", \"B\", \"C\")\n * WOQL.order_by(A, [B, \"asc\"], [C, \"desc\"]).triple(A, B, C);\n */\nWOQL.order_by = function (...varNames) {\n return new WOQLQuery().order_by(...varNames);\n};\n\n/**\n *\n * Groups the results of the contained subquery on the basis of identical values for Groupvars,\n * extracts the patterns defined in PatternVars and stores the results in GroupedVar\n * @param {array|string|Var} varList - Either a single variable or an array of variables\n * @param {array|string|Var} patternVars - Either a single variable or an array of variables\n * @param {string|Var} resultVarName - output variable name\n * @param {WOQLQuery} [subquery] - The query whose results will be grouped\n * @returns {WOQLQuery} A WOQLQuery which contains the grouping expression\n * @example\n * //subquery is an argument or a chained query\n * let [age, last_name, first_name, age_group, person] = vars(\"age\", \"last name\", \"first name\",\n * \"age group\", \"person\")\n * group_by(age, [last_name, first_name], age_group)\n * .triple(person, \"first_name\", first_name)\n * .triple(person, \"last_name\", last_name)\n * .triple(person, \"age\", age)\n */\nWOQL.group_by = function (varList, patternVars, resultVarName, subquery) {\n return new WOQLQuery().group_by(varList, patternVars, resultVarName, subquery);\n};\n\n/**\n *\n * A function that always matches, always returns true\n * @returns {WOQLQuery} A WOQLQuery object containing the true value that will match any pattern\n * @example\n * when(true()).triple(\"a\", \"b\", \"c\")\n */\nWOQL.true = function () {\n return new WOQLQuery().true();\n};\n\n/**\n *\n * Performs a path regular expression match on the graph\n * @param {string|Var} subject - An IRI or variable that refers to an IRI representing the subject,\n * i.e. the starting point of the path\n * @param {string} pattern -(string) - A path regular expression describing a pattern through\n * multiple edges of the graph (see: https://terminusdb.com/docs/path-query-reference-guide)\n * @param {string|Var} object - An IRI or variable that refers to an IRI representing the object,\n * i.e. ending point of the path\n * @param {string|Var} [resultVarName] - A variable in which the actual paths\n * traversed will be stored\n * @returns {WOQLQuery} - A WOQLQuery which contains the path regular expression matching expression\n * @example\n * let [person, grand_uncle, lineage] = vars(\"person\", \"grand uncle\", \"lineage\")\n * path(person, \"((father|mother) {2,2}), brother)\", grand_uncle, lineage)\n */\nWOQL.path = function (subject, pattern, object, resultVarName) {\n return new WOQLQuery().path(subject, pattern, object, resultVarName);\n};\n\n/**\n *\n * Calculates the size in bytes of the contents of the resource identified in ResourceID\n * @param {string|Var} resourceId - A valid resource identifier string (can refer to any graph /\n * branch / commit / db)\n * @param {string|Var} resultVarName - The variable name\n * @example\n * let [varSize] = vars(\"varSize\")\n * size(\"admin/minecraft/local/branch/main/instance/main\", varSize)\n * //returns the number of bytes in the main instance graph on the main branch\n */\nWOQL.size = function (resourceId, resultVarName) {\n return new WOQLQuery().size(resourceId, resultVarName);\n};\n\n/**\n *\n * Calculates the number of triples of the contents of the resource identified in ResourceID\n * @param {string|Var} resourceId - A valid resource identifier string (can refer to any graph /\n * branch / commit / db)\n * @param {string|number|Var} tripleCount - An integer literal with the size in bytes or a\n * variable containing that integer\n * @returns {WOQLQuery} A WOQLQuery which contains the size expression\n * @example\n * let [count] = vars(\"count\")\n * triple_count(\"admin/minecraft/local/_commits\", count)\n * //returns the number of bytes in the local commit graph\n */\nWOQL.triple_count = function (resourceId, tripleCount) {\n return new WOQLQuery().triple_count(resourceId, tripleCount);\n};\n\n/**\n *\n * Returns true if 'elementId' is of type 'elementType', according to the current DB schema\n * @param {string|Var} elementId - the id of a schema graph element\n * @param {string|Var} elementType - the element type\n * @returns {WOQLQuery} A WOQLQuery object containing the type_of pattern matching rule\n *\n */\nWOQL.type_of = function (elementId, elementType) {\n return new WOQLQuery().type_of(elementId, elementType);\n};\n\n/**\n *\n * Generates a query that by default matches all triples in a graph identified by \"graph\"\n * or in all the current terminusDB's graph\n * @param {string | boolean} [graph] - false or the resource identifier of a graph possible\n * value are schema/{main - myschema - *} | instance/{main - myschema - *} |\n * inference/{main - myschema - *}\n * @param {string|Var} [subject] - The IRI of a triple’s subject or a variable,\n * default value \"v:Subject\"\n * @param {string|Var} [predicate] - The IRI of a property or a variable,\n * default value \"v:Predicate\"\n * @param {string|Var} [object] - The IRI of a node or a variable, or a literal,\n * default value \"v:Object\"\n * @returns {WOQLQuery} A WOQLQuery which contains the pattern matching expression\n * @example\n * star(\"schema/main\")\n * //will return every triple in schema/main graph\n */\nWOQL.star = function (graph, subject, predicate, object) {\n return new WOQLQuery().star(graph, subject, predicate, object);\n};\n\n/**\n *\n * Generates a query that by default matches all triples in a graph - identical to\n * star() except for order of arguments\n * @param {string|Var} [subject] - The IRI of a triple’s subject or a variable\n * @param {string|Var} [predicate] - The IRI of a property or a variable\n * @param {string|Var} [object] - The IRI of a node or a variable, or a literal\n * @param {typedef.GraphRef} [graphRef] - the resource identifier of a graph possible\n * value are schema/{main - myschema - *} | instance/{main - myschema - *} |\n * inference/{main - myschema - *}\n * @returns {WOQLQuery} - A WOQLQuery which contains the pattern matching expression\n * all(\"mydoc\")\n * //will return every triple in the instance/main graph that has \"doc:mydoc\" as its subject\n */\nWOQL.all = function (subject, predicate, object, graphRef) {\n return new WOQLQuery().all(subject, predicate, object, graphRef);\n};\n\n/**\n *\n * Specifies the identity of a node that can then be used in subsequent builder functions.\n * Note that node() requires subsequent chained functions to complete the triples / quads\n * that it produces - by itself it only generates the subject.\n * @param {string|Var} nodeid - The IRI of a node or a variable containing an IRI which will\n * be the subject of the builder functions\n * @param {typedef.FuntionType} [chainType] - Optional type of builder function to build\n * (default is triple)\n * @returns {WOQLQuery} - A WOQLQuery which contains the partial Node pattern matching expression\n * @example\n * node(\"mydoc\").label(\"my label\")\n * //equivalent to triple(\"mydoc\", \"label\", \"my label\")\n */\nWOQL.node = function (nodeid, chainType) {\n return new WOQLQuery().node(nodeid, chainType);\n};\n// These ones are special ones for dealing with the schema only...\n\n/**\n * Inserts a single triple into the database declaring the Node to have type Type,\n * optionally into the specified graph\n * @param {string|Var} classId - IRI string or variable containing\n * the IRI of the node to be inserted\n * @param {string|Var} classType - IRI string or variable containing the IRI of the\n * type of the node (class/document name)\n * @param {typedef.GraphRef} [graphRef] - Optional Graph resource identifier\n * @returns {WOQLQuery} A WOQLQuery which contains the insert expression\n * @example\n * insert(\"mydoc\", \"MyType\")\n * //equivalent to add_triple(\"mydoc\", \"rdf:type\", \"@schema:MyType\")\n */\nWOQL.insert = function (classId, classType, graphRef) {\n return new WOQLQuery().insert(classId, classType, graphRef);\n};\n\n/**\n * Sets the graph resource ID that will be used for subsequent chained function calls\n * @param {typedef.GraphRef} [graphRef] Resource String identifying the graph which will\n * be used for subsequent chained schema calls\n * @returns {WOQLQuery} A WOQLQuery which contains the partial Graph pattern matching expression\n * @example\n * WOQL.graph(\"schema\")\n * //equivalent to add_quad(\"MyClass\", \"label\", \"My Class Label\", \"schema/main\")\n */\n\nWOQL.graph = function (graphRef) {\n return new WOQLQuery().graph(graphRef);\n};\n\n// to be review\n/**\n * Deletes all triples in the passed graph (defaults to instance/main)\n * @param {typedef.GraphRef} [graphRef] - Resource String identifying the graph from\n * which all triples will be removed\n * @returns {WOQLQuery} - A WOQLQuery which contains the deletion expression\n * @example\n * nuke(\"schema/main\")\n * //will delete everything from the schema/main graph\n */\nWOQL.nuke = function (graphRef) {\n return new WOQLQuery().nuke(graphRef);\n};\n\n/**\n * Generates an empty WOQLQuery object\n * @returns {WOQLQuery}\n * @example\n * let q = query()\n * //then q.triple(1, 1) ...\n */\nWOQL.query = function () {\n return new WOQLQuery();\n};\n\n/**\n * Generates a WOQLQuery object from the passed WOQL JSON - if an argument is passed,\n * the query object is created from it, if none is passed, the current state is\n * returned as a JSON-LD\n * @param {object} [JSON_LD] - JSON-LD woql document encoding a query\n * @returns {WOQLQuery | object} either a JSON-LD or a WOQLQuery object\n *\n * json version of query for passing to api\n */\nWOQL.json = function (JSON_LD) {\n return new WOQLQuery().json(JSON_LD);\n};\n\n/**\n * get the predefined library query [WOQLLibrary](/api/woqlLibrary.js?id=WOQLLibrary)\n * @returns {WOQLQuery} WOQLQuery object\n * @example\n * //get commits older than the specified commit id\n * const query = WOQL.lib().previousCommits('m8vpxewh2aovfauebfkbzwmj4qwr5lb')\n *\n * //return the commits of a specific branch starting from the head\n * //you can add the limit (how many results to return.) and the start point\n * //if a timestamp is given, gets the commits before the specified timestamp\n * //WOQL.lib().commits(branch='main',limit=0,start=0,timestamp=0)\n *\n * const query = WOQL.lib().commits('main',10,2,1630683082.9278786)\n *\n * //return the branches list with the timestamp and commits id\n * const query = WOQL.lib().branches()\n */\nWOQL.lib = function () {\n return new WOQLLibrary();\n};\n\n/**\n * Generates explicitly a JSON-LD string literal from the input\n * @param {string | boolean | number} val - any primitive literal type\n * @returns {object} - A JSON-LD string literal\n * @example\n * string(1)\n * //returns { \"@type\": \"xsd:string\", \"@value\": \"1\" }\n */\nWOQL.string = function (val) {\n return new WOQLQuery().string(val);\n};\n\n/**\n * Generates explicitly a JSON-LD string literal from the input\n * @param {string} val - any literal type\n * @param {string} type - an xsd or xdd type\n * @returns {object} - A JSON-LD literal\n * @example\n * literal(1, \"nonNegativeInteger\")\n * //returns { \"@type\": \"xsd:nonNegativeInteger\", \"@value\": 1 }\n */\nWOQL.literal = function (val, type) {\n return new WOQLQuery().literal(val, type);\n};\n\n/**\n * Generates explicitly a JSON-LD literal date from the imput\n * @param {string} date - any date format string (YYYY-MM-DD)\n * @returns {object} - A JSON-LD literal date\n * @example\n * date(\"2022-10-02\")\n * //returns { \"@type\": \"xsd:date\", \"@value\": \"2022-10-02\" }\n */\nWOQL.date = function (date) {\n return new WOQLQuery().literal(date, 'xsd:date');\n};\n\n/**\n * Generates explicitly a JSON-LD literal datetime from the imput\n * @param {string} datetime - any datetime format string (YYYY-MM-DDThh-mm-ssZ)\n * @returns {object} - A JSON-LD literal datetime\n * @example\n * datetime(\"2022-10-19T14:17:12Z\")\n * //returns { \"@type\": \"xsd:dateTime\", \"@value\": \"2022-10-19T14:17:12Z\" }\n */\nWOQL.datetime = function (datetime) {\n return new WOQLQuery().literal(datetime, 'xsd:dateTime');\n};\n\n/**\n * Generates explicitly a JSON-LD literal boolean from the input\n * @param {boolean} bool - true | false\n * @returns {object} - A JSON-LD literal boolean\n * @example\n * boolean(true)\n * //returns { \"@type\": \"xsd:boolean\", \"@value\": true }\n */\nWOQL.boolean = function (bool) {\n return new WOQLQuery().boolean(bool);\n};\n\n/**\n * Explicitly sets a value to be an IRI - avoiding automatic type marshalling\n * @param {string} val string which will be treated as an IRI\n * @returns {object} - A JSON-LD IRI value\n */\nWOQL.iri = function (val) {\n return new WOQLQuery().iri(val);\n};\n\n/**\n * Generates javascript variables for use as WOQL variables within a query\n * @param {...string} varNames\n * @returns {array<Var>} an array of javascript variables which can be dereferenced using the\n * array destructuring operation\n * @example\n * const [a, b, c] = WOQL.vars(\"a\", \"b\", \"c\")\n * //a, b, c are javascript variables which can be used as WOQL variables in subsequent queries\n */\n\nWOQL.vars = function (...varNames) {\n return varNames.map((item) => new Var(item));\n};\n\n/**\n * Produces an encoded form of a document that can be used by a WOQL operation\n * such as `WOQL.insert_document`.\n * @param {object} object - Document to encode\n * @returns {object} The encoded document\n * @example\n * const doc = WOQL.doc({ \"@type\": \"Person\", name: \"Newperson\" })\n */\n\nWOQL.doc = function (object) {\n return new Doc(object);\n};\n\n/**\n * Use instead to run your query woqlclient.query('myWOQLQuery')\n * @deprecated\n * Gets/Sets woqlClient\n * @param {WOQLClient}\n * @returns {WOQLClient}\n */\nWOQL.client = function (client) {\n if (client) this._client = client;\n return this._client;\n};\n\n/**\n *\n * @param {...string} varNames\n * @returns {object<Var>}\n * @example\n * const v = WOQL.Vars('var01', 'var02', 'var03');\n * triple(v.var01, v.var02, v.var03)\n */\nWOQL.Vars = function (...varNames) {\n return new Vars(...varNames);\n};\n\n/**\n *\n * query module\n * allow you to use WOQL words as top level functions\n * @param {*} auto_eval\n */\nWOQL.emerge = function (auto_eval) {\n const unemerged = ['emerge', 'true', 'eval'];\n function _emerge_str(k) {\n const str = `function ${k}(...args){\n return WOQL.${k}(...args)\n }`;\n return str;\n }\n const funcs = [_emerge_str('Vars')];\n // eslint-disable-next-line no-restricted-syntax\n for (const k in this) {\n if (typeof this[k] === 'function') {\n if (unemerged.indexOf(k) === -1) {\n funcs.push(_emerge_str(k));\n }\n }\n }\n const str = funcs.join(';\\n');\n // eslint-disable-next-line no-eval\n if (auto_eval) eval(str);\n return str;\n};\n\n/**\n * Update a pattern matching rule for the triple (Subject, Predicate, oldObjValue) with the\n * new one (Subject, Predicate, newObjValue)\n * @param {string|Var} subject - The IRI of a triple’s subject or a variable\n * @param {string|Var} predicate - The IRI of a property or a variable\n * @param {string|Var} newObjValue - The value to update or a literal\n * @param {string|Var} oldObjValue - The old value of the object\n * @returns {WOQLQuery} A WOQLQuery which contains the a Update Triple Statement\n */\n\nWOQL.update_triple = function (subject, predicate, newObjValue, oldObjValue) {\n return new WOQLQuery().update_triple(subject, predicate, newObjValue, oldObjValue);\n};\n\n/**\n * Update a pattern matching rule for the quad [S, P, O, G] (Subject, Predicate, Object, Graph)\n * @param {string|Var} subject - The IRI of a triple’s subject or a variable\n * @param {string|Var} predicate - The IRI of a property or a variable\n * @param {string|Var} newObject - The value to update or a literal\n * @param {typedef.GraphRef} graphRef - A valid graph resource identifier string\n * @returns {WOQLQuery} A WOQLQuery which contains the a Update Quad Statement\n */\n\nWOQL.update_quad = function (subject, predicate, newObject, graphRef) {\n return new WOQLQuery().update_quad(subject, predicate, newObject, graphRef);\n};\n\n/**\n * Creates a pattern matching rule for a triple [Subject, Predicate, Object]\n * add extra information about the type of the value object\n * @param {string|Var} subject - The IRI of a triple’s subject or a variable\n * @param {string|Var} predicate - The IRI of a property or a variable\n * @param {string | number | boolean | Var} objValue - an specific value\n * @returns {WOQLQuery} A WOQLQuery which contains the a quad or a triple Statement\n */\nWOQL.value = function (subject, predicate, objValue) {\n return new WOQLQuery().value(subject, predicate, objValue);\n};\n\n/**\n * Creates a pattern matching rule for a triple [Subject, Predicate, Object]\n * @param {string|Var} subject - The IRI of a triple’s subject or a variable\n * @param {string|Var} predicate - The IRI of a property or a variable\n * @param {string|Var} object - The IRI of a node or a variable, or a literal\n * @returns {WOQLQuery} A WOQLQuery which contains the a quad or a triple Statement\n */\nWOQL.link = function (subject, predicate, object) {\n return new WOQLQuery().link(subject, predicate, object);\n};\n\n/**\n * Extract the value of a key in a bound document.\n * @param {string|Var} document - Document which is being accessed.\n * @param {string|Var} field - The field from which the document which is being accessed.\n * @param {string|Var} value - The value for the document and field.\n * @returns {WOQLQuery} A WOQLQuery which contains the a dot Statement\n */\nWOQL.dot = function (document, field, value) {\n return new WOQLQuery().dot(document, field, value);\n};\n\nmodule.exports = WOQL;\n","/* eslint-disable camelcase */\n/* eslint-disable no-param-reassign */\n/* eslint-disable no-underscore-dangle */\n/* eslint-disable no-unused-vars */\n/// /@ts-check\nconst FormData = require('form-data');\nconst fs = require('fs');\nconst typedef = require('./typedef');\nconst CONST = require('./const');\nconst DispatchRequest = require('./dispatchRequest');\nconst ErrorMessage = require('./errorMessage');\nconst ConnectionConfig = require('./connectionConfig');\nconst WOQL = require('./woql');\nconst WOQLQuery = require('./query/woqlCore');\n\n/**\n * @license Apache Version 2\n * @class\n * @classdesc The core functionality of the TerminusDB javascript client is\n * defined in the WOQLClient class - in the woqlClient.js file. This class provides\n * methods which allow you to directly get and set all of the configuration and API\n * endpoints of the client. The other parts of the WOQL core - connectionConfig.js\n * and connectionCapabilities.js - are used by the client to store internal state - they\n * should never have to be accessed directly. For situations where you want to communicate\n * with a TerminusDB server API, the WOQLClient class is all you will need.\n */\nclass WOQLClient {\n connectionConfig = null;\n\n databaseList = [];\n\n organizationList = [];\n\n /**\n * @constructor\n * @param {string} serverUrl - the terminusdb server url\n * @param {typedef.ParamsObj} [params] - an object with the connection parameters\n * @example\n * //to connect with your local terminusDB\n * const client = new TerminusClient.WOQLClient(SERVER_URL,{user:\"admin\",key:\"myKey\"})\n * async function getSchema() {\n * client.db(\"test\")\n * client.checkout(\"dev\")\n * const schema = await client.getSchema()\n * }\n * //The client has an internal state which defines what\n * //organization / database / repository / branch / ref it is currently attached to\n *\n * //to connect with your TerminusDB Cloud Instance\n * const client = new TerminusClient.WOQLClient('SERVER_CLOUD_URL/mycloudTeam',\n * {user:\"myemail@something.com\", organization:'mycloudTeam'})\n *\n * client.setApiKey(MY_ACCESS_TOKEN)\n *\n * //to get the list of all organization's databases\n * async function callGetDatabases(){\n * const dbList = await client.getDatabases()\n * console.log(dbList)\n * }\n *\n * async function getSchema() {\n * client.db(\"test\")\n * client.checkout(\"dev\")\n * const schema = await client.getSchema()\n * }\n */\n constructor(serverUrl, params) {\n this.connectionConfig = new ConnectionConfig(serverUrl, params);\n }\n}\n\n/**\n * set the api key to access the cloud resources\n * @param {string} accessToken\n */\nWOQLClient.prototype.setApiKey = function (accessToken) {\n const currentAuth = this.connectionConfig.localAuth() || {};\n currentAuth.key = accessToken;\n currentAuth.type = 'apikey';\n this.connectionConfig.setLocalAuth(currentAuth);\n};\n\n/**\n * add extra headers to your request\n * @param {object} customHeaders\n * @returns {object}\n */\n\n// eslint-disable-next-line consistent-return\nWOQLClient.prototype.customHeaders = function (customHeaders) {\n if (customHeaders) this._customHeaders = customHeaders;\n else return this._customHeaders;\n};\n\nWOQLClient.prototype.CONST = CONST;\n\n/**\n * creates a copy of the client with identical internal state and context\n * useful if we want to change context for a particular API call without changing\n * the current client context\n * @returns {WOQLClient} new client object with identical state to original but\n * which can be manipulated independently\n * @example\n * let newClient = client.copy()\n */\nWOQLClient.prototype.copy = function () {\n const other = new WOQLClient(this.server());\n // other.connection = this.connection //keep same connection meta data - shared by copy\n other.connectionConfig = this.connectionConfig.copy(); // new copy of current connection data\n other.databaseList = this.databaseList;\n return other;\n};\n\n/**\n * Gets the current connected server url\n * it can only be set creating a new WOQLCLient instance\n * @returns {string}\n */\nWOQLClient.prototype.server = function () {\n return this.connectionConfig.serverURL();\n};\n\n/**\n * Retrieve the URL of the server’s API base that we are currently connected to\n * @returns {string} the URL of the TerminusDB server api endpoint we are connected\n * to (typically server() + “api/”)\n * @example\n * let api_url = client.api()\n */\nWOQLClient.prototype.api = function () {\n return this.connectionConfig.apiURL();\n};\n\n/**\n * Gets/Sets the client’s internal organization context value, if you change the organization\n * name the databases list will be set to empty\n * @param {string | boolean} [orgId] the organization id to set the context to\n * @returns {string | boolean}\n * @example\n * client.organization(\"admin\")\n */\nWOQLClient.prototype.organization = function (orgId) {\n if (typeof orgId !== 'undefined') {\n this.connectionConfig.setOrganization(orgId);\n // we have to reset the databases list\n this.databases([]);\n }\n return this.connectionConfig.organization();\n};\n\n/**\n * Checks if a database exists\n *\n * Returns true if a DB exists and false if it doesn't. Other results\n * throw an exception.\n * @param {string} [orgName] the organization id to set the context to\n * @param {string} [dbName] the db name to set the context to\n * @returns {Promise}\n * @example\n * async function executeIfDatabaseExists(f){\n * const hasDB = await client.hasDatabase(\"admin\", \"testdb\")\n * if (hasDB) {\n * f()\n * }\n * }\n */\nWOQLClient.prototype.hasDatabase = async function (orgName, dbName) {\n const dbCheckUrl = `${this.connectionConfig.apiURL()}db/${orgName}/${dbName}`;\n return new Promise((resolve, reject) => {\n this.dispatch(CONST.HEAD, dbCheckUrl).then((req) => {\n resolve(true);\n }).catch((err) => {\n if (err.status === 404) {\n resolve(false);\n } else {\n reject(err);\n }\n });\n });\n};\n\n/**\n * Gets the organization's databases list.\n *\n * If no organization has been set up, the function throws an exception\n * @returns {Promise}\n * @example\n * async function callGetDatabases(){\n * const dbList = await client.getDatabases()\n * console.log(dbList)\n * }\n */\nWOQLClient.prototype.getDatabases = async function () {\n // return response\n if (!this.connectionConfig.organization()) {\n throw new Error('You need to set the organization name');\n }\n // when we will have the end point to get the databases only for the current organization\n // we'll change this call\n await this.getUserOrganizations();\n const dbs = this.userOrganizations().find(\n (element) => element.name === this.connectionConfig.organization(),\n );\n const dbList = dbs && dbs.databases ? dbs.databases : [];\n this.databases(dbList);\n return dbList;\n};\n\n/**\n * Set/Get the organization's databases list (id, label, comment) that the current\n * user has access to on the server.\n * @param {array} [dbList] a list of databases the user has access to on the server, each having:\n * @returns {array} the organization's databases list\n * @example\n * //to get the list of all organization's databases\n * async function callGetDatabases(){\n * await client.getDatabases()\n * console.log(client.databases())\n * }\n *\n */\nWOQLClient.prototype.databases = function (dbList) {\n if (dbList) this.databaseList = dbList;\n return this.databaseList || [];\n};\n\n/**\n * Gets the current user object as returned by the connect capabilities response\n * user has fields: [id, name, notes, author]\n * @returns {Object}\n */\nWOQLClient.prototype.user = function () {\n // this is the locacal\n return this.connectionConfig.user();\n};\n\n/**\n * @desription Gets the user's organization id\n * @returns {string} the user organization name\n */\n// this is something that need review\nWOQLClient.prototype.userOrganization = function () {\n return this.user();\n};\n\n/**\n * Gets the database's details\n * @param {string} [dbName] - the datbase name\n * @returns {object} the database description object\n */\nWOQLClient.prototype.databaseInfo = function (dbName) {\n // const dbIdVal = dbId || this.db();\n // const orgIdVal = orgId || this.organization()\n const database = this.databases().find((element) => element.name === dbName);\n return database || {};\n};\n\n/**\n * Sets / Gets the current database\n * @param {string} [dbId] - the database id to set the context to\n * @returns {string|boolean} - the current database or false\n * @example\n * client.db(\"mydb\")\n */\nWOQLClient.prototype.db = function (dbId) {\n if (typeof dbId !== 'undefined') {\n this.connectionConfig.setDB(dbId);\n }\n return this.connectionConfig.dbid;\n};\n\n/**\n *Sets the internal client context to allow it to talk to the server’s internal system database\n *\n */\nWOQLClient.prototype.setSystemDb = function () {\n this.db(this.connectionConfig.system_db);\n};\n\n/**\n * Gets / Sets the client’s internal repository context value (defaults to ‘local’)\n * @param {typedef.RepoType | string} [repoId] - default value is local\n * @returns {string} the current repository id within the client context\n * @example\n * client.repo(\"origin\")\n */\nWOQLClient.prototype.repo = function (repoId) {\n if (typeof repoId !== 'undefined') {\n this.connectionConfig.setRepo(repoId);\n }\n return this.connectionConfig.repo();\n};\n\n/**\n * Gets/Sets the client’s internal branch context value (defaults to ‘main’)\n * @param {string} [branchId] - the branch id to set the context to\n * @returns {string} the current branch id within the client context\n */\nWOQLClient.prototype.checkout = function (branchId) {\n if (typeof branchId !== 'undefined') {\n this.connectionConfig.setBranch(branchId);\n }\n return this.connectionConfig.branch();\n};\n\n/**\n * Sets / gets the current ref pointer (pointer to a commit within a branch)\n * Reference ID or Commit ID are unique hashes that are created whenever a new commit is recorded\n * @param {string} [commitId] - the reference ID or commit ID\n * @returns {string|boolean} the current commit id within the client context\n * @example\n * client.ref(\"mkz98k2h3j8cqjwi3wxxzuyn7cr6cw7\")\n */\nWOQLClient.prototype.ref = function (commitId) {\n if (typeof commitId !== 'undefined') {\n this.connectionConfig.setRef(commitId);\n }\n return this.connectionConfig.ref();\n};\n\n/**\n * Sets/Gets set the database basic connection credential\n * @param {typedef.CredentialObj} [newCredential]\n * @returns {typedef.CredentialObj | boolean}\n * @example\n * client.localAuth({user:\"admin\",\"key\":\"mykey\",\"type\":\"basic\"})\n */\nWOQLClient.prototype.localAuth = function (newCredential) {\n if (typeof newCredential !== 'undefined') {\n this.connectionConfig.setLocalAuth(newCredential);\n }\n return this.connectionConfig.localAuth();\n};\n/**\n * Use {@link #localAuth} instead.\n * @deprecated\n */\n\nWOQLClient.prototype.local_auth = WOQLClient.prototype.localAuth;\n\n/**\n * Sets/Gets the jwt token for authentication\n * we need this to connect 2 terminusdb server to each other for push, pull, clone actions\n * @param {typedef.CredentialObj} [newCredential]\n * @returns {typedef.CredentialObj | boolean}\n * @example\n * client.remoteAuth({\"key\":\"dhfmnmjglkrelgkptohkn\",\"type\":\"jwt\"})\n */\nWOQLClient.prototype.remoteAuth = function (newCredential) {\n if (typeof newCredential !== 'undefined') {\n this.connectionConfig.setRemoteAuth(newCredential);\n }\n return this.connectionConfig.remoteAuth();\n};\n\n/**\n * Use {@link #remoteAuth} instead.\n * @deprecated\n */\n\nWOQLClient.prototype.remote_auth = WOQLClient.prototype.remoteAuth;\n\n/**\n * Gets the string that will be written into the commit log for the current user\n * @returns {string} the current user\n * @example\n * client.author()\n */\nWOQLClient.prototype.author = function () {\n // we have to review this with is the author in local and remote\n // was a old functionality\n // if (ignoreJwt) {\n // this.connectionConfig.user(ignoreJwt)\n // }\n return this.connectionConfig.user();\n};\n\n/**\n * @param {typedef.ParamsObj} params - a object with connection params\n * @example sets several of the internal state values in a single call\n * (similar to connect, but only sets internal client state, does not communicate with server)\n * client.set({key: \"mypass\", branch: \"dev\", repo: \"origin\"})\n */\nWOQLClient.prototype.set = function (params) {\n this.connectionConfig.update(params);\n};\n\n/**\n * Generates a resource string for the required context\n * of the current context for \"commits\" \"meta\" \"branch\" and \"ref\" special resources\n * @param {typedef.ResourceType} resourceType - the type of resource string that is required - one\n * of “db”, “meta”, “repo”, “commits”, “branch”, “ref”\n * @param {string} [resourceId] - can be used to specify a specific branch / ref - if not supplied\n * the current context will be used\n * @returns {string} a resource string for the desired context\n * @example\n * const branch_resource = client.resource(\"branch\")\n */\n// eslint-disable-next-line consistent-return\nWOQLClient.prototype.resource = function (resourceType, resourceId) {\n let base = `${this.organization()}/${this.db()}/`;\n if (resourceType === 'db') return base;\n if (resourceType === 'meta') return `${base}_meta`;\n base += `${this.repo()}`;\n if (resourceType === 'repo') return base;\n if (resourceType === 'commits') return `${base}/_commits`;\n const resourceIdValue = resourceId || (resourceType === 'ref' ? this.ref() : this.checkout());\n if (resourceType === 'branch') return `${base}/branch/${resourceIdValue}`;\n if (resourceType === 'ref') return `${base}/commit/${resourceIdValue}`;\n};\n\n/**\n * You can call this to get the server info or override the start params\n * configuration, this.connectionConfig.server will be used if present,\n * or the promise will be rejected.\n *\n * @deprecated\n *\n * @param {typedef.ParamsObj} [params] - TerminusDB Server connection parameters\n * @returns {Promise} the connection capabilities response object or an error object\n * @example\n * client.connect()\n */\nWOQLClient.prototype.connect = function (params) {\n if (params) this.connectionConfig.update(params);\n // unset the current server setting until successful connect\n return this.dispatch(CONST.GET, this.connectionConfig.apiURLInfo()).then((response) => response);\n};\n\n/**\n * Creates a new database in TerminusDB server\n * @param {string} dbId - The id of the new database to be created\n * @param {typedef.DbDetails} dbDetails - object containing details about the database to be created\n * @param {string} [orgId] - optional organization id - if absent default local organization\n * id is used\n * @returns {Promise} A promise that returns the call response object, or an Error if rejected.\n * @example\n * //remember set schema:true if you need to add a schema graph\n * client.createDatabase(\"mydb\", {label: \"My Database\", comment: \"Testing\", schema: true})\n */\n// maybe we can pass only the detailObj it is have inside the dbid and org\nWOQLClient.prototype.createDatabase = function (dbId, dbDetails, orgId) {\n if (orgId) this.organization(orgId);\n // console.log(\"createDatabase\", orgId)\n if (dbId) {\n this.db(dbId);\n // to be review\n // console.log('____remoteURL_BFF__', this.connectionConfig.dbURL())\n return this.dispatch(CONST.POST, this.connectionConfig.dbURL(), dbDetails);\n }\n const errmsg = `Create database parameter error - you must specify a valid database id - ${dbId} is invalid`;\n return Promise.reject(\n new Error(ErrorMessage.getInvalidParameterMessage(CONST.CREATE_DATABASE, errmsg)),\n );\n};\n\n/**\n * Update a database in TerminusDB server\n * @param {typedef.DbDoc} dbDoc - object containing details about the database to be updated\n * @returns {Promise} A promise that returns the call response object, or an Error if rejected.\n * @example\n * client.updateDatabase({id: \"mydb\", label: \"My Database\", comment: \"Testing\"})\n */\nWOQLClient.prototype.updateDatabase = function (dbDoc) {\n const dbid = dbDoc.id || this.db();\n this.organization(dbDoc.organization || this.organization());\n if (dbid) {\n this.db(dbid);\n return this.dispatch(CONST.PUT, this.connectionConfig.dbURL(), dbDoc);\n }\n const errmsg = `Update database error - you must specify a valid database id - ${dbid} is invalid`;\n return Promise.reject(\n new Error(ErrorMessage.getInvalidParameterMessage(CONST.UPDATE_DATABASE, errmsg)),\n );\n};\n\n/**\n * Deletes a database from a TerminusDB server\n * @param {string} dbId The id of the database to be deleted\n * @param {string} [orgId] the id of the organization to which the database belongs\n * (in desktop use, this will always be “admin”)\n * @param {boolean} [force]\n * @returns {Promise} A promise that returns the call response object, or an Error if rejected.\n * @example\n * client.deleteDatabase(\"mydb\")\n */\nWOQLClient.prototype.deleteDatabase = function (dbId, orgId, force) {\n const orgIdValue = orgId || this.organization();\n this.organization(orgIdValue);\n const payload = force ? { force: true } : null;\n if (dbId && this.db(dbId)) {\n return this.dispatch(CONST.DELETE, this.connectionConfig.dbURL(), payload);\n }\n const errmsg = `Delete database parameter error - you must specify a valid database id - ${dbId} is invalid`;\n return Promise.reject(\n new Error(ErrorMessage.getInvalidParameterMessage(CONST.DELETE, errmsg)),\n );\n};\n\n/**\n * Retrieve the contents of a graph within a TerminusDB as triples, encoded in\n * the turtle (ttl) format\n * @param {typedef.GraphType} graphType - type of graph to get triples from,\n * either “instance” or “schema”\n * @returns {Promise} A promise that returns the call response object (with\n * the contents being a string representing a set of triples in turtle (ttl) format),\n * or an Error if rejected.\n * @example\n * const turtle = await client.getTriples(\"schema\", \"alt\")\n */\nWOQLClient.prototype.getTriples = function (graphType) {\n if (graphType) {\n return this.dispatch(\n CONST.GET,\n this.connectionConfig.triplesURL(graphType),\n );\n }\n const errmsg = 'Get triples parameter error - you must specify a valid graph type (inference, instance, schema), and graph id';\n return Promise.reject(\n new Error(ErrorMessage.getInvalidParameterMessage(CONST.GET, errmsg)),\n );\n};\n\n/**\n * Replace the contents of the specified graph with the passed triples encoded\n * in the turtle (ttl) format\n * @param {string} graphType - type of graph |instance|schema|inference|\n * @param {string} turtle - string encoding triples in turtle (ttl) format\n * @param {string} commitMsg - Textual message describing the reason for the update\n * @returns {Promise} A promise that returns the call response object, or an Error if rejected.\n * @example\n * client.updateTriples(\"schema\", \"alt\", turtle_string, \"dumping triples to graph alt\")\n */\nWOQLClient.prototype.updateTriples = function (graphType, turtle, commitMsg) {\n if (commitMsg && turtle && graphType) {\n const commit = this.generateCommitInfo(commitMsg);\n commit.turtle = turtle;\n return this.dispatch(\n CONST.UPDATE_TRIPLES,\n this.connectionConfig.triplesURL(graphType),\n commit,\n );\n }\n const errmsg = 'Update triples parameter error - you must specify a valid graph id, graph type, turtle contents and commit message';\n return Promise.reject(\n new Error(ErrorMessage.getInvalidParameterMessage(CONST.UPDATE_TRIPLES, errmsg)),\n );\n};\n\n/**\n * Appends the passed turtle to the contents of a graph\n * @param {string} graphType type of graph |instance|schema|inference|\n * @param {string} turtle is a valid set of triples in turtle format (OWL)\n * @param {string} commitMsg Textual message describing the reason for the update\n * @returns {Promise} A promise that returns the call response object, or an Error if rejected.\n */\nWOQLClient.prototype.insertTriples = function (graphType, turtle, commitMsg) {\n if (commitMsg && turtle && graphType) {\n const commit = this.generateCommitInfo(commitMsg);\n commit.turtle = turtle;\n return this.dispatch(\n CONST.INSERT_TRIPLES,\n this.connectionConfig.triplesURL(graphType),\n commit,\n );\n }\n const errmsg = 'Update triples parameter error - you must specify a valid graph id, graph type, turtle contents and commit message';\n return Promise.reject(\n new Error(ErrorMessage.getInvalidParameterMessage(CONST.INSERT_TRIPLES, errmsg)),\n );\n};\n\n/**\n * Sends a message to the server\n * @param {string} message - textual string\n * @param {string} [pathname] - a server path to send the message to\n * @returns {Promise} A promise that returns the call response object, or an Error if rejected.\n */\nWOQLClient.prototype.message = function (message, pathname) {\n let url = this.api();\n url += pathname ? this.api() + pathname : 'message';\n return this.dispatch(CONST.GET, url, message).then((response) => response);\n};\n\n/**\n * Sends an action to the server\n * @param {string} actionName - structure of the action\n * @param {object} [payload] - a request body call\n * @returns {Promise} A promise that returns the call response object, or an Error if rejected.\n */\nWOQLClient.prototype.action = function (actionName, payload) {\n const url = `${this.api()}action/${actionName}`;\n return this.dispatch(CONST.ACTION, url, payload).then((response) => response);\n};\n\n/**\n * Gets TerminusDB Server Information\n * @returns {Promise} A promise that returns the call response object, or an Error if rejected.\n * @example\n * client.info()\n */\nWOQLClient.prototype.info = function () {\n const url = `${this.api()}info`;\n return this.dispatch(CONST.GET, url).then((response) => response);\n};\n\n// Get Resource objects from WOQL query\nfunction getResourceObjects(queryObject, result_array) {\n if (queryObject instanceof Array) {\n for (let i = 0; i < queryObject.length; i += 1) {\n getResourceObjects(queryObject[i], result_array);\n }\n } else {\n const keys = Object.keys(queryObject);\n\n for (let i = 0; i < keys.length; i += 1) {\n if (keys[i] === 'resource') {\n if (queryObject[keys[i]]['@type'] && queryObject[keys[i]]['@type'] === 'QueryResource') {\n result_array.push(queryObject[keys[i]]);\n }\n }\n if (queryObject[keys[i]] instanceof Object || queryObject[keys[i]] instanceof Array) {\n getResourceObjects(queryObject[keys[i]], result_array);\n }\n }\n }\n}\n\n/**\n * Executes a WOQL query on the specified database and returns the results\n * @param {WOQLQuery} woql - an instance of the WOQLQuery class\n * @param {string} [commitMsg] - a message describing the reason for the change that will\n * be written into the commit log (only relevant if the query contains an update)\n * @param {boolean} [allWitnesses]\n * @param {string} [lastDataVersion] the last data version tracking id.\n * @param {boolean} [getDataVersion] If true the function will return object having result\n * and dataVersion.\n * @returns {Promise} A promise that returns the call response object or object having *result*\n * and *dataVersion* object if ***getDataVersion*** parameter is true, or an Error if rejected.\n * @example\n * const result = await client.query(WOQL.star())\n */\nWOQLClient.prototype.query = function (woql, commitMsg, allWitnesses, lastDataVersion = '', getDataVersion = false) {\n allWitnesses = allWitnesses || false;\n commitMsg = commitMsg || 'Commit generated with javascript client without message';\n if (woql && woql.json && (!woql.containsUpdate() || commitMsg)) {\n const doql = woql.containsUpdate() ? this.generateCommitInfo(commitMsg) : {};\n doql.query = woql.json();\n\n let postBody;\n const resourceObjects = [];\n getResourceObjects(doql.query, resourceObjects);\n\n if (resourceObjects.length > 0) {\n const formData = new FormData();\n\n resourceObjects.forEach((resourceObject) => {\n const fileName = resourceObject.source.post.split('/').pop();\n\n formData.append('file', fs.createReadStream(resourceObject.source.post));\n resourceObject.source.post = fileName;\n });\n\n formData.append('payload', Buffer.from(JSON.stringify(doql)), { filename: 'body.json', contentType: 'application/json' });\n this.customHeaders(formData.getHeaders());\n\n postBody = formData;\n } else {\n postBody = doql;\n }\n\n if (allWitnesses) doql.all_witnesses = true;\n\n if (typeof lastDataVersion === 'string' && lastDataVersion !== '') {\n this.customHeaders({ 'TerminusDB-Data-Version': lastDataVersion });\n }\n\n // eslint-disable-next-line max-len\n return this.dispatch(CONST.WOQL_QUERY, this.connectionConfig.queryURL(), postBody, getDataVersion);\n }\n\n let errmsg = 'WOQL query parameter error';\n if (woql && woql.json && woql.containsUpdate() && !commitMsg) {\n errmsg += ' - you must include a textual commit message to perform this update';\n } else {\n errmsg += ' - you must specify a valid WOQL Query';\n }\n return Promise.reject(\n new Error(ErrorMessage.getInvalidParameterMessage(CONST.WOQL_QUERY, errmsg)),\n );\n};\n\n/**\n * Creates a new branch with a TerminusDB database, starting from the current context of\n * the client (branch / ref)\n * @param {string} newBranchId - local identifier of the new branch the ID of the new branch\n * to be created\n * @param {boolean} [isEmpty] - if isEmpty is true it will create a empty branch.\n * @returns {Promise} A promise that returns the call response object, or an Error if rejected.\n * @example\n * client.branch(\"dev\")\n */\nWOQLClient.prototype.branch = function (newBranchId, isEmpty) {\n if (newBranchId) {\n let source = this.ref()\n ? { origin: `${this.organization()}/${this.db()}/${this.repo()}/commit/${this.ref()}` }\n : {\n origin: `${this.organization()}/${this.db()}/${this.repo()}/branch/${this.checkout()}`,\n };\n\n if (isEmpty && isEmpty === true) {\n // @ts-ignore\n source = {};\n }\n return this.dispatch(CONST.BRANCH, this.connectionConfig.branchURL(newBranchId), source);\n }\n const errmsg = 'Branch parameter error - you must specify a valid new branch id';\n return Promise.reject(new Error(ErrorMessage.getInvalidParameterMessage(CONST.BRANCH, errmsg)));\n};\n\n/**\n * Squash branch commits\n * @param {string} branchId - local identifier of the new branch\n * @param {string} commitMsg - Textual message describing the reason for the update\n * @returns {Promise} A promise that returns the call response object, or an Error if rejected.\n */\nWOQLClient.prototype.squashBranch = function (branchId, commitMsg) {\n if (commitMsg && branchId) {\n const commit = this.generateCommitInfo(commitMsg);\n return this.dispatch(\n CONST.SQUASH_BRANCH,\n this.connectionConfig.squashBranchURL(branchId),\n commit,\n );\n }\n const errmsg = 'Branch parameter error - you must specify a valid new branch id and a commit message';\n return Promise.reject(\n new Error(ErrorMessage.getInvalidParameterMessage(CONST.SQUASH_BRANCH, errmsg)),\n );\n};\n\n/**\n * Reset branch to a commit id, Reference ID or Commit ID are unique hashes that are\n * created whenever a new commit is recorded\n * @param {string} branchId - local identifier of the new branch\n * @param {string} commitId - Reference ID or Commit ID\n * @returns {Promise} A promise that returns the call response object, or an Error if rejected.\n */\nWOQLClient.prototype.resetBranch = function (branchId, commitId) {\n if (commitId && branchId) {\n // eslint-disable-next-line camelcase\n return this.dispatch(\n CONST.RESET_BRANCH,\n this.connectionConfig.resetBranchUrl(branchId),\n { commit_descriptor: commitId },\n );\n }\n const errmsg = 'Branch parameter error - you must specify a valid new branch id and a commit message';\n return Promise.reject(\n new Error(ErrorMessage.getInvalidParameterMessage(CONST.RESET_BRANCH, errmsg)),\n );\n};\n\n/**\n * Optimize db branch\n * @param {string} branchId - local identifier of the new branch\n * @returns {Promise} A promise that returns the call response object, or an Error if rejected.\n */\nWOQLClient.prototype.optimizeBranch = function (branchId) {\n if (branchId) {\n return this.dispatch(\n CONST.OPTIMIZE_SYSTEM,\n this.connectionConfig.optimizeBranchUrl(branchId),\n {},\n );\n }\n const errmsg = 'Branch parameter error - you must specify a valid branch id';\n return Promise.reject(new Error(ErrorMessage.getInvalidParameterMessage(CONST.BRANCH, errmsg)));\n};\n\n/**\n * Deletes a branch from database\n * @param {string} branchId - local identifier of the branch\n * @returns {Promise} A promise that returns the call response object, or an Error if rejected.\n */\nWOQLClient.prototype.deleteBranch = function (branchId) {\n if (branchId) {\n return this.dispatch(CONST.DELETE, this.connectionConfig.branchURL(branchId));\n }\n const errmsg = 'Branch parameter error - you must specify a valid new branch id';\n return Promise.reject(new Error(ErrorMessage.getInvalidParameterMessage(CONST.BRANCH, errmsg)));\n};\n\n/**\n * Pull changes from a branch on a remote database to a branch on a local database\n * @param {typedef.RemoteRepoDetails} remoteSourceRepo - an object describing the source of the pull\n * @returns {Promise} A promise that returns the call response object, or an Error if rejected.\n * @example\n * client.pull({remote: \"origin\", remote_branch: \"main\", message: \"Pulling from remote\"})\n */\nWOQLClient.prototype.pull = function (remoteSourceRepo) {\n const rc_args = this.prepareRevisionControlArgs(remoteSourceRepo);\n if (rc_args && rc_args.remote && rc_args.remote_branch) {\n return this.dispatch(CONST.PULL, this.connectionConfig.pullURL(), rc_args);\n }\n const errmsg = 'Pull parameter error - you must specify a valid remote source and branch to pull from';\n return Promise.reject(new Error(ErrorMessage.getInvalidParameterMessage(CONST.PULL, errmsg)));\n};\n\n/**\n * Fetch updates to a remote database to a remote repository with the local database\n * @param {string} remoteId - if of the remote to fetch (eg: 'origin')\n * @returns {Promise} A promise that returns the call response object, or an Error if rejected.\n */\nWOQLClient.prototype.fetch = function (remoteId) {\n return this.dispatch(CONST.FETCH, this.connectionConfig.fetchURL(remoteId));\n};\n\n/**\n * Push changes from a branch on a local database to a branch on a remote database\n * @param {typedef.RemoteRepoDetails} remoteTargetRepo - an object describing the target of the push\n * {remote: \"origin\", \"remote_branch\": \"main\", \"author\": \"admin\", \"message\": \"message\"}\n * @returns {Promise} A promise that returns the call response object, or an Error if rejected.\n * @example\n * client.push({remote: \"origin\", remote_branch: \"main\", message: \"Pulling from remote\"})\n */\nWOQLClient.prototype.push = function (remoteTargetRepo) {\n const rc_args = this.prepareRevisionControlArgs(remoteTargetRepo);\n if (rc_args && rc_args.remote && rc_args.remote_branch) {\n return this.dispatch(CONST.PUSH, this.connectionConfig.pushURL(), rc_args);\n }\n const errmsg = 'Push parameter error - you must specify a valid remote target';\n return Promise.reject(new Error(ErrorMessage.getInvalidParameterMessage(CONST.PUSH, errmsg)));\n};\n\n/**\n * Merges the passed branch into the current one using the rebase operation\n * @param {object} rebaseSource - json describing the source branch to be used as a base\n * @returns {Promise} A promise that returns the call response object, or an Error if rejected.\n * @example\n * //from the branch head\n * client.rebase({rebase_from: \"admin/db_name/local/branch/branch_name\", message:\n * \"Merging from dev\")\n * //or from a commit id\n * client.rebase({rebase_from: \"admin/db_name/local/commit/9w8hk3y6rb8tjdy961de3i536ntkqd8\",\n * message: \"Merging from dev\")\n */\nWOQLClient.prototype.rebase = function (rebaseSource) {\n const rc_args = this.prepareRevisionControlArgs(rebaseSource);\n if (rc_args && rc_args.rebase_from) {\n return this.dispatch(CONST.REBASE, this.connectionConfig.rebaseURL(), rc_args);\n }\n const errmsg = 'Rebase parameter error - you must specify a valid rebase source to rebase from';\n return Promise.reject(\n new Error(ErrorMessage.getInvalidParameterMessage(CONST.REBASE, errmsg)),\n );\n};\n\n/**\n * Reset the current branch HEAD to the specified commit path\n * @param {string} commitPath - The commit path to set the current branch to\n * @returns {Promise} A promise that returns the call response object, or an Error if rejected.\n */\nWOQLClient.prototype.reset = function (commitPath) {\n return this.dispatch(CONST.RESET, this.connectionConfig.resetURL(), {\n commit_descriptor: commitPath,\n });\n};\n\n/**\n * Clones a remote repo and creates a local copy\n * @param {typedef.CloneSourceDetails} cloneSource - object describing the source branch\n * to be used as a base\n * @param {string} newDbId - id of the new cloned database on the local server\n * @param {string} [orgId] - id of the local organization that the new cloned database\n * will be created in (in desktop mode this is always “admin”)\n * @returns {Promise} A promise that returns the call response object, or an Error if rejected.\n * @example\n * client.clonedb({remote_url: \"https://my.terminusdb.com/myorg/mydb\", label \"Cloned DB\", comment: \"Cloned from mydb\"}, newid: \"mydb\")\n */\nWOQLClient.prototype.clonedb = function (cloneSource, newDbId, orgId) {\n orgId = orgId || this.user_organization();\n this.organization(orgId);\n const rc_args = this.prepareRevisionControlArgs(cloneSource);\n if (newDbId && rc_args && rc_args.remote_url) {\n return this.dispatch(CONST.CLONE, this.connectionConfig.cloneURL(newDbId), rc_args);\n }\n const errmsg = 'Clone parameter error - you must specify a valid id for the cloned database';\n return Promise.reject(new Error(ErrorMessage.getInvalidParameterMessage(CONST.BRANCH, errmsg)));\n};\n\n/**\n * Common request dispatch function\n * @property {string} action - the action name\n * @property {string} apiUrl - the server call endpoint\n * @property {object} [payload] - the post body\n * @property {boolean} [getDataVersion] - If true return response with data version\n * @property {boolean} [compress] - If true, compress the data if it is bigger than 1024 bytes\n * @returns {Promise} A promise that returns the call response object, or an Error if rejected.\n */\nWOQLClient.prototype.dispatch = function (\n action,\n apiUrl,\n payload,\n getDataVersion,\n compress = false,\n) {\n if (!apiUrl) {\n return Promise.reject(\n new Error(\n ErrorMessage.getInvalidParameterMessage(\n action,\n this.connectionConfig.connection_error,\n ),\n ),\n );\n }\n // I have to review this I don't want a call everytime\n /* if(this.connectionConfig.tokenParameter){\n const param = this.connectionConfig.tokenParameter\n axios.post(param.url,param.options).then(result=>result.data).then(data=>{\n if(data.access_token){\n console.log(\"ACCESS_TOKEN\",data.access_token)\n this.localAuth({\"key\":data.access_token,\"type\":\"jwt\"})\n }\n return DispatchRequest(\n apiUrl,\n action,\n payload,\n this.localAuth(),\n this.remoteAuth(),\n this.customHeaders(),\n )\n })\n }else{ */\n return DispatchRequest(\n apiUrl,\n action,\n payload,\n this.localAuth(),\n this.remoteAuth(),\n this.customHeaders(),\n getDataVersion,\n compress,\n );\n // }\n};\n\n/**\n * Generates the json structure for commit messages\n * @param {string} msg - textual string describing reason for the change\n * @param {string} [author] - optional author id string - if absent current user id will be used\n * @returns {object}\n */\nWOQLClient.prototype.generateCommitInfo = function (msg, author) {\n if (!author) {\n author = this.author();\n }\n const commitInfo = { commit_info: { author, message: msg } };\n return commitInfo;\n};\n\n/**\n * Generates the json structure for commit descriptor\n * @param {string} commitId - a valid commit id o\n */\nWOQLClient.prototype.generateCommitDescriptor = function (commitId) {\n const cd = this.connectionConfig.commitDescriptorUrl(commitId);\n const ci = { commit_descriptor: cd };\n return ci;\n};\n\n/**\n * Adds an author string (from the user object returned by connect) to the commit message.\n * @param {object} [rc_args]\n * @returns {object | boolean}\n */\nWOQLClient.prototype.prepareRevisionControlArgs = function (rc_args) {\n if (!rc_args || typeof rc_args !== 'object') return false;\n if (!rc_args.author) rc_args.author = this.author();\n return rc_args;\n};\n\n/**\n * to add a new document or a list of new documents into the instance or the schema graph.\n * @param {object} json\n * @param {typedef.DocParamsPost} [params] - the post parameters {@link #typedef.DocParamsPost}\n * @param {string} [dbId] - the dbid\n * @param {message} [string] - the insert commit message\n * @param {string} [lastDataVersion] the last data version tracking id.\n * @param {boolean} [getDataVersion] If true the function will return object having result\n * and dataVersion.\n * @returns {Promise} A promise that returns the call response object or object having *result*\n * and *dataVersion* object if ***getDataVersion*** parameter is true, or an Error if rejected.\n * @example\n * const json = [{ \"@type\" : \"Class\",\n * \"@id\" : \"Coordinate\",\n * \"@key\" : { '@type' : 'Hash',\n * '@fields' : ['x','y'] },\n * \"x\" : \"xsd:decimal\",\n * \"y\" : \"xsd:decimal\" },\n * { \"@type\" : \"Class\",\n * \"@id\" : \"Country\",\n * \"@key\" : { '@type' : 'Lexical',\n * '@fields' : [name] },\n * \"name\" : \"xsd:string\",\n * \"perimeter\" : { \"@type\" : \"List\",\n * \"@class\" : \"Coordinate\" } }]\n * client.addDocument(json,{\"graph_type\":\"schema\"},\"mydb\",\"add new schema documents\")\n *\n * //if we would like to override the entire schema\n * const json = [\n * {\"@base\": \"terminusdb:///data/\",\n * \"@schema\": \"terminusdb:///schema#\",\n * \"@type\": \"@context\"\n * },\n * {\n * \"@id\": \"Person\",\n * \"@key\": {\n * \"@type\": \"Random\"\n * },\n * \"@type\": \"Class\",\n * \"name\": {\n * \"@class\": \"xsd:string\",\n * \"@type\": \"Optional\"\n * }\n * }]\n *\n * // client.addDocument(json,{\"graph_type\":\"schema\",\"full_replace:true\"},\n \"mydb\",\"update the all schema\");\n *\n * // Here we will pass true to show how to get dataVersion\n *\n * const response = await client.addDocument(json, {\"graph_type\": \"schema\"},\n * \"mydb\",\n * \"add new schema\", '',\n * true\n * )\n * console.log(response);\n *\n * // This will output:\n * // {\n * // result: [ ...... ],\n * // dataVersion: 'branch:5fs681tlycnn6jh0ceiqcq4qs89pdfs'\n * // }\n *\n * // Now we can use the data version we recieved as a response in previous\n * // function call and used it is next function call as lastDataVersion\n *\n * const response1 = await client.addDocument(json, {\"graph_type\": \"schema\"},\n * \"mydb\",\n * \"add new schema\", response.dataVersion,\n * )\n */\nWOQLClient.prototype.addDocument = function (json, params, dbId, message = 'add a new document', lastDataVersion = '', getDataVersion = false, compress = false) {\n if (dbId) {\n this.db(dbId);\n }\n\n if (typeof lastDataVersion === 'string' && lastDataVersion !== '') {\n this.customHeaders({ 'TerminusDB-Data-Version': lastDataVersion });\n }\n const docParams = params || {};\n docParams.author = this.author();\n docParams.message = message;\n return this.dispatch(\n CONST.POST,\n this.connectionConfig.documentURL(docParams),\n json,\n getDataVersion,\n compress,\n );\n};\n\n/**\n * Use {@link #getDocument} instead.\n * @deprecated\n *\n * Retrieves all documents that match a given document template\n * @param {object} query - the query template\n * @param {typedef.DocParamsGet} [params] - the get parameters\n * @param {string} [dbId] - the database id\n * @param {string} [branch] - the database branch\n * @param {string} [lastDataVersion] the last data version tracking id.\n * @param {boolean} [getDataVersion] If true the function will return object having result\n * and dataVersion.\n * @returns {Promise} A promise that returns the call response object or object having *result*\n * and *dataVersion* object if ***getDataVersion*** parameter is true, or an Error if rejected.\n * @example\n * const query = {\n * \"type\": \"Person\",\n * \"query\": { \"age\": 42 },\n * }\n * client.queryDocument(query, {\"as_list\":true})\n *\n *\n * // Here we will pass true to show how to get dataVersion\n * const query = {\n * \"type\": \"Person\",\n * \"query\": { \"age\": 42 },\n * }\n *\n * const response = await client.queryDocument(query, {\"as_list\": true}, '', '','',true);\n * console.log(response);\n *\n * // This will output:\n * // {\n * // result: [\n * // {\n * // '@id': 'Person/052d60ffbd114bf5e7331b03f07fcb7',\n * // '@type': 'Person',\n * // age: 42,\n * // name: 'John',\n * // },\n * // ],\n * // dataVersion: 'branch:5fs681tlycnn6jh0ceiqcq4qs89pdfs'\n * // }\n *\n * // Now we can use the data version we recieved as a response in previous\n * // query and used it is next query as lastDataVersion\n * const query = {\n * \"type\": \"Person\",\n * \"query\": { \"age\": 18 },\n * }\n *\n * const response1 = await client.queryDocument(query, {\"as_list\": true}, '',\n * '',\n * response.dataVersion\n * );\n */\nWOQLClient.prototype.queryDocument = function (query, params, dbId, branch, lastDataVersion = '', getDataVersion = false) {\n if (dbId) {\n this.db(dbId);\n }\n if (branch) {\n this.checkout(branch);\n }\n if (typeof lastDataVersion === 'string' && lastDataVersion !== '') {\n this.customHeaders({ 'TerminusDB-Data-Version': lastDataVersion });\n }\n\n return this.dispatch(\n CONST.QUERY_DOCUMENT,\n this.connectionConfig.documentURL(params),\n query,\n getDataVersion,\n );\n};\n\n/**\n *\n * @param {typedef.DocParamsGet} [params] - the get parameters,\n * you can pass document query search template with the params\n * @param {string} [dbId] - the database id\n * @param {string} [branch] - the database branch\n * @param {string} [lastDataVersion] the last data version tracking id.\n * @param {boolean} [getDataVersion] If true the function will return object having result\n * and dataVersion.\n * @param {object} [query] document query search template\n * @returns {Promise} A promise that returns the call response object or object having *result*\n * and *dataVersion* object if ***getDataVersion*** parameter is true, or an Error if rejected.\n * @example\n * //return the schema graph as a json array\n * client.getDocument({\"graph_type\":\"schema\",\"as_list\":true}).then(result={\n * console.log(result)\n * })\n *\n * //retutn the Country class document from the schema graph\n * client.getDocument({\"graph_type\":\"schema\",\"as_list\":true,\"id\":\"Country\"}).then(result={\n * console.log(result)\n * })\n *\n * //pass a document query template to query the document interface\n * const queryTemplate = { \"name\": \"Ireland\"}\n * client.getDocument({\"as_list\":true, \"@type\":\"Country\"\n * query:queryTemplate}).then(result=>{\n * console.log(result)\n * })\n *\n *\n * // Here we will pass true to show how to get dataVersion\n * const response = await client.getDocument({\"graph_type\":\"schema\",\"as_list\":true},\n * \"\",\n * \"\",\n * \"\",\n * true\n * )\n * console.log(response);\n *\n * // This will output:\n * // {\n * // result: [ ...... ],\n * // dataVersion: 'branch:5fs681tlycnn6jh0ceiqcq4qs89pdfs'\n * // }\n *\n * // Now we can use the data version we recieved as a response in previous\n * // function call and used it is next function call as lastDataVersion\n *\n * const response1 = await client.getDocument({\"graph_type\":\"schema\",\"as_list\":true},\n * \"\",\n * \"\",\n * response.dataVersion,\n * )\n */\n// document interface\nWOQLClient.prototype.getDocument = function (params, dbId, branch, lastDataVersion = '', getDataVersion = false, query = undefined) {\n if (dbId) {\n this.db(dbId);\n }\n if (branch) {\n this.checkout(branch);\n }\n if (typeof lastDataVersion === 'string' && lastDataVersion !== '') {\n this.customHeaders({ 'TerminusDB-Data-Version': lastDataVersion });\n }\n let queryDoc;\n if (query) {\n queryDoc = query;\n } else if (params && typeof params === 'object' && params.query) {\n queryDoc = { query: params.query };\n delete params.query;\n }\n // if query we are send a get with a payload\n\n if (queryDoc) {\n return this.dispatch(\n CONST.QUERY_DOCUMENT,\n this.connectionConfig.documentURL(params),\n queryDoc,\n getDataVersion,\n );\n }\n\n return this.dispatch(CONST.GET, this.connectionConfig.documentURL(params), {}, getDataVersion);\n};\n\n/**\n *\n * @param {object} json\n * @param {typedef.DocParamsPut} [params] - the Put parameters {@link #typedef.DocParamsPut}\n * @param {*} [dbId] - the database id\n * @param {*} [message] - the update commit message\n * @param {string} [lastDataVersion] the last data version tracking id.\n * @param {boolean} [getDataVersion] If true the function will return object having result\n * and dataVersion.\n * @param {boolean} [compress] If true, the function will create a new document if it doesn't exist.\n * @param {boolean} [create] Perform an *upsert* which inserts if the document\n * is not present (also works on nested documents)\n * @returns {Promise} A promise that returns the call response object or object having *result*\n * and *dataVersion* object if ***getDataVersion*** parameter is true, or an Error if rejected.\n * @example\n * client.updateDocument(\n * {\n * \"@id\": \"Person\",\n * \"@key\": {\n * \"@type\": \"Random\",\n * },\n * \"@type\": \"Class\",\n * label: \"xsd:string\",\n * },\n * { graph_type: \"schema\" }\n * );\n *\n *\n * // Here we will pass true to show how to get dataVersion\n *\n const response = await client.updateDocument(\n {\n \"@id\": \"Person\",\n \"@key\": {\n \"@type\": \"Random\",\n },\n \"@type\": \"Class\",\n label: \"xsd:string\",\n },\n { graph_type: \"schema\" },\n \"\",\n \"\",\n \"\",\n true\n );\n * console.log(response);\n *\n * // This will output:\n * // {\n * // result: [ ...... ],\n * // dataVersion: 'branch:5fs681tlycnn6jh0ceiqcq4qs89pdfs'\n * // }\n *\n * // Now we can use the data version we recieved as a response in previous\n * // function call and used it is next function call as lastDataVersion\n *\n * const response1 = await client.updateDocument(\n {\n \"@id\": \"Person\",\n \"@key\": {\n \"@type\": \"Random\",\n },\n \"@type\": \"Class\",\n label: \"xsd:string\",\n },\n { graph_type: \"schema\" },\n \"\",\n \"\",\n response.dataVersion\n );\n *\n * // update a document and create the linked document together\n * // we are update the document \"Person/Person01\"\n * // and create a new document {\"@type\": \"Person\",\"name\": \"child01\"} at the same time\n * const response1 = await client.updateDocument(\n {\n \"@id\": \"Person/Person01\",\n \"@type\": \"Person\",\n \"name\": \"Person01\"\n \"children\":[{\"@type\": \"Person\",\"name\": \"child01\"}]\n },{create:true})\n */\nWOQLClient.prototype.updateDocument = function (json, params, dbId, message = 'update document', lastDataVersion = '', getDataVersion = false, compress = false, create = false) {\n const docParams = params || {};\n docParams.author = this.author();\n docParams.message = message;\n if (create) {\n docParams.create = create;\n }\n if (dbId) {\n this.db(dbId);\n }\n if (typeof lastDataVersion === 'string' && lastDataVersion !== '') {\n this.customHeaders({ 'TerminusDB-Data-Version': lastDataVersion });\n }\n return this.dispatch(\n CONST.PUT,\n this.connectionConfig.documentURL(docParams),\n json,\n getDataVersion,\n compress,\n );\n};\n\n/**\n * to delete the document\n * @param {typedef.DocParamsDelete} [params]\n * @param {string} [dbId] - the database id\n * @param {string} [message] - the delete message\n * @param {string} [lastDataVersion] the last data version tracking id.\n * @param {boolean} [getDataVersion] If true the function will return object having result\n * and dataVersion.\n * @returns {Promise} A promise that returns the call response object or object having *result*\n * and *dataVersion* object if ***getDataVersion*** parameter is true, or an Error if rejected.\n * @example\n * client.deleteDocument({\"graph_type\":\"schema\",id:['Country','Coordinate']})\n *\n *\n * // Here we will pass true to show how to get dataVersion\n *\n * const response = await client.deleteDocument({\"graph_type\":\"schema\",id:['Country','Coordinate']},\n * \"\",\n * \"\",\n * \"\",\n * true\n * )\n * console.log(response);\n *\n * // This will output:\n * // {\n * // result: [ ...... ],\n * // dataVersion: 'branch:5fs681tlycnn6jh0ceiqcq4qs89pdfs'\n * // }\n *\n * // Now we can use the data version we recieved as a response in previous\n * // function call and used it is next function call as lastDataVersion\n *\n * const response1 = await client.deleteDocument({\"graph_type\":\"schema\",\n * id:['Country','Coordinate']},\n * \"\",\n * \"\",\n * response.dataVersion,\n * )\n */\nWOQLClient.prototype.deleteDocument = function (params, dbId, message = 'delete document', lastDataVersion = '', getDataVersion = false) {\n const docParams = params || {};\n let payload = null;\n if (Array.isArray(params.id)) {\n payload = params.id;\n delete docParams.id;\n }\n docParams.author = this.author();\n docParams.message = message;\n if (dbId) {\n this.db(dbId);\n }\n if (typeof lastDataVersion === 'string' && lastDataVersion !== '') {\n this.customHeaders({ 'TerminusDB-Data-Version': lastDataVersion });\n }\n return this.dispatch(\n CONST.DELETE,\n this.connectionConfig.documentURL(docParams),\n payload,\n getDataVersion,\n );\n};\n/**\n * The purpose of this method is to quickly discover the supported fields of a particular type.\n * @param {string} [type] - If given, the type to get information for. If omitted, information\n * for all types is returned\n * @param {string} [dbId] - the database id\n * @returns {Promise} A promise that returns the call response object, or an Error if rejected.\n * @example\n * client.getSchemaFrame(\"Country\")\n */\nWOQLClient.prototype.getSchemaFrame = function (type, dbId) {\n let params;\n if (type) params = { type };\n if (dbId) {\n this.db(dbId);\n }\n return this.dispatch(CONST.GET, this.connectionConfig.jsonSchemaURL(params));\n};\n\n/**\n * get the database schema in json format\n * @param {string} [dbId] - the database id\n * @param {string} [branch] - specific a branch/collection\n * @returns {Promise} A promise that returns the call response object, or an Error if rejected.\n * @example\n * client.getSchema()\n */\nWOQLClient.prototype.getSchema = function (dbId, branch) {\n const params = { graph_type: 'schema', as_list: true };\n return this.getDocument(params, dbId, branch);\n};\n\n/**\n * get all the schema classes (documents,subdocuments,abstracts)\n * @param {string} [dbId] - the database id\n * @returns {Promise} A promise that returns the call response object, or an Error if rejected.\n * @example\n * client.getClasses()\n */\n\nWOQLClient.prototype.getClasses = function (dbId) {\n const params = { graph_type: 'schema', as_list: true, type: 'sys:Class' };\n return this.getDocument(params, dbId);\n};\n\n/**\n * get all the Enum Objects\n * @param {string} [dbId]\n * @returns {Promise} A promise that returns the call response object, or an Error if rejected.\n * @example\n * client.getEnums()\n */\nWOQLClient.prototype.getEnums = function (dbId) {\n const params = { graph_type: 'schema', as_list: true, type: 'sys:Enum' };\n return this.getDocument(params, dbId);\n};\n\n/**\n * get all the Document Classes (no abstract or subdocument)\n * @param {string} [dbId]\n * @returns {Promise} A promise that returns the call response object, or an Error if rejected.\n * @example\n * client.getClassDocuments()\n */\nWOQLClient.prototype.getClassDocuments = function (dbId) {\n const params = { graph_type: 'schema', as_list: true, type: 'sys:Class' };\n return this.getDocument(params, dbId).then((result) => {\n let documents = [];\n if (result) {\n documents = result.filter((item) => !item['@subdocument'] && !item['@abstract']);\n }\n return documents;\n });\n};\n\n/**\n * get the database collections list\n * @param {string} [dbId] - the database id\n * @returns {Promise} A promise that returns the call response object, or an Error if rejected.\n * @example\n * client.getBranches()\n */\nWOQLClient.prototype.getBranches = function (dbId) {\n const params = { type: 'Branch', as_list: true };\n const branch = this.checkout();\n return this.getDocument(params, dbId, '_commits').then((result) => {\n const branchesObj = {};\n if (result) {\n result.forEach((item) => {\n branchesObj[item.name] = item;\n });\n }\n this.checkout(branch);\n return branchesObj;\n });\n // reset branch\n};\n\n/**\n * get the database collections list\n * @param {number} [start=0] - where to start printing the commit\n * information in the log (starting from the head of the current branch)\n * @param {number} [count=1] - The number of total commit log records to return\n * @returns {Promise} A promise that returns the call response object, or an Error if rejected.\n * @example\n * client.getCommitsLog(count=10)\n */\nWOQLClient.prototype.getCommitsLog = function (start = 0, count = 1) {\n return this.dispatch(\n CONST.GET,\n `${this.connectionConfig.log()}?start=${start}&count=${count}`,\n );\n};\n\n/**\n * get the database prefixes object\n * @param {string} [dbId] - the database id\n * @returns {Promise} A promise that returns the call response object, or an Error if rejected.\n * @example\n * client.getPrefixes()\n * //return object example\n * {\n * '@base': 'terminusdb:///data/',\n * '@schema': 'terminusdb:///schema#',\n * '@type': 'Context'}\n */\nWOQLClient.prototype.getPrefixes = function (dbId) {\n if (dbId) this.db(dbId);\n return this.dispatch(\n CONST.GET,\n this.connectionConfig.prefixesURL(),\n );\n};\n\n/**\n * Get the list of the user's organizations and the database related\n * @returns {Promise} A promise that returns the call response object, or an Error if rejected.\n * @example\n * async funtion callGetUserOrganizations(){\n * await getUserOrganizations()\n * console.log(client.userOrganizations())\n * }\n */\nWOQLClient.prototype.getUserOrganizations = function () {\n // this will be change to give back only the organizations list\n return this.dispatch(\n CONST.GET,\n this.connectionConfig.userOrganizationsURL(),\n ).then((response) => {\n const orgList = Array.isArray(response) ? response : [];\n this.userOrganizations(orgList);\n return orgList;\n });\n};\n\n/**\n * Get/Set the list of the user's organizations (id, organization, label, comment).\n * @param {array} [orgList] a list of user's Organization\n * @returns {array} the user Organizations list\n * @example\n * async funtion callGetUserOrganizations(){\n * await client.getUserOrganizations()\n * console.log(client.userOrganizations())\n * }\n */\nWOQLClient.prototype.userOrganizations = function (orgList) {\n if (orgList) this.organizationList = orgList;\n return this.organizationList || [];\n};\n\n/**\n * Apply a patch object to another object\n * @param {object} before - The current state of JSON document\n * @param {object} patch - The patch object\n * @returns {Promise} A promise that returns the call response object, or an Error if rejected.\n * @example\n * client.patch(\n * { \"@id\" : \"Person/Jane\", \"@type\" : \"Person\", \"name\" : \"Jane\"},\n * { \"name\" : { \"@op\" : \"ValueSwap\", \"@before\" : \"Jane\", \"@after\": \"Janine\" }}\n * ).then(patchResult=>{\n * console.log(patchResult)\n * })\n * //result example\n * //{ \"@id\" : \"Person/Jane\", \"@type\" : \"Person\", \"name\" : \"Jannet\"}\n */\nWOQLClient.prototype.patch = function (before, patch) {\n if (typeof before !== 'object' || typeof patch !== 'object') {\n const errmsg = '\"before\" or \"after\" parameter error - you must specify a valid before and after json document';\n\n return Promise.reject(\n new Error(ErrorMessage.getInvalidParameterMessage(CONST.PATCH, errmsg)),\n );\n }\n const payload = { before, patch };\n\n return this.dispatch(\n CONST.POST,\n `${this.connectionConfig.apiURL()}patch`,\n payload,\n ).then((response) => response);\n};\n\n/**\n * Apply a patch object to the current resource\n * @param {array} patch - The patch object\n * @param {string} message - The commit message\n * @returns {Promise} A promise that returns the call response object, or an Error if rejected.\n * @example\n * const patch = [\n * {\n * \"@id\": \"Obj/id1\",\n * \"name\": {\n * \"@op\": \"SwapValue\",\n * \"@before\": \"foo\",\n * \"@after\": \"bar\"\n * }\n * },\n * {\n * \"@id\": \"Obj/id2\",\n * \"name\": {\n * \"@op\": \"SwapValue\",\n * \"@before\": \"foo\",\n * \"@after\": \"bar\"\n * }\n * }\n * ]\n * client.db(\"mydb\")\n * client.checkout(\"mybranch\")\n * client.patchResource(patch,\"apply patch to mybranch\").then(patchResult=>{\n * console.log(patchResult)\n * })\n * // result example\n * // [\"Obj/id1\",\n * // \"Obj/id2\"]\n * // or conflict error 409\n * // {\n * // \"@type\": \"api:PatchError\",\n * // \"api:status\": \"api:conflict\",\n * // \"api:witnesses\": [\n * // {\n * // \"@op\": \"InsertConflict\",\n * // \"@id_already_exists\": \"Person/Jane\"\n * // }\n * //]\n * //}\n */\nWOQLClient.prototype.patchResource = function (patch, message) {\n if (!Array.isArray(patch)) {\n const errmsg = '\"patch\" parameter error - you must specify a valid patch document';\n\n return Promise.reject(\n new Error(ErrorMessage.getInvalidParameterMessage(CONST.PATCH, errmsg)),\n );\n }\n const payload = { patch, author: this.author(), message };\n\n return this.dispatch(\n CONST.POST,\n this.connectionConfig.patchURL(),\n payload,\n ).then((response) => response);\n};\n\n/**\n * Get the patch of difference between two documents.\n * @param {object} before - The current state of JSON document\n * @param {object} after - The updated state of JSON document\n * @param {object} [options] - {keep:{}} Options to send to the diff endpoint.\n * The diff api outputs the changes between the input,\n * in options you can list the properties that you would like to see in the diff result in any case.\n * @returns {Promise} A promise that returns the call response object, or an Error if rejected.\n * @example\n * client.getJSONDiff(\n * { \"@id\": \"Person/Jane\", \"@type\": \"Person\", name: \"Jane\" },\n * { \"@id\": \"Person/Jane\", \"@type\": \"Person\", name: \"Janine\" }\n * ).then(diffResult=>{\n * console.log(diffResult)\n * })\n * //result example\n * //{'@id': 'Person/Jane',\n * // name: { '@after': 'Janine', '@before': 'Jane', '@op': 'SwapValue' }}\n */\nWOQLClient.prototype.getJSONDiff = function (before, after, options) {\n if (typeof before !== 'object' || typeof after !== 'object') {\n const errmsg = '\"before\" or \"after\" parameter error - you must specify a valid before or after json document';\n\n return Promise.reject(\n new Error(ErrorMessage.getInvalidParameterMessage(CONST.GET_DIFF, errmsg)),\n );\n }\n const opt = (typeof options === 'undefined') ? {} : options;\n const payload = { before, after, ...opt };\n\n return this.dispatch(\n CONST.POST,\n `${this.connectionConfig.apiURL()}diff`,\n payload,\n ).then((response) => response);\n};\n\n/**\n * Get the patch of difference between two documents.\n * @param {string} dataVersion - The version from which to compare the object\n * @param {object} jsonObject - The updated state of JSON document\n * @param {string} id - The document id to be diffed\n * @param {object} [options] - {keep:{}} Options to send to the diff endpoint\n * the diff api outputs the changes between the input,\n * but you can list the properties that you would like to see in the diff result in any case.\n * @returns {Promise} A promise that returns the call response object, or an Error if rejected.\n * @example\n * const jsonObj = { \"@id\": \"Person/Jane\", \"@type\": \"Person\", name: \"Janine\" }\n * client.getVersionObjectDiff(\"main\",jsonObj\n * \"Person/Jane\").then(diffResp=>{\n * console.log(diffResp)\n * })\n */\nWOQLClient.prototype.getVersionObjectDiff = function (dataVersion, jsonObject, id, options) {\n if (typeof jsonObject !== 'object' || typeof dataVersion !== 'string' || typeof id !== 'string') {\n const errmsg = 'Parameters error - you must specify a valid jsonObject document, a valid branch or commit and a valid id';\n\n return Promise.reject(\n new Error(ErrorMessage.getInvalidParameterMessage(CONST.GET_DIFF, errmsg)),\n );\n }\n const opt = options || {};\n const payload = {\n after: jsonObject,\n before_data_version: dataVersion,\n id,\n ...opt,\n };\n return this.dispatch(\n CONST.POST,\n this.connectionConfig.diffURL(),\n payload,\n ).then((response) => response);\n};\n\n/**\n * Get the patch of difference between branches or commits.\n * @param {string} beforeVersion - Before branch/commit to compare\n * @param {string} afterVersion - After branch/commit to compare\n * @param {string} [id] - The document id to be diffed,\n * if it is omitted all the documents will be compared\n * @param {typedef.DiffObject} [options] - {keep:{},count:10,start:0}\n * Options to send to the diff endpoint.\n * The diff api outputs the changes between the input (branches or commits),\n * in options you can list the properties that you would like to see in the diff result in any case.\n * @returns {Promise} A promise that returns the call response object, or an Error if rejected.\n * @example\n * //This is to view all the changes between two commits\n * const beforeCommit = \"a73ssscfx0kke7z76083cgswszdxy6l\"\n * const afterCommit = \"73rqpooz65kbsheuno5dsayh71x7wf4\"\n *\n * client.getVersionDiff( beforeCommit, afterCommit).then(diffResult=>{\n * console.log(diffResult)\n * })\n *\n * //This is to view the changes between two commits but only for the given document\n * client.getVersionDiff( beforeCommit, afterCommit, \"Person/Tom\").then(diffResult=>{\n * console.log(diffResult)\n * })\n *\n * //This is to view the changes between a branch (head) and a commit for the given document\n * client.getVersionDiff(\"main\", afterCommit, \"Person/Tom\" ).then(diffResult=>{\n * console.log(diffResult)\n * })\n *\n * //This is to view the changes between two branches with the keep options\n * const options = {\"keep\":{\"@id\":true, \"name\": true}, start:0, count:10}\n * client.getVersionDiff(\"main\",\"mybranch\",options).then(diffResult=>{\n * console.log(diffResult)\n * })\n */\nWOQLClient.prototype.getVersionDiff = function (beforeVersion, afterVersion, id, options) {\n if (typeof beforeVersion !== 'string' || typeof afterVersion !== 'string') {\n const errmsg = 'Error, you have to provide a beforeVersion and afterVersion input';\n\n return Promise.reject(\n new Error(ErrorMessage.getInvalidParameterMessage(CONST.GET_DIFF, errmsg)),\n );\n }\n const opt = options || {};\n const payload = {\n before_data_version: beforeVersion,\n after_data_version: afterVersion,\n ...opt,\n };\n if (id) {\n payload.document_id = id;\n }\n // console.log(this.connectionConfig.diffURL())\n return this.dispatch(\n CONST.POST,\n this.connectionConfig.diffURL(),\n payload,\n ).then((response) => response);\n};\n\n/**\n * Diff two different commits and apply changes on the current branch/commit.\n * If you would like to change branch or commit before apply use client.checkout(\"branchName\")\n * @param {string} beforeVersion - Before branch/commit to compare\n * @param {string} afterVersion - After branch/commit to compare\n * @param {string} message - apply commit message\n * @param {boolean} [matchFinalState] - the default value is false\n * @param {object} [options] - {keep:{}} Options to send to the apply endpoint\n * @example\n * client.checkout(\"mybranch\")\n * client.apply(\"mybranch\",\"mybranch_new\",\"merge main\").then(result=>{\n * console.log(result)\n * })\n */\n// eslint-disable-next-line max-len\nWOQLClient.prototype.apply = function (beforeVersion, afterVersion, message, matchFinalState, options) {\n const opt = options || {};\n const commitMsg = this.generateCommitInfo(message);\n const payload = {\n before_commit: beforeVersion,\n after_commit: afterVersion,\n ...commitMsg,\n ...opt,\n };\n if (matchFinalState) {\n payload.match_final_state = matchFinalState;\n }\n return this.dispatch(\n CONST.POST,\n this.connectionConfig.applyURL(),\n payload,\n ).then((response) => response);\n};\n\n/**\n * Get the document's history for a specific database or branch\n * @param {string} id - id of document to report history of\n * @param {typedef.DocHistoryParams} [historyParams]\n * @example\n * //this will return the last 5 commits for the Person/Anna document\n * client.checkout(\"mybranch\")\n * client.docHistory(\"Person/Anna\",{start:0,count:5}).then(result=>{\n * console.log(result)\n * })\n * //this will return the last and the first commit for the Person/Anna document\n * client.docHistory(\"Person/Anna\",{updated:true,created:true}).then(result=>{\n * console.log(result)\n * })\n */\n// eslint-disable-next-line max-len\nWOQLClient.prototype.getDocumentHistory = function (id, historyParams) {\n const params = historyParams || {};\n params.id = id;\n return this.dispatch(\n CONST.GET,\n this.connectionConfig.docHistoryURL(params),\n ).then((response) => response);\n};\n\n/**\n * Call a custom Api endpoit\n * @param {string} requestType - The current state of JSON document\n * @param {string} customRequestURL - The patch object\n * @param {object} [payload] - the request payload\n * @returns {Promise} A promise that returns the call response object, or an Error if rejected.\n * @example\n * client.sendCustomRequest(\"GET\", \"http://localhost:3030/changes/\").then(result=>{\n * console.log(result)\n * })\n */\nWOQLClient.prototype.sendCustomRequest = function (requestType, customRequestURL, payload) {\n return this.dispatch(\n requestType,\n customRequestURL,\n payload,\n ).then((response) => response);\n};\n\nmodule.exports = WOQLClient;\n","/* eslint-env browser */\nmodule.exports = typeof self == 'object' ? self.FormData : window.FormData;\n","// Top level file is just a mixin of submodules & constants\n'use strict';\n\nconst { Deflate, deflate, deflateRaw, gzip } = require('./lib/deflate');\n\nconst { Inflate, inflate, inflateRaw, ungzip } = require('./lib/inflate');\n\nconst constants = require('./lib/zlib/constants');\n\nmodule.exports.Deflate = Deflate;\nmodule.exports.deflate = deflate;\nmodule.exports.deflateRaw = deflateRaw;\nmodule.exports.gzip = gzip;\nmodule.exports.Inflate = Inflate;\nmodule.exports.inflate = inflate;\nmodule.exports.inflateRaw = inflateRaw;\nmodule.exports.ungzip = ungzip;\nmodule.exports.constants = constants;\n","'use strict';\n\n\nconst zlib_deflate = require('./zlib/deflate');\nconst utils = require('./utils/common');\nconst strings = require('./utils/strings');\nconst msg = require('./zlib/messages');\nconst ZStream = require('./zlib/zstream');\n\nconst toString = Object.prototype.toString;\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\nconst {\n Z_NO_FLUSH, Z_SYNC_FLUSH, Z_FULL_FLUSH, Z_FINISH,\n Z_OK, Z_STREAM_END,\n Z_DEFAULT_COMPRESSION,\n Z_DEFAULT_STRATEGY,\n Z_DEFLATED\n} = require('./zlib/constants');\n\n/* ===========================================================================*/\n\n\n/**\n * class Deflate\n *\n * Generic JS-style wrapper for zlib calls. If you don't need\n * streaming behaviour - use more simple functions: [[deflate]],\n * [[deflateRaw]] and [[gzip]].\n **/\n\n/* internal\n * Deflate.chunks -> Array\n *\n * Chunks of output data, if [[Deflate#onData]] not overridden.\n **/\n\n/**\n * Deflate.result -> Uint8Array\n *\n * Compressed result, generated by default [[Deflate#onData]]\n * and [[Deflate#onEnd]] handlers. Filled after you push last chunk\n * (call [[Deflate#push]] with `Z_FINISH` / `true` param).\n **/\n\n/**\n * Deflate.err -> Number\n *\n * Error code after deflate finished. 0 (Z_OK) on success.\n * You will not need it in real life, because deflate errors\n * are possible only on wrong options or bad `onData` / `onEnd`\n * custom handlers.\n **/\n\n/**\n * Deflate.msg -> String\n *\n * Error message, if [[Deflate.err]] != 0\n **/\n\n\n/**\n * new Deflate(options)\n * - options (Object): zlib deflate options.\n *\n * Creates new deflator instance with specified params. Throws exception\n * on bad params. Supported options:\n *\n * - `level`\n * - `windowBits`\n * - `memLevel`\n * - `strategy`\n * - `dictionary`\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information on these.\n *\n * Additional options, for internal needs:\n *\n * - `chunkSize` - size of generated data chunks (16K by default)\n * - `raw` (Boolean) - do raw deflate\n * - `gzip` (Boolean) - create gzip wrapper\n * - `header` (Object) - custom header for gzip\n * - `text` (Boolean) - true if compressed data believed to be text\n * - `time` (Number) - modification time, unix timestamp\n * - `os` (Number) - operation system code\n * - `extra` (Array) - array of bytes with extra data (max 65536)\n * - `name` (String) - file name (binary string)\n * - `comment` (String) - comment (binary string)\n * - `hcrc` (Boolean) - true if header crc should be added\n *\n * ##### Example:\n *\n * ```javascript\n * const pako = require('pako')\n * , chunk1 = new Uint8Array([1,2,3,4,5,6,7,8,9])\n * , chunk2 = new Uint8Array([10,11,12,13,14,15,16,17,18,19]);\n *\n * const deflate = new pako.Deflate({ level: 3});\n *\n * deflate.push(chunk1, false);\n * deflate.push(chunk2, true); // true -> last chunk\n *\n * if (deflate.err) { throw new Error(deflate.err); }\n *\n * console.log(deflate.result);\n * ```\n **/\nfunction Deflate(options) {\n this.options = utils.assign({\n level: Z_DEFAULT_COMPRESSION,\n method: Z_DEFLATED,\n chunkSize: 16384,\n windowBits: 15,\n memLevel: 8,\n strategy: Z_DEFAULT_STRATEGY\n }, options || {});\n\n let opt = this.options;\n\n if (opt.raw && (opt.windowBits > 0)) {\n opt.windowBits = -opt.windowBits;\n }\n\n else if (opt.gzip && (opt.windowBits > 0) && (opt.windowBits < 16)) {\n opt.windowBits += 16;\n }\n\n this.err = 0; // error code, if happens (0 = Z_OK)\n this.msg = ''; // error message\n this.ended = false; // used to avoid multiple onEnd() calls\n this.chunks = []; // chunks of compressed data\n\n this.strm = new ZStream();\n this.strm.avail_out = 0;\n\n let status = zlib_deflate.deflateInit2(\n this.strm,\n opt.level,\n opt.method,\n opt.windowBits,\n opt.memLevel,\n opt.strategy\n );\n\n if (status !== Z_OK) {\n throw new Error(msg[status]);\n }\n\n if (opt.header) {\n zlib_deflate.deflateSetHeader(this.strm, opt.header);\n }\n\n if (opt.dictionary) {\n let dict;\n // Convert data if needed\n if (typeof opt.dictionary === 'string') {\n // If we need to compress text, change encoding to utf8.\n dict = strings.string2buf(opt.dictionary);\n } else if (toString.call(opt.dictionary) === '[object ArrayBuffer]') {\n dict = new Uint8Array(opt.dictionary);\n } else {\n dict = opt.dictionary;\n }\n\n status = zlib_deflate.deflateSetDictionary(this.strm, dict);\n\n if (status !== Z_OK) {\n throw new Error(msg[status]);\n }\n\n this._dict_set = true;\n }\n}\n\n/**\n * Deflate#push(data[, flush_mode]) -> Boolean\n * - data (Uint8Array|ArrayBuffer|String): input data. Strings will be\n * converted to utf8 byte sequence.\n * - flush_mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes.\n * See constants. Skipped or `false` means Z_NO_FLUSH, `true` means Z_FINISH.\n *\n * Sends input data to deflate pipe, generating [[Deflate#onData]] calls with\n * new compressed chunks. Returns `true` on success. The last data block must\n * have `flush_mode` Z_FINISH (or `true`). That will flush internal pending\n * buffers and call [[Deflate#onEnd]].\n *\n * On fail call [[Deflate#onEnd]] with error code and return false.\n *\n * ##### Example\n *\n * ```javascript\n * push(chunk, false); // push one of data chunks\n * ...\n * push(chunk, true); // push last chunk\n * ```\n **/\nDeflate.prototype.push = function (data, flush_mode) {\n const strm = this.strm;\n const chunkSize = this.options.chunkSize;\n let status, _flush_mode;\n\n if (this.ended) { return false; }\n\n if (flush_mode === ~~flush_mode) _flush_mode = flush_mode;\n else _flush_mode = flush_mode === true ? Z_FINISH : Z_NO_FLUSH;\n\n // Convert data if needed\n if (typeof data === 'string') {\n // If we need to compress text, change encoding to utf8.\n strm.input = strings.string2buf(data);\n } else if (toString.call(data) === '[object ArrayBuffer]') {\n strm.input = new Uint8Array(data);\n } else {\n strm.input = data;\n }\n\n strm.next_in = 0;\n strm.avail_in = strm.input.length;\n\n for (;;) {\n if (strm.avail_out === 0) {\n strm.output = new Uint8Array(chunkSize);\n strm.next_out = 0;\n strm.avail_out = chunkSize;\n }\n\n // Make sure avail_out > 6 to avoid repeating markers\n if ((_flush_mode === Z_SYNC_FLUSH || _flush_mode === Z_FULL_FLUSH) && strm.avail_out <= 6) {\n this.onData(strm.output.subarray(0, strm.next_out));\n strm.avail_out = 0;\n continue;\n }\n\n status = zlib_deflate.deflate(strm, _flush_mode);\n\n // Ended => flush and finish\n if (status === Z_STREAM_END) {\n if (strm.next_out > 0) {\n this.onData(strm.output.subarray(0, strm.next_out));\n }\n status = zlib_deflate.deflateEnd(this.strm);\n this.onEnd(status);\n this.ended = true;\n return status === Z_OK;\n }\n\n // Flush if out buffer full\n if (strm.avail_out === 0) {\n this.onData(strm.output);\n continue;\n }\n\n // Flush if requested and has data\n if (_flush_mode > 0 && strm.next_out > 0) {\n this.onData(strm.output.subarray(0, strm.next_out));\n strm.avail_out = 0;\n continue;\n }\n\n if (strm.avail_in === 0) break;\n }\n\n return true;\n};\n\n\n/**\n * Deflate#onData(chunk) -> Void\n * - chunk (Uint8Array): output data.\n *\n * By default, stores data blocks in `chunks[]` property and glue\n * those in `onEnd`. Override this handler, if you need another behaviour.\n **/\nDeflate.prototype.onData = function (chunk) {\n this.chunks.push(chunk);\n};\n\n\n/**\n * Deflate#onEnd(status) -> Void\n * - status (Number): deflate status. 0 (Z_OK) on success,\n * other if not.\n *\n * Called once after you tell deflate that the input stream is\n * complete (Z_FINISH). By default - join collected chunks,\n * free memory and fill `results` / `err` properties.\n **/\nDeflate.prototype.onEnd = function (status) {\n // On success - join\n if (status === Z_OK) {\n this.result = utils.flattenChunks(this.chunks);\n }\n this.chunks = [];\n this.err = status;\n this.msg = this.strm.msg;\n};\n\n\n/**\n * deflate(data[, options]) -> Uint8Array\n * - data (Uint8Array|String): input data to compress.\n * - options (Object): zlib deflate options.\n *\n * Compress `data` with deflate algorithm and `options`.\n *\n * Supported options are:\n *\n * - level\n * - windowBits\n * - memLevel\n * - strategy\n * - dictionary\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information on these.\n *\n * Sugar (options):\n *\n * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify\n * negative windowBits implicitly.\n *\n * ##### Example:\n *\n * ```javascript\n * const pako = require('pako')\n * const data = new Uint8Array([1,2,3,4,5,6,7,8,9]);\n *\n * console.log(pako.deflate(data));\n * ```\n **/\nfunction deflate(input, options) {\n const deflator = new Deflate(options);\n\n deflator.push(input, true);\n\n // That will never happens, if you don't cheat with options :)\n if (deflator.err) { throw deflator.msg || msg[deflator.err]; }\n\n return deflator.result;\n}\n\n\n/**\n * deflateRaw(data[, options]) -> Uint8Array\n * - data (Uint8Array|String): input data to compress.\n * - options (Object): zlib deflate options.\n *\n * The same as [[deflate]], but creates raw data, without wrapper\n * (header and adler32 crc).\n **/\nfunction deflateRaw(input, options) {\n options = options || {};\n options.raw = true;\n return deflate(input, options);\n}\n\n\n/**\n * gzip(data[, options]) -> Uint8Array\n * - data (Uint8Array|String): input data to compress.\n * - options (Object): zlib deflate options.\n *\n * The same as [[deflate]], but create gzip wrapper instead of\n * deflate one.\n **/\nfunction gzip(input, options) {\n options = options || {};\n options.gzip = true;\n return deflate(input, options);\n}\n\n\nmodule.exports.Deflate = Deflate;\nmodule.exports.deflate = deflate;\nmodule.exports.deflateRaw = deflateRaw;\nmodule.exports.gzip = gzip;\nmodule.exports.constants = require('./zlib/constants');\n","'use strict';\n\n\nconst zlib_inflate = require('./zlib/inflate');\nconst utils = require('./utils/common');\nconst strings = require('./utils/strings');\nconst msg = require('./zlib/messages');\nconst ZStream = require('./zlib/zstream');\nconst GZheader = require('./zlib/gzheader');\n\nconst toString = Object.prototype.toString;\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\nconst {\n Z_NO_FLUSH, Z_FINISH,\n Z_OK, Z_STREAM_END, Z_NEED_DICT, Z_STREAM_ERROR, Z_DATA_ERROR, Z_MEM_ERROR\n} = require('./zlib/constants');\n\n/* ===========================================================================*/\n\n\n/**\n * class Inflate\n *\n * Generic JS-style wrapper for zlib calls. If you don't need\n * streaming behaviour - use more simple functions: [[inflate]]\n * and [[inflateRaw]].\n **/\n\n/* internal\n * inflate.chunks -> Array\n *\n * Chunks of output data, if [[Inflate#onData]] not overridden.\n **/\n\n/**\n * Inflate.result -> Uint8Array|String\n *\n * Uncompressed result, generated by default [[Inflate#onData]]\n * and [[Inflate#onEnd]] handlers. Filled after you push last chunk\n * (call [[Inflate#push]] with `Z_FINISH` / `true` param).\n **/\n\n/**\n * Inflate.err -> Number\n *\n * Error code after inflate finished. 0 (Z_OK) on success.\n * Should be checked if broken data possible.\n **/\n\n/**\n * Inflate.msg -> String\n *\n * Error message, if [[Inflate.err]] != 0\n **/\n\n\n/**\n * new Inflate(options)\n * - options (Object): zlib inflate options.\n *\n * Creates new inflator instance with specified params. Throws exception\n * on bad params. Supported options:\n *\n * - `windowBits`\n * - `dictionary`\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information on these.\n *\n * Additional options, for internal needs:\n *\n * - `chunkSize` - size of generated data chunks (16K by default)\n * - `raw` (Boolean) - do raw inflate\n * - `to` (String) - if equal to 'string', then result will be converted\n * from utf8 to utf16 (javascript) string. When string output requested,\n * chunk length can differ from `chunkSize`, depending on content.\n *\n * By default, when no options set, autodetect deflate/gzip data format via\n * wrapper header.\n *\n * ##### Example:\n *\n * ```javascript\n * const pako = require('pako')\n * const chunk1 = new Uint8Array([1,2,3,4,5,6,7,8,9])\n * const chunk2 = new Uint8Array([10,11,12,13,14,15,16,17,18,19]);\n *\n * const inflate = new pako.Inflate({ level: 3});\n *\n * inflate.push(chunk1, false);\n * inflate.push(chunk2, true); // true -> last chunk\n *\n * if (inflate.err) { throw new Error(inflate.err); }\n *\n * console.log(inflate.result);\n * ```\n **/\nfunction Inflate(options) {\n this.options = utils.assign({\n chunkSize: 1024 * 64,\n windowBits: 15,\n to: ''\n }, options || {});\n\n const opt = this.options;\n\n // Force window size for `raw` data, if not set directly,\n // because we have no header for autodetect.\n if (opt.raw && (opt.windowBits >= 0) && (opt.windowBits < 16)) {\n opt.windowBits = -opt.windowBits;\n if (opt.windowBits === 0) { opt.windowBits = -15; }\n }\n\n // If `windowBits` not defined (and mode not raw) - set autodetect flag for gzip/deflate\n if ((opt.windowBits >= 0) && (opt.windowBits < 16) &&\n !(options && options.windowBits)) {\n opt.windowBits += 32;\n }\n\n // Gzip header has no info about windows size, we can do autodetect only\n // for deflate. So, if window size not set, force it to max when gzip possible\n if ((opt.windowBits > 15) && (opt.windowBits < 48)) {\n // bit 3 (16) -> gzipped data\n // bit 4 (32) -> autodetect gzip/deflate\n if ((opt.windowBits & 15) === 0) {\n opt.windowBits |= 15;\n }\n }\n\n this.err = 0; // error code, if happens (0 = Z_OK)\n this.msg = ''; // error message\n this.ended = false; // used to avoid multiple onEnd() calls\n this.chunks = []; // chunks of compressed data\n\n this.strm = new ZStream();\n this.strm.avail_out = 0;\n\n let status = zlib_inflate.inflateInit2(\n this.strm,\n opt.windowBits\n );\n\n if (status !== Z_OK) {\n throw new Error(msg[status]);\n }\n\n this.header = new GZheader();\n\n zlib_inflate.inflateGetHeader(this.strm, this.header);\n\n // Setup dictionary\n if (opt.dictionary) {\n // Convert data if needed\n if (typeof opt.dictionary === 'string') {\n opt.dictionary = strings.string2buf(opt.dictionary);\n } else if (toString.call(opt.dictionary) === '[object ArrayBuffer]') {\n opt.dictionary = new Uint8Array(opt.dictionary);\n }\n if (opt.raw) { //In raw mode we need to set the dictionary early\n status = zlib_inflate.inflateSetDictionary(this.strm, opt.dictionary);\n if (status !== Z_OK) {\n throw new Error(msg[status]);\n }\n }\n }\n}\n\n/**\n * Inflate#push(data[, flush_mode]) -> Boolean\n * - data (Uint8Array|ArrayBuffer): input data\n * - flush_mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE\n * flush modes. See constants. Skipped or `false` means Z_NO_FLUSH,\n * `true` means Z_FINISH.\n *\n * Sends input data to inflate pipe, generating [[Inflate#onData]] calls with\n * new output chunks. Returns `true` on success. If end of stream detected,\n * [[Inflate#onEnd]] will be called.\n *\n * `flush_mode` is not needed for normal operation, because end of stream\n * detected automatically. You may try to use it for advanced things, but\n * this functionality was not tested.\n *\n * On fail call [[Inflate#onEnd]] with error code and return false.\n *\n * ##### Example\n *\n * ```javascript\n * push(chunk, false); // push one of data chunks\n * ...\n * push(chunk, true); // push last chunk\n * ```\n **/\nInflate.prototype.push = function (data, flush_mode) {\n const strm = this.strm;\n const chunkSize = this.options.chunkSize;\n const dictionary = this.options.dictionary;\n let status, _flush_mode, last_avail_out;\n\n if (this.ended) return false;\n\n if (flush_mode === ~~flush_mode) _flush_mode = flush_mode;\n else _flush_mode = flush_mode === true ? Z_FINISH : Z_NO_FLUSH;\n\n // Convert data if needed\n if (toString.call(data) === '[object ArrayBuffer]') {\n strm.input = new Uint8Array(data);\n } else {\n strm.input = data;\n }\n\n strm.next_in = 0;\n strm.avail_in = strm.input.length;\n\n for (;;) {\n if (strm.avail_out === 0) {\n strm.output = new Uint8Array(chunkSize);\n strm.next_out = 0;\n strm.avail_out = chunkSize;\n }\n\n status = zlib_inflate.inflate(strm, _flush_mode);\n\n if (status === Z_NEED_DICT && dictionary) {\n status = zlib_inflate.inflateSetDictionary(strm, dictionary);\n\n if (status === Z_OK) {\n status = zlib_inflate.inflate(strm, _flush_mode);\n } else if (status === Z_DATA_ERROR) {\n // Replace code with more verbose\n status = Z_NEED_DICT;\n }\n }\n\n // Skip snyc markers if more data follows and not raw mode\n while (strm.avail_in > 0 &&\n status === Z_STREAM_END &&\n strm.state.wrap > 0 &&\n data[strm.next_in] !== 0)\n {\n zlib_inflate.inflateReset(strm);\n status = zlib_inflate.inflate(strm, _flush_mode);\n }\n\n switch (status) {\n case Z_STREAM_ERROR:\n case Z_DATA_ERROR:\n case Z_NEED_DICT:\n case Z_MEM_ERROR:\n this.onEnd(status);\n this.ended = true;\n return false;\n }\n\n // Remember real `avail_out` value, because we may patch out buffer content\n // to align utf8 strings boundaries.\n last_avail_out = strm.avail_out;\n\n if (strm.next_out) {\n if (strm.avail_out === 0 || status === Z_STREAM_END) {\n\n if (this.options.to === 'string') {\n\n let next_out_utf8 = strings.utf8border(strm.output, strm.next_out);\n\n let tail = strm.next_out - next_out_utf8;\n let utf8str = strings.buf2string(strm.output, next_out_utf8);\n\n // move tail & realign counters\n strm.next_out = tail;\n strm.avail_out = chunkSize - tail;\n if (tail) strm.output.set(strm.output.subarray(next_out_utf8, next_out_utf8 + tail), 0);\n\n this.onData(utf8str);\n\n } else {\n this.onData(strm.output.length === strm.next_out ? strm.output : strm.output.subarray(0, strm.next_out));\n }\n }\n }\n\n // Must repeat iteration if out buffer is full\n if (status === Z_OK && last_avail_out === 0) continue;\n\n // Finalize if end of stream reached.\n if (status === Z_STREAM_END) {\n status = zlib_inflate.inflateEnd(this.strm);\n this.onEnd(status);\n this.ended = true;\n return true;\n }\n\n if (strm.avail_in === 0) break;\n }\n\n return true;\n};\n\n\n/**\n * Inflate#onData(chunk) -> Void\n * - chunk (Uint8Array|String): output data. When string output requested,\n * each chunk will be string.\n *\n * By default, stores data blocks in `chunks[]` property and glue\n * those in `onEnd`. Override this handler, if you need another behaviour.\n **/\nInflate.prototype.onData = function (chunk) {\n this.chunks.push(chunk);\n};\n\n\n/**\n * Inflate#onEnd(status) -> Void\n * - status (Number): inflate status. 0 (Z_OK) on success,\n * other if not.\n *\n * Called either after you tell inflate that the input stream is\n * complete (Z_FINISH). By default - join collected chunks,\n * free memory and fill `results` / `err` properties.\n **/\nInflate.prototype.onEnd = function (status) {\n // On success - join\n if (status === Z_OK) {\n if (this.options.to === 'string') {\n this.result = this.chunks.join('');\n } else {\n this.result = utils.flattenChunks(this.chunks);\n }\n }\n this.chunks = [];\n this.err = status;\n this.msg = this.strm.msg;\n};\n\n\n/**\n * inflate(data[, options]) -> Uint8Array|String\n * - data (Uint8Array): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * Decompress `data` with inflate/ungzip and `options`. Autodetect\n * format via wrapper header by default. That's why we don't provide\n * separate `ungzip` method.\n *\n * Supported options are:\n *\n * - windowBits\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information.\n *\n * Sugar (options):\n *\n * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify\n * negative windowBits implicitly.\n * - `to` (String) - if equal to 'string', then result will be converted\n * from utf8 to utf16 (javascript) string. When string output requested,\n * chunk length can differ from `chunkSize`, depending on content.\n *\n *\n * ##### Example:\n *\n * ```javascript\n * const pako = require('pako');\n * const input = pako.deflate(new Uint8Array([1,2,3,4,5,6,7,8,9]));\n * let output;\n *\n * try {\n * output = pako.inflate(input);\n * } catch (err) {\n * console.log(err);\n * }\n * ```\n **/\nfunction inflate(input, options) {\n const inflator = new Inflate(options);\n\n inflator.push(input);\n\n // That will never happens, if you don't cheat with options :)\n if (inflator.err) throw inflator.msg || msg[inflator.err];\n\n return inflator.result;\n}\n\n\n/**\n * inflateRaw(data[, options]) -> Uint8Array|String\n * - data (Uint8Array): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * The same as [[inflate]], but creates raw data, without wrapper\n * (header and adler32 crc).\n **/\nfunction inflateRaw(input, options) {\n options = options || {};\n options.raw = true;\n return inflate(input, options);\n}\n\n\n/**\n * ungzip(data[, options]) -> Uint8Array|String\n * - data (Uint8Array): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * Just shortcut to [[inflate]], because it autodetects format\n * by header.content. Done for convenience.\n **/\n\n\nmodule.exports.Inflate = Inflate;\nmodule.exports.inflate = inflate;\nmodule.exports.inflateRaw = inflateRaw;\nmodule.exports.ungzip = inflate;\nmodule.exports.constants = require('./zlib/constants');\n","'use strict';\n\n\nconst _has = (obj, key) => {\n return Object.prototype.hasOwnProperty.call(obj, key);\n};\n\nmodule.exports.assign = function (obj /*from1, from2, from3, ...*/) {\n const sources = Array.prototype.slice.call(arguments, 1);\n while (sources.length) {\n const source = sources.shift();\n if (!source) { continue; }\n\n if (typeof source !== 'object') {\n throw new TypeError(source + 'must be non-object');\n }\n\n for (const p in source) {\n if (_has(source, p)) {\n obj[p] = source[p];\n }\n }\n }\n\n return obj;\n};\n\n\n// Join array of chunks to single array.\nmodule.exports.flattenChunks = (chunks) => {\n // calculate data length\n let len = 0;\n\n for (let i = 0, l = chunks.length; i < l; i++) {\n len += chunks[i].length;\n }\n\n // join chunks\n const result = new Uint8Array(len);\n\n for (let i = 0, pos = 0, l = chunks.length; i < l; i++) {\n let chunk = chunks[i];\n result.set(chunk, pos);\n pos += chunk.length;\n }\n\n return result;\n};\n","// String encode/decode helpers\n'use strict';\n\n\n// Quick check if we can use fast array to bin string conversion\n//\n// - apply(Array) can fail on Android 2.2\n// - apply(Uint8Array) can fail on iOS 5.1 Safari\n//\nlet STR_APPLY_UIA_OK = true;\n\ntry { String.fromCharCode.apply(null, new Uint8Array(1)); } catch (__) { STR_APPLY_UIA_OK = false; }\n\n\n// Table with utf8 lengths (calculated by first byte of sequence)\n// Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS,\n// because max possible codepoint is 0x10ffff\nconst _utf8len = new Uint8Array(256);\nfor (let q = 0; q < 256; q++) {\n _utf8len[q] = (q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1);\n}\n_utf8len[254] = _utf8len[254] = 1; // Invalid sequence start\n\n\n// convert string to array (typed, when possible)\nmodule.exports.string2buf = (str) => {\n if (typeof TextEncoder === 'function' && TextEncoder.prototype.encode) {\n return new TextEncoder().encode(str);\n }\n\n let buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0;\n\n // count binary size\n for (m_pos = 0; m_pos < str_len; m_pos++) {\n c = str.charCodeAt(m_pos);\n if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) {\n c2 = str.charCodeAt(m_pos + 1);\n if ((c2 & 0xfc00) === 0xdc00) {\n c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);\n m_pos++;\n }\n }\n buf_len += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4;\n }\n\n // allocate buffer\n buf = new Uint8Array(buf_len);\n\n // convert\n for (i = 0, m_pos = 0; i < buf_len; m_pos++) {\n c = str.charCodeAt(m_pos);\n if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) {\n c2 = str.charCodeAt(m_pos + 1);\n if ((c2 & 0xfc00) === 0xdc00) {\n c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);\n m_pos++;\n }\n }\n if (c < 0x80) {\n /* one byte */\n buf[i++] = c;\n } else if (c < 0x800) {\n /* two bytes */\n buf[i++] = 0xC0 | (c >>> 6);\n buf[i++] = 0x80 | (c & 0x3f);\n } else if (c < 0x10000) {\n /* three bytes */\n buf[i++] = 0xE0 | (c >>> 12);\n buf[i++] = 0x80 | (c >>> 6 & 0x3f);\n buf[i++] = 0x80 | (c & 0x3f);\n } else {\n /* four bytes */\n buf[i++] = 0xf0 | (c >>> 18);\n buf[i++] = 0x80 | (c >>> 12 & 0x3f);\n buf[i++] = 0x80 | (c >>> 6 & 0x3f);\n buf[i++] = 0x80 | (c & 0x3f);\n }\n }\n\n return buf;\n};\n\n// Helper\nconst buf2binstring = (buf, len) => {\n // On Chrome, the arguments in a function call that are allowed is `65534`.\n // If the length of the buffer is smaller than that, we can use this optimization,\n // otherwise we will take a slower path.\n if (len < 65534) {\n if (buf.subarray && STR_APPLY_UIA_OK) {\n return String.fromCharCode.apply(null, buf.length === len ? buf : buf.subarray(0, len));\n }\n }\n\n let result = '';\n for (let i = 0; i < len; i++) {\n result += String.fromCharCode(buf[i]);\n }\n return result;\n};\n\n\n// convert array to string\nmodule.exports.buf2string = (buf, max) => {\n const len = max || buf.length;\n\n if (typeof TextDecoder === 'function' && TextDecoder.prototype.decode) {\n return new TextDecoder().decode(buf.subarray(0, max));\n }\n\n let i, out;\n\n // Reserve max possible length (2 words per char)\n // NB: by unknown reasons, Array is significantly faster for\n // String.fromCharCode.apply than Uint16Array.\n const utf16buf = new Array(len * 2);\n\n for (out = 0, i = 0; i < len;) {\n let c = buf[i++];\n // quick process ascii\n if (c < 0x80) { utf16buf[out++] = c; continue; }\n\n let c_len = _utf8len[c];\n // skip 5 & 6 byte codes\n if (c_len > 4) { utf16buf[out++] = 0xfffd; i += c_len - 1; continue; }\n\n // apply mask on first byte\n c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07;\n // join the rest\n while (c_len > 1 && i < len) {\n c = (c << 6) | (buf[i++] & 0x3f);\n c_len--;\n }\n\n // terminated by end of string?\n if (c_len > 1) { utf16buf[out++] = 0xfffd; continue; }\n\n if (c < 0x10000) {\n utf16buf[out++] = c;\n } else {\n c -= 0x10000;\n utf16buf[out++] = 0xd800 | ((c >> 10) & 0x3ff);\n utf16buf[out++] = 0xdc00 | (c & 0x3ff);\n }\n }\n\n return buf2binstring(utf16buf, out);\n};\n\n\n// Calculate max possible position in utf8 buffer,\n// that will not break sequence. If that's not possible\n// - (very small limits) return max size as is.\n//\n// buf[] - utf8 bytes array\n// max - length limit (mandatory);\nmodule.exports.utf8border = (buf, max) => {\n\n max = max || buf.length;\n if (max > buf.length) { max = buf.length; }\n\n // go back from last position, until start of sequence found\n let pos = max - 1;\n while (pos >= 0 && (buf[pos] & 0xC0) === 0x80) { pos--; }\n\n // Very small and broken sequence,\n // return max, because we should return something anyway.\n if (pos < 0) { return max; }\n\n // If we came to start of buffer - that means buffer is too small,\n // return max too.\n if (pos === 0) { return max; }\n\n return (pos + _utf8len[buf[pos]] > max) ? pos : max;\n};\n","'use strict';\n\n// Note: adler32 takes 12% for level 0 and 2% for level 6.\n// It isn't worth it to make additional optimizations as in original.\n// Small size is preferable.\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nconst adler32 = (adler, buf, len, pos) => {\n let s1 = (adler & 0xffff) |0,\n s2 = ((adler >>> 16) & 0xffff) |0,\n n = 0;\n\n while (len !== 0) {\n // Set limit ~ twice less than 5552, to keep\n // s2 in 31-bits, because we force signed ints.\n // in other case %= will fail.\n n = len > 2000 ? 2000 : len;\n len -= n;\n\n do {\n s1 = (s1 + buf[pos++]) |0;\n s2 = (s2 + s1) |0;\n } while (--n);\n\n s1 %= 65521;\n s2 %= 65521;\n }\n\n return (s1 | (s2 << 16)) |0;\n};\n\n\nmodule.exports = adler32;\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nmodule.exports = {\n\n /* Allowed flush values; see deflate() and inflate() below for details */\n Z_NO_FLUSH: 0,\n Z_PARTIAL_FLUSH: 1,\n Z_SYNC_FLUSH: 2,\n Z_FULL_FLUSH: 3,\n Z_FINISH: 4,\n Z_BLOCK: 5,\n Z_TREES: 6,\n\n /* Return codes for the compression/decompression functions. Negative values\n * are errors, positive values are used for special but normal events.\n */\n Z_OK: 0,\n Z_STREAM_END: 1,\n Z_NEED_DICT: 2,\n Z_ERRNO: -1,\n Z_STREAM_ERROR: -2,\n Z_DATA_ERROR: -3,\n Z_MEM_ERROR: -4,\n Z_BUF_ERROR: -5,\n //Z_VERSION_ERROR: -6,\n\n /* compression levels */\n Z_NO_COMPRESSION: 0,\n Z_BEST_SPEED: 1,\n Z_BEST_COMPRESSION: 9,\n Z_DEFAULT_COMPRESSION: -1,\n\n\n Z_FILTERED: 1,\n Z_HUFFMAN_ONLY: 2,\n Z_RLE: 3,\n Z_FIXED: 4,\n Z_DEFAULT_STRATEGY: 0,\n\n /* Possible values of the data_type field (though see inflate()) */\n Z_BINARY: 0,\n Z_TEXT: 1,\n //Z_ASCII: 1, // = Z_TEXT (deprecated)\n Z_UNKNOWN: 2,\n\n /* The deflate compression method */\n Z_DEFLATED: 8\n //Z_NULL: null // Use -1 or null inline, depending on var type\n};\n","'use strict';\n\n// Note: we can't get significant speed boost here.\n// So write code to minimize size - no pregenerated tables\n// and array tools dependencies.\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\n// Use ordinary array, since untyped makes no boost here\nconst makeTable = () => {\n let c, table = [];\n\n for (var n = 0; n < 256; n++) {\n c = n;\n for (var k = 0; k < 8; k++) {\n c = ((c & 1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1));\n }\n table[n] = c;\n }\n\n return table;\n};\n\n// Create table on load. Just 255 signed longs. Not a problem.\nconst crcTable = new Uint32Array(makeTable());\n\n\nconst crc32 = (crc, buf, len, pos) => {\n const t = crcTable;\n const end = pos + len;\n\n crc ^= -1;\n\n for (let i = pos; i < end; i++) {\n crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF];\n }\n\n return (crc ^ (-1)); // >>> 0;\n};\n\n\nmodule.exports = crc32;\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nconst { _tr_init, _tr_stored_block, _tr_flush_block, _tr_tally, _tr_align } = require('./trees');\nconst adler32 = require('./adler32');\nconst crc32 = require('./crc32');\nconst msg = require('./messages');\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\nconst {\n Z_NO_FLUSH, Z_PARTIAL_FLUSH, Z_FULL_FLUSH, Z_FINISH, Z_BLOCK,\n Z_OK, Z_STREAM_END, Z_STREAM_ERROR, Z_DATA_ERROR, Z_BUF_ERROR,\n Z_DEFAULT_COMPRESSION,\n Z_FILTERED, Z_HUFFMAN_ONLY, Z_RLE, Z_FIXED, Z_DEFAULT_STRATEGY,\n Z_UNKNOWN,\n Z_DEFLATED\n} = require('./constants');\n\n/*============================================================================*/\n\n\nconst MAX_MEM_LEVEL = 9;\n/* Maximum value for memLevel in deflateInit2 */\nconst MAX_WBITS = 15;\n/* 32K LZ77 window */\nconst DEF_MEM_LEVEL = 8;\n\n\nconst LENGTH_CODES = 29;\n/* number of length codes, not counting the special END_BLOCK code */\nconst LITERALS = 256;\n/* number of literal bytes 0..255 */\nconst L_CODES = LITERALS + 1 + LENGTH_CODES;\n/* number of Literal or Length codes, including the END_BLOCK code */\nconst D_CODES = 30;\n/* number of distance codes */\nconst BL_CODES = 19;\n/* number of codes used to transfer the bit lengths */\nconst HEAP_SIZE = 2 * L_CODES + 1;\n/* maximum heap size */\nconst MAX_BITS = 15;\n/* All codes must not exceed MAX_BITS bits */\n\nconst MIN_MATCH = 3;\nconst MAX_MATCH = 258;\nconst MIN_LOOKAHEAD = (MAX_MATCH + MIN_MATCH + 1);\n\nconst PRESET_DICT = 0x20;\n\nconst INIT_STATE = 42;\nconst EXTRA_STATE = 69;\nconst NAME_STATE = 73;\nconst COMMENT_STATE = 91;\nconst HCRC_STATE = 103;\nconst BUSY_STATE = 113;\nconst FINISH_STATE = 666;\n\nconst BS_NEED_MORE = 1; /* block not completed, need more input or more output */\nconst BS_BLOCK_DONE = 2; /* block flush performed */\nconst BS_FINISH_STARTED = 3; /* finish started, need only more output at next deflate */\nconst BS_FINISH_DONE = 4; /* finish done, accept no more input or output */\n\nconst OS_CODE = 0x03; // Unix :) . Don't detect, use this default.\n\nconst err = (strm, errorCode) => {\n strm.msg = msg[errorCode];\n return errorCode;\n};\n\nconst rank = (f) => {\n return ((f) << 1) - ((f) > 4 ? 9 : 0);\n};\n\nconst zero = (buf) => {\n let len = buf.length; while (--len >= 0) { buf[len] = 0; }\n};\n\n\n/* eslint-disable new-cap */\nlet HASH_ZLIB = (s, prev, data) => ((prev << s.hash_shift) ^ data) & s.hash_mask;\n// This hash causes less collisions, https://github.com/nodeca/pako/issues/135\n// But breaks binary compatibility\n//let HASH_FAST = (s, prev, data) => ((prev << 8) + (prev >> 8) + (data << 4)) & s.hash_mask;\nlet HASH = HASH_ZLIB;\n\n/* =========================================================================\n * Flush as much pending output as possible. All deflate() output goes\n * through this function so some applications may wish to modify it\n * to avoid allocating a large strm->output buffer and copying into it.\n * (See also read_buf()).\n */\nconst flush_pending = (strm) => {\n const s = strm.state;\n\n //_tr_flush_bits(s);\n let len = s.pending;\n if (len > strm.avail_out) {\n len = strm.avail_out;\n }\n if (len === 0) { return; }\n\n strm.output.set(s.pending_buf.subarray(s.pending_out, s.pending_out + len), strm.next_out);\n strm.next_out += len;\n s.pending_out += len;\n strm.total_out += len;\n strm.avail_out -= len;\n s.pending -= len;\n if (s.pending === 0) {\n s.pending_out = 0;\n }\n};\n\n\nconst flush_block_only = (s, last) => {\n _tr_flush_block(s, (s.block_start >= 0 ? s.block_start : -1), s.strstart - s.block_start, last);\n s.block_start = s.strstart;\n flush_pending(s.strm);\n};\n\n\nconst put_byte = (s, b) => {\n s.pending_buf[s.pending++] = b;\n};\n\n\n/* =========================================================================\n * Put a short in the pending buffer. The 16-bit value is put in MSB order.\n * IN assertion: the stream state is correct and there is enough room in\n * pending_buf.\n */\nconst putShortMSB = (s, b) => {\n\n // put_byte(s, (Byte)(b >> 8));\n// put_byte(s, (Byte)(b & 0xff));\n s.pending_buf[s.pending++] = (b >>> 8) & 0xff;\n s.pending_buf[s.pending++] = b & 0xff;\n};\n\n\n/* ===========================================================================\n * Read a new buffer from the current input stream, update the adler32\n * and total number of bytes read. All deflate() input goes through\n * this function so some applications may wish to modify it to avoid\n * allocating a large strm->input buffer and copying from it.\n * (See also flush_pending()).\n */\nconst read_buf = (strm, buf, start, size) => {\n\n let len = strm.avail_in;\n\n if (len > size) { len = size; }\n if (len === 0) { return 0; }\n\n strm.avail_in -= len;\n\n // zmemcpy(buf, strm->next_in, len);\n buf.set(strm.input.subarray(strm.next_in, strm.next_in + len), start);\n if (strm.state.wrap === 1) {\n strm.adler = adler32(strm.adler, buf, len, start);\n }\n\n else if (strm.state.wrap === 2) {\n strm.adler = crc32(strm.adler, buf, len, start);\n }\n\n strm.next_in += len;\n strm.total_in += len;\n\n return len;\n};\n\n\n/* ===========================================================================\n * Set match_start to the longest match starting at the given string and\n * return its length. Matches shorter or equal to prev_length are discarded,\n * in which case the result is equal to prev_length and match_start is\n * garbage.\n * IN assertions: cur_match is the head of the hash chain for the current\n * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1\n * OUT assertion: the match length is not greater than s->lookahead.\n */\nconst longest_match = (s, cur_match) => {\n\n let chain_length = s.max_chain_length; /* max hash chain length */\n let scan = s.strstart; /* current string */\n let match; /* matched string */\n let len; /* length of current match */\n let best_len = s.prev_length; /* best match length so far */\n let nice_match = s.nice_match; /* stop if match long enough */\n const limit = (s.strstart > (s.w_size - MIN_LOOKAHEAD)) ?\n s.strstart - (s.w_size - MIN_LOOKAHEAD) : 0/*NIL*/;\n\n const _win = s.window; // shortcut\n\n const wmask = s.w_mask;\n const prev = s.prev;\n\n /* Stop when cur_match becomes <= limit. To simplify the code,\n * we prevent matches with the string of window index 0.\n */\n\n const strend = s.strstart + MAX_MATCH;\n let scan_end1 = _win[scan + best_len - 1];\n let scan_end = _win[scan + best_len];\n\n /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.\n * It is easy to get rid of this optimization if necessary.\n */\n // Assert(s->hash_bits >= 8 && MAX_MATCH == 258, \"Code too clever\");\n\n /* Do not waste too much time if we already have a good match: */\n if (s.prev_length >= s.good_match) {\n chain_length >>= 2;\n }\n /* Do not look for matches beyond the end of the input. This is necessary\n * to make deflate deterministic.\n */\n if (nice_match > s.lookahead) { nice_match = s.lookahead; }\n\n // Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, \"need lookahead\");\n\n do {\n // Assert(cur_match < s->strstart, \"no future\");\n match = cur_match;\n\n /* Skip to next match if the match length cannot increase\n * or if the match length is less than 2. Note that the checks below\n * for insufficient lookahead only occur occasionally for performance\n * reasons. Therefore uninitialized memory will be accessed, and\n * conditional jumps will be made that depend on those values.\n * However the length of the match is limited to the lookahead, so\n * the output of deflate is not affected by the uninitialized values.\n */\n\n if (_win[match + best_len] !== scan_end ||\n _win[match + best_len - 1] !== scan_end1 ||\n _win[match] !== _win[scan] ||\n _win[++match] !== _win[scan + 1]) {\n continue;\n }\n\n /* The check at best_len-1 can be removed because it will be made\n * again later. (This heuristic is not always a win.)\n * It is not necessary to compare scan[2] and match[2] since they\n * are always equal when the other bytes match, given that\n * the hash keys are equal and that HASH_BITS >= 8.\n */\n scan += 2;\n match++;\n // Assert(*scan == *match, \"match[2]?\");\n\n /* We check for insufficient lookahead only every 8th comparison;\n * the 256th check will be made at strstart+258.\n */\n do {\n /*jshint noempty:false*/\n } while (_win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n scan < strend);\n\n // Assert(scan <= s->window+(unsigned)(s->window_size-1), \"wild scan\");\n\n len = MAX_MATCH - (strend - scan);\n scan = strend - MAX_MATCH;\n\n if (len > best_len) {\n s.match_start = cur_match;\n best_len = len;\n if (len >= nice_match) {\n break;\n }\n scan_end1 = _win[scan + best_len - 1];\n scan_end = _win[scan + best_len];\n }\n } while ((cur_match = prev[cur_match & wmask]) > limit && --chain_length !== 0);\n\n if (best_len <= s.lookahead) {\n return best_len;\n }\n return s.lookahead;\n};\n\n\n/* ===========================================================================\n * Fill the window when the lookahead becomes insufficient.\n * Updates strstart and lookahead.\n *\n * IN assertion: lookahead < MIN_LOOKAHEAD\n * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD\n * At least one byte has been read, or avail_in == 0; reads are\n * performed for at least two bytes (required for the zip translate_eol\n * option -- not supported here).\n */\nconst fill_window = (s) => {\n\n const _w_size = s.w_size;\n let p, n, m, more, str;\n\n //Assert(s->lookahead < MIN_LOOKAHEAD, \"already enough lookahead\");\n\n do {\n more = s.window_size - s.lookahead - s.strstart;\n\n // JS ints have 32 bit, block below not needed\n /* Deal with !@#$% 64K limit: */\n //if (sizeof(int) <= 2) {\n // if (more == 0 && s->strstart == 0 && s->lookahead == 0) {\n // more = wsize;\n //\n // } else if (more == (unsigned)(-1)) {\n // /* Very unlikely, but possible on 16 bit machine if\n // * strstart == 0 && lookahead == 1 (input done a byte at time)\n // */\n // more--;\n // }\n //}\n\n\n /* If the window is almost full and there is insufficient lookahead,\n * move the upper half to the lower one to make room in the upper half.\n */\n if (s.strstart >= _w_size + (_w_size - MIN_LOOKAHEAD)) {\n\n s.window.set(s.window.subarray(_w_size, _w_size + _w_size), 0);\n s.match_start -= _w_size;\n s.strstart -= _w_size;\n /* we now have strstart >= MAX_DIST */\n s.block_start -= _w_size;\n\n /* Slide the hash table (could be avoided with 32 bit values\n at the expense of memory usage). We slide even when level == 0\n to keep the hash table consistent if we switch back to level > 0\n later. (Using level 0 permanently is not an optimal usage of\n zlib, so we don't care about this pathological case.)\n */\n\n n = s.hash_size;\n p = n;\n\n do {\n m = s.head[--p];\n s.head[p] = (m >= _w_size ? m - _w_size : 0);\n } while (--n);\n\n n = _w_size;\n p = n;\n\n do {\n m = s.prev[--p];\n s.prev[p] = (m >= _w_size ? m - _w_size : 0);\n /* If n is not on any hash chain, prev[n] is garbage but\n * its value will never be used.\n */\n } while (--n);\n\n more += _w_size;\n }\n if (s.strm.avail_in === 0) {\n break;\n }\n\n /* If there was no sliding:\n * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 &&\n * more == window_size - lookahead - strstart\n * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1)\n * => more >= window_size - 2*WSIZE + 2\n * In the BIG_MEM or MMAP case (not yet supported),\n * window_size == input_size + MIN_LOOKAHEAD &&\n * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD.\n * Otherwise, window_size == 2*WSIZE so more >= 2.\n * If there was sliding, more >= WSIZE. So in all cases, more >= 2.\n */\n //Assert(more >= 2, \"more < 2\");\n n = read_buf(s.strm, s.window, s.strstart + s.lookahead, more);\n s.lookahead += n;\n\n /* Initialize the hash value now that we have some input: */\n if (s.lookahead + s.insert >= MIN_MATCH) {\n str = s.strstart - s.insert;\n s.ins_h = s.window[str];\n\n /* UPDATE_HASH(s, s->ins_h, s->window[str + 1]); */\n s.ins_h = HASH(s, s.ins_h, s.window[str + 1]);\n//#if MIN_MATCH != 3\n// Call update_hash() MIN_MATCH-3 more times\n//#endif\n while (s.insert) {\n /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */\n s.ins_h = HASH(s, s.ins_h, s.window[str + MIN_MATCH - 1]);\n\n s.prev[str & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = str;\n str++;\n s.insert--;\n if (s.lookahead + s.insert < MIN_MATCH) {\n break;\n }\n }\n }\n /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage,\n * but this is not important since only literal bytes will be emitted.\n */\n\n } while (s.lookahead < MIN_LOOKAHEAD && s.strm.avail_in !== 0);\n\n /* If the WIN_INIT bytes after the end of the current data have never been\n * written, then zero those bytes in order to avoid memory check reports of\n * the use of uninitialized (or uninitialised as Julian writes) bytes by\n * the longest match routines. Update the high water mark for the next\n * time through here. WIN_INIT is set to MAX_MATCH since the longest match\n * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead.\n */\n// if (s.high_water < s.window_size) {\n// const curr = s.strstart + s.lookahead;\n// let init = 0;\n//\n// if (s.high_water < curr) {\n// /* Previous high water mark below current data -- zero WIN_INIT\n// * bytes or up to end of window, whichever is less.\n// */\n// init = s.window_size - curr;\n// if (init > WIN_INIT)\n// init = WIN_INIT;\n// zmemzero(s->window + curr, (unsigned)init);\n// s->high_water = curr + init;\n// }\n// else if (s->high_water < (ulg)curr + WIN_INIT) {\n// /* High water mark at or above current data, but below current data\n// * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up\n// * to end of window, whichever is less.\n// */\n// init = (ulg)curr + WIN_INIT - s->high_water;\n// if (init > s->window_size - s->high_water)\n// init = s->window_size - s->high_water;\n// zmemzero(s->window + s->high_water, (unsigned)init);\n// s->high_water += init;\n// }\n// }\n//\n// Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD,\n// \"not enough room for search\");\n};\n\n/* ===========================================================================\n * Copy without compression as much as possible from the input stream, return\n * the current block state.\n * This function does not insert new strings in the dictionary since\n * uncompressible data is probably not useful. This function is used\n * only for the level=0 compression option.\n * NOTE: this function should be optimized to avoid extra copying from\n * window to pending_buf.\n */\nconst deflate_stored = (s, flush) => {\n\n /* Stored blocks are limited to 0xffff bytes, pending_buf is limited\n * to pending_buf_size, and each stored block has a 5 byte header:\n */\n let max_block_size = 0xffff;\n\n if (max_block_size > s.pending_buf_size - 5) {\n max_block_size = s.pending_buf_size - 5;\n }\n\n /* Copy as much as possible from input to output: */\n for (;;) {\n /* Fill the window as much as possible: */\n if (s.lookahead <= 1) {\n\n //Assert(s->strstart < s->w_size+MAX_DIST(s) ||\n // s->block_start >= (long)s->w_size, \"slide too late\");\n// if (!(s.strstart < s.w_size + (s.w_size - MIN_LOOKAHEAD) ||\n// s.block_start >= s.w_size)) {\n// throw new Error(\"slide too late\");\n// }\n\n fill_window(s);\n if (s.lookahead === 0 && flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n\n if (s.lookahead === 0) {\n break;\n }\n /* flush the current block */\n }\n //Assert(s->block_start >= 0L, \"block gone\");\n// if (s.block_start < 0) throw new Error(\"block gone\");\n\n s.strstart += s.lookahead;\n s.lookahead = 0;\n\n /* Emit a stored block if pending_buf will be full: */\n const max_start = s.block_start + max_block_size;\n\n if (s.strstart === 0 || s.strstart >= max_start) {\n /* strstart == 0 is possible when wraparound on 16-bit machine */\n s.lookahead = s.strstart - max_start;\n s.strstart = max_start;\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n\n\n }\n /* Flush if we may have to slide, otherwise block_start may become\n * negative and the data will be gone:\n */\n if (s.strstart - s.block_start >= (s.w_size - MIN_LOOKAHEAD)) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n\n s.insert = 0;\n\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n\n if (s.strstart > s.block_start) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n\n return BS_NEED_MORE;\n};\n\n/* ===========================================================================\n * Compress as much as possible from the input stream, return the current\n * block state.\n * This function does not perform lazy evaluation of matches and inserts\n * new strings in the dictionary only for unmatched strings or for short\n * matches. It is used only for the fast compression options.\n */\nconst deflate_fast = (s, flush) => {\n\n let hash_head; /* head of the hash chain */\n let bflush; /* set if current block must be flushed */\n\n for (;;) {\n /* Make sure that we always have enough lookahead, except\n * at the end of the input file. We need MAX_MATCH bytes\n * for the next match, plus MIN_MATCH bytes to insert the\n * string following the next match.\n */\n if (s.lookahead < MIN_LOOKAHEAD) {\n fill_window(s);\n if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n if (s.lookahead === 0) {\n break; /* flush the current block */\n }\n }\n\n /* Insert the string window[strstart .. strstart+2] in the\n * dictionary, and set hash_head to the head of the hash chain:\n */\n hash_head = 0/*NIL*/;\n if (s.lookahead >= MIN_MATCH) {\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = HASH(s, s.ins_h, s.window[s.strstart + MIN_MATCH - 1]);\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n }\n\n /* Find the longest match, discarding those <= prev_length.\n * At this point we have always match_length < MIN_MATCH\n */\n if (hash_head !== 0/*NIL*/ && ((s.strstart - hash_head) <= (s.w_size - MIN_LOOKAHEAD))) {\n /* To simplify the code, we prevent matches with the string\n * of window index 0 (in particular we have to avoid a match\n * of the string with itself at the start of the input file).\n */\n s.match_length = longest_match(s, hash_head);\n /* longest_match() sets match_start */\n }\n if (s.match_length >= MIN_MATCH) {\n // check_match(s, s.strstart, s.match_start, s.match_length); // for debug only\n\n /*** _tr_tally_dist(s, s.strstart - s.match_start,\n s.match_length - MIN_MATCH, bflush); ***/\n bflush = _tr_tally(s, s.strstart - s.match_start, s.match_length - MIN_MATCH);\n\n s.lookahead -= s.match_length;\n\n /* Insert new strings in the hash table only if the match length\n * is not too large. This saves time but degrades compression.\n */\n if (s.match_length <= s.max_lazy_match/*max_insert_length*/ && s.lookahead >= MIN_MATCH) {\n s.match_length--; /* string at strstart already in table */\n do {\n s.strstart++;\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = HASH(s, s.ins_h, s.window[s.strstart + MIN_MATCH - 1]);\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n /* strstart never exceeds WSIZE-MAX_MATCH, so there are\n * always MIN_MATCH bytes ahead.\n */\n } while (--s.match_length !== 0);\n s.strstart++;\n } else\n {\n s.strstart += s.match_length;\n s.match_length = 0;\n s.ins_h = s.window[s.strstart];\n /* UPDATE_HASH(s, s.ins_h, s.window[s.strstart+1]); */\n s.ins_h = HASH(s, s.ins_h, s.window[s.strstart + 1]);\n\n//#if MIN_MATCH != 3\n// Call UPDATE_HASH() MIN_MATCH-3 more times\n//#endif\n /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not\n * matter since it will be recomputed at next deflate call.\n */\n }\n } else {\n /* No match, output a literal byte */\n //Tracevv((stderr,\"%c\", s.window[s.strstart]));\n /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/\n bflush = _tr_tally(s, 0, s.window[s.strstart]);\n\n s.lookahead--;\n s.strstart++;\n }\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n s.insert = ((s.strstart < (MIN_MATCH - 1)) ? s.strstart : MIN_MATCH - 1);\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n return BS_BLOCK_DONE;\n};\n\n/* ===========================================================================\n * Same as above, but achieves better compression. We use a lazy\n * evaluation for matches: a match is finally adopted only if there is\n * no better match at the next window position.\n */\nconst deflate_slow = (s, flush) => {\n\n let hash_head; /* head of hash chain */\n let bflush; /* set if current block must be flushed */\n\n let max_insert;\n\n /* Process the input block. */\n for (;;) {\n /* Make sure that we always have enough lookahead, except\n * at the end of the input file. We need MAX_MATCH bytes\n * for the next match, plus MIN_MATCH bytes to insert the\n * string following the next match.\n */\n if (s.lookahead < MIN_LOOKAHEAD) {\n fill_window(s);\n if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n if (s.lookahead === 0) { break; } /* flush the current block */\n }\n\n /* Insert the string window[strstart .. strstart+2] in the\n * dictionary, and set hash_head to the head of the hash chain:\n */\n hash_head = 0/*NIL*/;\n if (s.lookahead >= MIN_MATCH) {\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = HASH(s, s.ins_h, s.window[s.strstart + MIN_MATCH - 1]);\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n }\n\n /* Find the longest match, discarding those <= prev_length.\n */\n s.prev_length = s.match_length;\n s.prev_match = s.match_start;\n s.match_length = MIN_MATCH - 1;\n\n if (hash_head !== 0/*NIL*/ && s.prev_length < s.max_lazy_match &&\n s.strstart - hash_head <= (s.w_size - MIN_LOOKAHEAD)/*MAX_DIST(s)*/) {\n /* To simplify the code, we prevent matches with the string\n * of window index 0 (in particular we have to avoid a match\n * of the string with itself at the start of the input file).\n */\n s.match_length = longest_match(s, hash_head);\n /* longest_match() sets match_start */\n\n if (s.match_length <= 5 &&\n (s.strategy === Z_FILTERED || (s.match_length === MIN_MATCH && s.strstart - s.match_start > 4096/*TOO_FAR*/))) {\n\n /* If prev_match is also MIN_MATCH, match_start is garbage\n * but we will ignore the current match anyway.\n */\n s.match_length = MIN_MATCH - 1;\n }\n }\n /* If there was a match at the previous step and the current\n * match is not better, output the previous match:\n */\n if (s.prev_length >= MIN_MATCH && s.match_length <= s.prev_length) {\n max_insert = s.strstart + s.lookahead - MIN_MATCH;\n /* Do not insert strings in hash table beyond this. */\n\n //check_match(s, s.strstart-1, s.prev_match, s.prev_length);\n\n /***_tr_tally_dist(s, s.strstart - 1 - s.prev_match,\n s.prev_length - MIN_MATCH, bflush);***/\n bflush = _tr_tally(s, s.strstart - 1 - s.prev_match, s.prev_length - MIN_MATCH);\n /* Insert in hash table all strings up to the end of the match.\n * strstart-1 and strstart are already inserted. If there is not\n * enough lookahead, the last two strings are not inserted in\n * the hash table.\n */\n s.lookahead -= s.prev_length - 1;\n s.prev_length -= 2;\n do {\n if (++s.strstart <= max_insert) {\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = HASH(s, s.ins_h, s.window[s.strstart + MIN_MATCH - 1]);\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n }\n } while (--s.prev_length !== 0);\n s.match_available = 0;\n s.match_length = MIN_MATCH - 1;\n s.strstart++;\n\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n\n } else if (s.match_available) {\n /* If there was no match at the previous position, output a\n * single literal. If there was a match but the current match\n * is longer, truncate the previous match to a single literal.\n */\n //Tracevv((stderr,\"%c\", s->window[s->strstart-1]));\n /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/\n bflush = _tr_tally(s, 0, s.window[s.strstart - 1]);\n\n if (bflush) {\n /*** FLUSH_BLOCK_ONLY(s, 0) ***/\n flush_block_only(s, false);\n /***/\n }\n s.strstart++;\n s.lookahead--;\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n } else {\n /* There is no previous match to compare with, wait for\n * the next step to decide.\n */\n s.match_available = 1;\n s.strstart++;\n s.lookahead--;\n }\n }\n //Assert (flush != Z_NO_FLUSH, \"no flush?\");\n if (s.match_available) {\n //Tracevv((stderr,\"%c\", s->window[s->strstart-1]));\n /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/\n bflush = _tr_tally(s, 0, s.window[s.strstart - 1]);\n\n s.match_available = 0;\n }\n s.insert = s.strstart < MIN_MATCH - 1 ? s.strstart : MIN_MATCH - 1;\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n\n return BS_BLOCK_DONE;\n};\n\n\n/* ===========================================================================\n * For Z_RLE, simply look for runs of bytes, generate matches only of distance\n * one. Do not maintain a hash table. (It will be regenerated if this run of\n * deflate switches away from Z_RLE.)\n */\nconst deflate_rle = (s, flush) => {\n\n let bflush; /* set if current block must be flushed */\n let prev; /* byte at distance one to match */\n let scan, strend; /* scan goes up to strend for length of run */\n\n const _win = s.window;\n\n for (;;) {\n /* Make sure that we always have enough lookahead, except\n * at the end of the input file. We need MAX_MATCH bytes\n * for the longest run, plus one for the unrolled loop.\n */\n if (s.lookahead <= MAX_MATCH) {\n fill_window(s);\n if (s.lookahead <= MAX_MATCH && flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n if (s.lookahead === 0) { break; } /* flush the current block */\n }\n\n /* See how many times the previous byte repeats */\n s.match_length = 0;\n if (s.lookahead >= MIN_MATCH && s.strstart > 0) {\n scan = s.strstart - 1;\n prev = _win[scan];\n if (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan]) {\n strend = s.strstart + MAX_MATCH;\n do {\n /*jshint noempty:false*/\n } while (prev === _win[++scan] && prev === _win[++scan] &&\n prev === _win[++scan] && prev === _win[++scan] &&\n prev === _win[++scan] && prev === _win[++scan] &&\n prev === _win[++scan] && prev === _win[++scan] &&\n scan < strend);\n s.match_length = MAX_MATCH - (strend - scan);\n if (s.match_length > s.lookahead) {\n s.match_length = s.lookahead;\n }\n }\n //Assert(scan <= s->window+(uInt)(s->window_size-1), \"wild scan\");\n }\n\n /* Emit match if have run of MIN_MATCH or longer, else emit literal */\n if (s.match_length >= MIN_MATCH) {\n //check_match(s, s.strstart, s.strstart - 1, s.match_length);\n\n /*** _tr_tally_dist(s, 1, s.match_length - MIN_MATCH, bflush); ***/\n bflush = _tr_tally(s, 1, s.match_length - MIN_MATCH);\n\n s.lookahead -= s.match_length;\n s.strstart += s.match_length;\n s.match_length = 0;\n } else {\n /* No match, output a literal byte */\n //Tracevv((stderr,\"%c\", s->window[s->strstart]));\n /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/\n bflush = _tr_tally(s, 0, s.window[s.strstart]);\n\n s.lookahead--;\n s.strstart++;\n }\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n s.insert = 0;\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n return BS_BLOCK_DONE;\n};\n\n/* ===========================================================================\n * For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table.\n * (It will be regenerated if this run of deflate switches away from Huffman.)\n */\nconst deflate_huff = (s, flush) => {\n\n let bflush; /* set if current block must be flushed */\n\n for (;;) {\n /* Make sure that we have a literal to write. */\n if (s.lookahead === 0) {\n fill_window(s);\n if (s.lookahead === 0) {\n if (flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n break; /* flush the current block */\n }\n }\n\n /* Output a literal byte */\n s.match_length = 0;\n //Tracevv((stderr,\"%c\", s->window[s->strstart]));\n /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/\n bflush = _tr_tally(s, 0, s.window[s.strstart]);\n s.lookahead--;\n s.strstart++;\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n s.insert = 0;\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n return BS_BLOCK_DONE;\n};\n\n/* Values for max_lazy_match, good_match and max_chain_length, depending on\n * the desired pack level (0..9). The values given below have been tuned to\n * exclude worst case performance for pathological files. Better values may be\n * found for specific files.\n */\nfunction Config(good_length, max_lazy, nice_length, max_chain, func) {\n\n this.good_length = good_length;\n this.max_lazy = max_lazy;\n this.nice_length = nice_length;\n this.max_chain = max_chain;\n this.func = func;\n}\n\nconst configuration_table = [\n /* good lazy nice chain */\n new Config(0, 0, 0, 0, deflate_stored), /* 0 store only */\n new Config(4, 4, 8, 4, deflate_fast), /* 1 max speed, no lazy matches */\n new Config(4, 5, 16, 8, deflate_fast), /* 2 */\n new Config(4, 6, 32, 32, deflate_fast), /* 3 */\n\n new Config(4, 4, 16, 16, deflate_slow), /* 4 lazy matches */\n new Config(8, 16, 32, 32, deflate_slow), /* 5 */\n new Config(8, 16, 128, 128, deflate_slow), /* 6 */\n new Config(8, 32, 128, 256, deflate_slow), /* 7 */\n new Config(32, 128, 258, 1024, deflate_slow), /* 8 */\n new Config(32, 258, 258, 4096, deflate_slow) /* 9 max compression */\n];\n\n\n/* ===========================================================================\n * Initialize the \"longest match\" routines for a new zlib stream\n */\nconst lm_init = (s) => {\n\n s.window_size = 2 * s.w_size;\n\n /*** CLEAR_HASH(s); ***/\n zero(s.head); // Fill with NIL (= 0);\n\n /* Set the default configuration parameters:\n */\n s.max_lazy_match = configuration_table[s.level].max_lazy;\n s.good_match = configuration_table[s.level].good_length;\n s.nice_match = configuration_table[s.level].nice_length;\n s.max_chain_length = configuration_table[s.level].max_chain;\n\n s.strstart = 0;\n s.block_start = 0;\n s.lookahead = 0;\n s.insert = 0;\n s.match_length = s.prev_length = MIN_MATCH - 1;\n s.match_available = 0;\n s.ins_h = 0;\n};\n\n\nfunction DeflateState() {\n this.strm = null; /* pointer back to this zlib stream */\n this.status = 0; /* as the name implies */\n this.pending_buf = null; /* output still pending */\n this.pending_buf_size = 0; /* size of pending_buf */\n this.pending_out = 0; /* next pending byte to output to the stream */\n this.pending = 0; /* nb of bytes in the pending buffer */\n this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */\n this.gzhead = null; /* gzip header information to write */\n this.gzindex = 0; /* where in extra, name, or comment */\n this.method = Z_DEFLATED; /* can only be DEFLATED */\n this.last_flush = -1; /* value of flush param for previous deflate call */\n\n this.w_size = 0; /* LZ77 window size (32K by default) */\n this.w_bits = 0; /* log2(w_size) (8..16) */\n this.w_mask = 0; /* w_size - 1 */\n\n this.window = null;\n /* Sliding window. Input bytes are read into the second half of the window,\n * and move to the first half later to keep a dictionary of at least wSize\n * bytes. With this organization, matches are limited to a distance of\n * wSize-MAX_MATCH bytes, but this ensures that IO is always\n * performed with a length multiple of the block size.\n */\n\n this.window_size = 0;\n /* Actual size of window: 2*wSize, except when the user input buffer\n * is directly used as sliding window.\n */\n\n this.prev = null;\n /* Link to older string with same hash index. To limit the size of this\n * array to 64K, this link is maintained only for the last 32K strings.\n * An index in this array is thus a window index modulo 32K.\n */\n\n this.head = null; /* Heads of the hash chains or NIL. */\n\n this.ins_h = 0; /* hash index of string to be inserted */\n this.hash_size = 0; /* number of elements in hash table */\n this.hash_bits = 0; /* log2(hash_size) */\n this.hash_mask = 0; /* hash_size-1 */\n\n this.hash_shift = 0;\n /* Number of bits by which ins_h must be shifted at each input\n * step. It must be such that after MIN_MATCH steps, the oldest\n * byte no longer takes part in the hash key, that is:\n * hash_shift * MIN_MATCH >= hash_bits\n */\n\n this.block_start = 0;\n /* Window position at the beginning of the current output block. Gets\n * negative when the window is moved backwards.\n */\n\n this.match_length = 0; /* length of best match */\n this.prev_match = 0; /* previous match */\n this.match_available = 0; /* set if previous match exists */\n this.strstart = 0; /* start of string to insert */\n this.match_start = 0; /* start of matching string */\n this.lookahead = 0; /* number of valid bytes ahead in window */\n\n this.prev_length = 0;\n /* Length of the best match at previous step. Matches not greater than this\n * are discarded. This is used in the lazy match evaluation.\n */\n\n this.max_chain_length = 0;\n /* To speed up deflation, hash chains are never searched beyond this\n * length. A higher limit improves compression ratio but degrades the\n * speed.\n */\n\n this.max_lazy_match = 0;\n /* Attempt to find a better match only when the current match is strictly\n * smaller than this value. This mechanism is used only for compression\n * levels >= 4.\n */\n // That's alias to max_lazy_match, don't use directly\n //this.max_insert_length = 0;\n /* Insert new strings in the hash table only if the match length is not\n * greater than this length. This saves time but degrades compression.\n * max_insert_length is used only for compression levels <= 3.\n */\n\n this.level = 0; /* compression level (1..9) */\n this.strategy = 0; /* favor or force Huffman coding*/\n\n this.good_match = 0;\n /* Use a faster search when the previous match is longer than this */\n\n this.nice_match = 0; /* Stop searching when current match exceeds this */\n\n /* used by trees.c: */\n\n /* Didn't use ct_data typedef below to suppress compiler warning */\n\n // struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */\n // struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */\n // struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */\n\n // Use flat array of DOUBLE size, with interleaved fata,\n // because JS does not support effective\n this.dyn_ltree = new Uint16Array(HEAP_SIZE * 2);\n this.dyn_dtree = new Uint16Array((2 * D_CODES + 1) * 2);\n this.bl_tree = new Uint16Array((2 * BL_CODES + 1) * 2);\n zero(this.dyn_ltree);\n zero(this.dyn_dtree);\n zero(this.bl_tree);\n\n this.l_desc = null; /* desc. for literal tree */\n this.d_desc = null; /* desc. for distance tree */\n this.bl_desc = null; /* desc. for bit length tree */\n\n //ush bl_count[MAX_BITS+1];\n this.bl_count = new Uint16Array(MAX_BITS + 1);\n /* number of codes at each bit length for an optimal tree */\n\n //int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */\n this.heap = new Uint16Array(2 * L_CODES + 1); /* heap used to build the Huffman trees */\n zero(this.heap);\n\n this.heap_len = 0; /* number of elements in the heap */\n this.heap_max = 0; /* element of largest frequency */\n /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used.\n * The same heap array is used to build all trees.\n */\n\n this.depth = new Uint16Array(2 * L_CODES + 1); //uch depth[2*L_CODES+1];\n zero(this.depth);\n /* Depth of each subtree used as tie breaker for trees of equal frequency\n */\n\n this.l_buf = 0; /* buffer index for literals or lengths */\n\n this.lit_bufsize = 0;\n /* Size of match buffer for literals/lengths. There are 4 reasons for\n * limiting lit_bufsize to 64K:\n * - frequencies can be kept in 16 bit counters\n * - if compression is not successful for the first block, all input\n * data is still in the window so we can still emit a stored block even\n * when input comes from standard input. (This can also be done for\n * all blocks if lit_bufsize is not greater than 32K.)\n * - if compression is not successful for a file smaller than 64K, we can\n * even emit a stored file instead of a stored block (saving 5 bytes).\n * This is applicable only for zip (not gzip or zlib).\n * - creating new Huffman trees less frequently may not provide fast\n * adaptation to changes in the input data statistics. (Take for\n * example a binary file with poorly compressible code followed by\n * a highly compressible string table.) Smaller buffer sizes give\n * fast adaptation but have of course the overhead of transmitting\n * trees more frequently.\n * - I can't count above 4\n */\n\n this.last_lit = 0; /* running index in l_buf */\n\n this.d_buf = 0;\n /* Buffer index for distances. To simplify the code, d_buf and l_buf have\n * the same number of elements. To use different lengths, an extra flag\n * array would be necessary.\n */\n\n this.opt_len = 0; /* bit length of current block with optimal trees */\n this.static_len = 0; /* bit length of current block with static trees */\n this.matches = 0; /* number of string matches in current block */\n this.insert = 0; /* bytes at end of window left to insert */\n\n\n this.bi_buf = 0;\n /* Output buffer. bits are inserted starting at the bottom (least\n * significant bits).\n */\n this.bi_valid = 0;\n /* Number of valid bits in bi_buf. All bits above the last valid bit\n * are always zero.\n */\n\n // Used for window memory init. We safely ignore it for JS. That makes\n // sense only for pointers and memory check tools.\n //this.high_water = 0;\n /* High water mark offset in window for initialized bytes -- bytes above\n * this are set to zero in order to avoid memory check warnings when\n * longest match routines access bytes past the input. This is then\n * updated to the new high water mark.\n */\n}\n\n\nconst deflateResetKeep = (strm) => {\n\n if (!strm || !strm.state) {\n return err(strm, Z_STREAM_ERROR);\n }\n\n strm.total_in = strm.total_out = 0;\n strm.data_type = Z_UNKNOWN;\n\n const s = strm.state;\n s.pending = 0;\n s.pending_out = 0;\n\n if (s.wrap < 0) {\n s.wrap = -s.wrap;\n /* was made negative by deflate(..., Z_FINISH); */\n }\n s.status = (s.wrap ? INIT_STATE : BUSY_STATE);\n strm.adler = (s.wrap === 2) ?\n 0 // crc32(0, Z_NULL, 0)\n :\n 1; // adler32(0, Z_NULL, 0)\n s.last_flush = Z_NO_FLUSH;\n _tr_init(s);\n return Z_OK;\n};\n\n\nconst deflateReset = (strm) => {\n\n const ret = deflateResetKeep(strm);\n if (ret === Z_OK) {\n lm_init(strm.state);\n }\n return ret;\n};\n\n\nconst deflateSetHeader = (strm, head) => {\n\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n if (strm.state.wrap !== 2) { return Z_STREAM_ERROR; }\n strm.state.gzhead = head;\n return Z_OK;\n};\n\n\nconst deflateInit2 = (strm, level, method, windowBits, memLevel, strategy) => {\n\n if (!strm) { // === Z_NULL\n return Z_STREAM_ERROR;\n }\n let wrap = 1;\n\n if (level === Z_DEFAULT_COMPRESSION) {\n level = 6;\n }\n\n if (windowBits < 0) { /* suppress zlib wrapper */\n wrap = 0;\n windowBits = -windowBits;\n }\n\n else if (windowBits > 15) {\n wrap = 2; /* write gzip wrapper instead */\n windowBits -= 16;\n }\n\n\n if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method !== Z_DEFLATED ||\n windowBits < 8 || windowBits > 15 || level < 0 || level > 9 ||\n strategy < 0 || strategy > Z_FIXED) {\n return err(strm, Z_STREAM_ERROR);\n }\n\n\n if (windowBits === 8) {\n windowBits = 9;\n }\n /* until 256-byte window bug fixed */\n\n const s = new DeflateState();\n\n strm.state = s;\n s.strm = strm;\n\n s.wrap = wrap;\n s.gzhead = null;\n s.w_bits = windowBits;\n s.w_size = 1 << s.w_bits;\n s.w_mask = s.w_size - 1;\n\n s.hash_bits = memLevel + 7;\n s.hash_size = 1 << s.hash_bits;\n s.hash_mask = s.hash_size - 1;\n s.hash_shift = ~~((s.hash_bits + MIN_MATCH - 1) / MIN_MATCH);\n\n s.window = new Uint8Array(s.w_size * 2);\n s.head = new Uint16Array(s.hash_size);\n s.prev = new Uint16Array(s.w_size);\n\n // Don't need mem init magic for JS.\n //s.high_water = 0; /* nothing written to s->window yet */\n\n s.lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */\n\n s.pending_buf_size = s.lit_bufsize * 4;\n\n //overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2);\n //s->pending_buf = (uchf *) overlay;\n s.pending_buf = new Uint8Array(s.pending_buf_size);\n\n // It is offset from `s.pending_buf` (size is `s.lit_bufsize * 2`)\n //s->d_buf = overlay + s->lit_bufsize/sizeof(ush);\n s.d_buf = 1 * s.lit_bufsize;\n\n //s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize;\n s.l_buf = (1 + 2) * s.lit_bufsize;\n\n s.level = level;\n s.strategy = strategy;\n s.method = method;\n\n return deflateReset(strm);\n};\n\nconst deflateInit = (strm, level) => {\n\n return deflateInit2(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY);\n};\n\n\nconst deflate = (strm, flush) => {\n\n let beg, val; // for gzip header write only\n\n if (!strm || !strm.state ||\n flush > Z_BLOCK || flush < 0) {\n return strm ? err(strm, Z_STREAM_ERROR) : Z_STREAM_ERROR;\n }\n\n const s = strm.state;\n\n if (!strm.output ||\n (!strm.input && strm.avail_in !== 0) ||\n (s.status === FINISH_STATE && flush !== Z_FINISH)) {\n return err(strm, (strm.avail_out === 0) ? Z_BUF_ERROR : Z_STREAM_ERROR);\n }\n\n s.strm = strm; /* just in case */\n const old_flush = s.last_flush;\n s.last_flush = flush;\n\n /* Write the header */\n if (s.status === INIT_STATE) {\n\n if (s.wrap === 2) { // GZIP header\n strm.adler = 0; //crc32(0L, Z_NULL, 0);\n put_byte(s, 31);\n put_byte(s, 139);\n put_byte(s, 8);\n if (!s.gzhead) { // s->gzhead == Z_NULL\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, s.level === 9 ? 2 :\n (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ?\n 4 : 0));\n put_byte(s, OS_CODE);\n s.status = BUSY_STATE;\n }\n else {\n put_byte(s, (s.gzhead.text ? 1 : 0) +\n (s.gzhead.hcrc ? 2 : 0) +\n (!s.gzhead.extra ? 0 : 4) +\n (!s.gzhead.name ? 0 : 8) +\n (!s.gzhead.comment ? 0 : 16)\n );\n put_byte(s, s.gzhead.time & 0xff);\n put_byte(s, (s.gzhead.time >> 8) & 0xff);\n put_byte(s, (s.gzhead.time >> 16) & 0xff);\n put_byte(s, (s.gzhead.time >> 24) & 0xff);\n put_byte(s, s.level === 9 ? 2 :\n (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ?\n 4 : 0));\n put_byte(s, s.gzhead.os & 0xff);\n if (s.gzhead.extra && s.gzhead.extra.length) {\n put_byte(s, s.gzhead.extra.length & 0xff);\n put_byte(s, (s.gzhead.extra.length >> 8) & 0xff);\n }\n if (s.gzhead.hcrc) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending, 0);\n }\n s.gzindex = 0;\n s.status = EXTRA_STATE;\n }\n }\n else // DEFLATE header\n {\n let header = (Z_DEFLATED + ((s.w_bits - 8) << 4)) << 8;\n let level_flags = -1;\n\n if (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2) {\n level_flags = 0;\n } else if (s.level < 6) {\n level_flags = 1;\n } else if (s.level === 6) {\n level_flags = 2;\n } else {\n level_flags = 3;\n }\n header |= (level_flags << 6);\n if (s.strstart !== 0) { header |= PRESET_DICT; }\n header += 31 - (header % 31);\n\n s.status = BUSY_STATE;\n putShortMSB(s, header);\n\n /* Save the adler32 of the preset dictionary: */\n if (s.strstart !== 0) {\n putShortMSB(s, strm.adler >>> 16);\n putShortMSB(s, strm.adler & 0xffff);\n }\n strm.adler = 1; // adler32(0L, Z_NULL, 0);\n }\n }\n\n//#ifdef GZIP\n if (s.status === EXTRA_STATE) {\n if (s.gzhead.extra/* != Z_NULL*/) {\n beg = s.pending; /* start of bytes to update crc */\n\n while (s.gzindex < (s.gzhead.extra.length & 0xffff)) {\n if (s.pending === s.pending_buf_size) {\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n flush_pending(strm);\n beg = s.pending;\n if (s.pending === s.pending_buf_size) {\n break;\n }\n }\n put_byte(s, s.gzhead.extra[s.gzindex] & 0xff);\n s.gzindex++;\n }\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n if (s.gzindex === s.gzhead.extra.length) {\n s.gzindex = 0;\n s.status = NAME_STATE;\n }\n }\n else {\n s.status = NAME_STATE;\n }\n }\n if (s.status === NAME_STATE) {\n if (s.gzhead.name/* != Z_NULL*/) {\n beg = s.pending; /* start of bytes to update crc */\n //int val;\n\n do {\n if (s.pending === s.pending_buf_size) {\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n flush_pending(strm);\n beg = s.pending;\n if (s.pending === s.pending_buf_size) {\n val = 1;\n break;\n }\n }\n // JS specific: little magic to add zero terminator to end of string\n if (s.gzindex < s.gzhead.name.length) {\n val = s.gzhead.name.charCodeAt(s.gzindex++) & 0xff;\n } else {\n val = 0;\n }\n put_byte(s, val);\n } while (val !== 0);\n\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n if (val === 0) {\n s.gzindex = 0;\n s.status = COMMENT_STATE;\n }\n }\n else {\n s.status = COMMENT_STATE;\n }\n }\n if (s.status === COMMENT_STATE) {\n if (s.gzhead.comment/* != Z_NULL*/) {\n beg = s.pending; /* start of bytes to update crc */\n //int val;\n\n do {\n if (s.pending === s.pending_buf_size) {\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n flush_pending(strm);\n beg = s.pending;\n if (s.pending === s.pending_buf_size) {\n val = 1;\n break;\n }\n }\n // JS specific: little magic to add zero terminator to end of string\n if (s.gzindex < s.gzhead.comment.length) {\n val = s.gzhead.comment.charCodeAt(s.gzindex++) & 0xff;\n } else {\n val = 0;\n }\n put_byte(s, val);\n } while (val !== 0);\n\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n if (val === 0) {\n s.status = HCRC_STATE;\n }\n }\n else {\n s.status = HCRC_STATE;\n }\n }\n if (s.status === HCRC_STATE) {\n if (s.gzhead.hcrc) {\n if (s.pending + 2 > s.pending_buf_size) {\n flush_pending(strm);\n }\n if (s.pending + 2 <= s.pending_buf_size) {\n put_byte(s, strm.adler & 0xff);\n put_byte(s, (strm.adler >> 8) & 0xff);\n strm.adler = 0; //crc32(0L, Z_NULL, 0);\n s.status = BUSY_STATE;\n }\n }\n else {\n s.status = BUSY_STATE;\n }\n }\n//#endif\n\n /* Flush as much pending output as possible */\n if (s.pending !== 0) {\n flush_pending(strm);\n if (strm.avail_out === 0) {\n /* Since avail_out is 0, deflate will be called again with\n * more output space, but possibly with both pending and\n * avail_in equal to zero. There won't be anything to do,\n * but this is not an error situation so make sure we\n * return OK instead of BUF_ERROR at next call of deflate:\n */\n s.last_flush = -1;\n return Z_OK;\n }\n\n /* Make sure there is something to do and avoid duplicate consecutive\n * flushes. For repeated and useless calls with Z_FINISH, we keep\n * returning Z_STREAM_END instead of Z_BUF_ERROR.\n */\n } else if (strm.avail_in === 0 && rank(flush) <= rank(old_flush) &&\n flush !== Z_FINISH) {\n return err(strm, Z_BUF_ERROR);\n }\n\n /* User must not provide more input after the first FINISH: */\n if (s.status === FINISH_STATE && strm.avail_in !== 0) {\n return err(strm, Z_BUF_ERROR);\n }\n\n /* Start a new block or continue the current one.\n */\n if (strm.avail_in !== 0 || s.lookahead !== 0 ||\n (flush !== Z_NO_FLUSH && s.status !== FINISH_STATE)) {\n let bstate = (s.strategy === Z_HUFFMAN_ONLY) ? deflate_huff(s, flush) :\n (s.strategy === Z_RLE ? deflate_rle(s, flush) :\n configuration_table[s.level].func(s, flush));\n\n if (bstate === BS_FINISH_STARTED || bstate === BS_FINISH_DONE) {\n s.status = FINISH_STATE;\n }\n if (bstate === BS_NEED_MORE || bstate === BS_FINISH_STARTED) {\n if (strm.avail_out === 0) {\n s.last_flush = -1;\n /* avoid BUF_ERROR next call, see above */\n }\n return Z_OK;\n /* If flush != Z_NO_FLUSH && avail_out == 0, the next call\n * of deflate should use the same flush parameter to make sure\n * that the flush is complete. So we don't have to output an\n * empty block here, this will be done at next call. This also\n * ensures that for a very small output buffer, we emit at most\n * one empty block.\n */\n }\n if (bstate === BS_BLOCK_DONE) {\n if (flush === Z_PARTIAL_FLUSH) {\n _tr_align(s);\n }\n else if (flush !== Z_BLOCK) { /* FULL_FLUSH or SYNC_FLUSH */\n\n _tr_stored_block(s, 0, 0, false);\n /* For a full flush, this empty block will be recognized\n * as a special marker by inflate_sync().\n */\n if (flush === Z_FULL_FLUSH) {\n /*** CLEAR_HASH(s); ***/ /* forget history */\n zero(s.head); // Fill with NIL (= 0);\n\n if (s.lookahead === 0) {\n s.strstart = 0;\n s.block_start = 0;\n s.insert = 0;\n }\n }\n }\n flush_pending(strm);\n if (strm.avail_out === 0) {\n s.last_flush = -1; /* avoid BUF_ERROR at next call, see above */\n return Z_OK;\n }\n }\n }\n //Assert(strm->avail_out > 0, \"bug2\");\n //if (strm.avail_out <= 0) { throw new Error(\"bug2\");}\n\n if (flush !== Z_FINISH) { return Z_OK; }\n if (s.wrap <= 0) { return Z_STREAM_END; }\n\n /* Write the trailer */\n if (s.wrap === 2) {\n put_byte(s, strm.adler & 0xff);\n put_byte(s, (strm.adler >> 8) & 0xff);\n put_byte(s, (strm.adler >> 16) & 0xff);\n put_byte(s, (strm.adler >> 24) & 0xff);\n put_byte(s, strm.total_in & 0xff);\n put_byte(s, (strm.total_in >> 8) & 0xff);\n put_byte(s, (strm.total_in >> 16) & 0xff);\n put_byte(s, (strm.total_in >> 24) & 0xff);\n }\n else\n {\n putShortMSB(s, strm.adler >>> 16);\n putShortMSB(s, strm.adler & 0xffff);\n }\n\n flush_pending(strm);\n /* If avail_out is zero, the application will call deflate again\n * to flush the rest.\n */\n if (s.wrap > 0) { s.wrap = -s.wrap; }\n /* write the trailer only once! */\n return s.pending !== 0 ? Z_OK : Z_STREAM_END;\n};\n\n\nconst deflateEnd = (strm) => {\n\n if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) {\n return Z_STREAM_ERROR;\n }\n\n const status = strm.state.status;\n if (status !== INIT_STATE &&\n status !== EXTRA_STATE &&\n status !== NAME_STATE &&\n status !== COMMENT_STATE &&\n status !== HCRC_STATE &&\n status !== BUSY_STATE &&\n status !== FINISH_STATE\n ) {\n return err(strm, Z_STREAM_ERROR);\n }\n\n strm.state = null;\n\n return status === BUSY_STATE ? err(strm, Z_DATA_ERROR) : Z_OK;\n};\n\n\n/* =========================================================================\n * Initializes the compression dictionary from the given byte\n * sequence without producing any compressed output.\n */\nconst deflateSetDictionary = (strm, dictionary) => {\n\n let dictLength = dictionary.length;\n\n if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) {\n return Z_STREAM_ERROR;\n }\n\n const s = strm.state;\n const wrap = s.wrap;\n\n if (wrap === 2 || (wrap === 1 && s.status !== INIT_STATE) || s.lookahead) {\n return Z_STREAM_ERROR;\n }\n\n /* when using zlib wrappers, compute Adler-32 for provided dictionary */\n if (wrap === 1) {\n /* adler32(strm->adler, dictionary, dictLength); */\n strm.adler = adler32(strm.adler, dictionary, dictLength, 0);\n }\n\n s.wrap = 0; /* avoid computing Adler-32 in read_buf */\n\n /* if dictionary would fill window, just replace the history */\n if (dictLength >= s.w_size) {\n if (wrap === 0) { /* already empty otherwise */\n /*** CLEAR_HASH(s); ***/\n zero(s.head); // Fill with NIL (= 0);\n s.strstart = 0;\n s.block_start = 0;\n s.insert = 0;\n }\n /* use the tail */\n // dictionary = dictionary.slice(dictLength - s.w_size);\n let tmpDict = new Uint8Array(s.w_size);\n tmpDict.set(dictionary.subarray(dictLength - s.w_size, dictLength), 0);\n dictionary = tmpDict;\n dictLength = s.w_size;\n }\n /* insert dictionary into window and hash */\n const avail = strm.avail_in;\n const next = strm.next_in;\n const input = strm.input;\n strm.avail_in = dictLength;\n strm.next_in = 0;\n strm.input = dictionary;\n fill_window(s);\n while (s.lookahead >= MIN_MATCH) {\n let str = s.strstart;\n let n = s.lookahead - (MIN_MATCH - 1);\n do {\n /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */\n s.ins_h = HASH(s, s.ins_h, s.window[str + MIN_MATCH - 1]);\n\n s.prev[str & s.w_mask] = s.head[s.ins_h];\n\n s.head[s.ins_h] = str;\n str++;\n } while (--n);\n s.strstart = str;\n s.lookahead = MIN_MATCH - 1;\n fill_window(s);\n }\n s.strstart += s.lookahead;\n s.block_start = s.strstart;\n s.insert = s.lookahead;\n s.lookahead = 0;\n s.match_length = s.prev_length = MIN_MATCH - 1;\n s.match_available = 0;\n strm.next_in = next;\n strm.input = input;\n strm.avail_in = avail;\n s.wrap = wrap;\n return Z_OK;\n};\n\n\nmodule.exports.deflateInit = deflateInit;\nmodule.exports.deflateInit2 = deflateInit2;\nmodule.exports.deflateReset = deflateReset;\nmodule.exports.deflateResetKeep = deflateResetKeep;\nmodule.exports.deflateSetHeader = deflateSetHeader;\nmodule.exports.deflate = deflate;\nmodule.exports.deflateEnd = deflateEnd;\nmodule.exports.deflateSetDictionary = deflateSetDictionary;\nmodule.exports.deflateInfo = 'pako deflate (from Nodeca project)';\n\n/* Not implemented\nmodule.exports.deflateBound = deflateBound;\nmodule.exports.deflateCopy = deflateCopy;\nmodule.exports.deflateParams = deflateParams;\nmodule.exports.deflatePending = deflatePending;\nmodule.exports.deflatePrime = deflatePrime;\nmodule.exports.deflateTune = deflateTune;\n*/\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nfunction GZheader() {\n /* true if compressed data believed to be text */\n this.text = 0;\n /* modification time */\n this.time = 0;\n /* extra flags (not used when writing a gzip file) */\n this.xflags = 0;\n /* operating system */\n this.os = 0;\n /* pointer to extra field or Z_NULL if none */\n this.extra = null;\n /* extra field length (valid if extra != Z_NULL) */\n this.extra_len = 0; // Actually, we don't need it in JS,\n // but leave for few code modifications\n\n //\n // Setup limits is not necessary because in js we should not preallocate memory\n // for inflate use constant limit in 65536 bytes\n //\n\n /* space at extra (only when reading header) */\n // this.extra_max = 0;\n /* pointer to zero-terminated file name or Z_NULL */\n this.name = '';\n /* space at name (only when reading header) */\n // this.name_max = 0;\n /* pointer to zero-terminated comment or Z_NULL */\n this.comment = '';\n /* space at comment (only when reading header) */\n // this.comm_max = 0;\n /* true if there was or will be a header crc */\n this.hcrc = 0;\n /* true when done reading gzip header (not used when writing a gzip file) */\n this.done = false;\n}\n\nmodule.exports = GZheader;\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\n// See state defs from inflate.js\nconst BAD = 30; /* got a data error -- remain here until reset */\nconst TYPE = 12; /* i: waiting for type bits, including last-flag bit */\n\n/*\n Decode literal, length, and distance codes and write out the resulting\n literal and match bytes until either not enough input or output is\n available, an end-of-block is encountered, or a data error is encountered.\n When large enough input and output buffers are supplied to inflate(), for\n example, a 16K input buffer and a 64K output buffer, more than 95% of the\n inflate execution time is spent in this routine.\n\n Entry assumptions:\n\n state.mode === LEN\n strm.avail_in >= 6\n strm.avail_out >= 258\n start >= strm.avail_out\n state.bits < 8\n\n On return, state.mode is one of:\n\n LEN -- ran out of enough output space or enough available input\n TYPE -- reached end of block code, inflate() to interpret next block\n BAD -- error in block data\n\n Notes:\n\n - The maximum input bits used by a length/distance pair is 15 bits for the\n length code, 5 bits for the length extra, 15 bits for the distance code,\n and 13 bits for the distance extra. This totals 48 bits, or six bytes.\n Therefore if strm.avail_in >= 6, then there is enough input to avoid\n checking for available input while decoding.\n\n - The maximum bytes that a single length/distance pair can output is 258\n bytes, which is the maximum length that can be coded. inflate_fast()\n requires strm.avail_out >= 258 for each loop to avoid checking for\n output space.\n */\nmodule.exports = function inflate_fast(strm, start) {\n let _in; /* local strm.input */\n let last; /* have enough input while in < last */\n let _out; /* local strm.output */\n let beg; /* inflate()'s initial strm.output */\n let end; /* while out < end, enough space available */\n//#ifdef INFLATE_STRICT\n let dmax; /* maximum distance from zlib header */\n//#endif\n let wsize; /* window size or zero if not using window */\n let whave; /* valid bytes in the window */\n let wnext; /* window write index */\n // Use `s_window` instead `window`, avoid conflict with instrumentation tools\n let s_window; /* allocated sliding window, if wsize != 0 */\n let hold; /* local strm.hold */\n let bits; /* local strm.bits */\n let lcode; /* local strm.lencode */\n let dcode; /* local strm.distcode */\n let lmask; /* mask for first level of length codes */\n let dmask; /* mask for first level of distance codes */\n let here; /* retrieved table entry */\n let op; /* code bits, operation, extra bits, or */\n /* window position, window bytes to copy */\n let len; /* match length, unused bytes */\n let dist; /* match distance */\n let from; /* where to copy match from */\n let from_source;\n\n\n let input, output; // JS specific, because we have no pointers\n\n /* copy state to local variables */\n const state = strm.state;\n //here = state.here;\n _in = strm.next_in;\n input = strm.input;\n last = _in + (strm.avail_in - 5);\n _out = strm.next_out;\n output = strm.output;\n beg = _out - (start - strm.avail_out);\n end = _out + (strm.avail_out - 257);\n//#ifdef INFLATE_STRICT\n dmax = state.dmax;\n//#endif\n wsize = state.wsize;\n whave = state.whave;\n wnext = state.wnext;\n s_window = state.window;\n hold = state.hold;\n bits = state.bits;\n lcode = state.lencode;\n dcode = state.distcode;\n lmask = (1 << state.lenbits) - 1;\n dmask = (1 << state.distbits) - 1;\n\n\n /* decode literals and length/distances until end-of-block or not enough\n input data or output space */\n\n top:\n do {\n if (bits < 15) {\n hold += input[_in++] << bits;\n bits += 8;\n hold += input[_in++] << bits;\n bits += 8;\n }\n\n here = lcode[hold & lmask];\n\n dolen:\n for (;;) { // Goto emulation\n op = here >>> 24/*here.bits*/;\n hold >>>= op;\n bits -= op;\n op = (here >>> 16) & 0xff/*here.op*/;\n if (op === 0) { /* literal */\n //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?\n // \"inflate: literal '%c'\\n\" :\n // \"inflate: literal 0x%02x\\n\", here.val));\n output[_out++] = here & 0xffff/*here.val*/;\n }\n else if (op & 16) { /* length base */\n len = here & 0xffff/*here.val*/;\n op &= 15; /* number of extra bits */\n if (op) {\n if (bits < op) {\n hold += input[_in++] << bits;\n bits += 8;\n }\n len += hold & ((1 << op) - 1);\n hold >>>= op;\n bits -= op;\n }\n //Tracevv((stderr, \"inflate: length %u\\n\", len));\n if (bits < 15) {\n hold += input[_in++] << bits;\n bits += 8;\n hold += input[_in++] << bits;\n bits += 8;\n }\n here = dcode[hold & dmask];\n\n dodist:\n for (;;) { // goto emulation\n op = here >>> 24/*here.bits*/;\n hold >>>= op;\n bits -= op;\n op = (here >>> 16) & 0xff/*here.op*/;\n\n if (op & 16) { /* distance base */\n dist = here & 0xffff/*here.val*/;\n op &= 15; /* number of extra bits */\n if (bits < op) {\n hold += input[_in++] << bits;\n bits += 8;\n if (bits < op) {\n hold += input[_in++] << bits;\n bits += 8;\n }\n }\n dist += hold & ((1 << op) - 1);\n//#ifdef INFLATE_STRICT\n if (dist > dmax) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break top;\n }\n//#endif\n hold >>>= op;\n bits -= op;\n //Tracevv((stderr, \"inflate: distance %u\\n\", dist));\n op = _out - beg; /* max distance in output */\n if (dist > op) { /* see if copy from window */\n op = dist - op; /* distance back in window */\n if (op > whave) {\n if (state.sane) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break top;\n }\n\n// (!) This block is disabled in zlib defaults,\n// don't enable it for binary compatibility\n//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR\n// if (len <= op - whave) {\n// do {\n// output[_out++] = 0;\n// } while (--len);\n// continue top;\n// }\n// len -= op - whave;\n// do {\n// output[_out++] = 0;\n// } while (--op > whave);\n// if (op === 0) {\n// from = _out - dist;\n// do {\n// output[_out++] = output[from++];\n// } while (--len);\n// continue top;\n// }\n//#endif\n }\n from = 0; // window index\n from_source = s_window;\n if (wnext === 0) { /* very common case */\n from += wsize - op;\n if (op < len) { /* some from window */\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = _out - dist; /* rest from output */\n from_source = output;\n }\n }\n else if (wnext < op) { /* wrap around window */\n from += wsize + wnext - op;\n op -= wnext;\n if (op < len) { /* some from end of window */\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = 0;\n if (wnext < len) { /* some from start of window */\n op = wnext;\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = _out - dist; /* rest from output */\n from_source = output;\n }\n }\n }\n else { /* contiguous in window */\n from += wnext - op;\n if (op < len) { /* some from window */\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = _out - dist; /* rest from output */\n from_source = output;\n }\n }\n while (len > 2) {\n output[_out++] = from_source[from++];\n output[_out++] = from_source[from++];\n output[_out++] = from_source[from++];\n len -= 3;\n }\n if (len) {\n output[_out++] = from_source[from++];\n if (len > 1) {\n output[_out++] = from_source[from++];\n }\n }\n }\n else {\n from = _out - dist; /* copy direct from output */\n do { /* minimum length is three */\n output[_out++] = output[from++];\n output[_out++] = output[from++];\n output[_out++] = output[from++];\n len -= 3;\n } while (len > 2);\n if (len) {\n output[_out++] = output[from++];\n if (len > 1) {\n output[_out++] = output[from++];\n }\n }\n }\n }\n else if ((op & 64) === 0) { /* 2nd level distance code */\n here = dcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))];\n continue dodist;\n }\n else {\n strm.msg = 'invalid distance code';\n state.mode = BAD;\n break top;\n }\n\n break; // need to emulate goto via \"continue\"\n }\n }\n else if ((op & 64) === 0) { /* 2nd level length code */\n here = lcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))];\n continue dolen;\n }\n else if (op & 32) { /* end-of-block */\n //Tracevv((stderr, \"inflate: end of block\\n\"));\n state.mode = TYPE;\n break top;\n }\n else {\n strm.msg = 'invalid literal/length code';\n state.mode = BAD;\n break top;\n }\n\n break; // need to emulate goto via \"continue\"\n }\n } while (_in < last && _out < end);\n\n /* return unused bytes (on entry, bits < 8, so in won't go too far back) */\n len = bits >> 3;\n _in -= len;\n bits -= len << 3;\n hold &= (1 << bits) - 1;\n\n /* update state and return */\n strm.next_in = _in;\n strm.next_out = _out;\n strm.avail_in = (_in < last ? 5 + (last - _in) : 5 - (_in - last));\n strm.avail_out = (_out < end ? 257 + (end - _out) : 257 - (_out - end));\n state.hold = hold;\n state.bits = bits;\n return;\n};\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nconst adler32 = require('./adler32');\nconst crc32 = require('./crc32');\nconst inflate_fast = require('./inffast');\nconst inflate_table = require('./inftrees');\n\nconst CODES = 0;\nconst LENS = 1;\nconst DISTS = 2;\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\nconst {\n Z_FINISH, Z_BLOCK, Z_TREES,\n Z_OK, Z_STREAM_END, Z_NEED_DICT, Z_STREAM_ERROR, Z_DATA_ERROR, Z_MEM_ERROR, Z_BUF_ERROR,\n Z_DEFLATED\n} = require('./constants');\n\n\n/* STATES ====================================================================*/\n/* ===========================================================================*/\n\n\nconst HEAD = 1; /* i: waiting for magic header */\nconst FLAGS = 2; /* i: waiting for method and flags (gzip) */\nconst TIME = 3; /* i: waiting for modification time (gzip) */\nconst OS = 4; /* i: waiting for extra flags and operating system (gzip) */\nconst EXLEN = 5; /* i: waiting for extra length (gzip) */\nconst EXTRA = 6; /* i: waiting for extra bytes (gzip) */\nconst NAME = 7; /* i: waiting for end of file name (gzip) */\nconst COMMENT = 8; /* i: waiting for end of comment (gzip) */\nconst HCRC = 9; /* i: waiting for header crc (gzip) */\nconst DICTID = 10; /* i: waiting for dictionary check value */\nconst DICT = 11; /* waiting for inflateSetDictionary() call */\nconst TYPE = 12; /* i: waiting for type bits, including last-flag bit */\nconst TYPEDO = 13; /* i: same, but skip check to exit inflate on new block */\nconst STORED = 14; /* i: waiting for stored size (length and complement) */\nconst COPY_ = 15; /* i/o: same as COPY below, but only first time in */\nconst COPY = 16; /* i/o: waiting for input or output to copy stored block */\nconst TABLE = 17; /* i: waiting for dynamic block table lengths */\nconst LENLENS = 18; /* i: waiting for code length code lengths */\nconst CODELENS = 19; /* i: waiting for length/lit and distance code lengths */\nconst LEN_ = 20; /* i: same as LEN below, but only first time in */\nconst LEN = 21; /* i: waiting for length/lit/eob code */\nconst LENEXT = 22; /* i: waiting for length extra bits */\nconst DIST = 23; /* i: waiting for distance code */\nconst DISTEXT = 24; /* i: waiting for distance extra bits */\nconst MATCH = 25; /* o: waiting for output space to copy string */\nconst LIT = 26; /* o: waiting for output space to write literal */\nconst CHECK = 27; /* i: waiting for 32-bit check value */\nconst LENGTH = 28; /* i: waiting for 32-bit length (gzip) */\nconst DONE = 29; /* finished check, done -- remain here until reset */\nconst BAD = 30; /* got a data error -- remain here until reset */\nconst MEM = 31; /* got an inflate() memory error -- remain here until reset */\nconst SYNC = 32; /* looking for synchronization bytes to restart inflate() */\n\n/* ===========================================================================*/\n\n\n\nconst ENOUGH_LENS = 852;\nconst ENOUGH_DISTS = 592;\n//const ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS);\n\nconst MAX_WBITS = 15;\n/* 32K LZ77 window */\nconst DEF_WBITS = MAX_WBITS;\n\n\nconst zswap32 = (q) => {\n\n return (((q >>> 24) & 0xff) +\n ((q >>> 8) & 0xff00) +\n ((q & 0xff00) << 8) +\n ((q & 0xff) << 24));\n};\n\n\nfunction InflateState() {\n this.mode = 0; /* current inflate mode */\n this.last = false; /* true if processing last block */\n this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */\n this.havedict = false; /* true if dictionary provided */\n this.flags = 0; /* gzip header method and flags (0 if zlib) */\n this.dmax = 0; /* zlib header max distance (INFLATE_STRICT) */\n this.check = 0; /* protected copy of check value */\n this.total = 0; /* protected copy of output count */\n // TODO: may be {}\n this.head = null; /* where to save gzip header information */\n\n /* sliding window */\n this.wbits = 0; /* log base 2 of requested window size */\n this.wsize = 0; /* window size or zero if not using window */\n this.whave = 0; /* valid bytes in the window */\n this.wnext = 0; /* window write index */\n this.window = null; /* allocated sliding window, if needed */\n\n /* bit accumulator */\n this.hold = 0; /* input bit accumulator */\n this.bits = 0; /* number of bits in \"in\" */\n\n /* for string and stored block copying */\n this.length = 0; /* literal or length of data to copy */\n this.offset = 0; /* distance back to copy string from */\n\n /* for table and code decoding */\n this.extra = 0; /* extra bits needed */\n\n /* fixed and dynamic code tables */\n this.lencode = null; /* starting table for length/literal codes */\n this.distcode = null; /* starting table for distance codes */\n this.lenbits = 0; /* index bits for lencode */\n this.distbits = 0; /* index bits for distcode */\n\n /* dynamic table building */\n this.ncode = 0; /* number of code length code lengths */\n this.nlen = 0; /* number of length code lengths */\n this.ndist = 0; /* number of distance code lengths */\n this.have = 0; /* number of code lengths in lens[] */\n this.next = null; /* next available space in codes[] */\n\n this.lens = new Uint16Array(320); /* temporary storage for code lengths */\n this.work = new Uint16Array(288); /* work area for code table building */\n\n /*\n because we don't have pointers in js, we use lencode and distcode directly\n as buffers so we don't need codes\n */\n //this.codes = new Int32Array(ENOUGH); /* space for code tables */\n this.lendyn = null; /* dynamic table for length/literal codes (JS specific) */\n this.distdyn = null; /* dynamic table for distance codes (JS specific) */\n this.sane = 0; /* if false, allow invalid distance too far */\n this.back = 0; /* bits back of last unprocessed length/lit */\n this.was = 0; /* initial length of match */\n}\n\n\nconst inflateResetKeep = (strm) => {\n\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n const state = strm.state;\n strm.total_in = strm.total_out = state.total = 0;\n strm.msg = ''; /*Z_NULL*/\n if (state.wrap) { /* to support ill-conceived Java test suite */\n strm.adler = state.wrap & 1;\n }\n state.mode = HEAD;\n state.last = 0;\n state.havedict = 0;\n state.dmax = 32768;\n state.head = null/*Z_NULL*/;\n state.hold = 0;\n state.bits = 0;\n //state.lencode = state.distcode = state.next = state.codes;\n state.lencode = state.lendyn = new Int32Array(ENOUGH_LENS);\n state.distcode = state.distdyn = new Int32Array(ENOUGH_DISTS);\n\n state.sane = 1;\n state.back = -1;\n //Tracev((stderr, \"inflate: reset\\n\"));\n return Z_OK;\n};\n\n\nconst inflateReset = (strm) => {\n\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n const state = strm.state;\n state.wsize = 0;\n state.whave = 0;\n state.wnext = 0;\n return inflateResetKeep(strm);\n\n};\n\n\nconst inflateReset2 = (strm, windowBits) => {\n let wrap;\n\n /* get the state */\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n const state = strm.state;\n\n /* extract wrap request from windowBits parameter */\n if (windowBits < 0) {\n wrap = 0;\n windowBits = -windowBits;\n }\n else {\n wrap = (windowBits >> 4) + 1;\n if (windowBits < 48) {\n windowBits &= 15;\n }\n }\n\n /* set number of window bits, free window if different */\n if (windowBits && (windowBits < 8 || windowBits > 15)) {\n return Z_STREAM_ERROR;\n }\n if (state.window !== null && state.wbits !== windowBits) {\n state.window = null;\n }\n\n /* update state and reset the rest of it */\n state.wrap = wrap;\n state.wbits = windowBits;\n return inflateReset(strm);\n};\n\n\nconst inflateInit2 = (strm, windowBits) => {\n\n if (!strm) { return Z_STREAM_ERROR; }\n //strm.msg = Z_NULL; /* in case we return an error */\n\n const state = new InflateState();\n\n //if (state === Z_NULL) return Z_MEM_ERROR;\n //Tracev((stderr, \"inflate: allocated\\n\"));\n strm.state = state;\n state.window = null/*Z_NULL*/;\n const ret = inflateReset2(strm, windowBits);\n if (ret !== Z_OK) {\n strm.state = null/*Z_NULL*/;\n }\n return ret;\n};\n\n\nconst inflateInit = (strm) => {\n\n return inflateInit2(strm, DEF_WBITS);\n};\n\n\n/*\n Return state with length and distance decoding tables and index sizes set to\n fixed code decoding. Normally this returns fixed tables from inffixed.h.\n If BUILDFIXED is defined, then instead this routine builds the tables the\n first time it's called, and returns those tables the first time and\n thereafter. This reduces the size of the code by about 2K bytes, in\n exchange for a little execution time. However, BUILDFIXED should not be\n used for threaded applications, since the rewriting of the tables and virgin\n may not be thread-safe.\n */\nlet virgin = true;\n\nlet lenfix, distfix; // We have no pointers in JS, so keep tables separate\n\n\nconst fixedtables = (state) => {\n\n /* build fixed huffman tables if first call (may not be thread safe) */\n if (virgin) {\n lenfix = new Int32Array(512);\n distfix = new Int32Array(32);\n\n /* literal/length table */\n let sym = 0;\n while (sym < 144) { state.lens[sym++] = 8; }\n while (sym < 256) { state.lens[sym++] = 9; }\n while (sym < 280) { state.lens[sym++] = 7; }\n while (sym < 288) { state.lens[sym++] = 8; }\n\n inflate_table(LENS, state.lens, 0, 288, lenfix, 0, state.work, { bits: 9 });\n\n /* distance table */\n sym = 0;\n while (sym < 32) { state.lens[sym++] = 5; }\n\n inflate_table(DISTS, state.lens, 0, 32, distfix, 0, state.work, { bits: 5 });\n\n /* do this just once */\n virgin = false;\n }\n\n state.lencode = lenfix;\n state.lenbits = 9;\n state.distcode = distfix;\n state.distbits = 5;\n};\n\n\n/*\n Update the window with the last wsize (normally 32K) bytes written before\n returning. If window does not exist yet, create it. This is only called\n when a window is already in use, or when output has been written during this\n inflate call, but the end of the deflate stream has not been reached yet.\n It is also called to create a window for dictionary data when a dictionary\n is loaded.\n\n Providing output buffers larger than 32K to inflate() should provide a speed\n advantage, since only the last 32K of output is copied to the sliding window\n upon return from inflate(), and since all distances after the first 32K of\n output will fall in the output data, making match copies simpler and faster.\n The advantage may be dependent on the size of the processor's data caches.\n */\nconst updatewindow = (strm, src, end, copy) => {\n\n let dist;\n const state = strm.state;\n\n /* if it hasn't been done already, allocate space for the window */\n if (state.window === null) {\n state.wsize = 1 << state.wbits;\n state.wnext = 0;\n state.whave = 0;\n\n state.window = new Uint8Array(state.wsize);\n }\n\n /* copy state->wsize or less output bytes into the circular window */\n if (copy >= state.wsize) {\n state.window.set(src.subarray(end - state.wsize, end), 0);\n state.wnext = 0;\n state.whave = state.wsize;\n }\n else {\n dist = state.wsize - state.wnext;\n if (dist > copy) {\n dist = copy;\n }\n //zmemcpy(state->window + state->wnext, end - copy, dist);\n state.window.set(src.subarray(end - copy, end - copy + dist), state.wnext);\n copy -= dist;\n if (copy) {\n //zmemcpy(state->window, end - copy, copy);\n state.window.set(src.subarray(end - copy, end), 0);\n state.wnext = copy;\n state.whave = state.wsize;\n }\n else {\n state.wnext += dist;\n if (state.wnext === state.wsize) { state.wnext = 0; }\n if (state.whave < state.wsize) { state.whave += dist; }\n }\n }\n return 0;\n};\n\n\nconst inflate = (strm, flush) => {\n\n let state;\n let input, output; // input/output buffers\n let next; /* next input INDEX */\n let put; /* next output INDEX */\n let have, left; /* available input and output */\n let hold; /* bit buffer */\n let bits; /* bits in bit buffer */\n let _in, _out; /* save starting available input and output */\n let copy; /* number of stored or match bytes to copy */\n let from; /* where to copy match bytes from */\n let from_source;\n let here = 0; /* current decoding table entry */\n let here_bits, here_op, here_val; // paked \"here\" denormalized (JS specific)\n //let last; /* parent table entry */\n let last_bits, last_op, last_val; // paked \"last\" denormalized (JS specific)\n let len; /* length to copy for repeats, bits to drop */\n let ret; /* return code */\n const hbuf = new Uint8Array(4); /* buffer for gzip header crc calculation */\n let opts;\n\n let n; // temporary variable for NEED_BITS\n\n const order = /* permutation of code lengths */\n new Uint8Array([ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ]);\n\n\n if (!strm || !strm.state || !strm.output ||\n (!strm.input && strm.avail_in !== 0)) {\n return Z_STREAM_ERROR;\n }\n\n state = strm.state;\n if (state.mode === TYPE) { state.mode = TYPEDO; } /* skip check */\n\n\n //--- LOAD() ---\n put = strm.next_out;\n output = strm.output;\n left = strm.avail_out;\n next = strm.next_in;\n input = strm.input;\n have = strm.avail_in;\n hold = state.hold;\n bits = state.bits;\n //---\n\n _in = have;\n _out = left;\n ret = Z_OK;\n\n inf_leave: // goto emulation\n for (;;) {\n switch (state.mode) {\n case HEAD:\n if (state.wrap === 0) {\n state.mode = TYPEDO;\n break;\n }\n //=== NEEDBITS(16);\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if ((state.wrap & 2) && hold === 0x8b1f) { /* gzip header */\n state.check = 0/*crc32(0L, Z_NULL, 0)*/;\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32(state.check, hbuf, 2, 0);\n //===//\n\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = FLAGS;\n break;\n }\n state.flags = 0; /* expect zlib header */\n if (state.head) {\n state.head.done = false;\n }\n if (!(state.wrap & 1) || /* check if zlib header allowed */\n (((hold & 0xff)/*BITS(8)*/ << 8) + (hold >> 8)) % 31) {\n strm.msg = 'incorrect header check';\n state.mode = BAD;\n break;\n }\n if ((hold & 0x0f)/*BITS(4)*/ !== Z_DEFLATED) {\n strm.msg = 'unknown compression method';\n state.mode = BAD;\n break;\n }\n //--- DROPBITS(4) ---//\n hold >>>= 4;\n bits -= 4;\n //---//\n len = (hold & 0x0f)/*BITS(4)*/ + 8;\n if (state.wbits === 0) {\n state.wbits = len;\n }\n else if (len > state.wbits) {\n strm.msg = 'invalid window size';\n state.mode = BAD;\n break;\n }\n\n // !!! pako patch. Force use `options.windowBits` if passed.\n // Required to always use max window size by default.\n state.dmax = 1 << state.wbits;\n //state.dmax = 1 << len;\n\n //Tracev((stderr, \"inflate: zlib header ok\\n\"));\n strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/;\n state.mode = hold & 0x200 ? DICTID : TYPE;\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n break;\n case FLAGS:\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.flags = hold;\n if ((state.flags & 0xff) !== Z_DEFLATED) {\n strm.msg = 'unknown compression method';\n state.mode = BAD;\n break;\n }\n if (state.flags & 0xe000) {\n strm.msg = 'unknown header flags set';\n state.mode = BAD;\n break;\n }\n if (state.head) {\n state.head.text = ((hold >> 8) & 1);\n }\n if (state.flags & 0x0200) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32(state.check, hbuf, 2, 0);\n //===//\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = TIME;\n /* falls through */\n case TIME:\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (state.head) {\n state.head.time = hold;\n }\n if (state.flags & 0x0200) {\n //=== CRC4(state.check, hold)\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n hbuf[2] = (hold >>> 16) & 0xff;\n hbuf[3] = (hold >>> 24) & 0xff;\n state.check = crc32(state.check, hbuf, 4, 0);\n //===\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = OS;\n /* falls through */\n case OS:\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (state.head) {\n state.head.xflags = (hold & 0xff);\n state.head.os = (hold >> 8);\n }\n if (state.flags & 0x0200) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32(state.check, hbuf, 2, 0);\n //===//\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = EXLEN;\n /* falls through */\n case EXLEN:\n if (state.flags & 0x0400) {\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.length = hold;\n if (state.head) {\n state.head.extra_len = hold;\n }\n if (state.flags & 0x0200) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32(state.check, hbuf, 2, 0);\n //===//\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n }\n else if (state.head) {\n state.head.extra = null/*Z_NULL*/;\n }\n state.mode = EXTRA;\n /* falls through */\n case EXTRA:\n if (state.flags & 0x0400) {\n copy = state.length;\n if (copy > have) { copy = have; }\n if (copy) {\n if (state.head) {\n len = state.head.extra_len - state.length;\n if (!state.head.extra) {\n // Use untyped array for more convenient processing later\n state.head.extra = new Uint8Array(state.head.extra_len);\n }\n state.head.extra.set(\n input.subarray(\n next,\n // extra field is limited to 65536 bytes\n // - no need for additional size check\n next + copy\n ),\n /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/\n len\n );\n //zmemcpy(state.head.extra + len, next,\n // len + copy > state.head.extra_max ?\n // state.head.extra_max - len : copy);\n }\n if (state.flags & 0x0200) {\n state.check = crc32(state.check, input, copy, next);\n }\n have -= copy;\n next += copy;\n state.length -= copy;\n }\n if (state.length) { break inf_leave; }\n }\n state.length = 0;\n state.mode = NAME;\n /* falls through */\n case NAME:\n if (state.flags & 0x0800) {\n if (have === 0) { break inf_leave; }\n copy = 0;\n do {\n // TODO: 2 or 1 bytes?\n len = input[next + copy++];\n /* use constant limit because in js we should not preallocate memory */\n if (state.head && len &&\n (state.length < 65536 /*state.head.name_max*/)) {\n state.head.name += String.fromCharCode(len);\n }\n } while (len && copy < have);\n\n if (state.flags & 0x0200) {\n state.check = crc32(state.check, input, copy, next);\n }\n have -= copy;\n next += copy;\n if (len) { break inf_leave; }\n }\n else if (state.head) {\n state.head.name = null;\n }\n state.length = 0;\n state.mode = COMMENT;\n /* falls through */\n case COMMENT:\n if (state.flags & 0x1000) {\n if (have === 0) { break inf_leave; }\n copy = 0;\n do {\n len = input[next + copy++];\n /* use constant limit because in js we should not preallocate memory */\n if (state.head && len &&\n (state.length < 65536 /*state.head.comm_max*/)) {\n state.head.comment += String.fromCharCode(len);\n }\n } while (len && copy < have);\n if (state.flags & 0x0200) {\n state.check = crc32(state.check, input, copy, next);\n }\n have -= copy;\n next += copy;\n if (len) { break inf_leave; }\n }\n else if (state.head) {\n state.head.comment = null;\n }\n state.mode = HCRC;\n /* falls through */\n case HCRC:\n if (state.flags & 0x0200) {\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (hold !== (state.check & 0xffff)) {\n strm.msg = 'header crc mismatch';\n state.mode = BAD;\n break;\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n }\n if (state.head) {\n state.head.hcrc = ((state.flags >> 9) & 1);\n state.head.done = true;\n }\n strm.adler = state.check = 0;\n state.mode = TYPE;\n break;\n case DICTID:\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n strm.adler = state.check = zswap32(hold);\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = DICT;\n /* falls through */\n case DICT:\n if (state.havedict === 0) {\n //--- RESTORE() ---\n strm.next_out = put;\n strm.avail_out = left;\n strm.next_in = next;\n strm.avail_in = have;\n state.hold = hold;\n state.bits = bits;\n //---\n return Z_NEED_DICT;\n }\n strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/;\n state.mode = TYPE;\n /* falls through */\n case TYPE:\n if (flush === Z_BLOCK || flush === Z_TREES) { break inf_leave; }\n /* falls through */\n case TYPEDO:\n if (state.last) {\n //--- BYTEBITS() ---//\n hold >>>= bits & 7;\n bits -= bits & 7;\n //---//\n state.mode = CHECK;\n break;\n }\n //=== NEEDBITS(3); */\n while (bits < 3) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.last = (hold & 0x01)/*BITS(1)*/;\n //--- DROPBITS(1) ---//\n hold >>>= 1;\n bits -= 1;\n //---//\n\n switch ((hold & 0x03)/*BITS(2)*/) {\n case 0: /* stored block */\n //Tracev((stderr, \"inflate: stored block%s\\n\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = STORED;\n break;\n case 1: /* fixed block */\n fixedtables(state);\n //Tracev((stderr, \"inflate: fixed codes block%s\\n\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = LEN_; /* decode codes */\n if (flush === Z_TREES) {\n //--- DROPBITS(2) ---//\n hold >>>= 2;\n bits -= 2;\n //---//\n break inf_leave;\n }\n break;\n case 2: /* dynamic block */\n //Tracev((stderr, \"inflate: dynamic codes block%s\\n\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = TABLE;\n break;\n case 3:\n strm.msg = 'invalid block type';\n state.mode = BAD;\n }\n //--- DROPBITS(2) ---//\n hold >>>= 2;\n bits -= 2;\n //---//\n break;\n case STORED:\n //--- BYTEBITS() ---// /* go to byte boundary */\n hold >>>= bits & 7;\n bits -= bits & 7;\n //---//\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if ((hold & 0xffff) !== ((hold >>> 16) ^ 0xffff)) {\n strm.msg = 'invalid stored block lengths';\n state.mode = BAD;\n break;\n }\n state.length = hold & 0xffff;\n //Tracev((stderr, \"inflate: stored length %u\\n\",\n // state.length));\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = COPY_;\n if (flush === Z_TREES) { break inf_leave; }\n /* falls through */\n case COPY_:\n state.mode = COPY;\n /* falls through */\n case COPY:\n copy = state.length;\n if (copy) {\n if (copy > have) { copy = have; }\n if (copy > left) { copy = left; }\n if (copy === 0) { break inf_leave; }\n //--- zmemcpy(put, next, copy); ---\n output.set(input.subarray(next, next + copy), put);\n //---//\n have -= copy;\n next += copy;\n left -= copy;\n put += copy;\n state.length -= copy;\n break;\n }\n //Tracev((stderr, \"inflate: stored end\\n\"));\n state.mode = TYPE;\n break;\n case TABLE:\n //=== NEEDBITS(14); */\n while (bits < 14) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.nlen = (hold & 0x1f)/*BITS(5)*/ + 257;\n //--- DROPBITS(5) ---//\n hold >>>= 5;\n bits -= 5;\n //---//\n state.ndist = (hold & 0x1f)/*BITS(5)*/ + 1;\n //--- DROPBITS(5) ---//\n hold >>>= 5;\n bits -= 5;\n //---//\n state.ncode = (hold & 0x0f)/*BITS(4)*/ + 4;\n //--- DROPBITS(4) ---//\n hold >>>= 4;\n bits -= 4;\n //---//\n//#ifndef PKZIP_BUG_WORKAROUND\n if (state.nlen > 286 || state.ndist > 30) {\n strm.msg = 'too many length or distance symbols';\n state.mode = BAD;\n break;\n }\n//#endif\n //Tracev((stderr, \"inflate: table sizes ok\\n\"));\n state.have = 0;\n state.mode = LENLENS;\n /* falls through */\n case LENLENS:\n while (state.have < state.ncode) {\n //=== NEEDBITS(3);\n while (bits < 3) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.lens[order[state.have++]] = (hold & 0x07);//BITS(3);\n //--- DROPBITS(3) ---//\n hold >>>= 3;\n bits -= 3;\n //---//\n }\n while (state.have < 19) {\n state.lens[order[state.have++]] = 0;\n }\n // We have separate tables & no pointers. 2 commented lines below not needed.\n //state.next = state.codes;\n //state.lencode = state.next;\n // Switch to use dynamic table\n state.lencode = state.lendyn;\n state.lenbits = 7;\n\n opts = { bits: state.lenbits };\n ret = inflate_table(CODES, state.lens, 0, 19, state.lencode, 0, state.work, opts);\n state.lenbits = opts.bits;\n\n if (ret) {\n strm.msg = 'invalid code lengths set';\n state.mode = BAD;\n break;\n }\n //Tracev((stderr, \"inflate: code lengths ok\\n\"));\n state.have = 0;\n state.mode = CODELENS;\n /* falls through */\n case CODELENS:\n while (state.have < state.nlen + state.ndist) {\n for (;;) {\n here = state.lencode[hold & ((1 << state.lenbits) - 1)];/*BITS(state.lenbits)*/\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n if (here_val < 16) {\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n state.lens[state.have++] = here_val;\n }\n else {\n if (here_val === 16) {\n //=== NEEDBITS(here.bits + 2);\n n = here_bits + 2;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n if (state.have === 0) {\n strm.msg = 'invalid bit length repeat';\n state.mode = BAD;\n break;\n }\n len = state.lens[state.have - 1];\n copy = 3 + (hold & 0x03);//BITS(2);\n //--- DROPBITS(2) ---//\n hold >>>= 2;\n bits -= 2;\n //---//\n }\n else if (here_val === 17) {\n //=== NEEDBITS(here.bits + 3);\n n = here_bits + 3;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n len = 0;\n copy = 3 + (hold & 0x07);//BITS(3);\n //--- DROPBITS(3) ---//\n hold >>>= 3;\n bits -= 3;\n //---//\n }\n else {\n //=== NEEDBITS(here.bits + 7);\n n = here_bits + 7;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n len = 0;\n copy = 11 + (hold & 0x7f);//BITS(7);\n //--- DROPBITS(7) ---//\n hold >>>= 7;\n bits -= 7;\n //---//\n }\n if (state.have + copy > state.nlen + state.ndist) {\n strm.msg = 'invalid bit length repeat';\n state.mode = BAD;\n break;\n }\n while (copy--) {\n state.lens[state.have++] = len;\n }\n }\n }\n\n /* handle error breaks in while */\n if (state.mode === BAD) { break; }\n\n /* check for end-of-block code (better have one) */\n if (state.lens[256] === 0) {\n strm.msg = 'invalid code -- missing end-of-block';\n state.mode = BAD;\n break;\n }\n\n /* build code tables -- note: do not change the lenbits or distbits\n values here (9 and 6) without reading the comments in inftrees.h\n concerning the ENOUGH constants, which depend on those values */\n state.lenbits = 9;\n\n opts = { bits: state.lenbits };\n ret = inflate_table(LENS, state.lens, 0, state.nlen, state.lencode, 0, state.work, opts);\n // We have separate tables & no pointers. 2 commented lines below not needed.\n // state.next_index = opts.table_index;\n state.lenbits = opts.bits;\n // state.lencode = state.next;\n\n if (ret) {\n strm.msg = 'invalid literal/lengths set';\n state.mode = BAD;\n break;\n }\n\n state.distbits = 6;\n //state.distcode.copy(state.codes);\n // Switch to use dynamic table\n state.distcode = state.distdyn;\n opts = { bits: state.distbits };\n ret = inflate_table(DISTS, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts);\n // We have separate tables & no pointers. 2 commented lines below not needed.\n // state.next_index = opts.table_index;\n state.distbits = opts.bits;\n // state.distcode = state.next;\n\n if (ret) {\n strm.msg = 'invalid distances set';\n state.mode = BAD;\n break;\n }\n //Tracev((stderr, 'inflate: codes ok\\n'));\n state.mode = LEN_;\n if (flush === Z_TREES) { break inf_leave; }\n /* falls through */\n case LEN_:\n state.mode = LEN;\n /* falls through */\n case LEN:\n if (have >= 6 && left >= 258) {\n //--- RESTORE() ---\n strm.next_out = put;\n strm.avail_out = left;\n strm.next_in = next;\n strm.avail_in = have;\n state.hold = hold;\n state.bits = bits;\n //---\n inflate_fast(strm, _out);\n //--- LOAD() ---\n put = strm.next_out;\n output = strm.output;\n left = strm.avail_out;\n next = strm.next_in;\n input = strm.input;\n have = strm.avail_in;\n hold = state.hold;\n bits = state.bits;\n //---\n\n if (state.mode === TYPE) {\n state.back = -1;\n }\n break;\n }\n state.back = 0;\n for (;;) {\n here = state.lencode[hold & ((1 << state.lenbits) - 1)]; /*BITS(state.lenbits)*/\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if (here_bits <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n if (here_op && (here_op & 0xf0) === 0) {\n last_bits = here_bits;\n last_op = here_op;\n last_val = here_val;\n for (;;) {\n here = state.lencode[last_val +\n ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)];\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((last_bits + here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n //--- DROPBITS(last.bits) ---//\n hold >>>= last_bits;\n bits -= last_bits;\n //---//\n state.back += last_bits;\n }\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n state.back += here_bits;\n state.length = here_val;\n if (here_op === 0) {\n //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?\n // \"inflate: literal '%c'\\n\" :\n // \"inflate: literal 0x%02x\\n\", here.val));\n state.mode = LIT;\n break;\n }\n if (here_op & 32) {\n //Tracevv((stderr, \"inflate: end of block\\n\"));\n state.back = -1;\n state.mode = TYPE;\n break;\n }\n if (here_op & 64) {\n strm.msg = 'invalid literal/length code';\n state.mode = BAD;\n break;\n }\n state.extra = here_op & 15;\n state.mode = LENEXT;\n /* falls through */\n case LENEXT:\n if (state.extra) {\n //=== NEEDBITS(state.extra);\n n = state.extra;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.length += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/;\n //--- DROPBITS(state.extra) ---//\n hold >>>= state.extra;\n bits -= state.extra;\n //---//\n state.back += state.extra;\n }\n //Tracevv((stderr, \"inflate: length %u\\n\", state.length));\n state.was = state.length;\n state.mode = DIST;\n /* falls through */\n case DIST:\n for (;;) {\n here = state.distcode[hold & ((1 << state.distbits) - 1)];/*BITS(state.distbits)*/\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n if ((here_op & 0xf0) === 0) {\n last_bits = here_bits;\n last_op = here_op;\n last_val = here_val;\n for (;;) {\n here = state.distcode[last_val +\n ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)];\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((last_bits + here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n //--- DROPBITS(last.bits) ---//\n hold >>>= last_bits;\n bits -= last_bits;\n //---//\n state.back += last_bits;\n }\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n state.back += here_bits;\n if (here_op & 64) {\n strm.msg = 'invalid distance code';\n state.mode = BAD;\n break;\n }\n state.offset = here_val;\n state.extra = (here_op) & 15;\n state.mode = DISTEXT;\n /* falls through */\n case DISTEXT:\n if (state.extra) {\n //=== NEEDBITS(state.extra);\n n = state.extra;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.offset += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/;\n //--- DROPBITS(state.extra) ---//\n hold >>>= state.extra;\n bits -= state.extra;\n //---//\n state.back += state.extra;\n }\n//#ifdef INFLATE_STRICT\n if (state.offset > state.dmax) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break;\n }\n//#endif\n //Tracevv((stderr, \"inflate: distance %u\\n\", state.offset));\n state.mode = MATCH;\n /* falls through */\n case MATCH:\n if (left === 0) { break inf_leave; }\n copy = _out - left;\n if (state.offset > copy) { /* copy from window */\n copy = state.offset - copy;\n if (copy > state.whave) {\n if (state.sane) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break;\n }\n// (!) This block is disabled in zlib defaults,\n// don't enable it for binary compatibility\n//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR\n// Trace((stderr, \"inflate.c too far\\n\"));\n// copy -= state.whave;\n// if (copy > state.length) { copy = state.length; }\n// if (copy > left) { copy = left; }\n// left -= copy;\n// state.length -= copy;\n// do {\n// output[put++] = 0;\n// } while (--copy);\n// if (state.length === 0) { state.mode = LEN; }\n// break;\n//#endif\n }\n if (copy > state.wnext) {\n copy -= state.wnext;\n from = state.wsize - copy;\n }\n else {\n from = state.wnext - copy;\n }\n if (copy > state.length) { copy = state.length; }\n from_source = state.window;\n }\n else { /* copy from output */\n from_source = output;\n from = put - state.offset;\n copy = state.length;\n }\n if (copy > left) { copy = left; }\n left -= copy;\n state.length -= copy;\n do {\n output[put++] = from_source[from++];\n } while (--copy);\n if (state.length === 0) { state.mode = LEN; }\n break;\n case LIT:\n if (left === 0) { break inf_leave; }\n output[put++] = state.length;\n left--;\n state.mode = LEN;\n break;\n case CHECK:\n if (state.wrap) {\n //=== NEEDBITS(32);\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n // Use '|' instead of '+' to make sure that result is signed\n hold |= input[next++] << bits;\n bits += 8;\n }\n //===//\n _out -= left;\n strm.total_out += _out;\n state.total += _out;\n if (_out) {\n strm.adler = state.check =\n /*UPDATE(state.check, put - _out, _out);*/\n (state.flags ? crc32(state.check, output, _out, put - _out) : adler32(state.check, output, _out, put - _out));\n\n }\n _out = left;\n // NB: crc32 stored as signed 32-bit int, zswap32 returns signed too\n if ((state.flags ? hold : zswap32(hold)) !== state.check) {\n strm.msg = 'incorrect data check';\n state.mode = BAD;\n break;\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n //Tracev((stderr, \"inflate: check matches trailer\\n\"));\n }\n state.mode = LENGTH;\n /* falls through */\n case LENGTH:\n if (state.wrap && state.flags) {\n //=== NEEDBITS(32);\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (hold !== (state.total & 0xffffffff)) {\n strm.msg = 'incorrect length check';\n state.mode = BAD;\n break;\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n //Tracev((stderr, \"inflate: length matches trailer\\n\"));\n }\n state.mode = DONE;\n /* falls through */\n case DONE:\n ret = Z_STREAM_END;\n break inf_leave;\n case BAD:\n ret = Z_DATA_ERROR;\n break inf_leave;\n case MEM:\n return Z_MEM_ERROR;\n case SYNC:\n /* falls through */\n default:\n return Z_STREAM_ERROR;\n }\n }\n\n // inf_leave <- here is real place for \"goto inf_leave\", emulated via \"break inf_leave\"\n\n /*\n Return from inflate(), updating the total counts and the check value.\n If there was no progress during the inflate() call, return a buffer\n error. Call updatewindow() to create and/or update the window state.\n Note: a memory error from inflate() is non-recoverable.\n */\n\n //--- RESTORE() ---\n strm.next_out = put;\n strm.avail_out = left;\n strm.next_in = next;\n strm.avail_in = have;\n state.hold = hold;\n state.bits = bits;\n //---\n\n if (state.wsize || (_out !== strm.avail_out && state.mode < BAD &&\n (state.mode < CHECK || flush !== Z_FINISH))) {\n if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out)) {\n state.mode = MEM;\n return Z_MEM_ERROR;\n }\n }\n _in -= strm.avail_in;\n _out -= strm.avail_out;\n strm.total_in += _in;\n strm.total_out += _out;\n state.total += _out;\n if (state.wrap && _out) {\n strm.adler = state.check = /*UPDATE(state.check, strm.next_out - _out, _out);*/\n (state.flags ? crc32(state.check, output, _out, strm.next_out - _out) : adler32(state.check, output, _out, strm.next_out - _out));\n }\n strm.data_type = state.bits + (state.last ? 64 : 0) +\n (state.mode === TYPE ? 128 : 0) +\n (state.mode === LEN_ || state.mode === COPY_ ? 256 : 0);\n if (((_in === 0 && _out === 0) || flush === Z_FINISH) && ret === Z_OK) {\n ret = Z_BUF_ERROR;\n }\n return ret;\n};\n\n\nconst inflateEnd = (strm) => {\n\n if (!strm || !strm.state /*|| strm->zfree == (free_func)0*/) {\n return Z_STREAM_ERROR;\n }\n\n let state = strm.state;\n if (state.window) {\n state.window = null;\n }\n strm.state = null;\n return Z_OK;\n};\n\n\nconst inflateGetHeader = (strm, head) => {\n\n /* check state */\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n const state = strm.state;\n if ((state.wrap & 2) === 0) { return Z_STREAM_ERROR; }\n\n /* save header structure */\n state.head = head;\n head.done = false;\n return Z_OK;\n};\n\n\nconst inflateSetDictionary = (strm, dictionary) => {\n const dictLength = dictionary.length;\n\n let state;\n let dictid;\n let ret;\n\n /* check state */\n if (!strm /* == Z_NULL */ || !strm.state /* == Z_NULL */) { return Z_STREAM_ERROR; }\n state = strm.state;\n\n if (state.wrap !== 0 && state.mode !== DICT) {\n return Z_STREAM_ERROR;\n }\n\n /* check for correct dictionary identifier */\n if (state.mode === DICT) {\n dictid = 1; /* adler32(0, null, 0)*/\n /* dictid = adler32(dictid, dictionary, dictLength); */\n dictid = adler32(dictid, dictionary, dictLength, 0);\n if (dictid !== state.check) {\n return Z_DATA_ERROR;\n }\n }\n /* copy dictionary to window using updatewindow(), which will amend the\n existing dictionary if appropriate */\n ret = updatewindow(strm, dictionary, dictLength, dictLength);\n if (ret) {\n state.mode = MEM;\n return Z_MEM_ERROR;\n }\n state.havedict = 1;\n // Tracev((stderr, \"inflate: dictionary set\\n\"));\n return Z_OK;\n};\n\n\nmodule.exports.inflateReset = inflateReset;\nmodule.exports.inflateReset2 = inflateReset2;\nmodule.exports.inflateResetKeep = inflateResetKeep;\nmodule.exports.inflateInit = inflateInit;\nmodule.exports.inflateInit2 = inflateInit2;\nmodule.exports.inflate = inflate;\nmodule.exports.inflateEnd = inflateEnd;\nmodule.exports.inflateGetHeader = inflateGetHeader;\nmodule.exports.inflateSetDictionary = inflateSetDictionary;\nmodule.exports.inflateInfo = 'pako inflate (from Nodeca project)';\n\n/* Not implemented\nmodule.exports.inflateCopy = inflateCopy;\nmodule.exports.inflateGetDictionary = inflateGetDictionary;\nmodule.exports.inflateMark = inflateMark;\nmodule.exports.inflatePrime = inflatePrime;\nmodule.exports.inflateSync = inflateSync;\nmodule.exports.inflateSyncPoint = inflateSyncPoint;\nmodule.exports.inflateUndermine = inflateUndermine;\n*/\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nconst MAXBITS = 15;\nconst ENOUGH_LENS = 852;\nconst ENOUGH_DISTS = 592;\n//const ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS);\n\nconst CODES = 0;\nconst LENS = 1;\nconst DISTS = 2;\n\nconst lbase = new Uint16Array([ /* Length codes 257..285 base */\n 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,\n 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0\n]);\n\nconst lext = new Uint8Array([ /* Length codes 257..285 extra */\n 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,\n 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78\n]);\n\nconst dbase = new Uint16Array([ /* Distance codes 0..29 base */\n 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,\n 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,\n 8193, 12289, 16385, 24577, 0, 0\n]);\n\nconst dext = new Uint8Array([ /* Distance codes 0..29 extra */\n 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,\n 23, 23, 24, 24, 25, 25, 26, 26, 27, 27,\n 28, 28, 29, 29, 64, 64\n]);\n\nconst inflate_table = (type, lens, lens_index, codes, table, table_index, work, opts) =>\n{\n const bits = opts.bits;\n //here = opts.here; /* table entry for duplication */\n\n let len = 0; /* a code's length in bits */\n let sym = 0; /* index of code symbols */\n let min = 0, max = 0; /* minimum and maximum code lengths */\n let root = 0; /* number of index bits for root table */\n let curr = 0; /* number of index bits for current table */\n let drop = 0; /* code bits to drop for sub-table */\n let left = 0; /* number of prefix codes available */\n let used = 0; /* code entries in table used */\n let huff = 0; /* Huffman code */\n let incr; /* for incrementing code, index */\n let fill; /* index for replicating entries */\n let low; /* low bits for current root entry */\n let mask; /* mask for low root bits */\n let next; /* next available space in table */\n let base = null; /* base value table to use */\n let base_index = 0;\n// let shoextra; /* extra bits table to use */\n let end; /* use base and extra for symbol > end */\n const count = new Uint16Array(MAXBITS + 1); //[MAXBITS+1]; /* number of codes of each length */\n const offs = new Uint16Array(MAXBITS + 1); //[MAXBITS+1]; /* offsets in table for each length */\n let extra = null;\n let extra_index = 0;\n\n let here_bits, here_op, here_val;\n\n /*\n Process a set of code lengths to create a canonical Huffman code. The\n code lengths are lens[0..codes-1]. Each length corresponds to the\n symbols 0..codes-1. The Huffman code is generated by first sorting the\n symbols by length from short to long, and retaining the symbol order\n for codes with equal lengths. Then the code starts with all zero bits\n for the first code of the shortest length, and the codes are integer\n increments for the same length, and zeros are appended as the length\n increases. For the deflate format, these bits are stored backwards\n from their more natural integer increment ordering, and so when the\n decoding tables are built in the large loop below, the integer codes\n are incremented backwards.\n\n This routine assumes, but does not check, that all of the entries in\n lens[] are in the range 0..MAXBITS. The caller must assure this.\n 1..MAXBITS is interpreted as that code length. zero means that that\n symbol does not occur in this code.\n\n The codes are sorted by computing a count of codes for each length,\n creating from that a table of starting indices for each length in the\n sorted table, and then entering the symbols in order in the sorted\n table. The sorted table is work[], with that space being provided by\n the caller.\n\n The length counts are used for other purposes as well, i.e. finding\n the minimum and maximum length codes, determining if there are any\n codes at all, checking for a valid set of lengths, and looking ahead\n at length counts to determine sub-table sizes when building the\n decoding tables.\n */\n\n /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */\n for (len = 0; len <= MAXBITS; len++) {\n count[len] = 0;\n }\n for (sym = 0; sym < codes; sym++) {\n count[lens[lens_index + sym]]++;\n }\n\n /* bound code lengths, force root to be within code lengths */\n root = bits;\n for (max = MAXBITS; max >= 1; max--) {\n if (count[max] !== 0) { break; }\n }\n if (root > max) {\n root = max;\n }\n if (max === 0) { /* no symbols to code at all */\n //table.op[opts.table_index] = 64; //here.op = (var char)64; /* invalid code marker */\n //table.bits[opts.table_index] = 1; //here.bits = (var char)1;\n //table.val[opts.table_index++] = 0; //here.val = (var short)0;\n table[table_index++] = (1 << 24) | (64 << 16) | 0;\n\n\n //table.op[opts.table_index] = 64;\n //table.bits[opts.table_index] = 1;\n //table.val[opts.table_index++] = 0;\n table[table_index++] = (1 << 24) | (64 << 16) | 0;\n\n opts.bits = 1;\n return 0; /* no symbols, but wait for decoding to report error */\n }\n for (min = 1; min < max; min++) {\n if (count[min] !== 0) { break; }\n }\n if (root < min) {\n root = min;\n }\n\n /* check for an over-subscribed or incomplete set of lengths */\n left = 1;\n for (len = 1; len <= MAXBITS; len++) {\n left <<= 1;\n left -= count[len];\n if (left < 0) {\n return -1;\n } /* over-subscribed */\n }\n if (left > 0 && (type === CODES || max !== 1)) {\n return -1; /* incomplete set */\n }\n\n /* generate offsets into symbol table for each length for sorting */\n offs[1] = 0;\n for (len = 1; len < MAXBITS; len++) {\n offs[len + 1] = offs[len] + count[len];\n }\n\n /* sort symbols by length, by symbol order within each length */\n for (sym = 0; sym < codes; sym++) {\n if (lens[lens_index + sym] !== 0) {\n work[offs[lens[lens_index + sym]]++] = sym;\n }\n }\n\n /*\n Create and fill in decoding tables. In this loop, the table being\n filled is at next and has curr index bits. The code being used is huff\n with length len. That code is converted to an index by dropping drop\n bits off of the bottom. For codes where len is less than drop + curr,\n those top drop + curr - len bits are incremented through all values to\n fill the table with replicated entries.\n\n root is the number of index bits for the root table. When len exceeds\n root, sub-tables are created pointed to by the root entry with an index\n of the low root bits of huff. This is saved in low to check for when a\n new sub-table should be started. drop is zero when the root table is\n being filled, and drop is root when sub-tables are being filled.\n\n When a new sub-table is needed, it is necessary to look ahead in the\n code lengths to determine what size sub-table is needed. The length\n counts are used for this, and so count[] is decremented as codes are\n entered in the tables.\n\n used keeps track of how many table entries have been allocated from the\n provided *table space. It is checked for LENS and DIST tables against\n the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in\n the initial root table size constants. See the comments in inftrees.h\n for more information.\n\n sym increments through all symbols, and the loop terminates when\n all codes of length max, i.e. all codes, have been processed. This\n routine permits incomplete codes, so another loop after this one fills\n in the rest of the decoding tables with invalid code markers.\n */\n\n /* set up for code type */\n // poor man optimization - use if-else instead of switch,\n // to avoid deopts in old v8\n if (type === CODES) {\n base = extra = work; /* dummy value--not used */\n end = 19;\n\n } else if (type === LENS) {\n base = lbase;\n base_index -= 257;\n extra = lext;\n extra_index -= 257;\n end = 256;\n\n } else { /* DISTS */\n base = dbase;\n extra = dext;\n end = -1;\n }\n\n /* initialize opts for loop */\n huff = 0; /* starting code */\n sym = 0; /* starting code symbol */\n len = min; /* starting code length */\n next = table_index; /* current table to fill in */\n curr = root; /* current table index bits */\n drop = 0; /* current bits to drop from code for index */\n low = -1; /* trigger new sub-table when len > root */\n used = 1 << root; /* use root table entries */\n mask = used - 1; /* mask for comparing low */\n\n /* check available table space */\n if ((type === LENS && used > ENOUGH_LENS) ||\n (type === DISTS && used > ENOUGH_DISTS)) {\n return 1;\n }\n\n /* process all codes and make table entries */\n for (;;) {\n /* create table entry */\n here_bits = len - drop;\n if (work[sym] < end) {\n here_op = 0;\n here_val = work[sym];\n }\n else if (work[sym] > end) {\n here_op = extra[extra_index + work[sym]];\n here_val = base[base_index + work[sym]];\n }\n else {\n here_op = 32 + 64; /* end of block */\n here_val = 0;\n }\n\n /* replicate for those indices with low len bits equal to huff */\n incr = 1 << (len - drop);\n fill = 1 << curr;\n min = fill; /* save offset to next table */\n do {\n fill -= incr;\n table[next + (huff >> drop) + fill] = (here_bits << 24) | (here_op << 16) | here_val |0;\n } while (fill !== 0);\n\n /* backwards increment the len-bit code huff */\n incr = 1 << (len - 1);\n while (huff & incr) {\n incr >>= 1;\n }\n if (incr !== 0) {\n huff &= incr - 1;\n huff += incr;\n } else {\n huff = 0;\n }\n\n /* go to next symbol, update count, len */\n sym++;\n if (--count[len] === 0) {\n if (len === max) { break; }\n len = lens[lens_index + work[sym]];\n }\n\n /* create new sub-table if needed */\n if (len > root && (huff & mask) !== low) {\n /* if first time, transition to sub-tables */\n if (drop === 0) {\n drop = root;\n }\n\n /* increment past last table */\n next += min; /* here min is 1 << curr */\n\n /* determine length of next table */\n curr = len - drop;\n left = 1 << curr;\n while (curr + drop < max) {\n left -= count[curr + drop];\n if (left <= 0) { break; }\n curr++;\n left <<= 1;\n }\n\n /* check for enough space */\n used += 1 << curr;\n if ((type === LENS && used > ENOUGH_LENS) ||\n (type === DISTS && used > ENOUGH_DISTS)) {\n return 1;\n }\n\n /* point entry in root table to sub-table */\n low = huff & mask;\n /*table.op[low] = curr;\n table.bits[low] = root;\n table.val[low] = next - opts.table_index;*/\n table[low] = (root << 24) | (curr << 16) | (next - table_index) |0;\n }\n }\n\n /* fill in remaining table entry if code is incomplete (guaranteed to have\n at most one remaining entry, since if the code is incomplete, the\n maximum code length that was allowed to get this far is one bit) */\n if (huff !== 0) {\n //table.op[next + huff] = 64; /* invalid code marker */\n //table.bits[next + huff] = len - drop;\n //table.val[next + huff] = 0;\n table[next + huff] = ((len - drop) << 24) | (64 << 16) |0;\n }\n\n /* set return parameters */\n //opts.table_index += used;\n opts.bits = root;\n return 0;\n};\n\n\nmodule.exports = inflate_table;\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nmodule.exports = {\n 2: 'need dictionary', /* Z_NEED_DICT 2 */\n 1: 'stream end', /* Z_STREAM_END 1 */\n 0: '', /* Z_OK 0 */\n '-1': 'file error', /* Z_ERRNO (-1) */\n '-2': 'stream error', /* Z_STREAM_ERROR (-2) */\n '-3': 'data error', /* Z_DATA_ERROR (-3) */\n '-4': 'insufficient memory', /* Z_MEM_ERROR (-4) */\n '-5': 'buffer error', /* Z_BUF_ERROR (-5) */\n '-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */\n};\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\n/* eslint-disable space-unary-ops */\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\n\n//const Z_FILTERED = 1;\n//const Z_HUFFMAN_ONLY = 2;\n//const Z_RLE = 3;\nconst Z_FIXED = 4;\n//const Z_DEFAULT_STRATEGY = 0;\n\n/* Possible values of the data_type field (though see inflate()) */\nconst Z_BINARY = 0;\nconst Z_TEXT = 1;\n//const Z_ASCII = 1; // = Z_TEXT\nconst Z_UNKNOWN = 2;\n\n/*============================================================================*/\n\n\nfunction zero(buf) { let len = buf.length; while (--len >= 0) { buf[len] = 0; } }\n\n// From zutil.h\n\nconst STORED_BLOCK = 0;\nconst STATIC_TREES = 1;\nconst DYN_TREES = 2;\n/* The three kinds of block type */\n\nconst MIN_MATCH = 3;\nconst MAX_MATCH = 258;\n/* The minimum and maximum match lengths */\n\n// From deflate.h\n/* ===========================================================================\n * Internal compression state.\n */\n\nconst LENGTH_CODES = 29;\n/* number of length codes, not counting the special END_BLOCK code */\n\nconst LITERALS = 256;\n/* number of literal bytes 0..255 */\n\nconst L_CODES = LITERALS + 1 + LENGTH_CODES;\n/* number of Literal or Length codes, including the END_BLOCK code */\n\nconst D_CODES = 30;\n/* number of distance codes */\n\nconst BL_CODES = 19;\n/* number of codes used to transfer the bit lengths */\n\nconst HEAP_SIZE = 2 * L_CODES + 1;\n/* maximum heap size */\n\nconst MAX_BITS = 15;\n/* All codes must not exceed MAX_BITS bits */\n\nconst Buf_size = 16;\n/* size of bit buffer in bi_buf */\n\n\n/* ===========================================================================\n * Constants\n */\n\nconst MAX_BL_BITS = 7;\n/* Bit length codes must not exceed MAX_BL_BITS bits */\n\nconst END_BLOCK = 256;\n/* end of block literal code */\n\nconst REP_3_6 = 16;\n/* repeat previous bit length 3-6 times (2 bits of repeat count) */\n\nconst REPZ_3_10 = 17;\n/* repeat a zero length 3-10 times (3 bits of repeat count) */\n\nconst REPZ_11_138 = 18;\n/* repeat a zero length 11-138 times (7 bits of repeat count) */\n\n/* eslint-disable comma-spacing,array-bracket-spacing */\nconst extra_lbits = /* extra bits for each length code */\n new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]);\n\nconst extra_dbits = /* extra bits for each distance code */\n new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]);\n\nconst extra_blbits = /* extra bits for each bit length code */\n new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]);\n\nconst bl_order =\n new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);\n/* eslint-enable comma-spacing,array-bracket-spacing */\n\n/* The lengths of the bit length codes are sent in order of decreasing\n * probability, to avoid transmitting the lengths for unused bit length codes.\n */\n\n/* ===========================================================================\n * Local data. These are initialized only once.\n */\n\n// We pre-fill arrays with 0 to avoid uninitialized gaps\n\nconst DIST_CODE_LEN = 512; /* see definition of array dist_code below */\n\n// !!!! Use flat array instead of structure, Freq = i*2, Len = i*2+1\nconst static_ltree = new Array((L_CODES + 2) * 2);\nzero(static_ltree);\n/* The static literal tree. Since the bit lengths are imposed, there is no\n * need for the L_CODES extra codes used during heap construction. However\n * The codes 286 and 287 are needed to build a canonical tree (see _tr_init\n * below).\n */\n\nconst static_dtree = new Array(D_CODES * 2);\nzero(static_dtree);\n/* The static distance tree. (Actually a trivial tree since all codes use\n * 5 bits.)\n */\n\nconst _dist_code = new Array(DIST_CODE_LEN);\nzero(_dist_code);\n/* Distance codes. The first 256 values correspond to the distances\n * 3 .. 258, the last 256 values correspond to the top 8 bits of\n * the 15 bit distances.\n */\n\nconst _length_code = new Array(MAX_MATCH - MIN_MATCH + 1);\nzero(_length_code);\n/* length code for each normalized match length (0 == MIN_MATCH) */\n\nconst base_length = new Array(LENGTH_CODES);\nzero(base_length);\n/* First normalized length for each code (0 = MIN_MATCH) */\n\nconst base_dist = new Array(D_CODES);\nzero(base_dist);\n/* First normalized distance for each code (0 = distance of 1) */\n\n\nfunction StaticTreeDesc(static_tree, extra_bits, extra_base, elems, max_length) {\n\n this.static_tree = static_tree; /* static tree or NULL */\n this.extra_bits = extra_bits; /* extra bits for each code or NULL */\n this.extra_base = extra_base; /* base index for extra_bits */\n this.elems = elems; /* max number of elements in the tree */\n this.max_length = max_length; /* max bit length for the codes */\n\n // show if `static_tree` has data or dummy - needed for monomorphic objects\n this.has_stree = static_tree && static_tree.length;\n}\n\n\nlet static_l_desc;\nlet static_d_desc;\nlet static_bl_desc;\n\n\nfunction TreeDesc(dyn_tree, stat_desc) {\n this.dyn_tree = dyn_tree; /* the dynamic tree */\n this.max_code = 0; /* largest code with non zero frequency */\n this.stat_desc = stat_desc; /* the corresponding static tree */\n}\n\n\n\nconst d_code = (dist) => {\n\n return dist < 256 ? _dist_code[dist] : _dist_code[256 + (dist >>> 7)];\n};\n\n\n/* ===========================================================================\n * Output a short LSB first on the stream.\n * IN assertion: there is enough room in pendingBuf.\n */\nconst put_short = (s, w) => {\n// put_byte(s, (uch)((w) & 0xff));\n// put_byte(s, (uch)((ush)(w) >> 8));\n s.pending_buf[s.pending++] = (w) & 0xff;\n s.pending_buf[s.pending++] = (w >>> 8) & 0xff;\n};\n\n\n/* ===========================================================================\n * Send a value on a given number of bits.\n * IN assertion: length <= 16 and value fits in length bits.\n */\nconst send_bits = (s, value, length) => {\n\n if (s.bi_valid > (Buf_size - length)) {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n put_short(s, s.bi_buf);\n s.bi_buf = value >> (Buf_size - s.bi_valid);\n s.bi_valid += length - Buf_size;\n } else {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n s.bi_valid += length;\n }\n};\n\n\nconst send_code = (s, c, tree) => {\n\n send_bits(s, tree[c * 2]/*.Code*/, tree[c * 2 + 1]/*.Len*/);\n};\n\n\n/* ===========================================================================\n * Reverse the first len bits of a code, using straightforward code (a faster\n * method would use a table)\n * IN assertion: 1 <= len <= 15\n */\nconst bi_reverse = (code, len) => {\n\n let res = 0;\n do {\n res |= code & 1;\n code >>>= 1;\n res <<= 1;\n } while (--len > 0);\n return res >>> 1;\n};\n\n\n/* ===========================================================================\n * Flush the bit buffer, keeping at most 7 bits in it.\n */\nconst bi_flush = (s) => {\n\n if (s.bi_valid === 16) {\n put_short(s, s.bi_buf);\n s.bi_buf = 0;\n s.bi_valid = 0;\n\n } else if (s.bi_valid >= 8) {\n s.pending_buf[s.pending++] = s.bi_buf & 0xff;\n s.bi_buf >>= 8;\n s.bi_valid -= 8;\n }\n};\n\n\n/* ===========================================================================\n * Compute the optimal bit lengths for a tree and update the total bit length\n * for the current block.\n * IN assertion: the fields freq and dad are set, heap[heap_max] and\n * above are the tree nodes sorted by increasing frequency.\n * OUT assertions: the field len is set to the optimal bit length, the\n * array bl_count contains the frequencies for each bit length.\n * The length opt_len is updated; static_len is also updated if stree is\n * not null.\n */\nconst gen_bitlen = (s, desc) =>\n// deflate_state *s;\n// tree_desc *desc; /* the tree descriptor */\n{\n const tree = desc.dyn_tree;\n const max_code = desc.max_code;\n const stree = desc.stat_desc.static_tree;\n const has_stree = desc.stat_desc.has_stree;\n const extra = desc.stat_desc.extra_bits;\n const base = desc.stat_desc.extra_base;\n const max_length = desc.stat_desc.max_length;\n let h; /* heap index */\n let n, m; /* iterate over the tree elements */\n let bits; /* bit length */\n let xbits; /* extra bits */\n let f; /* frequency */\n let overflow = 0; /* number of elements with bit length too large */\n\n for (bits = 0; bits <= MAX_BITS; bits++) {\n s.bl_count[bits] = 0;\n }\n\n /* In a first pass, compute the optimal bit lengths (which may\n * overflow in the case of the bit length tree).\n */\n tree[s.heap[s.heap_max] * 2 + 1]/*.Len*/ = 0; /* root of the heap */\n\n for (h = s.heap_max + 1; h < HEAP_SIZE; h++) {\n n = s.heap[h];\n bits = tree[tree[n * 2 + 1]/*.Dad*/ * 2 + 1]/*.Len*/ + 1;\n if (bits > max_length) {\n bits = max_length;\n overflow++;\n }\n tree[n * 2 + 1]/*.Len*/ = bits;\n /* We overwrite tree[n].Dad which is no longer needed */\n\n if (n > max_code) { continue; } /* not a leaf node */\n\n s.bl_count[bits]++;\n xbits = 0;\n if (n >= base) {\n xbits = extra[n - base];\n }\n f = tree[n * 2]/*.Freq*/;\n s.opt_len += f * (bits + xbits);\n if (has_stree) {\n s.static_len += f * (stree[n * 2 + 1]/*.Len*/ + xbits);\n }\n }\n if (overflow === 0) { return; }\n\n // Trace((stderr,\"\\nbit length overflow\\n\"));\n /* This happens for example on obj2 and pic of the Calgary corpus */\n\n /* Find the first bit length which could increase: */\n do {\n bits = max_length - 1;\n while (s.bl_count[bits] === 0) { bits--; }\n s.bl_count[bits]--; /* move one leaf down the tree */\n s.bl_count[bits + 1] += 2; /* move one overflow item as its brother */\n s.bl_count[max_length]--;\n /* The brother of the overflow item also moves one step up,\n * but this does not affect bl_count[max_length]\n */\n overflow -= 2;\n } while (overflow > 0);\n\n /* Now recompute all bit lengths, scanning in increasing frequency.\n * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all\n * lengths instead of fixing only the wrong ones. This idea is taken\n * from 'ar' written by Haruhiko Okumura.)\n */\n for (bits = max_length; bits !== 0; bits--) {\n n = s.bl_count[bits];\n while (n !== 0) {\n m = s.heap[--h];\n if (m > max_code) { continue; }\n if (tree[m * 2 + 1]/*.Len*/ !== bits) {\n // Trace((stderr,\"code %d bits %d->%d\\n\", m, tree[m].Len, bits));\n s.opt_len += (bits - tree[m * 2 + 1]/*.Len*/) * tree[m * 2]/*.Freq*/;\n tree[m * 2 + 1]/*.Len*/ = bits;\n }\n n--;\n }\n }\n};\n\n\n/* ===========================================================================\n * Generate the codes for a given tree and bit counts (which need not be\n * optimal).\n * IN assertion: the array bl_count contains the bit length statistics for\n * the given tree and the field len is set for all tree elements.\n * OUT assertion: the field code is set for all tree elements of non\n * zero code length.\n */\nconst gen_codes = (tree, max_code, bl_count) =>\n// ct_data *tree; /* the tree to decorate */\n// int max_code; /* largest code with non zero frequency */\n// ushf *bl_count; /* number of codes at each bit length */\n{\n const next_code = new Array(MAX_BITS + 1); /* next code value for each bit length */\n let code = 0; /* running code value */\n let bits; /* bit index */\n let n; /* code index */\n\n /* The distribution counts are first used to generate the code values\n * without bit reversal.\n */\n for (bits = 1; bits <= MAX_BITS; bits++) {\n next_code[bits] = code = (code + bl_count[bits - 1]) << 1;\n }\n /* Check that the bit counts in bl_count are consistent. The last code\n * must be all ones.\n */\n //Assert (code + bl_count[MAX_BITS]-1 == (1<<MAX_BITS)-1,\n // \"inconsistent bit counts\");\n //Tracev((stderr,\"\\ngen_codes: max_code %d \", max_code));\n\n for (n = 0; n <= max_code; n++) {\n let len = tree[n * 2 + 1]/*.Len*/;\n if (len === 0) { continue; }\n /* Now reverse the bits */\n tree[n * 2]/*.Code*/ = bi_reverse(next_code[len]++, len);\n\n //Tracecv(tree != static_ltree, (stderr,\"\\nn %3d %c l %2d c %4x (%x) \",\n // n, (isgraph(n) ? n : ' '), len, tree[n].Code, next_code[len]-1));\n }\n};\n\n\n/* ===========================================================================\n * Initialize the various 'constant' tables.\n */\nconst tr_static_init = () => {\n\n let n; /* iterates over tree elements */\n let bits; /* bit counter */\n let length; /* length value */\n let code; /* code value */\n let dist; /* distance index */\n const bl_count = new Array(MAX_BITS + 1);\n /* number of codes at each bit length for an optimal tree */\n\n // do check in _tr_init()\n //if (static_init_done) return;\n\n /* For some embedded targets, global variables are not initialized: */\n/*#ifdef NO_INIT_GLOBAL_POINTERS\n static_l_desc.static_tree = static_ltree;\n static_l_desc.extra_bits = extra_lbits;\n static_d_desc.static_tree = static_dtree;\n static_d_desc.extra_bits = extra_dbits;\n static_bl_desc.extra_bits = extra_blbits;\n#endif*/\n\n /* Initialize the mapping length (0..255) -> length code (0..28) */\n length = 0;\n for (code = 0; code < LENGTH_CODES - 1; code++) {\n base_length[code] = length;\n for (n = 0; n < (1 << extra_lbits[code]); n++) {\n _length_code[length++] = code;\n }\n }\n //Assert (length == 256, \"tr_static_init: length != 256\");\n /* Note that the length 255 (match length 258) can be represented\n * in two different ways: code 284 + 5 bits or code 285, so we\n * overwrite length_code[255] to use the best encoding:\n */\n _length_code[length - 1] = code;\n\n /* Initialize the mapping dist (0..32K) -> dist code (0..29) */\n dist = 0;\n for (code = 0; code < 16; code++) {\n base_dist[code] = dist;\n for (n = 0; n < (1 << extra_dbits[code]); n++) {\n _dist_code[dist++] = code;\n }\n }\n //Assert (dist == 256, \"tr_static_init: dist != 256\");\n dist >>= 7; /* from now on, all distances are divided by 128 */\n for (; code < D_CODES; code++) {\n base_dist[code] = dist << 7;\n for (n = 0; n < (1 << (extra_dbits[code] - 7)); n++) {\n _dist_code[256 + dist++] = code;\n }\n }\n //Assert (dist == 256, \"tr_static_init: 256+dist != 512\");\n\n /* Construct the codes of the static literal tree */\n for (bits = 0; bits <= MAX_BITS; bits++) {\n bl_count[bits] = 0;\n }\n\n n = 0;\n while (n <= 143) {\n static_ltree[n * 2 + 1]/*.Len*/ = 8;\n n++;\n bl_count[8]++;\n }\n while (n <= 255) {\n static_ltree[n * 2 + 1]/*.Len*/ = 9;\n n++;\n bl_count[9]++;\n }\n while (n <= 279) {\n static_ltree[n * 2 + 1]/*.Len*/ = 7;\n n++;\n bl_count[7]++;\n }\n while (n <= 287) {\n static_ltree[n * 2 + 1]/*.Len*/ = 8;\n n++;\n bl_count[8]++;\n }\n /* Codes 286 and 287 do not exist, but we must include them in the\n * tree construction to get a canonical Huffman tree (longest code\n * all ones)\n */\n gen_codes(static_ltree, L_CODES + 1, bl_count);\n\n /* The static distance tree is trivial: */\n for (n = 0; n < D_CODES; n++) {\n static_dtree[n * 2 + 1]/*.Len*/ = 5;\n static_dtree[n * 2]/*.Code*/ = bi_reverse(n, 5);\n }\n\n // Now data ready and we can init static trees\n static_l_desc = new StaticTreeDesc(static_ltree, extra_lbits, LITERALS + 1, L_CODES, MAX_BITS);\n static_d_desc = new StaticTreeDesc(static_dtree, extra_dbits, 0, D_CODES, MAX_BITS);\n static_bl_desc = new StaticTreeDesc(new Array(0), extra_blbits, 0, BL_CODES, MAX_BL_BITS);\n\n //static_init_done = true;\n};\n\n\n/* ===========================================================================\n * Initialize a new block.\n */\nconst init_block = (s) => {\n\n let n; /* iterates over tree elements */\n\n /* Initialize the trees. */\n for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < BL_CODES; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; }\n\n s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1;\n s.opt_len = s.static_len = 0;\n s.last_lit = s.matches = 0;\n};\n\n\n/* ===========================================================================\n * Flush the bit buffer and align the output on a byte boundary\n */\nconst bi_windup = (s) =>\n{\n if (s.bi_valid > 8) {\n put_short(s, s.bi_buf);\n } else if (s.bi_valid > 0) {\n //put_byte(s, (Byte)s->bi_buf);\n s.pending_buf[s.pending++] = s.bi_buf;\n }\n s.bi_buf = 0;\n s.bi_valid = 0;\n};\n\n/* ===========================================================================\n * Copy a stored block, storing first the length and its\n * one's complement if requested.\n */\nconst copy_block = (s, buf, len, header) =>\n//DeflateState *s;\n//charf *buf; /* the input data */\n//unsigned len; /* its length */\n//int header; /* true if block header must be written */\n{\n bi_windup(s); /* align on byte boundary */\n\n if (header) {\n put_short(s, len);\n put_short(s, ~len);\n }\n// while (len--) {\n// put_byte(s, *buf++);\n// }\n s.pending_buf.set(s.window.subarray(buf, buf + len), s.pending);\n s.pending += len;\n};\n\n/* ===========================================================================\n * Compares to subtrees, using the tree depth as tie breaker when\n * the subtrees have equal frequency. This minimizes the worst case length.\n */\nconst smaller = (tree, n, m, depth) => {\n\n const _n2 = n * 2;\n const _m2 = m * 2;\n return (tree[_n2]/*.Freq*/ < tree[_m2]/*.Freq*/ ||\n (tree[_n2]/*.Freq*/ === tree[_m2]/*.Freq*/ && depth[n] <= depth[m]));\n};\n\n/* ===========================================================================\n * Restore the heap property by moving down the tree starting at node k,\n * exchanging a node with the smallest of its two sons if necessary, stopping\n * when the heap property is re-established (each father smaller than its\n * two sons).\n */\nconst pqdownheap = (s, tree, k) =>\n// deflate_state *s;\n// ct_data *tree; /* the tree to restore */\n// int k; /* node to move down */\n{\n const v = s.heap[k];\n let j = k << 1; /* left son of k */\n while (j <= s.heap_len) {\n /* Set j to the smallest of the two sons: */\n if (j < s.heap_len &&\n smaller(tree, s.heap[j + 1], s.heap[j], s.depth)) {\n j++;\n }\n /* Exit if v is smaller than both sons */\n if (smaller(tree, v, s.heap[j], s.depth)) { break; }\n\n /* Exchange v with the smallest son */\n s.heap[k] = s.heap[j];\n k = j;\n\n /* And continue down the tree, setting j to the left son of k */\n j <<= 1;\n }\n s.heap[k] = v;\n};\n\n\n// inlined manually\n// const SMALLEST = 1;\n\n/* ===========================================================================\n * Send the block data compressed using the given Huffman trees\n */\nconst compress_block = (s, ltree, dtree) =>\n// deflate_state *s;\n// const ct_data *ltree; /* literal tree */\n// const ct_data *dtree; /* distance tree */\n{\n let dist; /* distance of matched string */\n let lc; /* match length or unmatched char (if dist == 0) */\n let lx = 0; /* running index in l_buf */\n let code; /* the code to send */\n let extra; /* number of extra bits to send */\n\n if (s.last_lit !== 0) {\n do {\n dist = (s.pending_buf[s.d_buf + lx * 2] << 8) | (s.pending_buf[s.d_buf + lx * 2 + 1]);\n lc = s.pending_buf[s.l_buf + lx];\n lx++;\n\n if (dist === 0) {\n send_code(s, lc, ltree); /* send a literal byte */\n //Tracecv(isgraph(lc), (stderr,\" '%c' \", lc));\n } else {\n /* Here, lc is the match length - MIN_MATCH */\n code = _length_code[lc];\n send_code(s, code + LITERALS + 1, ltree); /* send the length code */\n extra = extra_lbits[code];\n if (extra !== 0) {\n lc -= base_length[code];\n send_bits(s, lc, extra); /* send the extra length bits */\n }\n dist--; /* dist is now the match distance - 1 */\n code = d_code(dist);\n //Assert (code < D_CODES, \"bad d_code\");\n\n send_code(s, code, dtree); /* send the distance code */\n extra = extra_dbits[code];\n if (extra !== 0) {\n dist -= base_dist[code];\n send_bits(s, dist, extra); /* send the extra distance bits */\n }\n } /* literal or match pair ? */\n\n /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */\n //Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx,\n // \"pendingBuf overflow\");\n\n } while (lx < s.last_lit);\n }\n\n send_code(s, END_BLOCK, ltree);\n};\n\n\n/* ===========================================================================\n * Construct one Huffman tree and assigns the code bit strings and lengths.\n * Update the total bit length for the current block.\n * IN assertion: the field freq is set for all tree elements.\n * OUT assertions: the fields len and code are set to the optimal bit length\n * and corresponding code. The length opt_len is updated; static_len is\n * also updated if stree is not null. The field max_code is set.\n */\nconst build_tree = (s, desc) =>\n// deflate_state *s;\n// tree_desc *desc; /* the tree descriptor */\n{\n const tree = desc.dyn_tree;\n const stree = desc.stat_desc.static_tree;\n const has_stree = desc.stat_desc.has_stree;\n const elems = desc.stat_desc.elems;\n let n, m; /* iterate over heap elements */\n let max_code = -1; /* largest code with non zero frequency */\n let node; /* new node being created */\n\n /* Construct the initial heap, with least frequent element in\n * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1].\n * heap[0] is not used.\n */\n s.heap_len = 0;\n s.heap_max = HEAP_SIZE;\n\n for (n = 0; n < elems; n++) {\n if (tree[n * 2]/*.Freq*/ !== 0) {\n s.heap[++s.heap_len] = max_code = n;\n s.depth[n] = 0;\n\n } else {\n tree[n * 2 + 1]/*.Len*/ = 0;\n }\n }\n\n /* The pkzip format requires that at least one distance code exists,\n * and that at least one bit should be sent even if there is only one\n * possible code. So to avoid special checks later on we force at least\n * two codes of non zero frequency.\n */\n while (s.heap_len < 2) {\n node = s.heap[++s.heap_len] = (max_code < 2 ? ++max_code : 0);\n tree[node * 2]/*.Freq*/ = 1;\n s.depth[node] = 0;\n s.opt_len--;\n\n if (has_stree) {\n s.static_len -= stree[node * 2 + 1]/*.Len*/;\n }\n /* node is 0 or 1 so it does not have extra bits */\n }\n desc.max_code = max_code;\n\n /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree,\n * establish sub-heaps of increasing lengths:\n */\n for (n = (s.heap_len >> 1/*int /2*/); n >= 1; n--) { pqdownheap(s, tree, n); }\n\n /* Construct the Huffman tree by repeatedly combining the least two\n * frequent nodes.\n */\n node = elems; /* next internal node of the tree */\n do {\n //pqremove(s, tree, n); /* n = node of least frequency */\n /*** pqremove ***/\n n = s.heap[1/*SMALLEST*/];\n s.heap[1/*SMALLEST*/] = s.heap[s.heap_len--];\n pqdownheap(s, tree, 1/*SMALLEST*/);\n /***/\n\n m = s.heap[1/*SMALLEST*/]; /* m = node of next least frequency */\n\n s.heap[--s.heap_max] = n; /* keep the nodes sorted by frequency */\n s.heap[--s.heap_max] = m;\n\n /* Create a new node father of n and m */\n tree[node * 2]/*.Freq*/ = tree[n * 2]/*.Freq*/ + tree[m * 2]/*.Freq*/;\n s.depth[node] = (s.depth[n] >= s.depth[m] ? s.depth[n] : s.depth[m]) + 1;\n tree[n * 2 + 1]/*.Dad*/ = tree[m * 2 + 1]/*.Dad*/ = node;\n\n /* and insert the new node in the heap */\n s.heap[1/*SMALLEST*/] = node++;\n pqdownheap(s, tree, 1/*SMALLEST*/);\n\n } while (s.heap_len >= 2);\n\n s.heap[--s.heap_max] = s.heap[1/*SMALLEST*/];\n\n /* At this point, the fields freq and dad are set. We can now\n * generate the bit lengths.\n */\n gen_bitlen(s, desc);\n\n /* The field len is now set, we can generate the bit codes */\n gen_codes(tree, max_code, s.bl_count);\n};\n\n\n/* ===========================================================================\n * Scan a literal or distance tree to determine the frequencies of the codes\n * in the bit length tree.\n */\nconst scan_tree = (s, tree, max_code) =>\n// deflate_state *s;\n// ct_data *tree; /* the tree to be scanned */\n// int max_code; /* and its largest code of non zero frequency */\n{\n let n; /* iterates over all tree elements */\n let prevlen = -1; /* last emitted length */\n let curlen; /* length of current code */\n\n let nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */\n\n let count = 0; /* repeat count of the current code */\n let max_count = 7; /* max repeat count */\n let min_count = 4; /* min repeat count */\n\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n }\n tree[(max_code + 1) * 2 + 1]/*.Len*/ = 0xffff; /* guard */\n\n for (n = 0; n <= max_code; n++) {\n curlen = nextlen;\n nextlen = tree[(n + 1) * 2 + 1]/*.Len*/;\n\n if (++count < max_count && curlen === nextlen) {\n continue;\n\n } else if (count < min_count) {\n s.bl_tree[curlen * 2]/*.Freq*/ += count;\n\n } else if (curlen !== 0) {\n\n if (curlen !== prevlen) { s.bl_tree[curlen * 2]/*.Freq*/++; }\n s.bl_tree[REP_3_6 * 2]/*.Freq*/++;\n\n } else if (count <= 10) {\n s.bl_tree[REPZ_3_10 * 2]/*.Freq*/++;\n\n } else {\n s.bl_tree[REPZ_11_138 * 2]/*.Freq*/++;\n }\n\n count = 0;\n prevlen = curlen;\n\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n\n } else if (curlen === nextlen) {\n max_count = 6;\n min_count = 3;\n\n } else {\n max_count = 7;\n min_count = 4;\n }\n }\n};\n\n\n/* ===========================================================================\n * Send a literal or distance tree in compressed form, using the codes in\n * bl_tree.\n */\nconst send_tree = (s, tree, max_code) =>\n// deflate_state *s;\n// ct_data *tree; /* the tree to be scanned */\n// int max_code; /* and its largest code of non zero frequency */\n{\n let n; /* iterates over all tree elements */\n let prevlen = -1; /* last emitted length */\n let curlen; /* length of current code */\n\n let nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */\n\n let count = 0; /* repeat count of the current code */\n let max_count = 7; /* max repeat count */\n let min_count = 4; /* min repeat count */\n\n /* tree[max_code+1].Len = -1; */ /* guard already set */\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n }\n\n for (n = 0; n <= max_code; n++) {\n curlen = nextlen;\n nextlen = tree[(n + 1) * 2 + 1]/*.Len*/;\n\n if (++count < max_count && curlen === nextlen) {\n continue;\n\n } else if (count < min_count) {\n do { send_code(s, curlen, s.bl_tree); } while (--count !== 0);\n\n } else if (curlen !== 0) {\n if (curlen !== prevlen) {\n send_code(s, curlen, s.bl_tree);\n count--;\n }\n //Assert(count >= 3 && count <= 6, \" 3_6?\");\n send_code(s, REP_3_6, s.bl_tree);\n send_bits(s, count - 3, 2);\n\n } else if (count <= 10) {\n send_code(s, REPZ_3_10, s.bl_tree);\n send_bits(s, count - 3, 3);\n\n } else {\n send_code(s, REPZ_11_138, s.bl_tree);\n send_bits(s, count - 11, 7);\n }\n\n count = 0;\n prevlen = curlen;\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n\n } else if (curlen === nextlen) {\n max_count = 6;\n min_count = 3;\n\n } else {\n max_count = 7;\n min_count = 4;\n }\n }\n};\n\n\n/* ===========================================================================\n * Construct the Huffman tree for the bit lengths and return the index in\n * bl_order of the last bit length code to send.\n */\nconst build_bl_tree = (s) => {\n\n let max_blindex; /* index of last bit length code of non zero freq */\n\n /* Determine the bit length frequencies for literal and distance trees */\n scan_tree(s, s.dyn_ltree, s.l_desc.max_code);\n scan_tree(s, s.dyn_dtree, s.d_desc.max_code);\n\n /* Build the bit length tree: */\n build_tree(s, s.bl_desc);\n /* opt_len now includes the length of the tree representations, except\n * the lengths of the bit lengths codes and the 5+5+4 bits for the counts.\n */\n\n /* Determine the number of bit length codes to send. The pkzip format\n * requires that at least 4 bit length codes be sent. (appnote.txt says\n * 3 but the actual value used is 4.)\n */\n for (max_blindex = BL_CODES - 1; max_blindex >= 3; max_blindex--) {\n if (s.bl_tree[bl_order[max_blindex] * 2 + 1]/*.Len*/ !== 0) {\n break;\n }\n }\n /* Update opt_len to include the bit length tree and counts */\n s.opt_len += 3 * (max_blindex + 1) + 5 + 5 + 4;\n //Tracev((stderr, \"\\ndyn trees: dyn %ld, stat %ld\",\n // s->opt_len, s->static_len));\n\n return max_blindex;\n};\n\n\n/* ===========================================================================\n * Send the header for a block using dynamic Huffman trees: the counts, the\n * lengths of the bit length codes, the literal tree and the distance tree.\n * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.\n */\nconst send_all_trees = (s, lcodes, dcodes, blcodes) =>\n// deflate_state *s;\n// int lcodes, dcodes, blcodes; /* number of codes for each tree */\n{\n let rank; /* index in bl_order */\n\n //Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, \"not enough codes\");\n //Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES,\n // \"too many codes\");\n //Tracev((stderr, \"\\nbl counts: \"));\n send_bits(s, lcodes - 257, 5); /* not +255 as stated in appnote.txt */\n send_bits(s, dcodes - 1, 5);\n send_bits(s, blcodes - 4, 4); /* not -3 as stated in appnote.txt */\n for (rank = 0; rank < blcodes; rank++) {\n //Tracev((stderr, \"\\nbl code %2d \", bl_order[rank]));\n send_bits(s, s.bl_tree[bl_order[rank] * 2 + 1]/*.Len*/, 3);\n }\n //Tracev((stderr, \"\\nbl tree: sent %ld\", s->bits_sent));\n\n send_tree(s, s.dyn_ltree, lcodes - 1); /* literal tree */\n //Tracev((stderr, \"\\nlit tree: sent %ld\", s->bits_sent));\n\n send_tree(s, s.dyn_dtree, dcodes - 1); /* distance tree */\n //Tracev((stderr, \"\\ndist tree: sent %ld\", s->bits_sent));\n};\n\n\n/* ===========================================================================\n * Check if the data type is TEXT or BINARY, using the following algorithm:\n * - TEXT if the two conditions below are satisfied:\n * a) There are no non-portable control characters belonging to the\n * \"black list\" (0..6, 14..25, 28..31).\n * b) There is at least one printable character belonging to the\n * \"white list\" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255).\n * - BINARY otherwise.\n * - The following partially-portable control characters form a\n * \"gray list\" that is ignored in this detection algorithm:\n * (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}).\n * IN assertion: the fields Freq of dyn_ltree are set.\n */\nconst detect_data_type = (s) => {\n /* black_mask is the bit mask of black-listed bytes\n * set bits 0..6, 14..25, and 28..31\n * 0xf3ffc07f = binary 11110011111111111100000001111111\n */\n let black_mask = 0xf3ffc07f;\n let n;\n\n /* Check for non-textual (\"black-listed\") bytes. */\n for (n = 0; n <= 31; n++, black_mask >>>= 1) {\n if ((black_mask & 1) && (s.dyn_ltree[n * 2]/*.Freq*/ !== 0)) {\n return Z_BINARY;\n }\n }\n\n /* Check for textual (\"white-listed\") bytes. */\n if (s.dyn_ltree[9 * 2]/*.Freq*/ !== 0 || s.dyn_ltree[10 * 2]/*.Freq*/ !== 0 ||\n s.dyn_ltree[13 * 2]/*.Freq*/ !== 0) {\n return Z_TEXT;\n }\n for (n = 32; n < LITERALS; n++) {\n if (s.dyn_ltree[n * 2]/*.Freq*/ !== 0) {\n return Z_TEXT;\n }\n }\n\n /* There are no \"black-listed\" or \"white-listed\" bytes:\n * this stream either is empty or has tolerated (\"gray-listed\") bytes only.\n */\n return Z_BINARY;\n};\n\n\nlet static_init_done = false;\n\n/* ===========================================================================\n * Initialize the tree data structures for a new zlib stream.\n */\nconst _tr_init = (s) =>\n{\n\n if (!static_init_done) {\n tr_static_init();\n static_init_done = true;\n }\n\n s.l_desc = new TreeDesc(s.dyn_ltree, static_l_desc);\n s.d_desc = new TreeDesc(s.dyn_dtree, static_d_desc);\n s.bl_desc = new TreeDesc(s.bl_tree, static_bl_desc);\n\n s.bi_buf = 0;\n s.bi_valid = 0;\n\n /* Initialize the first block of the first file: */\n init_block(s);\n};\n\n\n/* ===========================================================================\n * Send a stored block\n */\nconst _tr_stored_block = (s, buf, stored_len, last) =>\n//DeflateState *s;\n//charf *buf; /* input block */\n//ulg stored_len; /* length of input block */\n//int last; /* one if this is the last block for a file */\n{\n send_bits(s, (STORED_BLOCK << 1) + (last ? 1 : 0), 3); /* send block type */\n copy_block(s, buf, stored_len, true); /* with header */\n};\n\n\n/* ===========================================================================\n * Send one empty static block to give enough lookahead for inflate.\n * This takes 10 bits, of which 7 may remain in the bit buffer.\n */\nconst _tr_align = (s) => {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n};\n\n\n/* ===========================================================================\n * Determine the best encoding for the current block: dynamic trees, static\n * trees or store, and output the encoded block to the zip file.\n */\nconst _tr_flush_block = (s, buf, stored_len, last) =>\n//DeflateState *s;\n//charf *buf; /* input block, or NULL if too old */\n//ulg stored_len; /* length of input block */\n//int last; /* one if this is the last block for a file */\n{\n let opt_lenb, static_lenb; /* opt_len and static_len in bytes */\n let max_blindex = 0; /* index of last bit length code of non zero freq */\n\n /* Build the Huffman trees unless a stored block is forced */\n if (s.level > 0) {\n\n /* Check if the file is binary or text */\n if (s.strm.data_type === Z_UNKNOWN) {\n s.strm.data_type = detect_data_type(s);\n }\n\n /* Construct the literal and distance trees */\n build_tree(s, s.l_desc);\n // Tracev((stderr, \"\\nlit data: dyn %ld, stat %ld\", s->opt_len,\n // s->static_len));\n\n build_tree(s, s.d_desc);\n // Tracev((stderr, \"\\ndist data: dyn %ld, stat %ld\", s->opt_len,\n // s->static_len));\n /* At this point, opt_len and static_len are the total bit lengths of\n * the compressed block data, excluding the tree representations.\n */\n\n /* Build the bit length tree for the above two trees, and get the index\n * in bl_order of the last bit length code to send.\n */\n max_blindex = build_bl_tree(s);\n\n /* Determine the best encoding. Compute the block lengths in bytes. */\n opt_lenb = (s.opt_len + 3 + 7) >>> 3;\n static_lenb = (s.static_len + 3 + 7) >>> 3;\n\n // Tracev((stderr, \"\\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u \",\n // opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,\n // s->last_lit));\n\n if (static_lenb <= opt_lenb) { opt_lenb = static_lenb; }\n\n } else {\n // Assert(buf != (char*)0, \"lost buf\");\n opt_lenb = static_lenb = stored_len + 5; /* force a stored block */\n }\n\n if ((stored_len + 4 <= opt_lenb) && (buf !== -1)) {\n /* 4: two words for the lengths */\n\n /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE.\n * Otherwise we can't have processed more than WSIZE input bytes since\n * the last block flush, because compression would have been\n * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to\n * transform a block into a stored block.\n */\n _tr_stored_block(s, buf, stored_len, last);\n\n } else if (s.strategy === Z_FIXED || static_lenb === opt_lenb) {\n\n send_bits(s, (STATIC_TREES << 1) + (last ? 1 : 0), 3);\n compress_block(s, static_ltree, static_dtree);\n\n } else {\n send_bits(s, (DYN_TREES << 1) + (last ? 1 : 0), 3);\n send_all_trees(s, s.l_desc.max_code + 1, s.d_desc.max_code + 1, max_blindex + 1);\n compress_block(s, s.dyn_ltree, s.dyn_dtree);\n }\n // Assert (s->compressed_len == s->bits_sent, \"bad compressed size\");\n /* The above check is made mod 2^32, for files larger than 512 MB\n * and uLong implemented on 32 bits.\n */\n init_block(s);\n\n if (last) {\n bi_windup(s);\n }\n // Tracev((stderr,\"\\ncomprlen %lu(%lu) \", s->compressed_len>>3,\n // s->compressed_len-7*last));\n};\n\n/* ===========================================================================\n * Save the match info and tally the frequency counts. Return true if\n * the current block must be flushed.\n */\nconst _tr_tally = (s, dist, lc) =>\n// deflate_state *s;\n// unsigned dist; /* distance of matched string */\n// unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */\n{\n //let out_length, in_length, dcode;\n\n s.pending_buf[s.d_buf + s.last_lit * 2] = (dist >>> 8) & 0xff;\n s.pending_buf[s.d_buf + s.last_lit * 2 + 1] = dist & 0xff;\n\n s.pending_buf[s.l_buf + s.last_lit] = lc & 0xff;\n s.last_lit++;\n\n if (dist === 0) {\n /* lc is the unmatched char */\n s.dyn_ltree[lc * 2]/*.Freq*/++;\n } else {\n s.matches++;\n /* Here, lc is the match length - MIN_MATCH */\n dist--; /* dist = match distance - 1 */\n //Assert((ush)dist < (ush)MAX_DIST(s) &&\n // (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) &&\n // (ush)d_code(dist) < (ush)D_CODES, \"_tr_tally: bad match\");\n\n s.dyn_ltree[(_length_code[lc] + LITERALS + 1) * 2]/*.Freq*/++;\n s.dyn_dtree[d_code(dist) * 2]/*.Freq*/++;\n }\n\n// (!) This block is disabled in zlib defaults,\n// don't enable it for binary compatibility\n\n//#ifdef TRUNCATE_BLOCK\n// /* Try to guess if it is profitable to stop the current block here */\n// if ((s.last_lit & 0x1fff) === 0 && s.level > 2) {\n// /* Compute an upper bound for the compressed length */\n// out_length = s.last_lit*8;\n// in_length = s.strstart - s.block_start;\n//\n// for (dcode = 0; dcode < D_CODES; dcode++) {\n// out_length += s.dyn_dtree[dcode*2]/*.Freq*/ * (5 + extra_dbits[dcode]);\n// }\n// out_length >>>= 3;\n// //Tracev((stderr,\"\\nlast_lit %u, in %ld, out ~%ld(%ld%%) \",\n// // s->last_lit, in_length, out_length,\n// // 100L - out_length*100L/in_length));\n// if (s.matches < (s.last_lit>>1)/*int /2*/ && out_length < (in_length>>1)/*int /2*/) {\n// return true;\n// }\n// }\n//#endif\n\n return (s.last_lit === s.lit_bufsize - 1);\n /* We avoid equality with lit_bufsize because of wraparound at 64K\n * on 16 bit machines and because stored blocks are restricted to\n * 64K-1 bytes.\n */\n};\n\nmodule.exports._tr_init = _tr_init;\nmodule.exports._tr_stored_block = _tr_stored_block;\nmodule.exports._tr_flush_block = _tr_flush_block;\nmodule.exports._tr_tally = _tr_tally;\nmodule.exports._tr_align = _tr_align;\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nfunction ZStream() {\n /* next input byte */\n this.input = null; // JS specific, because we have no pointers\n this.next_in = 0;\n /* number of bytes available at input */\n this.avail_in = 0;\n /* total number of input bytes read so far */\n this.total_in = 0;\n /* next output byte should be put there */\n this.output = null; // JS specific, because we have no pointers\n this.next_out = 0;\n /* remaining free space at output */\n this.avail_out = 0;\n /* total number of bytes output so far */\n this.total_out = 0;\n /* last error message, NULL if no error */\n this.msg = ''/*Z_NULL*/;\n /* not visible by applications */\n this.state = null;\n /* best guess about the data type: binary or text */\n this.data_type = 2/*Z_UNKNOWN*/;\n /* adler32 value of the uncompressed data */\n this.adler = 0;\n}\n\nmodule.exports = ZStream;\n","// Axios v1.6.2 Copyright (c) 2023 Matt Zabriskie and contributors\n'use strict';\n\nfunction bind(fn, thisArg) {\n return function wrap() {\n return fn.apply(thisArg, arguments);\n };\n}\n\n// utils is a library of generic helper functions non-specific to axios\n\nconst {toString} = Object.prototype;\nconst {getPrototypeOf} = Object;\n\nconst kindOf = (cache => thing => {\n const str = toString.call(thing);\n return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());\n})(Object.create(null));\n\nconst kindOfTest = (type) => {\n type = type.toLowerCase();\n return (thing) => kindOf(thing) === type\n};\n\nconst typeOfTest = type => thing => typeof thing === type;\n\n/**\n * Determine if a value is an Array\n *\n * @param {Object} val The value to test\n *\n * @returns {boolean} True if value is an Array, otherwise false\n */\nconst {isArray} = Array;\n\n/**\n * Determine if a value is undefined\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if the value is undefined, otherwise false\n */\nconst isUndefined = typeOfTest('undefined');\n\n/**\n * Determine if a value is a Buffer\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Buffer, otherwise false\n */\nfunction isBuffer(val) {\n return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)\n && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);\n}\n\n/**\n * Determine if a value is an ArrayBuffer\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is an ArrayBuffer, otherwise false\n */\nconst isArrayBuffer = kindOfTest('ArrayBuffer');\n\n\n/**\n * Determine if a value is a view on an ArrayBuffer\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false\n */\nfunction isArrayBufferView(val) {\n let result;\n if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {\n result = ArrayBuffer.isView(val);\n } else {\n result = (val) && (val.buffer) && (isArrayBuffer(val.buffer));\n }\n return result;\n}\n\n/**\n * Determine if a value is a String\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a String, otherwise false\n */\nconst isString = typeOfTest('string');\n\n/**\n * Determine if a value is a Function\n *\n * @param {*} val The value to test\n * @returns {boolean} True if value is a Function, otherwise false\n */\nconst isFunction = typeOfTest('function');\n\n/**\n * Determine if a value is a Number\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Number, otherwise false\n */\nconst isNumber = typeOfTest('number');\n\n/**\n * Determine if a value is an Object\n *\n * @param {*} thing The value to test\n *\n * @returns {boolean} True if value is an Object, otherwise false\n */\nconst isObject = (thing) => thing !== null && typeof thing === 'object';\n\n/**\n * Determine if a value is a Boolean\n *\n * @param {*} thing The value to test\n * @returns {boolean} True if value is a Boolean, otherwise false\n */\nconst isBoolean = thing => thing === true || thing === false;\n\n/**\n * Determine if a value is a plain Object\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a plain Object, otherwise false\n */\nconst isPlainObject = (val) => {\n if (kindOf(val) !== 'object') {\n return false;\n }\n\n const prototype = getPrototypeOf(val);\n return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val);\n};\n\n/**\n * Determine if a value is a Date\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Date, otherwise false\n */\nconst isDate = kindOfTest('Date');\n\n/**\n * Determine if a value is a File\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a File, otherwise false\n */\nconst isFile = kindOfTest('File');\n\n/**\n * Determine if a value is a Blob\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Blob, otherwise false\n */\nconst isBlob = kindOfTest('Blob');\n\n/**\n * Determine if a value is a FileList\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a File, otherwise false\n */\nconst isFileList = kindOfTest('FileList');\n\n/**\n * Determine if a value is a Stream\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Stream, otherwise false\n */\nconst isStream = (val) => isObject(val) && isFunction(val.pipe);\n\n/**\n * Determine if a value is a FormData\n *\n * @param {*} thing The value to test\n *\n * @returns {boolean} True if value is an FormData, otherwise false\n */\nconst isFormData = (thing) => {\n let kind;\n return thing && (\n (typeof FormData === 'function' && thing instanceof FormData) || (\n isFunction(thing.append) && (\n (kind = kindOf(thing)) === 'formdata' ||\n // detect form-data instance\n (kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]')\n )\n )\n )\n};\n\n/**\n * Determine if a value is a URLSearchParams object\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a URLSearchParams object, otherwise false\n */\nconst isURLSearchParams = kindOfTest('URLSearchParams');\n\n/**\n * Trim excess whitespace off the beginning and end of a string\n *\n * @param {String} str The String to trim\n *\n * @returns {String} The String freed of excess whitespace\n */\nconst trim = (str) => str.trim ?\n str.trim() : str.replace(/^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g, '');\n\n/**\n * Iterate over an Array or an Object invoking a function for each item.\n *\n * If `obj` is an Array callback will be called passing\n * the value, index, and complete array for each item.\n *\n * If 'obj' is an Object callback will be called passing\n * the value, key, and complete object for each property.\n *\n * @param {Object|Array} obj The object to iterate\n * @param {Function} fn The callback to invoke for each item\n *\n * @param {Boolean} [allOwnKeys = false]\n * @returns {any}\n */\nfunction forEach(obj, fn, {allOwnKeys = false} = {}) {\n // Don't bother if no value provided\n if (obj === null || typeof obj === 'undefined') {\n return;\n }\n\n let i;\n let l;\n\n // Force an array if not already something iterable\n if (typeof obj !== 'object') {\n /*eslint no-param-reassign:0*/\n obj = [obj];\n }\n\n if (isArray(obj)) {\n // Iterate over array values\n for (i = 0, l = obj.length; i < l; i++) {\n fn.call(null, obj[i], i, obj);\n }\n } else {\n // Iterate over object keys\n const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);\n const len = keys.length;\n let key;\n\n for (i = 0; i < len; i++) {\n key = keys[i];\n fn.call(null, obj[key], key, obj);\n }\n }\n}\n\nfunction findKey(obj, key) {\n key = key.toLowerCase();\n const keys = Object.keys(obj);\n let i = keys.length;\n let _key;\n while (i-- > 0) {\n _key = keys[i];\n if (key === _key.toLowerCase()) {\n return _key;\n }\n }\n return null;\n}\n\nconst _global = (() => {\n /*eslint no-undef:0*/\n if (typeof globalThis !== \"undefined\") return globalThis;\n return typeof self !== \"undefined\" ? self : (typeof window !== 'undefined' ? window : global)\n})();\n\nconst isContextDefined = (context) => !isUndefined(context) && context !== _global;\n\n/**\n * Accepts varargs expecting each argument to be an object, then\n * immutably merges the properties of each object and returns result.\n *\n * When multiple objects contain the same key the later object in\n * the arguments list will take precedence.\n *\n * Example:\n *\n * ```js\n * var result = merge({foo: 123}, {foo: 456});\n * console.log(result.foo); // outputs 456\n * ```\n *\n * @param {Object} obj1 Object to merge\n *\n * @returns {Object} Result of all merge properties\n */\nfunction merge(/* obj1, obj2, obj3, ... */) {\n const {caseless} = isContextDefined(this) && this || {};\n const result = {};\n const assignValue = (val, key) => {\n const targetKey = caseless && findKey(result, key) || key;\n if (isPlainObject(result[targetKey]) && isPlainObject(val)) {\n result[targetKey] = merge(result[targetKey], val);\n } else if (isPlainObject(val)) {\n result[targetKey] = merge({}, val);\n } else if (isArray(val)) {\n result[targetKey] = val.slice();\n } else {\n result[targetKey] = val;\n }\n };\n\n for (let i = 0, l = arguments.length; i < l; i++) {\n arguments[i] && forEach(arguments[i], assignValue);\n }\n return result;\n}\n\n/**\n * Extends object a by mutably adding to it the properties of object b.\n *\n * @param {Object} a The object to be extended\n * @param {Object} b The object to copy properties from\n * @param {Object} thisArg The object to bind function to\n *\n * @param {Boolean} [allOwnKeys]\n * @returns {Object} The resulting value of object a\n */\nconst extend = (a, b, thisArg, {allOwnKeys}= {}) => {\n forEach(b, (val, key) => {\n if (thisArg && isFunction(val)) {\n a[key] = bind(val, thisArg);\n } else {\n a[key] = val;\n }\n }, {allOwnKeys});\n return a;\n};\n\n/**\n * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)\n *\n * @param {string} content with BOM\n *\n * @returns {string} content value without BOM\n */\nconst stripBOM = (content) => {\n if (content.charCodeAt(0) === 0xFEFF) {\n content = content.slice(1);\n }\n return content;\n};\n\n/**\n * Inherit the prototype methods from one constructor into another\n * @param {function} constructor\n * @param {function} superConstructor\n * @param {object} [props]\n * @param {object} [descriptors]\n *\n * @returns {void}\n */\nconst inherits = (constructor, superConstructor, props, descriptors) => {\n constructor.prototype = Object.create(superConstructor.prototype, descriptors);\n constructor.prototype.constructor = constructor;\n Object.defineProperty(constructor, 'super', {\n value: superConstructor.prototype\n });\n props && Object.assign(constructor.prototype, props);\n};\n\n/**\n * Resolve object with deep prototype chain to a flat object\n * @param {Object} sourceObj source object\n * @param {Object} [destObj]\n * @param {Function|Boolean} [filter]\n * @param {Function} [propFilter]\n *\n * @returns {Object}\n */\nconst toFlatObject = (sourceObj, destObj, filter, propFilter) => {\n let props;\n let i;\n let prop;\n const merged = {};\n\n destObj = destObj || {};\n // eslint-disable-next-line no-eq-null,eqeqeq\n if (sourceObj == null) return destObj;\n\n do {\n props = Object.getOwnPropertyNames(sourceObj);\n i = props.length;\n while (i-- > 0) {\n prop = props[i];\n if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {\n destObj[prop] = sourceObj[prop];\n merged[prop] = true;\n }\n }\n sourceObj = filter !== false && getPrototypeOf(sourceObj);\n } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);\n\n return destObj;\n};\n\n/**\n * Determines whether a string ends with the characters of a specified string\n *\n * @param {String} str\n * @param {String} searchString\n * @param {Number} [position= 0]\n *\n * @returns {boolean}\n */\nconst endsWith = (str, searchString, position) => {\n str = String(str);\n if (position === undefined || position > str.length) {\n position = str.length;\n }\n position -= searchString.length;\n const lastIndex = str.indexOf(searchString, position);\n return lastIndex !== -1 && lastIndex === position;\n};\n\n\n/**\n * Returns new array from array like object or null if failed\n *\n * @param {*} [thing]\n *\n * @returns {?Array}\n */\nconst toArray = (thing) => {\n if (!thing) return null;\n if (isArray(thing)) return thing;\n let i = thing.length;\n if (!isNumber(i)) return null;\n const arr = new Array(i);\n while (i-- > 0) {\n arr[i] = thing[i];\n }\n return arr;\n};\n\n/**\n * Checking if the Uint8Array exists and if it does, it returns a function that checks if the\n * thing passed in is an instance of Uint8Array\n *\n * @param {TypedArray}\n *\n * @returns {Array}\n */\n// eslint-disable-next-line func-names\nconst isTypedArray = (TypedArray => {\n // eslint-disable-next-line func-names\n return thing => {\n return TypedArray && thing instanceof TypedArray;\n };\n})(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array));\n\n/**\n * For each entry in the object, call the function with the key and value.\n *\n * @param {Object<any, any>} obj - The object to iterate over.\n * @param {Function} fn - The function to call for each entry.\n *\n * @returns {void}\n */\nconst forEachEntry = (obj, fn) => {\n const generator = obj && obj[Symbol.iterator];\n\n const iterator = generator.call(obj);\n\n let result;\n\n while ((result = iterator.next()) && !result.done) {\n const pair = result.value;\n fn.call(obj, pair[0], pair[1]);\n }\n};\n\n/**\n * It takes a regular expression and a string, and returns an array of all the matches\n *\n * @param {string} regExp - The regular expression to match against.\n * @param {string} str - The string to search.\n *\n * @returns {Array<boolean>}\n */\nconst matchAll = (regExp, str) => {\n let matches;\n const arr = [];\n\n while ((matches = regExp.exec(str)) !== null) {\n arr.push(matches);\n }\n\n return arr;\n};\n\n/* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */\nconst isHTMLForm = kindOfTest('HTMLFormElement');\n\nconst toCamelCase = str => {\n return str.toLowerCase().replace(/[-_\\s]([a-z\\d])(\\w*)/g,\n function replacer(m, p1, p2) {\n return p1.toUpperCase() + p2;\n }\n );\n};\n\n/* Creating a function that will check if an object has a property. */\nconst hasOwnProperty = (({hasOwnProperty}) => (obj, prop) => hasOwnProperty.call(obj, prop))(Object.prototype);\n\n/**\n * Determine if a value is a RegExp object\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a RegExp object, otherwise false\n */\nconst isRegExp = kindOfTest('RegExp');\n\nconst reduceDescriptors = (obj, reducer) => {\n const descriptors = Object.getOwnPropertyDescriptors(obj);\n const reducedDescriptors = {};\n\n forEach(descriptors, (descriptor, name) => {\n let ret;\n if ((ret = reducer(descriptor, name, obj)) !== false) {\n reducedDescriptors[name] = ret || descriptor;\n }\n });\n\n Object.defineProperties(obj, reducedDescriptors);\n};\n\n/**\n * Makes all methods read-only\n * @param {Object} obj\n */\n\nconst freezeMethods = (obj) => {\n reduceDescriptors(obj, (descriptor, name) => {\n // skip restricted props in strict mode\n if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {\n return false;\n }\n\n const value = obj[name];\n\n if (!isFunction(value)) return;\n\n descriptor.enumerable = false;\n\n if ('writable' in descriptor) {\n descriptor.writable = false;\n return;\n }\n\n if (!descriptor.set) {\n descriptor.set = () => {\n throw Error('Can not rewrite read-only method \\'' + name + '\\'');\n };\n }\n });\n};\n\nconst toObjectSet = (arrayOrString, delimiter) => {\n const obj = {};\n\n const define = (arr) => {\n arr.forEach(value => {\n obj[value] = true;\n });\n };\n\n isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));\n\n return obj;\n};\n\nconst noop = () => {};\n\nconst toFiniteNumber = (value, defaultValue) => {\n value = +value;\n return Number.isFinite(value) ? value : defaultValue;\n};\n\nconst ALPHA = 'abcdefghijklmnopqrstuvwxyz';\n\nconst DIGIT = '0123456789';\n\nconst ALPHABET = {\n DIGIT,\n ALPHA,\n ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT\n};\n\nconst generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {\n let str = '';\n const {length} = alphabet;\n while (size--) {\n str += alphabet[Math.random() * length|0];\n }\n\n return str;\n};\n\n/**\n * If the thing is a FormData object, return true, otherwise return false.\n *\n * @param {unknown} thing - The thing to check.\n *\n * @returns {boolean}\n */\nfunction isSpecCompliantForm(thing) {\n return !!(thing && isFunction(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator]);\n}\n\nconst toJSONObject = (obj) => {\n const stack = new Array(10);\n\n const visit = (source, i) => {\n\n if (isObject(source)) {\n if (stack.indexOf(source) >= 0) {\n return;\n }\n\n if(!('toJSON' in source)) {\n stack[i] = source;\n const target = isArray(source) ? [] : {};\n\n forEach(source, (value, key) => {\n const reducedValue = visit(value, i + 1);\n !isUndefined(reducedValue) && (target[key] = reducedValue);\n });\n\n stack[i] = undefined;\n\n return target;\n }\n }\n\n return source;\n };\n\n return visit(obj, 0);\n};\n\nconst isAsyncFn = kindOfTest('AsyncFunction');\n\nconst isThenable = (thing) =>\n thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);\n\nvar utils$1 = {\n isArray,\n isArrayBuffer,\n isBuffer,\n isFormData,\n isArrayBufferView,\n isString,\n isNumber,\n isBoolean,\n isObject,\n isPlainObject,\n isUndefined,\n isDate,\n isFile,\n isBlob,\n isRegExp,\n isFunction,\n isStream,\n isURLSearchParams,\n isTypedArray,\n isFileList,\n forEach,\n merge,\n extend,\n trim,\n stripBOM,\n inherits,\n toFlatObject,\n kindOf,\n kindOfTest,\n endsWith,\n toArray,\n forEachEntry,\n matchAll,\n isHTMLForm,\n hasOwnProperty,\n hasOwnProp: hasOwnProperty, // an alias to avoid ESLint no-prototype-builtins detection\n reduceDescriptors,\n freezeMethods,\n toObjectSet,\n toCamelCase,\n noop,\n toFiniteNumber,\n findKey,\n global: _global,\n isContextDefined,\n ALPHABET,\n generateString,\n isSpecCompliantForm,\n toJSONObject,\n isAsyncFn,\n isThenable\n};\n\n/**\n * Create an Error with the specified message, config, error code, request and response.\n *\n * @param {string} message The error message.\n * @param {string} [code] The error code (for example, 'ECONNABORTED').\n * @param {Object} [config] The config.\n * @param {Object} [request] The request.\n * @param {Object} [response] The response.\n *\n * @returns {Error} The created error.\n */\nfunction AxiosError(message, code, config, request, response) {\n Error.call(this);\n\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, this.constructor);\n } else {\n this.stack = (new Error()).stack;\n }\n\n this.message = message;\n this.name = 'AxiosError';\n code && (this.code = code);\n config && (this.config = config);\n request && (this.request = request);\n response && (this.response = response);\n}\n\nutils$1.inherits(AxiosError, Error, {\n toJSON: function toJSON() {\n return {\n // Standard\n message: this.message,\n name: this.name,\n // Microsoft\n description: this.description,\n number: this.number,\n // Mozilla\n fileName: this.fileName,\n lineNumber: this.lineNumber,\n columnNumber: this.columnNumber,\n stack: this.stack,\n // Axios\n config: utils$1.toJSONObject(this.config),\n code: this.code,\n status: this.response && this.response.status ? this.response.status : null\n };\n }\n});\n\nconst prototype$1 = AxiosError.prototype;\nconst descriptors = {};\n\n[\n 'ERR_BAD_OPTION_VALUE',\n 'ERR_BAD_OPTION',\n 'ECONNABORTED',\n 'ETIMEDOUT',\n 'ERR_NETWORK',\n 'ERR_FR_TOO_MANY_REDIRECTS',\n 'ERR_DEPRECATED',\n 'ERR_BAD_RESPONSE',\n 'ERR_BAD_REQUEST',\n 'ERR_CANCELED',\n 'ERR_NOT_SUPPORT',\n 'ERR_INVALID_URL'\n// eslint-disable-next-line func-names\n].forEach(code => {\n descriptors[code] = {value: code};\n});\n\nObject.defineProperties(AxiosError, descriptors);\nObject.defineProperty(prototype$1, 'isAxiosError', {value: true});\n\n// eslint-disable-next-line func-names\nAxiosError.from = (error, code, config, request, response, customProps) => {\n const axiosError = Object.create(prototype$1);\n\n utils$1.toFlatObject(error, axiosError, function filter(obj) {\n return obj !== Error.prototype;\n }, prop => {\n return prop !== 'isAxiosError';\n });\n\n AxiosError.call(axiosError, error.message, code, config, request, response);\n\n axiosError.cause = error;\n\n axiosError.name = error.name;\n\n customProps && Object.assign(axiosError, customProps);\n\n return axiosError;\n};\n\n// eslint-disable-next-line strict\nvar httpAdapter = null;\n\n/**\n * Determines if the given thing is a array or js object.\n *\n * @param {string} thing - The object or array to be visited.\n *\n * @returns {boolean}\n */\nfunction isVisitable(thing) {\n return utils$1.isPlainObject(thing) || utils$1.isArray(thing);\n}\n\n/**\n * It removes the brackets from the end of a string\n *\n * @param {string} key - The key of the parameter.\n *\n * @returns {string} the key without the brackets.\n */\nfunction removeBrackets(key) {\n return utils$1.endsWith(key, '[]') ? key.slice(0, -2) : key;\n}\n\n/**\n * It takes a path, a key, and a boolean, and returns a string\n *\n * @param {string} path - The path to the current key.\n * @param {string} key - The key of the current object being iterated over.\n * @param {string} dots - If true, the key will be rendered with dots instead of brackets.\n *\n * @returns {string} The path to the current key.\n */\nfunction renderKey(path, key, dots) {\n if (!path) return key;\n return path.concat(key).map(function each(token, i) {\n // eslint-disable-next-line no-param-reassign\n token = removeBrackets(token);\n return !dots && i ? '[' + token + ']' : token;\n }).join(dots ? '.' : '');\n}\n\n/**\n * If the array is an array and none of its elements are visitable, then it's a flat array.\n *\n * @param {Array<any>} arr - The array to check\n *\n * @returns {boolean}\n */\nfunction isFlatArray(arr) {\n return utils$1.isArray(arr) && !arr.some(isVisitable);\n}\n\nconst predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {\n return /^is[A-Z]/.test(prop);\n});\n\n/**\n * Convert a data object to FormData\n *\n * @param {Object} obj\n * @param {?Object} [formData]\n * @param {?Object} [options]\n * @param {Function} [options.visitor]\n * @param {Boolean} [options.metaTokens = true]\n * @param {Boolean} [options.dots = false]\n * @param {?Boolean} [options.indexes = false]\n *\n * @returns {Object}\n **/\n\n/**\n * It converts an object into a FormData object\n *\n * @param {Object<any, any>} obj - The object to convert to form data.\n * @param {string} formData - The FormData object to append to.\n * @param {Object<string, any>} options\n *\n * @returns\n */\nfunction toFormData(obj, formData, options) {\n if (!utils$1.isObject(obj)) {\n throw new TypeError('target must be an object');\n }\n\n // eslint-disable-next-line no-param-reassign\n formData = formData || new (FormData)();\n\n // eslint-disable-next-line no-param-reassign\n options = utils$1.toFlatObject(options, {\n metaTokens: true,\n dots: false,\n indexes: false\n }, false, function defined(option, source) {\n // eslint-disable-next-line no-eq-null,eqeqeq\n return !utils$1.isUndefined(source[option]);\n });\n\n const metaTokens = options.metaTokens;\n // eslint-disable-next-line no-use-before-define\n const visitor = options.visitor || defaultVisitor;\n const dots = options.dots;\n const indexes = options.indexes;\n const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;\n const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);\n\n if (!utils$1.isFunction(visitor)) {\n throw new TypeError('visitor must be a function');\n }\n\n function convertValue(value) {\n if (value === null) return '';\n\n if (utils$1.isDate(value)) {\n return value.toISOString();\n }\n\n if (!useBlob && utils$1.isBlob(value)) {\n throw new AxiosError('Blob is not supported. Use a Buffer instead.');\n }\n\n if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {\n return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);\n }\n\n return value;\n }\n\n /**\n * Default visitor.\n *\n * @param {*} value\n * @param {String|Number} key\n * @param {Array<String|Number>} path\n * @this {FormData}\n *\n * @returns {boolean} return true to visit the each prop of the value recursively\n */\n function defaultVisitor(value, key, path) {\n let arr = value;\n\n if (value && !path && typeof value === 'object') {\n if (utils$1.endsWith(key, '{}')) {\n // eslint-disable-next-line no-param-reassign\n key = metaTokens ? key : key.slice(0, -2);\n // eslint-disable-next-line no-param-reassign\n value = JSON.stringify(value);\n } else if (\n (utils$1.isArray(value) && isFlatArray(value)) ||\n ((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value))\n )) {\n // eslint-disable-next-line no-param-reassign\n key = removeBrackets(key);\n\n arr.forEach(function each(el, index) {\n !(utils$1.isUndefined(el) || el === null) && formData.append(\n // eslint-disable-next-line no-nested-ternary\n indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'),\n convertValue(el)\n );\n });\n return false;\n }\n }\n\n if (isVisitable(value)) {\n return true;\n }\n\n formData.append(renderKey(path, key, dots), convertValue(value));\n\n return false;\n }\n\n const stack = [];\n\n const exposedHelpers = Object.assign(predicates, {\n defaultVisitor,\n convertValue,\n isVisitable\n });\n\n function build(value, path) {\n if (utils$1.isUndefined(value)) return;\n\n if (stack.indexOf(value) !== -1) {\n throw Error('Circular reference detected in ' + path.join('.'));\n }\n\n stack.push(value);\n\n utils$1.forEach(value, function each(el, key) {\n const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(\n formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers\n );\n\n if (result === true) {\n build(el, path ? path.concat(key) : [key]);\n }\n });\n\n stack.pop();\n }\n\n if (!utils$1.isObject(obj)) {\n throw new TypeError('data must be an object');\n }\n\n build(obj);\n\n return formData;\n}\n\n/**\n * It encodes a string by replacing all characters that are not in the unreserved set with\n * their percent-encoded equivalents\n *\n * @param {string} str - The string to encode.\n *\n * @returns {string} The encoded string.\n */\nfunction encode$1(str) {\n const charMap = {\n '!': '%21',\n \"'\": '%27',\n '(': '%28',\n ')': '%29',\n '~': '%7E',\n '%20': '+',\n '%00': '\\x00'\n };\n return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {\n return charMap[match];\n });\n}\n\n/**\n * It takes a params object and converts it to a FormData object\n *\n * @param {Object<string, any>} params - The parameters to be converted to a FormData object.\n * @param {Object<string, any>} options - The options object passed to the Axios constructor.\n *\n * @returns {void}\n */\nfunction AxiosURLSearchParams(params, options) {\n this._pairs = [];\n\n params && toFormData(params, this, options);\n}\n\nconst prototype = AxiosURLSearchParams.prototype;\n\nprototype.append = function append(name, value) {\n this._pairs.push([name, value]);\n};\n\nprototype.toString = function toString(encoder) {\n const _encode = encoder ? function(value) {\n return encoder.call(this, value, encode$1);\n } : encode$1;\n\n return this._pairs.map(function each(pair) {\n return _encode(pair[0]) + '=' + _encode(pair[1]);\n }, '').join('&');\n};\n\n/**\n * It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their\n * URI encoded counterparts\n *\n * @param {string} val The value to be encoded.\n *\n * @returns {string} The encoded value.\n */\nfunction encode(val) {\n return encodeURIComponent(val).\n replace(/%3A/gi, ':').\n replace(/%24/g, '$').\n replace(/%2C/gi, ',').\n replace(/%20/g, '+').\n replace(/%5B/gi, '[').\n replace(/%5D/gi, ']');\n}\n\n/**\n * Build a URL by appending params to the end\n *\n * @param {string} url The base of the url (e.g., http://www.google.com)\n * @param {object} [params] The params to be appended\n * @param {?object} options\n *\n * @returns {string} The formatted url\n */\nfunction buildURL(url, params, options) {\n /*eslint no-param-reassign:0*/\n if (!params) {\n return url;\n }\n \n const _encode = options && options.encode || encode;\n\n const serializeFn = options && options.serialize;\n\n let serializedParams;\n\n if (serializeFn) {\n serializedParams = serializeFn(params, options);\n } else {\n serializedParams = utils$1.isURLSearchParams(params) ?\n params.toString() :\n new AxiosURLSearchParams(params, options).toString(_encode);\n }\n\n if (serializedParams) {\n const hashmarkIndex = url.indexOf(\"#\");\n\n if (hashmarkIndex !== -1) {\n url = url.slice(0, hashmarkIndex);\n }\n url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;\n }\n\n return url;\n}\n\nclass InterceptorManager {\n constructor() {\n this.handlers = [];\n }\n\n /**\n * Add a new interceptor to the stack\n *\n * @param {Function} fulfilled The function to handle `then` for a `Promise`\n * @param {Function} rejected The function to handle `reject` for a `Promise`\n *\n * @return {Number} An ID used to remove interceptor later\n */\n use(fulfilled, rejected, options) {\n this.handlers.push({\n fulfilled,\n rejected,\n synchronous: options ? options.synchronous : false,\n runWhen: options ? options.runWhen : null\n });\n return this.handlers.length - 1;\n }\n\n /**\n * Remove an interceptor from the stack\n *\n * @param {Number} id The ID that was returned by `use`\n *\n * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise\n */\n eject(id) {\n if (this.handlers[id]) {\n this.handlers[id] = null;\n }\n }\n\n /**\n * Clear all interceptors from the stack\n *\n * @returns {void}\n */\n clear() {\n if (this.handlers) {\n this.handlers = [];\n }\n }\n\n /**\n * Iterate over all the registered interceptors\n *\n * This method is particularly useful for skipping over any\n * interceptors that may have become `null` calling `eject`.\n *\n * @param {Function} fn The function to call for each interceptor\n *\n * @returns {void}\n */\n forEach(fn) {\n utils$1.forEach(this.handlers, function forEachHandler(h) {\n if (h !== null) {\n fn(h);\n }\n });\n }\n}\n\nvar InterceptorManager$1 = InterceptorManager;\n\nvar transitionalDefaults = {\n silentJSONParsing: true,\n forcedJSONParsing: true,\n clarifyTimeoutError: false\n};\n\nvar URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;\n\nvar FormData$1 = typeof FormData !== 'undefined' ? FormData : null;\n\nvar Blob$1 = typeof Blob !== 'undefined' ? Blob : null;\n\nvar platform$1 = {\n isBrowser: true,\n classes: {\n URLSearchParams: URLSearchParams$1,\n FormData: FormData$1,\n Blob: Blob$1\n },\n protocols: ['http', 'https', 'file', 'blob', 'url', 'data']\n};\n\nconst hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';\n\n/**\n * Determine if we're running in a standard browser environment\n *\n * This allows axios to run in a web worker, and react-native.\n * Both environments support XMLHttpRequest, but not fully standard globals.\n *\n * web workers:\n * typeof window -> undefined\n * typeof document -> undefined\n *\n * react-native:\n * navigator.product -> 'ReactNative'\n * nativescript\n * navigator.product -> 'NativeScript' or 'NS'\n *\n * @returns {boolean}\n */\nconst hasStandardBrowserEnv = (\n (product) => {\n return hasBrowserEnv && ['ReactNative', 'NativeScript', 'NS'].indexOf(product) < 0\n })(typeof navigator !== 'undefined' && navigator.product);\n\n/**\n * Determine if we're running in a standard browser webWorker environment\n *\n * Although the `isStandardBrowserEnv` method indicates that\n * `allows axios to run in a web worker`, the WebWorker will still be\n * filtered out due to its judgment standard\n * `typeof window !== 'undefined' && typeof document !== 'undefined'`.\n * This leads to a problem when axios post `FormData` in webWorker\n */\nconst hasStandardBrowserWebWorkerEnv = (() => {\n return (\n typeof WorkerGlobalScope !== 'undefined' &&\n // eslint-disable-next-line no-undef\n self instanceof WorkerGlobalScope &&\n typeof self.importScripts === 'function'\n );\n})();\n\nvar utils = /*#__PURE__*/Object.freeze({\n __proto__: null,\n hasBrowserEnv: hasBrowserEnv,\n hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,\n hasStandardBrowserEnv: hasStandardBrowserEnv\n});\n\nvar platform = {\n ...utils,\n ...platform$1\n};\n\nfunction toURLEncodedForm(data, options) {\n return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({\n visitor: function(value, key, path, helpers) {\n if (platform.isNode && utils$1.isBuffer(value)) {\n this.append(key, value.toString('base64'));\n return false;\n }\n\n return helpers.defaultVisitor.apply(this, arguments);\n }\n }, options));\n}\n\n/**\n * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']\n *\n * @param {string} name - The name of the property to get.\n *\n * @returns An array of strings.\n */\nfunction parsePropPath(name) {\n // foo[x][y][z]\n // foo.x.y.z\n // foo-x-y-z\n // foo x y z\n return utils$1.matchAll(/\\w+|\\[(\\w*)]/g, name).map(match => {\n return match[0] === '[]' ? '' : match[1] || match[0];\n });\n}\n\n/**\n * Convert an array to an object.\n *\n * @param {Array<any>} arr - The array to convert to an object.\n *\n * @returns An object with the same keys and values as the array.\n */\nfunction arrayToObject(arr) {\n const obj = {};\n const keys = Object.keys(arr);\n let i;\n const len = keys.length;\n let key;\n for (i = 0; i < len; i++) {\n key = keys[i];\n obj[key] = arr[key];\n }\n return obj;\n}\n\n/**\n * It takes a FormData object and returns a JavaScript object\n *\n * @param {string} formData The FormData object to convert to JSON.\n *\n * @returns {Object<string, any> | null} The converted object.\n */\nfunction formDataToJSON(formData) {\n function buildPath(path, value, target, index) {\n let name = path[index++];\n const isNumericKey = Number.isFinite(+name);\n const isLast = index >= path.length;\n name = !name && utils$1.isArray(target) ? target.length : name;\n\n if (isLast) {\n if (utils$1.hasOwnProp(target, name)) {\n target[name] = [target[name], value];\n } else {\n target[name] = value;\n }\n\n return !isNumericKey;\n }\n\n if (!target[name] || !utils$1.isObject(target[name])) {\n target[name] = [];\n }\n\n const result = buildPath(path, value, target[name], index);\n\n if (result && utils$1.isArray(target[name])) {\n target[name] = arrayToObject(target[name]);\n }\n\n return !isNumericKey;\n }\n\n if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {\n const obj = {};\n\n utils$1.forEachEntry(formData, (name, value) => {\n buildPath(parsePropPath(name), value, obj, 0);\n });\n\n return obj;\n }\n\n return null;\n}\n\n/**\n * It takes a string, tries to parse it, and if it fails, it returns the stringified version\n * of the input\n *\n * @param {any} rawValue - The value to be stringified.\n * @param {Function} parser - A function that parses a string into a JavaScript object.\n * @param {Function} encoder - A function that takes a value and returns a string.\n *\n * @returns {string} A stringified version of the rawValue.\n */\nfunction stringifySafely(rawValue, parser, encoder) {\n if (utils$1.isString(rawValue)) {\n try {\n (parser || JSON.parse)(rawValue);\n return utils$1.trim(rawValue);\n } catch (e) {\n if (e.name !== 'SyntaxError') {\n throw e;\n }\n }\n }\n\n return (encoder || JSON.stringify)(rawValue);\n}\n\nconst defaults = {\n\n transitional: transitionalDefaults,\n\n adapter: ['xhr', 'http'],\n\n transformRequest: [function transformRequest(data, headers) {\n const contentType = headers.getContentType() || '';\n const hasJSONContentType = contentType.indexOf('application/json') > -1;\n const isObjectPayload = utils$1.isObject(data);\n\n if (isObjectPayload && utils$1.isHTMLForm(data)) {\n data = new FormData(data);\n }\n\n const isFormData = utils$1.isFormData(data);\n\n if (isFormData) {\n if (!hasJSONContentType) {\n return data;\n }\n return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;\n }\n\n if (utils$1.isArrayBuffer(data) ||\n utils$1.isBuffer(data) ||\n utils$1.isStream(data) ||\n utils$1.isFile(data) ||\n utils$1.isBlob(data)\n ) {\n return data;\n }\n if (utils$1.isArrayBufferView(data)) {\n return data.buffer;\n }\n if (utils$1.isURLSearchParams(data)) {\n headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);\n return data.toString();\n }\n\n let isFileList;\n\n if (isObjectPayload) {\n if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {\n return toURLEncodedForm(data, this.formSerializer).toString();\n }\n\n if ((isFileList = utils$1.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {\n const _FormData = this.env && this.env.FormData;\n\n return toFormData(\n isFileList ? {'files[]': data} : data,\n _FormData && new _FormData(),\n this.formSerializer\n );\n }\n }\n\n if (isObjectPayload || hasJSONContentType ) {\n headers.setContentType('application/json', false);\n return stringifySafely(data);\n }\n\n return data;\n }],\n\n transformResponse: [function transformResponse(data) {\n const transitional = this.transitional || defaults.transitional;\n const forcedJSONParsing = transitional && transitional.forcedJSONParsing;\n const JSONRequested = this.responseType === 'json';\n\n if (data && utils$1.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {\n const silentJSONParsing = transitional && transitional.silentJSONParsing;\n const strictJSONParsing = !silentJSONParsing && JSONRequested;\n\n try {\n return JSON.parse(data);\n } catch (e) {\n if (strictJSONParsing) {\n if (e.name === 'SyntaxError') {\n throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);\n }\n throw e;\n }\n }\n }\n\n return data;\n }],\n\n /**\n * A timeout in milliseconds to abort a request. If set to 0 (default) a\n * timeout is not created.\n */\n timeout: 0,\n\n xsrfCookieName: 'XSRF-TOKEN',\n xsrfHeaderName: 'X-XSRF-TOKEN',\n\n maxContentLength: -1,\n maxBodyLength: -1,\n\n env: {\n FormData: platform.classes.FormData,\n Blob: platform.classes.Blob\n },\n\n validateStatus: function validateStatus(status) {\n return status >= 200 && status < 300;\n },\n\n headers: {\n common: {\n 'Accept': 'application/json, text/plain, */*',\n 'Content-Type': undefined\n }\n }\n};\n\nutils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {\n defaults.headers[method] = {};\n});\n\nvar defaults$1 = defaults;\n\n// RawAxiosHeaders whose duplicates are ignored by node\n// c.f. https://nodejs.org/api/http.html#http_message_headers\nconst ignoreDuplicateOf = utils$1.toObjectSet([\n 'age', 'authorization', 'content-length', 'content-type', 'etag',\n 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',\n 'last-modified', 'location', 'max-forwards', 'proxy-authorization',\n 'referer', 'retry-after', 'user-agent'\n]);\n\n/**\n * Parse headers into an object\n *\n * ```\n * Date: Wed, 27 Aug 2014 08:58:49 GMT\n * Content-Type: application/json\n * Connection: keep-alive\n * Transfer-Encoding: chunked\n * ```\n *\n * @param {String} rawHeaders Headers needing to be parsed\n *\n * @returns {Object} Headers parsed into an object\n */\nvar parseHeaders = rawHeaders => {\n const parsed = {};\n let key;\n let val;\n let i;\n\n rawHeaders && rawHeaders.split('\\n').forEach(function parser(line) {\n i = line.indexOf(':');\n key = line.substring(0, i).trim().toLowerCase();\n val = line.substring(i + 1).trim();\n\n if (!key || (parsed[key] && ignoreDuplicateOf[key])) {\n return;\n }\n\n if (key === 'set-cookie') {\n if (parsed[key]) {\n parsed[key].push(val);\n } else {\n parsed[key] = [val];\n }\n } else {\n parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;\n }\n });\n\n return parsed;\n};\n\nconst $internals = Symbol('internals');\n\nfunction normalizeHeader(header) {\n return header && String(header).trim().toLowerCase();\n}\n\nfunction normalizeValue(value) {\n if (value === false || value == null) {\n return value;\n }\n\n return utils$1.isArray(value) ? value.map(normalizeValue) : String(value);\n}\n\nfunction parseTokens(str) {\n const tokens = Object.create(null);\n const tokensRE = /([^\\s,;=]+)\\s*(?:=\\s*([^,;]+))?/g;\n let match;\n\n while ((match = tokensRE.exec(str))) {\n tokens[match[1]] = match[2];\n }\n\n return tokens;\n}\n\nconst isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());\n\nfunction matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {\n if (utils$1.isFunction(filter)) {\n return filter.call(this, value, header);\n }\n\n if (isHeaderNameFilter) {\n value = header;\n }\n\n if (!utils$1.isString(value)) return;\n\n if (utils$1.isString(filter)) {\n return value.indexOf(filter) !== -1;\n }\n\n if (utils$1.isRegExp(filter)) {\n return filter.test(value);\n }\n}\n\nfunction formatHeader(header) {\n return header.trim()\n .toLowerCase().replace(/([a-z\\d])(\\w*)/g, (w, char, str) => {\n return char.toUpperCase() + str;\n });\n}\n\nfunction buildAccessors(obj, header) {\n const accessorName = utils$1.toCamelCase(' ' + header);\n\n ['get', 'set', 'has'].forEach(methodName => {\n Object.defineProperty(obj, methodName + accessorName, {\n value: function(arg1, arg2, arg3) {\n return this[methodName].call(this, header, arg1, arg2, arg3);\n },\n configurable: true\n });\n });\n}\n\nclass AxiosHeaders {\n constructor(headers) {\n headers && this.set(headers);\n }\n\n set(header, valueOrRewrite, rewrite) {\n const self = this;\n\n function setHeader(_value, _header, _rewrite) {\n const lHeader = normalizeHeader(_header);\n\n if (!lHeader) {\n throw new Error('header name must be a non-empty string');\n }\n\n const key = utils$1.findKey(self, lHeader);\n\n if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) {\n self[key || _header] = normalizeValue(_value);\n }\n }\n\n const setHeaders = (headers, _rewrite) =>\n utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));\n\n if (utils$1.isPlainObject(header) || header instanceof this.constructor) {\n setHeaders(header, valueOrRewrite);\n } else if(utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {\n setHeaders(parseHeaders(header), valueOrRewrite);\n } else {\n header != null && setHeader(valueOrRewrite, header, rewrite);\n }\n\n return this;\n }\n\n get(header, parser) {\n header = normalizeHeader(header);\n\n if (header) {\n const key = utils$1.findKey(this, header);\n\n if (key) {\n const value = this[key];\n\n if (!parser) {\n return value;\n }\n\n if (parser === true) {\n return parseTokens(value);\n }\n\n if (utils$1.isFunction(parser)) {\n return parser.call(this, value, key);\n }\n\n if (utils$1.isRegExp(parser)) {\n return parser.exec(value);\n }\n\n throw new TypeError('parser must be boolean|regexp|function');\n }\n }\n }\n\n has(header, matcher) {\n header = normalizeHeader(header);\n\n if (header) {\n const key = utils$1.findKey(this, header);\n\n return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));\n }\n\n return false;\n }\n\n delete(header, matcher) {\n const self = this;\n let deleted = false;\n\n function deleteHeader(_header) {\n _header = normalizeHeader(_header);\n\n if (_header) {\n const key = utils$1.findKey(self, _header);\n\n if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {\n delete self[key];\n\n deleted = true;\n }\n }\n }\n\n if (utils$1.isArray(header)) {\n header.forEach(deleteHeader);\n } else {\n deleteHeader(header);\n }\n\n return deleted;\n }\n\n clear(matcher) {\n const keys = Object.keys(this);\n let i = keys.length;\n let deleted = false;\n\n while (i--) {\n const key = keys[i];\n if(!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {\n delete this[key];\n deleted = true;\n }\n }\n\n return deleted;\n }\n\n normalize(format) {\n const self = this;\n const headers = {};\n\n utils$1.forEach(this, (value, header) => {\n const key = utils$1.findKey(headers, header);\n\n if (key) {\n self[key] = normalizeValue(value);\n delete self[header];\n return;\n }\n\n const normalized = format ? formatHeader(header) : String(header).trim();\n\n if (normalized !== header) {\n delete self[header];\n }\n\n self[normalized] = normalizeValue(value);\n\n headers[normalized] = true;\n });\n\n return this;\n }\n\n concat(...targets) {\n return this.constructor.concat(this, ...targets);\n }\n\n toJSON(asStrings) {\n const obj = Object.create(null);\n\n utils$1.forEach(this, (value, header) => {\n value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);\n });\n\n return obj;\n }\n\n [Symbol.iterator]() {\n return Object.entries(this.toJSON())[Symbol.iterator]();\n }\n\n toString() {\n return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\\n');\n }\n\n get [Symbol.toStringTag]() {\n return 'AxiosHeaders';\n }\n\n static from(thing) {\n return thing instanceof this ? thing : new this(thing);\n }\n\n static concat(first, ...targets) {\n const computed = new this(first);\n\n targets.forEach((target) => computed.set(target));\n\n return computed;\n }\n\n static accessor(header) {\n const internals = this[$internals] = (this[$internals] = {\n accessors: {}\n });\n\n const accessors = internals.accessors;\n const prototype = this.prototype;\n\n function defineAccessor(_header) {\n const lHeader = normalizeHeader(_header);\n\n if (!accessors[lHeader]) {\n buildAccessors(prototype, _header);\n accessors[lHeader] = true;\n }\n }\n\n utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);\n\n return this;\n }\n}\n\nAxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);\n\n// reserved names hotfix\nutils$1.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {\n let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`\n return {\n get: () => value,\n set(headerValue) {\n this[mapped] = headerValue;\n }\n }\n});\n\nutils$1.freezeMethods(AxiosHeaders);\n\nvar AxiosHeaders$1 = AxiosHeaders;\n\n/**\n * Transform the data for a request or a response\n *\n * @param {Array|Function} fns A single function or Array of functions\n * @param {?Object} response The response object\n *\n * @returns {*} The resulting transformed data\n */\nfunction transformData(fns, response) {\n const config = this || defaults$1;\n const context = response || config;\n const headers = AxiosHeaders$1.from(context.headers);\n let data = context.data;\n\n utils$1.forEach(fns, function transform(fn) {\n data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);\n });\n\n headers.normalize();\n\n return data;\n}\n\nfunction isCancel(value) {\n return !!(value && value.__CANCEL__);\n}\n\n/**\n * A `CanceledError` is an object that is thrown when an operation is canceled.\n *\n * @param {string=} message The message.\n * @param {Object=} config The config.\n * @param {Object=} request The request.\n *\n * @returns {CanceledError} The created error.\n */\nfunction CanceledError(message, config, request) {\n // eslint-disable-next-line no-eq-null,eqeqeq\n AxiosError.call(this, message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request);\n this.name = 'CanceledError';\n}\n\nutils$1.inherits(CanceledError, AxiosError, {\n __CANCEL__: true\n});\n\n/**\n * Resolve or reject a Promise based on response status.\n *\n * @param {Function} resolve A function that resolves the promise.\n * @param {Function} reject A function that rejects the promise.\n * @param {object} response The response.\n *\n * @returns {object} The response.\n */\nfunction settle(resolve, reject, response) {\n const validateStatus = response.config.validateStatus;\n if (!response.status || !validateStatus || validateStatus(response.status)) {\n resolve(response);\n } else {\n reject(new AxiosError(\n 'Request failed with status code ' + response.status,\n [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],\n response.config,\n response.request,\n response\n ));\n }\n}\n\nvar cookies = platform.hasStandardBrowserEnv ?\n\n // Standard browser envs support document.cookie\n {\n write(name, value, expires, path, domain, secure) {\n const cookie = [name + '=' + encodeURIComponent(value)];\n\n utils$1.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());\n\n utils$1.isString(path) && cookie.push('path=' + path);\n\n utils$1.isString(domain) && cookie.push('domain=' + domain);\n\n secure === true && cookie.push('secure');\n\n document.cookie = cookie.join('; ');\n },\n\n read(name) {\n const match = document.cookie.match(new RegExp('(^|;\\\\s*)(' + name + ')=([^;]*)'));\n return (match ? decodeURIComponent(match[3]) : null);\n },\n\n remove(name) {\n this.write(name, '', Date.now() - 86400000);\n }\n }\n\n :\n\n // Non-standard browser env (web workers, react-native) lack needed support.\n {\n write() {},\n read() {\n return null;\n },\n remove() {}\n };\n\n/**\n * Determines whether the specified URL is absolute\n *\n * @param {string} url The URL to test\n *\n * @returns {boolean} True if the specified URL is absolute, otherwise false\n */\nfunction isAbsoluteURL(url) {\n // A URL is considered absolute if it begins with \"<scheme>://\" or \"//\" (protocol-relative URL).\n // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed\n // by any combination of letters, digits, plus, period, or hyphen.\n return /^([a-z][a-z\\d+\\-.]*:)?\\/\\//i.test(url);\n}\n\n/**\n * Creates a new URL by combining the specified URLs\n *\n * @param {string} baseURL The base URL\n * @param {string} relativeURL The relative URL\n *\n * @returns {string} The combined URL\n */\nfunction combineURLs(baseURL, relativeURL) {\n return relativeURL\n ? baseURL.replace(/\\/+$/, '') + '/' + relativeURL.replace(/^\\/+/, '')\n : baseURL;\n}\n\n/**\n * Creates a new URL by combining the baseURL with the requestedURL,\n * only when the requestedURL is not already an absolute URL.\n * If the requestURL is absolute, this function returns the requestedURL untouched.\n *\n * @param {string} baseURL The base URL\n * @param {string} requestedURL Absolute or relative URL to combine\n *\n * @returns {string} The combined full path\n */\nfunction buildFullPath(baseURL, requestedURL) {\n if (baseURL && !isAbsoluteURL(requestedURL)) {\n return combineURLs(baseURL, requestedURL);\n }\n return requestedURL;\n}\n\nvar isURLSameOrigin = platform.hasStandardBrowserEnv ?\n\n// Standard browser envs have full support of the APIs needed to test\n// whether the request URL is of the same origin as current location.\n (function standardBrowserEnv() {\n const msie = /(msie|trident)/i.test(navigator.userAgent);\n const urlParsingNode = document.createElement('a');\n let originURL;\n\n /**\n * Parse a URL to discover its components\n *\n * @param {String} url The URL to be parsed\n * @returns {Object}\n */\n function resolveURL(url) {\n let href = url;\n\n if (msie) {\n // IE needs attribute set twice to normalize properties\n urlParsingNode.setAttribute('href', href);\n href = urlParsingNode.href;\n }\n\n urlParsingNode.setAttribute('href', href);\n\n // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils\n return {\n href: urlParsingNode.href,\n protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',\n host: urlParsingNode.host,\n search: urlParsingNode.search ? urlParsingNode.search.replace(/^\\?/, '') : '',\n hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',\n hostname: urlParsingNode.hostname,\n port: urlParsingNode.port,\n pathname: (urlParsingNode.pathname.charAt(0) === '/') ?\n urlParsingNode.pathname :\n '/' + urlParsingNode.pathname\n };\n }\n\n originURL = resolveURL(window.location.href);\n\n /**\n * Determine if a URL shares the same origin as the current location\n *\n * @param {String} requestURL The URL to test\n * @returns {boolean} True if URL shares the same origin, otherwise false\n */\n return function isURLSameOrigin(requestURL) {\n const parsed = (utils$1.isString(requestURL)) ? resolveURL(requestURL) : requestURL;\n return (parsed.protocol === originURL.protocol &&\n parsed.host === originURL.host);\n };\n })() :\n\n // Non standard browser envs (web workers, react-native) lack needed support.\n (function nonStandardBrowserEnv() {\n return function isURLSameOrigin() {\n return true;\n };\n })();\n\nfunction parseProtocol(url) {\n const match = /^([-+\\w]{1,25})(:?\\/\\/|:)/.exec(url);\n return match && match[1] || '';\n}\n\n/**\n * Calculate data maxRate\n * @param {Number} [samplesCount= 10]\n * @param {Number} [min= 1000]\n * @returns {Function}\n */\nfunction speedometer(samplesCount, min) {\n samplesCount = samplesCount || 10;\n const bytes = new Array(samplesCount);\n const timestamps = new Array(samplesCount);\n let head = 0;\n let tail = 0;\n let firstSampleTS;\n\n min = min !== undefined ? min : 1000;\n\n return function push(chunkLength) {\n const now = Date.now();\n\n const startedAt = timestamps[tail];\n\n if (!firstSampleTS) {\n firstSampleTS = now;\n }\n\n bytes[head] = chunkLength;\n timestamps[head] = now;\n\n let i = tail;\n let bytesCount = 0;\n\n while (i !== head) {\n bytesCount += bytes[i++];\n i = i % samplesCount;\n }\n\n head = (head + 1) % samplesCount;\n\n if (head === tail) {\n tail = (tail + 1) % samplesCount;\n }\n\n if (now - firstSampleTS < min) {\n return;\n }\n\n const passed = startedAt && now - startedAt;\n\n return passed ? Math.round(bytesCount * 1000 / passed) : undefined;\n };\n}\n\nfunction progressEventReducer(listener, isDownloadStream) {\n let bytesNotified = 0;\n const _speedometer = speedometer(50, 250);\n\n return e => {\n const loaded = e.loaded;\n const total = e.lengthComputable ? e.total : undefined;\n const progressBytes = loaded - bytesNotified;\n const rate = _speedometer(progressBytes);\n const inRange = loaded <= total;\n\n bytesNotified = loaded;\n\n const data = {\n loaded,\n total,\n progress: total ? (loaded / total) : undefined,\n bytes: progressBytes,\n rate: rate ? rate : undefined,\n estimated: rate && total && inRange ? (total - loaded) / rate : undefined,\n event: e\n };\n\n data[isDownloadStream ? 'download' : 'upload'] = true;\n\n listener(data);\n };\n}\n\nconst isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';\n\nvar xhrAdapter = isXHRAdapterSupported && function (config) {\n return new Promise(function dispatchXhrRequest(resolve, reject) {\n let requestData = config.data;\n const requestHeaders = AxiosHeaders$1.from(config.headers).normalize();\n let {responseType, withXSRFToken} = config;\n let onCanceled;\n function done() {\n if (config.cancelToken) {\n config.cancelToken.unsubscribe(onCanceled);\n }\n\n if (config.signal) {\n config.signal.removeEventListener('abort', onCanceled);\n }\n }\n\n let contentType;\n\n if (utils$1.isFormData(requestData)) {\n if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {\n requestHeaders.setContentType(false); // Let the browser set it\n } else if ((contentType = requestHeaders.getContentType()) !== false) {\n // fix semicolon duplication issue for ReactNative FormData implementation\n const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];\n requestHeaders.setContentType([type || 'multipart/form-data', ...tokens].join('; '));\n }\n }\n\n let request = new XMLHttpRequest();\n\n // HTTP basic authentication\n if (config.auth) {\n const username = config.auth.username || '';\n const password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';\n requestHeaders.set('Authorization', 'Basic ' + btoa(username + ':' + password));\n }\n\n const fullPath = buildFullPath(config.baseURL, config.url);\n\n request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);\n\n // Set the request timeout in MS\n request.timeout = config.timeout;\n\n function onloadend() {\n if (!request) {\n return;\n }\n // Prepare the response\n const responseHeaders = AxiosHeaders$1.from(\n 'getAllResponseHeaders' in request && request.getAllResponseHeaders()\n );\n const responseData = !responseType || responseType === 'text' || responseType === 'json' ?\n request.responseText : request.response;\n const response = {\n data: responseData,\n status: request.status,\n statusText: request.statusText,\n headers: responseHeaders,\n config,\n request\n };\n\n settle(function _resolve(value) {\n resolve(value);\n done();\n }, function _reject(err) {\n reject(err);\n done();\n }, response);\n\n // Clean up request\n request = null;\n }\n\n if ('onloadend' in request) {\n // Use onloadend if available\n request.onloadend = onloadend;\n } else {\n // Listen for ready state to emulate onloadend\n request.onreadystatechange = function handleLoad() {\n if (!request || request.readyState !== 4) {\n return;\n }\n\n // The request errored out and we didn't get a response, this will be\n // handled by onerror instead\n // With one exception: request that using file: protocol, most browsers\n // will return status as 0 even though it's a successful request\n if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {\n return;\n }\n // readystate handler is calling before onerror or ontimeout handlers,\n // so we should call onloadend on the next 'tick'\n setTimeout(onloadend);\n };\n }\n\n // Handle browser request cancellation (as opposed to a manual cancellation)\n request.onabort = function handleAbort() {\n if (!request) {\n return;\n }\n\n reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request));\n\n // Clean up request\n request = null;\n };\n\n // Handle low level network errors\n request.onerror = function handleError() {\n // Real errors are hidden from us by the browser\n // onerror should only fire if it's a network error\n reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request));\n\n // Clean up request\n request = null;\n };\n\n // Handle timeout\n request.ontimeout = function handleTimeout() {\n let timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';\n const transitional = config.transitional || transitionalDefaults;\n if (config.timeoutErrorMessage) {\n timeoutErrorMessage = config.timeoutErrorMessage;\n }\n reject(new AxiosError(\n timeoutErrorMessage,\n transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,\n config,\n request));\n\n // Clean up request\n request = null;\n };\n\n // Add xsrf header\n // This is only done if running in a standard browser environment.\n // Specifically not if we're in a web worker, or react-native.\n if(platform.hasStandardBrowserEnv) {\n withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(config));\n\n if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(fullPath))) {\n // Add xsrf header\n const xsrfValue = config.xsrfHeaderName && config.xsrfCookieName && cookies.read(config.xsrfCookieName);\n\n if (xsrfValue) {\n requestHeaders.set(config.xsrfHeaderName, xsrfValue);\n }\n }\n }\n\n // Remove Content-Type if data is undefined\n requestData === undefined && requestHeaders.setContentType(null);\n\n // Add headers to the request\n if ('setRequestHeader' in request) {\n utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {\n request.setRequestHeader(key, val);\n });\n }\n\n // Add withCredentials to request if needed\n if (!utils$1.isUndefined(config.withCredentials)) {\n request.withCredentials = !!config.withCredentials;\n }\n\n // Add responseType to request if needed\n if (responseType && responseType !== 'json') {\n request.responseType = config.responseType;\n }\n\n // Handle progress if needed\n if (typeof config.onDownloadProgress === 'function') {\n request.addEventListener('progress', progressEventReducer(config.onDownloadProgress, true));\n }\n\n // Not all browsers support upload events\n if (typeof config.onUploadProgress === 'function' && request.upload) {\n request.upload.addEventListener('progress', progressEventReducer(config.onUploadProgress));\n }\n\n if (config.cancelToken || config.signal) {\n // Handle cancellation\n // eslint-disable-next-line func-names\n onCanceled = cancel => {\n if (!request) {\n return;\n }\n reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);\n request.abort();\n request = null;\n };\n\n config.cancelToken && config.cancelToken.subscribe(onCanceled);\n if (config.signal) {\n config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled);\n }\n }\n\n const protocol = parseProtocol(fullPath);\n\n if (protocol && platform.protocols.indexOf(protocol) === -1) {\n reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));\n return;\n }\n\n\n // Send the request\n request.send(requestData || null);\n });\n};\n\nconst knownAdapters = {\n http: httpAdapter,\n xhr: xhrAdapter\n};\n\nutils$1.forEach(knownAdapters, (fn, value) => {\n if (fn) {\n try {\n Object.defineProperty(fn, 'name', {value});\n } catch (e) {\n // eslint-disable-next-line no-empty\n }\n Object.defineProperty(fn, 'adapterName', {value});\n }\n});\n\nconst renderReason = (reason) => `- ${reason}`;\n\nconst isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;\n\nvar adapters = {\n getAdapter: (adapters) => {\n adapters = utils$1.isArray(adapters) ? adapters : [adapters];\n\n const {length} = adapters;\n let nameOrAdapter;\n let adapter;\n\n const rejectedReasons = {};\n\n for (let i = 0; i < length; i++) {\n nameOrAdapter = adapters[i];\n let id;\n\n adapter = nameOrAdapter;\n\n if (!isResolvedHandle(nameOrAdapter)) {\n adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];\n\n if (adapter === undefined) {\n throw new AxiosError(`Unknown adapter '${id}'`);\n }\n }\n\n if (adapter) {\n break;\n }\n\n rejectedReasons[id || '#' + i] = adapter;\n }\n\n if (!adapter) {\n\n const reasons = Object.entries(rejectedReasons)\n .map(([id, state]) => `adapter ${id} ` +\n (state === false ? 'is not supported by the environment' : 'is not available in the build')\n );\n\n let s = length ?\n (reasons.length > 1 ? 'since :\\n' + reasons.map(renderReason).join('\\n') : ' ' + renderReason(reasons[0])) :\n 'as no adapter specified';\n\n throw new AxiosError(\n `There is no suitable adapter to dispatch the request ` + s,\n 'ERR_NOT_SUPPORT'\n );\n }\n\n return adapter;\n },\n adapters: knownAdapters\n};\n\n/**\n * Throws a `CanceledError` if cancellation has been requested.\n *\n * @param {Object} config The config that is to be used for the request\n *\n * @returns {void}\n */\nfunction throwIfCancellationRequested(config) {\n if (config.cancelToken) {\n config.cancelToken.throwIfRequested();\n }\n\n if (config.signal && config.signal.aborted) {\n throw new CanceledError(null, config);\n }\n}\n\n/**\n * Dispatch a request to the server using the configured adapter.\n *\n * @param {object} config The config that is to be used for the request\n *\n * @returns {Promise} The Promise to be fulfilled\n */\nfunction dispatchRequest(config) {\n throwIfCancellationRequested(config);\n\n config.headers = AxiosHeaders$1.from(config.headers);\n\n // Transform request data\n config.data = transformData.call(\n config,\n config.transformRequest\n );\n\n if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {\n config.headers.setContentType('application/x-www-form-urlencoded', false);\n }\n\n const adapter = adapters.getAdapter(config.adapter || defaults$1.adapter);\n\n return adapter(config).then(function onAdapterResolution(response) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n response.data = transformData.call(\n config,\n config.transformResponse,\n response\n );\n\n response.headers = AxiosHeaders$1.from(response.headers);\n\n return response;\n }, function onAdapterRejection(reason) {\n if (!isCancel(reason)) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n if (reason && reason.response) {\n reason.response.data = transformData.call(\n config,\n config.transformResponse,\n reason.response\n );\n reason.response.headers = AxiosHeaders$1.from(reason.response.headers);\n }\n }\n\n return Promise.reject(reason);\n });\n}\n\nconst headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? thing.toJSON() : thing;\n\n/**\n * Config-specific merge-function which creates a new config-object\n * by merging two configuration objects together.\n *\n * @param {Object} config1\n * @param {Object} config2\n *\n * @returns {Object} New object resulting from merging config2 to config1\n */\nfunction mergeConfig(config1, config2) {\n // eslint-disable-next-line no-param-reassign\n config2 = config2 || {};\n const config = {};\n\n function getMergedValue(target, source, caseless) {\n if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {\n return utils$1.merge.call({caseless}, target, source);\n } else if (utils$1.isPlainObject(source)) {\n return utils$1.merge({}, source);\n } else if (utils$1.isArray(source)) {\n return source.slice();\n }\n return source;\n }\n\n // eslint-disable-next-line consistent-return\n function mergeDeepProperties(a, b, caseless) {\n if (!utils$1.isUndefined(b)) {\n return getMergedValue(a, b, caseless);\n } else if (!utils$1.isUndefined(a)) {\n return getMergedValue(undefined, a, caseless);\n }\n }\n\n // eslint-disable-next-line consistent-return\n function valueFromConfig2(a, b) {\n if (!utils$1.isUndefined(b)) {\n return getMergedValue(undefined, b);\n }\n }\n\n // eslint-disable-next-line consistent-return\n function defaultToConfig2(a, b) {\n if (!utils$1.isUndefined(b)) {\n return getMergedValue(undefined, b);\n } else if (!utils$1.isUndefined(a)) {\n return getMergedValue(undefined, a);\n }\n }\n\n // eslint-disable-next-line consistent-return\n function mergeDirectKeys(a, b, prop) {\n if (prop in config2) {\n return getMergedValue(a, b);\n } else if (prop in config1) {\n return getMergedValue(undefined, a);\n }\n }\n\n const mergeMap = {\n url: valueFromConfig2,\n method: valueFromConfig2,\n data: valueFromConfig2,\n baseURL: defaultToConfig2,\n transformRequest: defaultToConfig2,\n transformResponse: defaultToConfig2,\n paramsSerializer: defaultToConfig2,\n timeout: defaultToConfig2,\n timeoutMessage: defaultToConfig2,\n withCredentials: defaultToConfig2,\n withXSRFToken: defaultToConfig2,\n adapter: defaultToConfig2,\n responseType: defaultToConfig2,\n xsrfCookieName: defaultToConfig2,\n xsrfHeaderName: defaultToConfig2,\n onUploadProgress: defaultToConfig2,\n onDownloadProgress: defaultToConfig2,\n decompress: defaultToConfig2,\n maxContentLength: defaultToConfig2,\n maxBodyLength: defaultToConfig2,\n beforeRedirect: defaultToConfig2,\n transport: defaultToConfig2,\n httpAgent: defaultToConfig2,\n httpsAgent: defaultToConfig2,\n cancelToken: defaultToConfig2,\n socketPath: defaultToConfig2,\n responseEncoding: defaultToConfig2,\n validateStatus: mergeDirectKeys,\n headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)\n };\n\n utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {\n const merge = mergeMap[prop] || mergeDeepProperties;\n const configValue = merge(config1[prop], config2[prop], prop);\n (utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);\n });\n\n return config;\n}\n\nconst VERSION = \"1.6.2\";\n\nconst validators$1 = {};\n\n// eslint-disable-next-line func-names\n['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach((type, i) => {\n validators$1[type] = function validator(thing) {\n return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;\n };\n});\n\nconst deprecatedWarnings = {};\n\n/**\n * Transitional option validator\n *\n * @param {function|boolean?} validator - set to false if the transitional option has been removed\n * @param {string?} version - deprecated version / removed since version\n * @param {string?} message - some message with additional info\n *\n * @returns {function}\n */\nvalidators$1.transitional = function transitional(validator, version, message) {\n function formatMessage(opt, desc) {\n return '[Axios v' + VERSION + '] Transitional option \\'' + opt + '\\'' + desc + (message ? '. ' + message : '');\n }\n\n // eslint-disable-next-line func-names\n return (value, opt, opts) => {\n if (validator === false) {\n throw new AxiosError(\n formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')),\n AxiosError.ERR_DEPRECATED\n );\n }\n\n if (version && !deprecatedWarnings[opt]) {\n deprecatedWarnings[opt] = true;\n // eslint-disable-next-line no-console\n console.warn(\n formatMessage(\n opt,\n ' has been deprecated since v' + version + ' and will be removed in the near future'\n )\n );\n }\n\n return validator ? validator(value, opt, opts) : true;\n };\n};\n\n/**\n * Assert object's properties type\n *\n * @param {object} options\n * @param {object} schema\n * @param {boolean?} allowUnknown\n *\n * @returns {object}\n */\n\nfunction assertOptions(options, schema, allowUnknown) {\n if (typeof options !== 'object') {\n throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE);\n }\n const keys = Object.keys(options);\n let i = keys.length;\n while (i-- > 0) {\n const opt = keys[i];\n const validator = schema[opt];\n if (validator) {\n const value = options[opt];\n const result = value === undefined || validator(value, opt, options);\n if (result !== true) {\n throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE);\n }\n continue;\n }\n if (allowUnknown !== true) {\n throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION);\n }\n }\n}\n\nvar validator = {\n assertOptions,\n validators: validators$1\n};\n\nconst validators = validator.validators;\n\n/**\n * Create a new instance of Axios\n *\n * @param {Object} instanceConfig The default config for the instance\n *\n * @return {Axios} A new instance of Axios\n */\nclass Axios {\n constructor(instanceConfig) {\n this.defaults = instanceConfig;\n this.interceptors = {\n request: new InterceptorManager$1(),\n response: new InterceptorManager$1()\n };\n }\n\n /**\n * Dispatch a request\n *\n * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)\n * @param {?Object} config\n *\n * @returns {Promise} The Promise to be fulfilled\n */\n request(configOrUrl, config) {\n /*eslint no-param-reassign:0*/\n // Allow for axios('example/url'[, config]) a la fetch API\n if (typeof configOrUrl === 'string') {\n config = config || {};\n config.url = configOrUrl;\n } else {\n config = configOrUrl || {};\n }\n\n config = mergeConfig(this.defaults, config);\n\n const {transitional, paramsSerializer, headers} = config;\n\n if (transitional !== undefined) {\n validator.assertOptions(transitional, {\n silentJSONParsing: validators.transitional(validators.boolean),\n forcedJSONParsing: validators.transitional(validators.boolean),\n clarifyTimeoutError: validators.transitional(validators.boolean)\n }, false);\n }\n\n if (paramsSerializer != null) {\n if (utils$1.isFunction(paramsSerializer)) {\n config.paramsSerializer = {\n serialize: paramsSerializer\n };\n } else {\n validator.assertOptions(paramsSerializer, {\n encode: validators.function,\n serialize: validators.function\n }, true);\n }\n }\n\n // Set config.method\n config.method = (config.method || this.defaults.method || 'get').toLowerCase();\n\n // Flatten headers\n let contextHeaders = headers && utils$1.merge(\n headers.common,\n headers[config.method]\n );\n\n headers && utils$1.forEach(\n ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],\n (method) => {\n delete headers[method];\n }\n );\n\n config.headers = AxiosHeaders$1.concat(contextHeaders, headers);\n\n // filter out skipped interceptors\n const requestInterceptorChain = [];\n let synchronousRequestInterceptors = true;\n this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {\n if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {\n return;\n }\n\n synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;\n\n requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);\n });\n\n const responseInterceptorChain = [];\n this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {\n responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);\n });\n\n let promise;\n let i = 0;\n let len;\n\n if (!synchronousRequestInterceptors) {\n const chain = [dispatchRequest.bind(this), undefined];\n chain.unshift.apply(chain, requestInterceptorChain);\n chain.push.apply(chain, responseInterceptorChain);\n len = chain.length;\n\n promise = Promise.resolve(config);\n\n while (i < len) {\n promise = promise.then(chain[i++], chain[i++]);\n }\n\n return promise;\n }\n\n len = requestInterceptorChain.length;\n\n let newConfig = config;\n\n i = 0;\n\n while (i < len) {\n const onFulfilled = requestInterceptorChain[i++];\n const onRejected = requestInterceptorChain[i++];\n try {\n newConfig = onFulfilled(newConfig);\n } catch (error) {\n onRejected.call(this, error);\n break;\n }\n }\n\n try {\n promise = dispatchRequest.call(this, newConfig);\n } catch (error) {\n return Promise.reject(error);\n }\n\n i = 0;\n len = responseInterceptorChain.length;\n\n while (i < len) {\n promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);\n }\n\n return promise;\n }\n\n getUri(config) {\n config = mergeConfig(this.defaults, config);\n const fullPath = buildFullPath(config.baseURL, config.url);\n return buildURL(fullPath, config.params, config.paramsSerializer);\n }\n}\n\n// Provide aliases for supported request methods\nutils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {\n /*eslint func-names:0*/\n Axios.prototype[method] = function(url, config) {\n return this.request(mergeConfig(config || {}, {\n method,\n url,\n data: (config || {}).data\n }));\n };\n});\n\nutils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {\n /*eslint func-names:0*/\n\n function generateHTTPMethod(isForm) {\n return function httpMethod(url, data, config) {\n return this.request(mergeConfig(config || {}, {\n method,\n headers: isForm ? {\n 'Content-Type': 'multipart/form-data'\n } : {},\n url,\n data\n }));\n };\n }\n\n Axios.prototype[method] = generateHTTPMethod();\n\n Axios.prototype[method + 'Form'] = generateHTTPMethod(true);\n});\n\nvar Axios$1 = Axios;\n\n/**\n * A `CancelToken` is an object that can be used to request cancellation of an operation.\n *\n * @param {Function} executor The executor function.\n *\n * @returns {CancelToken}\n */\nclass CancelToken {\n constructor(executor) {\n if (typeof executor !== 'function') {\n throw new TypeError('executor must be a function.');\n }\n\n let resolvePromise;\n\n this.promise = new Promise(function promiseExecutor(resolve) {\n resolvePromise = resolve;\n });\n\n const token = this;\n\n // eslint-disable-next-line func-names\n this.promise.then(cancel => {\n if (!token._listeners) return;\n\n let i = token._listeners.length;\n\n while (i-- > 0) {\n token._listeners[i](cancel);\n }\n token._listeners = null;\n });\n\n // eslint-disable-next-line func-names\n this.promise.then = onfulfilled => {\n let _resolve;\n // eslint-disable-next-line func-names\n const promise = new Promise(resolve => {\n token.subscribe(resolve);\n _resolve = resolve;\n }).then(onfulfilled);\n\n promise.cancel = function reject() {\n token.unsubscribe(_resolve);\n };\n\n return promise;\n };\n\n executor(function cancel(message, config, request) {\n if (token.reason) {\n // Cancellation has already been requested\n return;\n }\n\n token.reason = new CanceledError(message, config, request);\n resolvePromise(token.reason);\n });\n }\n\n /**\n * Throws a `CanceledError` if cancellation has been requested.\n */\n throwIfRequested() {\n if (this.reason) {\n throw this.reason;\n }\n }\n\n /**\n * Subscribe to the cancel signal\n */\n\n subscribe(listener) {\n if (this.reason) {\n listener(this.reason);\n return;\n }\n\n if (this._listeners) {\n this._listeners.push(listener);\n } else {\n this._listeners = [listener];\n }\n }\n\n /**\n * Unsubscribe from the cancel signal\n */\n\n unsubscribe(listener) {\n if (!this._listeners) {\n return;\n }\n const index = this._listeners.indexOf(listener);\n if (index !== -1) {\n this._listeners.splice(index, 1);\n }\n }\n\n /**\n * Returns an object that contains a new `CancelToken` and a function that, when called,\n * cancels the `CancelToken`.\n */\n static source() {\n let cancel;\n const token = new CancelToken(function executor(c) {\n cancel = c;\n });\n return {\n token,\n cancel\n };\n }\n}\n\nvar CancelToken$1 = CancelToken;\n\n/**\n * Syntactic sugar for invoking a function and expanding an array for arguments.\n *\n * Common use case would be to use `Function.prototype.apply`.\n *\n * ```js\n * function f(x, y, z) {}\n * var args = [1, 2, 3];\n * f.apply(null, args);\n * ```\n *\n * With `spread` this example can be re-written.\n *\n * ```js\n * spread(function(x, y, z) {})([1, 2, 3]);\n * ```\n *\n * @param {Function} callback\n *\n * @returns {Function}\n */\nfunction spread(callback) {\n return function wrap(arr) {\n return callback.apply(null, arr);\n };\n}\n\n/**\n * Determines whether the payload is an error thrown by Axios\n *\n * @param {*} payload The value to test\n *\n * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false\n */\nfunction isAxiosError(payload) {\n return utils$1.isObject(payload) && (payload.isAxiosError === true);\n}\n\nconst HttpStatusCode = {\n Continue: 100,\n SwitchingProtocols: 101,\n Processing: 102,\n EarlyHints: 103,\n Ok: 200,\n Created: 201,\n Accepted: 202,\n NonAuthoritativeInformation: 203,\n NoContent: 204,\n ResetContent: 205,\n PartialContent: 206,\n MultiStatus: 207,\n AlreadyReported: 208,\n ImUsed: 226,\n MultipleChoices: 300,\n MovedPermanently: 301,\n Found: 302,\n SeeOther: 303,\n NotModified: 304,\n UseProxy: 305,\n Unused: 306,\n TemporaryRedirect: 307,\n PermanentRedirect: 308,\n BadRequest: 400,\n Unauthorized: 401,\n PaymentRequired: 402,\n Forbidden: 403,\n NotFound: 404,\n MethodNotAllowed: 405,\n NotAcceptable: 406,\n ProxyAuthenticationRequired: 407,\n RequestTimeout: 408,\n Conflict: 409,\n Gone: 410,\n LengthRequired: 411,\n PreconditionFailed: 412,\n PayloadTooLarge: 413,\n UriTooLong: 414,\n UnsupportedMediaType: 415,\n RangeNotSatisfiable: 416,\n ExpectationFailed: 417,\n ImATeapot: 418,\n MisdirectedRequest: 421,\n UnprocessableEntity: 422,\n Locked: 423,\n FailedDependency: 424,\n TooEarly: 425,\n UpgradeRequired: 426,\n PreconditionRequired: 428,\n TooManyRequests: 429,\n RequestHeaderFieldsTooLarge: 431,\n UnavailableForLegalReasons: 451,\n InternalServerError: 500,\n NotImplemented: 501,\n BadGateway: 502,\n ServiceUnavailable: 503,\n GatewayTimeout: 504,\n HttpVersionNotSupported: 505,\n VariantAlsoNegotiates: 506,\n InsufficientStorage: 507,\n LoopDetected: 508,\n NotExtended: 510,\n NetworkAuthenticationRequired: 511,\n};\n\nObject.entries(HttpStatusCode).forEach(([key, value]) => {\n HttpStatusCode[value] = key;\n});\n\nvar HttpStatusCode$1 = HttpStatusCode;\n\n/**\n * Create an instance of Axios\n *\n * @param {Object} defaultConfig The default config for the instance\n *\n * @returns {Axios} A new instance of Axios\n */\nfunction createInstance(defaultConfig) {\n const context = new Axios$1(defaultConfig);\n const instance = bind(Axios$1.prototype.request, context);\n\n // Copy axios.prototype to instance\n utils$1.extend(instance, Axios$1.prototype, context, {allOwnKeys: true});\n\n // Copy context to instance\n utils$1.extend(instance, context, null, {allOwnKeys: true});\n\n // Factory for creating new instances\n instance.create = function create(instanceConfig) {\n return createInstance(mergeConfig(defaultConfig, instanceConfig));\n };\n\n return instance;\n}\n\n// Create the default instance to be exported\nconst axios = createInstance(defaults$1);\n\n// Expose Axios class to allow class inheritance\naxios.Axios = Axios$1;\n\n// Expose Cancel & CancelToken\naxios.CanceledError = CanceledError;\naxios.CancelToken = CancelToken$1;\naxios.isCancel = isCancel;\naxios.VERSION = VERSION;\naxios.toFormData = toFormData;\n\n// Expose AxiosError class\naxios.AxiosError = AxiosError;\n\n// alias for CanceledError for backward compatibility\naxios.Cancel = axios.CanceledError;\n\n// Expose all/spread\naxios.all = function all(promises) {\n return Promise.all(promises);\n};\n\naxios.spread = spread;\n\n// Expose isAxiosError\naxios.isAxiosError = isAxiosError;\n\n// Expose mergeConfig\naxios.mergeConfig = mergeConfig;\n\naxios.AxiosHeaders = AxiosHeaders$1;\n\naxios.formToJSON = thing => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);\n\naxios.getAdapter = adapters.getAdapter;\n\naxios.HttpStatusCode = HttpStatusCode$1;\n\naxios.default = axios;\n\nmodule.exports = axios;\n//# sourceMappingURL=axios.cjs.map\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(1045);\n"],"names":["root","factory","exports","module","define","amd","this","_require","require","Var","Vars","Doc","WOQLClient","UTILS","View","WOQL","WOQLResult","WOQLTable","WOQLGraph","axiosInstance","AccessControl","WOQLQuery","DispatchRequest","ErrorMessage","CONST","cloudAPIUrl","params","baseURL","getAPIUrl","jwt","setJwtToken","token","setApiToken","key","setApiKey","user","defaultOrganization","getDefaultOrganization","prototype","organization","Error","apiKey","apiType","lastIndexOf","length","concat","dispatch","requestUrl","action","payload","type","customHeaders","Promise","reject","getInvalidParameterMessage","_customHeaders","getOrganization","org","GET","getAllOrganizations","createOrganization","orgName","encodeURISegment","POST","deleteOrganization","DELETE","createRole","name","actions","deleteRole","getAllUsers","createUser","password","deleteUser","userId","manageCapability","userName","resourceName","rolesArr","operation","scopeType","roles","scope","scope_type","getAccessRoles","getOrgUsers","getTeamUserRoles","ifOrganizationExists","HEAD","createOrganizationRemote","getPendingOrgInvites","sendOrgInvite","userEmail","role","errorMessage","note","arguments","undefined","email_to","getOrgInvite","inviteId","inviteHash","removeDocType","deleteOrgInvite","updateOrgInviteStatus","accepted","PUT","getTeamUserRole","removeUserFromOrg","getDatabaseRolesOfUser","createUserRole","updateUserRole","capabilityId","capHash","accessRequestsList","sendAccessRequest","email","affiliation","deleteAccessRequest","acceId","getUserInfo","userNameUrl","create","ConnectionConfig","serverUrl","server","baseServer","remote_auth","local_auth","organizationid","dbid","default_branch_id","default_repo_id","system_db","api_extension","branchid","repoid","refid","connection_error","surl","parseServerURL","update","copy","other","orgID","setOrganization","db","setDB","setLocalBasicAuth","branch","setBranch","ref","setRef","repo","setRepo","serverURL","author","apiURL","apiURLInfo","localAuth","localUser","ignoreJwt","str","substring","serverUrlEncoding","orgArr","split","replace","clearCursor","setError","orgId","dbId","repoId","branchId","refId","setRemoteBasicAuth","remoteKey","remoteUserID","userKey","setLocalAuth","newCredential","setRemoteAuth","remoteAuth","dbURL","dbBase","userURL","url","organizationURL","userOrganizationsURL","rolesURL","updateRolesURL","graphURL","graphType","branchBase","triplesURL","csvURL","queryURL","log","updateOrganizationRoleURL","cloneURL","newRepoId","crl","cloneableURL","pullURL","patchURL","diffURL","applyURL","docHistoryURL","paramsStr","queryParameter","fetchURL","remoteName","purl","rebaseURL","resetURL","pushURL","branchURL","repoBase","squashBranchURL","nuid","b","resetBranchUrl","commitDescriptorUrl","commitId","optimizeBranchUrl","encodeURIComponent","dbURLFragment","documentURL","prefixesURL","_typeof","queryString","Object","keys","map","join","jsonSchemaURL","freeze","QUERY_DOCUMENT","SQUASH_BRANCH","UPDATE_SCHEMA","CONNECT","CREATE_DATABASE","READ_DATABASE","UPDATE_DATABASE","CREATE_USER","READ_USER","UPDATE_USER","CREATE_ORGANIZATION","READ_ORGANIZATION","UPDATE_ORGANIZATION","GET_ROLES","UPDATE_ROLES","CREATE_GRAPH","GET_TRIPLES","INSERT_TRIPLES","UPDATE_TRIPLES","CLASS_FRAME","WOQL_QUERY","CLONE","CSV","FRAME","PUSH","PULL","FETCH","REBASE","RESET","BRANCH","RESET_BRANCH","ADD_CSV","GET_CSV","UPDATE_CSV","MESSAGE","ACTION","INFO","OPTIMIZE_SYSTEM","GET_DIFF","PATCH","pako","version","getResultWithDataVersion","response","result","data","dataVersion","headers","formatAuthHeader","auth_obj","auth_key","btoa","err","Buffer","from","toString","btoaImplementation","basic","apikey","checkPayload","options","compress","jsonStringPost","JSON","stringify","gzip","getDataVersion","mode","redirect","referrer","maxContentLength","Infinity","maxBodyLength","startsWith","window","https","agent","Agent","rejectUnauthorized","httpsAgent","Authorization","then","apiErrorFormatted","head","ext","URIEncodePayload","get","put","compressedContent","jsonString","compressedContentPost","post","getErrorAsMessage","api","formatErrorMessage","body","status","method","stack","msg","nmsg","_i","_Object$keys","getAPIErrorMessage","e","getAccessDeniedMessage","accessDenied","getInvalidURIMessage","call","parseAPIError","text","json","error","redirected","WOQLQueryExt","_WOQLQueryExt","_inherits","_super","query","_classCallCheck","star","Graph","Subj","Pred","Obj","quad","triple","all","string","s","String","tf","literal","t","indexOf","iri","node","update_triple","subject","predicate","newObjValue","oldObjValue","tmp_name","counter","and","opt","delete_triple","not","add_triple","update_quad","newObject","graph","delete_quad","add_quad","nuke","graphRef","ctxt","_set_context","k","triple_builder_context","insert","id","refGraph","WOQLPrinter","_createClass","_defineProperty","loadDefaultVocabulary","cursor","tokenize","pat","parts","getClauseAndRemainder","seq","push","open","trim","charAt","i","rem","ret","tokensToJSON","q","ntoks","pp","pred","slice","cleaned","cleanPathPredicate","or","compilePredicate","left","right","first","second","sequence","plus","meat","to","times","parameterError","copyJSON","orig","rollup","Array","isArray","comment","consequent","nuj","part","nupart","j","sub","empty","errors","message","hasErrors","addSubQuery","Subq","jobj","nv","containsUpdate","update_operators","updated","contains_update","jlt","val","varj","varb","variable","rawVar","rawVarList","vl","co","qobj","asv","colname_or_index","asvar","indicator","index","wform","opts","format","format_type","format_header","h","arop","arg","cleanArithmeticValue","dataList","wvar","string_only","expandDataVariable","cleanDataValue","valueList","expandValueVariable","cleanObject","vlist","list","v","dataValueList","dvl","o","cleanSubject","subj","expandNodeVariable","cleanPredicate","p","wellKnownPredicate","noxsd","vocab","full","start","obj","encoded","res","expandArithmeticVariable","cleanNodeValue","cleanGraph","g","expandVariable","varname","always","defaultContext","DB_IRI","def","pref","standard_urls","scm","doc","getContext","prop","paging_transitive_properties","nq","nc","context","c","setVocabulary","getVocabulary","execute","client","commit_msg","prettyPrint","clang","printer","printJSON","findLastSubject","lqs","ls","findLastProperty","_is_property_triple","object","pred_str","obj_str","compilePathPattern","toks","convert","pairs","_Object$entries","entries","_Object$entries$_i","value","field","dictionary","_len","args","_key","varObj","argumentName","WOQLLibrary","branches","using","commits","limit","timestamp","woql","select","andArr","path","less","apply","previousCommits","commit_id","first_commit","language","indent_spaces","boxed_predicates","subject_cleaned_predicates","schema_cleaned_predicates","list_operators","query_list_operators","operator_maps","IDGenerator","IsA","PostResource","QueryResource","AsVars","NamedAsVars","IndexedAsVars","DeletedTriple","shortcuts","optional","regexp","subsumption","equals","concatenate","pythonic","as","with","show_context","needsParentheses","nspaces","n","spaces","level","fluent","newline","_this","console","pvar","operator","getQueryResourceStr","ujson","unboxJSON","printArgument","getBoxedPredicate","isListOperator","getFunctionForOperator","indent","getWOQLPrelude","getArgumentOrder","divlimit","forEach","item","nfluent","argumentTakesNewline","source","functName","file","splice","isQueryListOperator","argumentRequiresArray","decompileDocument","decompileVariables","decompileAsVars","decompileRegexPattern","arr_entries","nlevel","jstr","uncleanArgument","jsonDoc","decompileDictionary","_this2","decompileFieldValuePair","fieldValue","valueDoc","checkIsArray","varName","decompilePathPattern","_this3","order","listArr","listTmp","listItem","inline","toUpperCase","prelude","f","m","toLowerCase","bp","asvs","_this4","wasv","target","pstruct","next","astr","sequenceArr","next1","next2","seqstr","orArr","WOQLCore","_WOQLCore","nodeid","chainType","_get","_getPrototypeOf","read_document","IRI","output","wrapCursorWithAnd","identifier","document","insert_document","docjson","update_document","delete_document","newby","nj","refPath","subquery","collection","varNames","last","embedquery","pop","variables","distinct","_len2","_key2","_len3","subqueries","_key3","unshift","onevar","qjson","subvar","into","added_triple","removed_triple","link","objValue","added_quad","removed_quad","classA","classB","parent","child","eq","varValue","substr","before","after","subString","asvars","queryResource","_WOQLQuery","columns","_toConsumableArray","resource","varsToExp","fileResource","_WOQLQuery2","nasvars","iasv","_len4","varList","_key4","onemap","oasv","remote","remoteObj","formatObj","inputStr","resultVarName","untrimmed","trimmed","eval","arithExp","expression","_len5","_key5","_WOQLQuery3","shift","minus","_len6","_key6","_WOQLQuery4","_len7","_key7","_WOQLQuery5","divide","_len8","_key8","_WOQLQuery6","div","_len9","_key9","_WOQLQuery7","exp","varNum","expNum","floor","argument","isa","instanceIRI","classId","element","like","stringA","stringB","distance","similarity","varNum01","varNum02","greater","unique","prefix","inputVarList","base","key_list","uri","idgen","outputVar","idgenerator","upper","inputVarName","mixed","lower","pad","len","separator","pattern","member","slist","nlist","slist2","x","rest","glue","sum","total","re","resultVarList","vb","once","immediately","count","countVarName","typecast","varType","cast","order_by","_len10","orderedVarlist","_key10","ordering","group_by","gvarlist","groupedvar","groupquery","template","grouped","dot","size","resourceId","triple_count","TripleCount","type_of","elementId","elementType","ACTIONS","Utils","test","DELETE_DATABASE","SCHEMA_READ_ACCESS","SCHEMA_WRITE_ACCESS","INSTANCE_READ_ACCESS","INSTANCE_WRITE_ACCESS","COMMIT_READ_ACCESS","COMMIT_WRITE_ACCESS","META_READ_ACCESS","META_WRITE_ACCESS","encodeURI","decodeURI","rdf","rdfs","xsd","xdd","owl","system","vio","layer","payloadArr","_i2","_Object$keys2","keyElement","valueElement","_i3","_Object$keys3","hasOwnProperty","r","Math","random","d","Date","getTime","_i4","_Object$keys4","ida","idb","unshorten","shorten","prefixes","validURL","bits","jsonld","shorten_json_val","nvals","json_shorten","nujson","nkey","nval","unshorten_json_val","json_unshorten","allow_shorthand","prot","nurl","urlFragment","location","href","urlStr","_slicedToArray","_url$split2","vars","nvars","addNamespaceToVariable","mvar","removeNamespaceFromVariable","row","rad","TypeHelper","isStringType","stype","isDatatype","sh","numberWithCommas","formatBytes","bytes","decimals","dm","sizes","parseFloat","pow","toFixed","datatypes","parseRangeValue","dividor","vals","DateHelper","parseXsdTime","tz","extractXsdTimezone","hour","minute","timezone","parseXsdDate","year","parsed","abs","month","parseInt","day","parseDate","ty","parseXsdDateTime","addXsdPadding","nparsed","xsdFromParsed","xparsed","convertTimestampToXsd","a","getFullYear","getMonth","getDate","getHours","getMinutes","getSeconds","datetime","ptime","_i5","_Object$keys5","endsWith","Config","WOQLChartConfig","ViewConfig","WOQLChartRule","WOQLViewRule","setPrototypeOf","rules","margin","title","description","layout","align","getBasicPrettyPrint","conf","chart","getRulesJSON","loadJSON","config","loadBasicJSON","jr","nr","_title","_description","_layout","_align","marginObj","_margin","xAxis","woqlRule","setVariables","legend","yAxis","bar","line","point","area","style","rule","label","legendType","fillOpacity","fill","color","stroke","strokeWidth","isVisible","labelRotate","angle","padding","paddingObj","labelDateInput","labelDateOutput","stackId","axisDomain","domainArr","domain","colorEntry","propValue","customColors","colorsObj","barSize","WOQLChooser","WOQLChooserConfig","WOQLChooserRule","change","show_empty","values","labels","titles","sort","direction","getBasicJSON","chooser","onChange","placeholder","value_variable","label_variable","title_variable","sort_variable","sort_direction","l","selected","ObjectFrame","FrameConfig","FrameHelper","DocumentFrame","load_schema","addRuleForVio","docview","shrt","property","dburl","loadDocument","encoding","getDocument","loadDataFrames","loadSchema","cls","ncls","getClassFrame","loadSchemaFrames","loadComplete","loadDocumentSchema","docid","clsid","loadData","classframes","loadJSONLDDocument","load","loadClassFrames","subjid","newDoc","fillFromSchema","genBNID","filterFrame","loadRenderer","applyRules","frame","render","compare","setErrors","frameconf","clearErrors","mymatch","mfilter","setFrameDisplayOptions","FrameRule","DocumentRule","json_rules","get_schema","show_all","renderer","show_parts","fp","display_options","view","showDisabledButtons","show_disabled_buttons","hidden","collapse","headerStyle","header_style","features","setFrameFeatures","headerFeatures","header_features","header","showEmpty","dataviewer","setFrameArgs","existing","fresh","got","fkey","rep","props","rend","func","errs","hf","feats","applyFeatureProperty","nfeats","nfeat","unpackFeatures","extensions","fstr","fid","TerminusRule","FramePattern","TerminusPattern","testRules","onmatch","matched_rules","patternMatchesFrame","checkFrame","setPattern","frame_type","subjectClass","range","depth","par","children","kid","rtype","getRendererType","illegalRuleType","checkFrameType","checkLabel","checkSubject","checkSubjectClass","checkProperty","checkDepth","checkRange","checkValue","checkType","checkLiteral","checkParent","checkChildren","checkIndex","checkStatus","unpack","frameType","kids","rsubj","IDsMatch","found","properties","isUpdated","isNew","numberMatch","propertyIDsMatch","vs","isDatatypeProperty","valuesMatch","rangeIDsMatch","rcls","classIDsMatch","ftype","getLabel","stringMatch","isProperty","isObject","isData","renderer_type","constructor","WOQLGraphConfig","WOQLGraphRule","literals","show_literals","source_variable","fontfamily","fontfam","show_force","force","fix_nodes","fixed","explode_out","explode","selected_grows","bigsel","width","gwidth","height","gheight","edges","nedges","removeNamespacesFromVariables","show_edges","edge","cols","estrs","charge","collisionRadius","arrow","symmetric","weight","w","originalDocument","PropertyFrame","cframe","DataFrame","loadParent","rangeValue","ClassFrame","dl","Restriction","restriction","min","max","loadRestriction","jsonld_context","cf","isValid","hasSchema","rdoc","getPropertyClassFrame","isClassChoice","isLogic","getChosenFrame","addJSONLDDocument","getAsFrame","parentframe","ff","domainValue","getAsFrames","frames","restrictions","reset","originalFrames","clear","jsonlddoc","loadFromJSONLD","getProperties","filled","missing","getMissingPropertyList","nmissing","newb","getPossibleContainedClasses","efcf","operands","getDocumentLinks","mprop","dval","isDocument","getFilledPropertyList","newid","pf","_i6","_Object$keys6","clone","cloned","_i7","_Object$keys7","getChild","childid","pframe","getProperty","_i8","_Object$keys8","addProperty","ndata","nprop","createEmpty","createEmptyChoice","clss","getClassChoices","addValueFrame","addPropertyValue","addValue","removeProperty","removePropertyValue","removeValue","extract","extracts","extracted","extractJSONLD","set","parentObject","renderProperties","sortProperties","nprops","unsorted","standardCompare","cardControlAllows","hasRestriction","currentnum","getSummary","propcount","saveQuery","update_object","pathToDoc","deleteQuery","delete_object","df","addFrame","oframe","nu","nframe","hasVal","childUpdated","getComment","hasCardinalityRestriction","getRestriction","deletePropertyValue","gets","cvalues","fs","renderValues","sortedVals","sortValues","originalValue","isValidType","dt","hasCardRestriction","lab","labelFromURL","getType","isObjectProperty","isRestriction","isChoice","isString","getStdURL","getChoiceOptions","elements","option","lang","getTypeShorthand","getShorthand","contents","normalizer","objlit","newval","ntype","nlang","upd","loadFromObjectFrame","getChosenClassFrames","objframe","fframe","chosen","dataframe","cloneDataFrame","getChosenClassFrame","operand","cardinality","maxCardinality","minCardinality","nrest","WOQLStream","WOQLStreamConfig","WOQLStreamRule","wqt","mtemplate","stream","WOQLTableConfig","WOQLTableRule","column_order","pagesize","filter","filterable","pager","bindings","page","changesize","table","canfilter","tfilterable","tfilter","trenderer","theader","show_pager","change_pagesize","show_pagesize","show_pagenumber","column","hdr","wid","maxWidth","minWidth","unsortable","uncompressed","sortable","mjson","njson","testBasics","testValue","constraint","vundertest","arr","nonstring","compareIDs","vala","valb","RegExp","WOQLRule","view_render","view_renderer","vbindings","getBasicprettyPrint","icon","border","click","hover","onClick","onHover","WOQLChart","setResult","ch","choices","rows","getVariableList","includeRow","rowToChoice","matchRow","rownum","choice","getRowID","getLabelFromBinding","getTitleFromBinding","getSelectedFromBinding","rval","sp","getSpecialRenderer","renderSpecial","setRenderer","prev","nodes","calculateVariableTypes","extractFromBinding","combineEdges","combineNodes","includeNode","includeLiteralNode","createEdgesFromIDs","ndid","addAdornedNode","addAdornedEdge","ks","kt","matchEdge","hid","getConfigValue","nid","nodetype","matchNode","radius","getLiteralOwner","cs","es","getEdges","nnodes","nodes_referenced_by_edges","fedges","k2","getNodes","variableName","num","getLimit","getPagingProperty","setLimit","setPagingProperty","isPaged","getPage","psize","hasStart","getStart","setPage","pagenum","pstart","setStart","addStart","nextPage","firstPage","previousPage","npage","setPageSize","hasSelect","getSelectVariables","pageprop","results","insert_count","inserts","delete_count","deletes","transaction_retry_count","variable_names","formatter","formatted","rowObj","propName","oval","noval","kval","hasBindings","hasUpdates","getBindings","asc_or_desc","compareValues","WOQLPattern","current_variable","varlist","constraints","tester","matches","matchCell","matchColumn","ruleName","ruleRow","matchPair","keya","keyb","testVariableConstraints","testVariableConstraint","wqrs","DataValue","datavalue","datatype","canAdvancePage","canChangePage","canRetreatPage","getPageSize","getColumnsToRender","hasColumnOrder","getColumnOrder","self","col","getColumnHeaderContents","colid","labelFromVariable","nquery","nresult","notify","hasDefinedEvent","getDefinedEvent","findRule","find","getRowClick","getCellClick","getRowHover","getCellHover","getColumnFilter","getColumnDimensions","cstyle","hasCellClick","hasRowClick","hasCellHover","hasRowHover","getRenderer","isSortableColumn","isFilterableColumn","renderValue","dv","nvalue","getRendererForDatatype","getSpecificRender","typedef","_WOQLQuery8","_WOQLQuery9","_WOQLQuery10","patternVars","tripleCount","classType","JSON_LD","date","bool","_client","_construct","auto_eval","unemerged","_emerge_str","funcs","_regeneratorRuntime","Op","hasOwn","$Symbol","Symbol","iteratorSymbol","iterator","asyncIteratorSymbol","asyncIterator","toStringTagSymbol","toStringTag","defineProperty","enumerable","configurable","writable","wrap","innerFn","outerFn","tryLocsList","protoGenerator","Generator","generator","Context","_invoke","state","done","delegate","delegateResult","maybeInvokeDelegate","ContinueSentinel","sent","_sent","dispatchException","abrupt","record","tryCatch","fn","GeneratorFunction","GeneratorFunctionPrototype","IteratorPrototype","getProto","getPrototypeOf","NativeIteratorPrototype","Gp","defineIteratorMethods","AsyncIterator","PromiseImpl","invoke","resolve","__await","unwrapped","previousPromise","callInvokeWithMethodAndArg","TypeError","info","resultName","nextLoc","pushTryEntry","locs","entry","tryLoc","catchLoc","finallyLoc","afterLoc","tryEntries","resetTryEntry","completion","iterable","iteratorMethod","isNaN","doneResult","displayName","isGeneratorFunction","genFun","ctor","mark","__proto__","awrap","async","iter","reverse","skipTempReset","stop","rootRecord","exception","handle","loc","caught","hasCatch","hasFinally","finallyEntry","complete","finish","thrown","delegateYield","asyncGeneratorStep","gen","_next","_throw","_asyncToGenerator","_defineProperties","descriptor","Constructor","protoProps","staticProps","FormData","instance","connectionConfig","getResourceObjects","queryObject","result_array","accessToken","currentAuth","databaseList","databases","hasDatabase","_ref","_callee","dbName","dbCheckUrl","_context","req","_x","_x2","getDatabases","_callee2","dbs","dbList","_context2","getUserOrganizations","userOrganizations","userOrganization","databaseInfo","setSystemDb","checkout","resourceType","resourceIdValue","connect","createDatabase","dbDetails","errmsg","updateDatabase","dbDoc","deleteDatabase","orgIdValue","getTriples","updateTriples","turtle","commitMsg","commit","generateCommitInfo","insertTriples","pathname","actionName","allWitnesses","lastDataVersion","postBody","doql","resourceObjects","formData","resourceObject","fileName","append","createReadStream","filename","contentType","getHeaders","all_witnesses","newBranchId","isEmpty","origin","squashBranch","resetBranch","commit_descriptor","optimizeBranch","deleteBranch","pull","remoteSourceRepo","rc_args","prepareRevisionControlArgs","remote_branch","fetch","remoteId","remoteTargetRepo","rebase","rebaseSource","rebase_from","commitPath","clonedb","cloneSource","newDbId","user_organization","remote_url","apiUrl","commit_info","generateCommitDescriptor","addDocument","docParams","queryDocument","queryDoc","updateDocument","deleteDocument","getSchemaFrame","getSchema","graph_type","as_list","getClasses","getEnums","getClassDocuments","documents","getBranches","branchesObj","getCommitsLog","getPrefixes","orgList","organizationList","patch","patchResource","getJSONDiff","_objectSpread","getVersionObjectDiff","jsonObject","before_data_version","getVersionDiff","beforeVersion","afterVersion","after_data_version","document_id","matchFinalState","before_commit","after_commit","match_final_state","getDocumentHistory","historyParams","sendCustomRequest","requestType","customRequestURL","Deflate","deflate","deflateRaw","Inflate","inflate","inflateRaw","ungzip","constants","zlib_deflate","utils","strings","ZStream","Z_NO_FLUSH","Z_SYNC_FLUSH","Z_FULL_FLUSH","Z_FINISH","Z_OK","Z_STREAM_END","Z_DEFAULT_COMPRESSION","Z_DEFAULT_STRATEGY","Z_DEFLATED","assign","chunkSize","windowBits","memLevel","strategy","raw","ended","chunks","strm","avail_out","deflateInit2","deflateSetHeader","dict","string2buf","Uint8Array","deflateSetDictionary","_dict_set","input","deflator","flush_mode","_flush_mode","next_in","avail_in","next_out","onData","subarray","deflateEnd","onEnd","chunk","flattenChunks","zlib_inflate","GZheader","Z_NEED_DICT","Z_STREAM_ERROR","Z_DATA_ERROR","Z_MEM_ERROR","inflateInit2","inflateGetHeader","inflateSetDictionary","inflator","last_avail_out","inflateReset","next_out_utf8","utf8border","tail","utf8str","buf2string","inflateEnd","_has","sources","pos","STR_APPLY_UIA_OK","fromCharCode","__","_utf8len","TextEncoder","encode","buf","c2","m_pos","str_len","buf_len","charCodeAt","TextDecoder","decode","out","utf16buf","c_len","buf2binstring","adler","s1","s2","Z_PARTIAL_FLUSH","Z_BLOCK","Z_TREES","Z_ERRNO","Z_BUF_ERROR","Z_NO_COMPRESSION","Z_BEST_SPEED","Z_BEST_COMPRESSION","Z_FILTERED","Z_HUFFMAN_ONLY","Z_RLE","Z_FIXED","Z_BINARY","Z_TEXT","Z_UNKNOWN","crcTable","Uint32Array","makeTable","crc","end","_tr_init","_tr_stored_block","_tr_flush_block","_tr_tally","_tr_align","adler32","crc32","MAX_MATCH","MIN_LOOKAHEAD","HCRC_STATE","BUSY_STATE","FINISH_STATE","errorCode","rank","zero","HASH","hash_shift","hash_mask","flush_pending","pending","pending_buf","pending_out","total_out","flush_block_only","block_start","strstart","put_byte","putShortMSB","read_buf","total_in","longest_match","cur_match","match","chain_length","max_chain_length","scan","best_len","prev_length","nice_match","w_size","_win","wmask","w_mask","strend","scan_end1","scan_end","good_match","lookahead","match_start","fill_window","_w_size","more","window_size","hash_size","ins_h","deflate_fast","flush","hash_head","bflush","match_length","max_lazy_match","MIN_MATCH","last_lit","deflate_slow","max_insert","prev_match","match_available","good_length","max_lazy","nice_length","max_chain","configuration_table","max_block_size","pending_buf_size","max_start","DeflateState","gzhead","gzindex","last_flush","w_bits","hash_bits","dyn_ltree","Uint16Array","HEAP_SIZE","dyn_dtree","bl_tree","l_desc","d_desc","bl_desc","bl_count","MAX_BITS","heap","heap_len","heap_max","l_buf","lit_bufsize","d_buf","opt_len","static_len","bi_buf","bi_valid","deflateResetKeep","data_type","deflateReset","deflateInit","beg","old_flush","hcrc","extra","time","os","level_flags","bstate","deflate_huff","deflate_rle","dictLength","tmpDict","avail","deflateInfo","xflags","extra_len","_in","_out","dmax","wsize","whave","wnext","s_window","hold","lcode","dcode","lmask","dmask","here","op","dist","from_source","lencode","distcode","lenbits","distbits","top","dolen","dodist","sane","inflate_fast","inflate_table","TYPE","BAD","zswap32","InflateState","havedict","flags","check","wbits","offset","ncode","nlen","ndist","have","lens","work","lendyn","distdyn","back","was","inflateResetKeep","Int32Array","inflateReset2","lenfix","distfix","virgin","fixedtables","sym","updatewindow","src","inflateInit","here_bits","here_op","here_val","last_bits","last_op","last_val","hbuf","inf_leave","dictid","inflateInfo","lbase","lext","dbase","dext","lens_index","codes","table_index","incr","low","mask","curr","drop","used","huff","base_index","MAXBITS","offs","extra_index","extra_lbits","extra_dbits","extra_blbits","bl_order","static_ltree","static_dtree","D_CODES","_dist_code","_length_code","base_length","base_dist","StaticTreeDesc","static_tree","extra_bits","extra_base","elems","max_length","has_stree","static_l_desc","static_d_desc","static_bl_desc","TreeDesc","dyn_tree","stat_desc","max_code","d_code","put_short","send_bits","send_code","tree","bi_reverse","code","gen_codes","next_code","init_block","LITERALS","END_BLOCK","bi_windup","smaller","_n2","_m2","pqdownheap","compress_block","ltree","dtree","lc","lx","build_tree","desc","stree","xbits","overflow","gen_bitlen","scan_tree","curlen","prevlen","nextlen","max_count","min_count","REP_3_6","REPZ_3_10","REPZ_11_138","send_tree","static_init_done","stored_len","copy_block","LENGTH_CODES","L_CODES","tr_static_init","opt_lenb","static_lenb","max_blindex","black_mask","detect_data_type","BL_CODES","build_bl_tree","lcodes","dcodes","blcodes","send_all_trees","STATIC_TREES","bi_flush","bind","thisArg","kindOf","cache","thing","kindOfTest","typeOfTest","isUndefined","isArrayBuffer","isFunction","isNumber","isPlainObject","isDate","isFile","isBlob","isFileList","isURLSearchParams","allOwnKeys","getOwnPropertyNames","findKey","_global","globalThis","isContextDefined","isTypedArray","TypedArray","isHTMLForm","isRegExp","reduceDescriptors","reducer","descriptors","getOwnPropertyDescriptors","reducedDescriptors","defineProperties","ALPHA","DIGIT","ALPHABET","ALPHA_DIGIT","isAsyncFn","utils$1","isBuffer","isFormData","kind","isArrayBufferView","ArrayBuffer","isView","buffer","isBoolean","isStream","pipe","merge","caseless","assignValue","targetKey","extend","stripBOM","content","inherits","superConstructor","toFlatObject","sourceObj","destObj","propFilter","merged","searchString","position","lastIndex","toArray","forEachEntry","pair","matchAll","regExp","exec","hasOwnProp","freezeMethods","toObjectSet","arrayOrString","delimiter","toCamelCase","p1","p2","noop","toFiniteNumber","defaultValue","Number","isFinite","global","generateString","alphabet","isSpecCompliantForm","toJSONObject","visit","reducedValue","isThenable","catch","AxiosError","request","captureStackTrace","toJSON","number","lineNumber","columnNumber","prototype$1","isVisitable","removeBrackets","renderKey","dots","customProps","axiosError","cause","predicates","toFormData","metaTokens","indexes","visitor","defaultVisitor","useBlob","Blob","convertValue","toISOString","some","isFlatArray","el","exposedHelpers","build","encode$1","charMap","AxiosURLSearchParams","_pairs","buildURL","_encode","serializeFn","serialize","serializedParams","hashmarkIndex","encoder","InterceptorManager$1","handlers","use","fulfilled","rejected","synchronous","runWhen","eject","transitionalDefaults","silentJSONParsing","forcedJSONParsing","clarifyTimeoutError","platform$1","isBrowser","classes","URLSearchParams","protocols","hasBrowserEnv","hasStandardBrowserEnv","product","navigator","hasStandardBrowserWebWorkerEnv","WorkerGlobalScope","importScripts","platform","formDataToJSON","buildPath","isNumericKey","isLast","arrayToObject","parsePropPath","defaults","transitional","adapter","transformRequest","getContentType","hasJSONContentType","isObjectPayload","setContentType","helpers","isNode","toURLEncodedForm","formSerializer","_FormData","env","rawValue","parser","parse","stringifySafely","transformResponse","JSONRequested","responseType","strictJSONParsing","ERR_BAD_RESPONSE","timeout","xsrfCookieName","xsrfHeaderName","validateStatus","common","defaults$1","ignoreDuplicateOf","$internals","normalizeHeader","normalizeValue","matchHeaderValue","isHeaderNameFilter","AxiosHeaders","valueOrRewrite","rewrite","setHeader","_value","_header","_rewrite","lHeader","setHeaders","isValidHeaderName","rawHeaders","parseHeaders","tokens","tokensRE","parseTokens","has","matcher","delete","deleted","deleteHeader","normalize","normalized","char","formatHeader","targets","asStrings","static","computed","accessors","defineAccessor","accessorName","methodName","arg1","arg2","arg3","buildAccessors","accessor","mapped","headerValue","AxiosHeaders$1","transformData","fns","isCancel","__CANCEL__","CanceledError","ERR_CANCELED","cookies","write","expires","secure","cookie","toGMTString","read","decodeURIComponent","remove","now","buildFullPath","requestedURL","relativeURL","combineURLs","isURLSameOrigin","msie","userAgent","urlParsingNode","createElement","originURL","resolveURL","setAttribute","protocol","host","search","hash","hostname","port","requestURL","progressEventReducer","listener","isDownloadStream","bytesNotified","_speedometer","samplesCount","timestamps","firstSampleTS","chunkLength","startedAt","bytesCount","passed","round","speedometer","loaded","lengthComputable","progressBytes","rate","progress","estimated","event","knownAdapters","http","xhr","XMLHttpRequest","requestData","requestHeaders","onCanceled","withXSRFToken","cancelToken","unsubscribe","signal","removeEventListener","Boolean","auth","username","unescape","fullPath","onloadend","responseHeaders","getAllResponseHeaders","ERR_BAD_REQUEST","settle","responseText","statusText","paramsSerializer","onreadystatechange","readyState","responseURL","setTimeout","onabort","ECONNABORTED","onerror","ERR_NETWORK","ontimeout","timeoutErrorMessage","ETIMEDOUT","xsrfValue","setRequestHeader","withCredentials","onDownloadProgress","addEventListener","onUploadProgress","upload","cancel","abort","subscribe","aborted","parseProtocol","send","renderReason","reason","isResolvedHandle","adapters","nameOrAdapter","rejectedReasons","reasons","throwIfCancellationRequested","throwIfRequested","dispatchRequest","headersToObject","mergeConfig","config1","config2","getMergedValue","mergeDeepProperties","valueFromConfig2","defaultToConfig2","mergeDirectKeys","mergeMap","timeoutMessage","decompress","beforeRedirect","transport","httpAgent","socketPath","responseEncoding","configValue","validators$1","deprecatedWarnings","validator","formatMessage","ERR_DEPRECATED","warn","assertOptions","schema","allowUnknown","ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","validators","Axios","instanceConfig","interceptors","configOrUrl","boolean","function","contextHeaders","requestInterceptorChain","synchronousRequestInterceptors","interceptor","responseInterceptorChain","promise","chain","newConfig","onFulfilled","onRejected","getUri","generateHTTPMethod","isForm","Axios$1","CancelToken","executor","resolvePromise","_listeners","onfulfilled","_resolve","CancelToken$1","HttpStatusCode","Continue","SwitchingProtocols","Processing","EarlyHints","Ok","Created","Accepted","NonAuthoritativeInformation","NoContent","ResetContent","PartialContent","MultiStatus","AlreadyReported","ImUsed","MultipleChoices","MovedPermanently","Found","SeeOther","NotModified","UseProxy","Unused","TemporaryRedirect","PermanentRedirect","BadRequest","Unauthorized","PaymentRequired","Forbidden","NotFound","MethodNotAllowed","NotAcceptable","ProxyAuthenticationRequired","RequestTimeout","Conflict","Gone","LengthRequired","PreconditionFailed","PayloadTooLarge","UriTooLong","UnsupportedMediaType","RangeNotSatisfiable","ExpectationFailed","ImATeapot","MisdirectedRequest","UnprocessableEntity","Locked","FailedDependency","TooEarly","UpgradeRequired","PreconditionRequired","TooManyRequests","RequestHeaderFieldsTooLarge","UnavailableForLegalReasons","InternalServerError","NotImplemented","BadGateway","ServiceUnavailable","GatewayTimeout","HttpVersionNotSupported","VariantAlsoNegotiates","InsufficientStorage","LoopDetected","NotExtended","NetworkAuthenticationRequired","HttpStatusCode$1","axios","createInstance","defaultConfig","VERSION","Cancel","promises","spread","callback","isAxiosError","formToJSON","getAdapter","default","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","Function","__webpack_exports__"],"sourceRoot":""}
\No newline at end of file