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AM,gBAEjD,GACV,EAAO,EAAM,SAAS,GAItB,GAFU,EAAM,cAAc,OAAO,KAAqB,EAAM,oBAErD,GAEP,IAEE,QAAQ,KACV,EAAK,YAAc,CAAC,mCAAoC,oDAIrD,CACT,EAEA,KAAK,WAAa,SAAU,GAC1B,IAAI,EAAM,UAAU,OAAS,QAAsB,IAAjB,UAAU,IAAmB,UAAU,GAErE,EAAO,EAAM,iBAAiB,GAElC,OAAO,EAAM,gBAAgB,EAAM,EACrC,EAGgB,KACW,mBAAd,KAAK,KACd,KAAK,GAAO,KAAK,GAAK,KAAK,OAK/B,IAAI,EAAO,KAEX,IAAK,IAAI,KAAQ,MAEf,MADA,EAAO,MAAM,IACG,MAAK,EAAM,eAAe,GAAQ,EAAM,GAAQ,EAAc,QAGhF,KAAK,WAAa,CAAC,CACrB,CAkEA,OAhEA,aAAa,EAAU,CAAC,CACtB,IAAK,gBACL,MAAO,SAAuB,GAE5B,IAAI,EAAY,CAAC,EACb,EAAO,KAAK,aA+BhB,MA7BqB,iBAAV,EACT,EAAU,GAAQ,CAAC,GACV,aAAa,IACjB,EAAU,eAAe,EAAM,gBAClC,EAAU,EAAM,cAAgB,IAGlC,EAAU,EAAM,cAAc,KAAK,EAAM,YAChC,QAAQ,IACjB,EAAM,SAAQ,SAAU,GACtB,GAAI,aAAa,GAAI,CACnB,IAAI,EAAO,EAAE,cAAgB,QAExB,EAAU,eAAe,KAC5B,EAAU,GAAQ,IAGpB,EAAU,GAAM,KAAK,EAAE,UACzB,MAAW,QAAQ,KAEZ,EAAU,eAAe,KAC5B,EAAU,GAAQ,IAGpB,EAAU,GAAM,KAAK,GAEzB,IAGK,CACT,KA2BK,CACT,CArnC4B,GAooCxB,IAAM,SAEV,OAAO,QAAU","file":"/npm/iiif-prezi2to3@2.0.2/dist/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/iiif-prezi2to3@2.0.2/dist/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","'use strict';\n\nfunction _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }\n\nvar crypto = _interopDefault(require('crypto'));\n\nfunction _classCallCheck(instance, Constructor) {\n  if (!(instance instanceof Constructor)) {\n    throw new TypeError(\"Cannot call a class as a function\");\n  }\n}\n\nfunction _defineProperties(target, props) {\n  for (var i = 0; i < props.length; i++) {\n    var descriptor = props[i];\n    descriptor.enumerable = descriptor.enumerable || false;\n    descriptor.configurable = true;\n    if (\"value\" in descriptor) descriptor.writable = true;\n    Object.defineProperty(target, descriptor.key, descriptor);\n  }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n  if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n  if (staticProps) _defineProperties(Constructor, staticProps);\n  return Constructor;\n}\n\n// This alphabet uses `A-Za-z0-9_-` symbols. The genetic algorithm helped\n// optimize the gzip compression for this alphabet.\nvar urlAlphabet = 'ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW';\n\n// for better performance.\n\nvar buffers = {};\n\nvar random = function random(bytes) {\n  var buffer = buffers[bytes];\n\n  if (!buffer) {\n    // `Buffer.allocUnsafe()` is faster because it doesn’t flush the memory.\n    // Memory flushing is unnecessary since the buffer allocation itself resets\n    // the memory with the new bytes.\n    buffer = Buffer.allocUnsafe(bytes);\n    if (bytes <= 255) buffers[bytes] = buffer;\n  }\n\n  return crypto.randomFillSync(buffer);\n};\n\nvar customRandom = function customRandom(alphabet, size, getRandom) {\n  // First, a bitmask is necessary to generate the ID. The bitmask makes bytes\n  // values closer to the alphabet size. The bitmask calculates the closest\n  // `2^31 - 1` number, which exceeds the alphabet size.\n  // For example, the bitmask for the alphabet size 30 is 31 (00011111).\n  var mask = (2 << 31 - Math.clz32(alphabet.length - 1 | 1)) - 1; // Though, the bitmask solution is not perfect since the bytes exceeding\n  // the alphabet size are refused. Therefore, to reliably generate the ID,\n  // the random bytes redundancy has to be satisfied.\n  // Note: every hardware random generator call is performance expensive,\n  // because the system call for entropy collection takes a lot of time.\n  // So, to avoid additional system calls, extra bytes are requested in advance.\n  // Next, a step determines how many random bytes to generate.\n  // The number of random bytes gets decided upon the ID size, mask,\n  // alphabet size, and magic number 1.6 (using 1.6 peaks at performance\n  // according to benchmarks).\n\n  var step = Math.ceil(1.6 * mask * size / alphabet.length);\n  return function () {\n    var id = '';\n\n    while (true) {\n      var bytes = getRandom(step); // A compact alternative for `for (var i = 0; i < step; i++)`.\n\n      var i = step;\n\n      while (i--) {\n        // Adding `|| ''` refuses a random byte that exceeds the alphabet size.\n        id += alphabet[bytes[i] & mask] || ''; // `id.length + 1 === size` is a more compact option.\n\n        if (id.length === +size) return id;\n      }\n    }\n  };\n};\n\nvar customAlphabet = function customAlphabet(alphabet, size) {\n  return customRandom(alphabet, size, random);\n};\n\nvar nanoid = function nanoid() {\n  var size = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 21;\n  var bytes = random(size);\n  var id = ''; // A compact alternative for `for (var i = 0; i < step; i++)`.\n\n  while (size--) {\n    // It is incorrect to use bytes exceeding the alphabet size.\n    // The following mask reduces the random byte in the 0-255 value\n    // range to the 0-63 value range. Therefore, adding hacks, such\n    // as empty string fallback or magic numbers, is unneccessary because\n    // the bitmask trims bytes down to the alphabet size.\n    id += urlAlphabet[bytes[size] & 63];\n  }\n\n  return id;\n};\n\nvar nanoid$1 = /*#__PURE__*/Object.freeze({\n  __proto__: null,\n  nanoid: nanoid,\n  customAlphabet: customAlphabet,\n  customRandom: customRandom,\n  urlAlphabet: urlAlphabet,\n  random: random\n});\n\n// IIIF Presentation API version 2 to version 3 upgrader\n//\n\nvar nanoid$2 = nanoid$1.nanoid;\nvar FLAGS = {\n  \"crawl\": {\n    \"prop\": \"crawl\",\n    \"default\": false,\n    \"description\":  '' \n  },\n  \"desc_2_md\": {\n    \"prop\": \"description_is_metadata\",\n    \"default\": true,\n    \"description\":  '' \n  },\n  \"related_2_md\": {\n    \"prop\": \"related_is_metadata\",\n    \"default\": false,\n    \"description\":  '' \n  },\n  \"ext_ok\": {\n    \"prop\": \"ext_ok\",\n    \"default\": false,\n    \"description\":  '' \n  },\n  \"default_lang\": {\n    \"prop\": \"default_lang\",\n    \"default\": \"@none\",\n    \"description\":  '' \n  },\n  \"deref_links\": {\n    \"prop\": \"deref_links\",\n    \"default\": true,\n    \"description\":  '' \n  },\n  \"debug\": {\n    \"prop\": \"debug\",\n    \"default\": false,\n    \"description\":  '' \n  },\n  \"attribution_label\": {\n    \"prop\": \"attribution_label\",\n    \"default\": \"Attribution\",\n    \"description\":  '' \n  },\n  \"license_label\": {\n    \"prop\": \"license_label\",\n    \"default\": \"Rights/License\",\n    \"description\":  '' \n  }\n};\nvar CONTENT_TYPE_MAP = {\n  \"image\": \"Image\",\n  \"audio\": \"Sound\",\n  \"video\": \"Video\",\n  \"application/pdf\": \"Text\",\n  \"text/html\": \"Text\",\n  \"text/plain\": \"Text\",\n  \"application/xml\": \"Dataset\",\n  \"text/xml\": \"Dataset\"\n};\nvar OBJECT_PROPERTY_TYPES = {\n  \"thumbnail\": \"Image\",\n  \"logo\": \"Image\",\n  \"homepage\": null,\n  \"rendering\": null,\n  \"seeAlso\": \"Dataset\",\n  \"partOf\": null\n};\nvar SET_PROPERTIES = [\"thumbnail\", \"logo\", \"behavior\", \"rendering\", \"service\", \"seeAlso\", \"partOf\"];\nvar LANGUAGE_PROPERTIES = ['label', 'summary'];\nvar DO_NOT_TRAVERSE = ['metadata', 'structures', '_structures', 'requiredStatement'];\nvar SIMPLE_TYPE_MAP = {\n  \"Layer\": \"AnnotationCollection\",\n  \"AnnotationList\": \"AnnotationPage\",\n  \"cnt:ContentAsText\": \"TextualBody\"\n};\nvar TYPES_WITH_MANDATORY_ID = ['Collection', 'Manifest', 'Canvas', 'Annotation', 'Range', 'AnnotationCollection', 'AnnotationPage'];\nvar PARTOF_MAPPING = {\n  'Collection': 'Collection',\n  'Manifest': 'Collection',\n  'Canvas': 'Manifest',\n  'Annotation': 'AnnotationPage',\n  'AnnotationPage': 'AnnotationCollection'\n}; // const KEY_ORDER = [\n//     \"@context\", \"id\", \"@id\", \"type\", \"@type\", \"motivation\", \"label\", \"profile\",\n// \t\"format\", \"language\", \"value\", \"metadata\", \"requiredStatement\", \"thumbnail\",\n// \t\"homepage\", \"logo\", \"rights\", \"logo\", \"height\", \"width\", \"start\",\n// \t\"viewingDirection\", \"behavior\", \"navDate\", \"rendering\", \"seeAlso\",\n//     \"partOf\",  \"includes\", \"items\", \"structures\", \"annotations\"\n// ];\n// const KEY_ORDER_HASH = KEY_ORDER.reduce(\n//     (acc, key, idx) => acc[key] = idx,\n//     {}\n// );\n\nvar isArray = function isArray(i) {\n  return i instanceof Array;\n};\n\nvar isDictionary = function isDictionary(i) {\n  return i instanceof Object && !(i instanceof Array);\n};\n\nvar Upgrader = /*#__PURE__*/function () {\n  function Upgrader() {\n    var _this = this;\n\n    var flags = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n    _classCallCheck(this, Upgrader);\n\n    this.warn = function (msg) {\n    };\n\n    this.retrieveResource = function (uri) {\n      var request = new XMLHttpRequest();\n      request.open('GET', uri, false); // `false` makes the request synchronous\n\n      try {\n        request.send(null);\n\n        if (request.status === 200) {\n          return JSON.parse(request.responseText);\n        }\n      } catch (ex) {}\n\n      return {};\n    };\n\n    this.mintURI = function () {\n      var newUUID = nanoid$2();\n      return \"https://example.org/uuid/\".concat(newUUID);\n    };\n\n    this.traverse = function (what) {\n      var p3version = {};\n      var v = null;\n      var fn = null;\n\n      var _loop = function _loop(k) {\n        v = what[k];\n\n        if (LANGUAGE_PROPERTIES.includes(k) || DO_NOT_TRAVERSE.includes(k)) {\n          //also handled by language_map, etc\n          p3version[k] = v;\n          return \"continue\";\n        } else if (k === 'service') {\n          // break service out as it has so many types\n          fn = _this.processService;\n        } else {\n          fn = _this.processResource;\n        }\n\n        if (isDictionary(v)) {\n          var keys = Object.keys(v);\n\n          if (!(keys.length === 2 && keys.includes('type') && keys.includes('id'))) {\n            p3version[k] = fn(v);\n          } else {\n            p3version[k] = v;\n          }\n        } else if (isArray(v)) {\n          var p3versionl = [];\n          v.forEach(function (i) {\n            if (isDictionary(i)) {\n              var _keys = Object.keys(i);\n\n              if (!(_keys.length === 2 && _keys.includes('type') && _keys.includes('id'))) {\n                p3versionl.push(fn(i));\n              } else {\n                p3versionl.push(i);\n              }\n            } else {\n              p3versionl.push(i);\n            }\n\n            p3version[k] = p3versionl;\n          });\n        } else {\n          p3version[k] = v;\n        }\n\n        if (!LANGUAGE_PROPERTIES.includes(k) && !DO_NOT_TRAVERSE.includes(k)) {\n          _this.warn(\"Unknown property: \".concat(k));\n        }\n      };\n\n      for (var k in what) {\n        var _ret = _loop(k);\n\n        if (_ret === \"continue\") continue;\n      }\n\n      return p3version;\n    };\n\n    this.fixServiceType = function (what) {\n      // manage known service contexts\n      if (what.hasOwnProperty('@context')) {\n        var ctxt = what['@context'];\n\n        if (ctxt === \"http://iiif.io/api/image/2/context.json\" || ctxt === \"http://iiif.io/api/image/2/level2.json\") {\n          what['@type'] = \"ImageService2\";\n          delete what['@context'];\n          return what;\n        } else if ([\"http://iiif.io/api/image/1/context.json\", \"http://library.stanford.edu/iiif/image-api/1.1/context.json\"].includes(ctxt)) {\n          what['@type'] = \"ImageService1\";\n          delete what['@context'];\n          return what;\n        } else if ([\"http://iiif.io/api/search/1/context.json\", \"http://iiif.io/api/search/0/context.json\", \"http://iiif.io/api/auth/1/context.json\", \"http://iiif.io/api/auth/0/context.json\"].includes(ctxt)) {\n          // handle below in profiles, but delete context here\n          delete what['@context'];\n        } else if (ctxt === \"http://iiif.io/api/annex/openannotation/context.json\") {\n          what['@type'] = \"ImageApiSelector\";\n          delete what['@context'];\n        } else {\n          what['@type'] = \"Service\";\n\n          _this.warn(\"Unknown context: \".concat(ctxt));\n        }\n      } else {\n        what['@type'] = \"Service\";\n\n        _this.warn('No cotext at all');\n      }\n\n      if (what.hasOwnProperty('profile')) {\n        // Auth: CookieService1 , TokenService1\n        var profile = what['profile'];\n\n        if ([\"http://iiif.io/api/auth/1/kiosk\", \"http://iiif.io/api/auth/1/login\", \"http://iiif.io/api/auth/1/clickthrough\", \"http://iiif.io/api/auth/1/external\", \"http://iiif.io/api/auth/0/kiosk\", \"http://iiif.io/api/auth/0/login\", \"http://iiif.io/api/auth/0/clickthrough\", \"http://iiif.io/api/auth/0/external\"].includes(profile)) {\n          what['@type'] = 'AuthCookieService1'; // leave profile alone\n        } else if ([\"http://iiif.io/api/auth/1/token\", \"http://iiif.io/api/auth/0/token\"].includes(profile)) {\n          what['@type'] = 'AuthTokenService1';\n        } else if ([\"http://iiif.io/api/auth/1/logout\", \"http://iiif.io/api/auth/0/logout\"].includes(profile)) {\n          what['@type'] = 'AuthLogoutService1';\n        } else if ([\"http://iiif.io/api/search/1/search\", \"http://iiif.io/api/search/0/search\"].includes(profile)) {\n          what['@type'] = \"SearchService1\";\n        } else if ([\"http://iiif.io/api/search/1/autocomplete\", \"http://iiif.io/api/search/0/autocomplete\"].includes(profile)) {\n          what['@type'] = \"AutoCompleteService1\";\n        }\n      }\n\n      return what;\n    };\n\n    this.fixType = function (what) {\n      // Called from processResource so we can switch\n      var t = what['@type'] || '';\n\n      if (t) {\n        if (isArray(t)) {\n          if (t.includes('oa:CssStyle')) {\n            t = \"CssStylesheet\";\n          } else if (t.includes('cnt:ContentAsText')) {\n            t = \"TextualBody\";\n          }\n        }\n\n        t = t.replace(/^(sc|oa|dctypes|iiif)\\:/, '');\n\n        if (SIMPLE_TYPE_MAP.hasOwnProperty(t)) {\n          t = SIMPLE_TYPE_MAP[t];\n        }\n\n        what['type'] = t;\n        delete what['@type'];\n      }\n\n      return what;\n    };\n\n    this.fixLanguages = function (what) {\n      LANGUAGE_PROPERTIES.forEach(function (p) {\n        if (what.hasOwnProperty(p)) {\n          try {\n            what[p] = _this.doLanguageMap(what[p]);\n          } catch (ex) {\n            throw ex; /// ??? ehh your pardon?\n          }\n        }\n      });\n\n      if (what.hasOwnProperty('metadata')) {\n        what['metadata'] = what['metadata'].map(function (pair) {\n          return {\n            'label': _this.doLanguageMap(pair['label']),\n            'value': _this.doLanguageMap(pair['value'])\n          };\n        });\n      }\n\n      return what;\n    };\n\n    this.fixSets = function (what) {\n      SET_PROPERTIES.forEach(function (p) {\n        if (what.hasOwnProperty(p)) {\n          if (!isArray(what[p])) {\n            what[p] = [what[p]];\n          }\n        }\n      });\n      return what;\n    };\n\n    this.getHeader = function (uri) {\n      var request = new XMLHttpRequest();\n      request.open('HEAD', uri, false); // `false` makes the request synchronous\n\n      try {\n        request.send(null);\n\n        if (request.status === 200) {\n          return {\n            headers: {\n              get: function get(headerName) {\n                return request.getResponseHeader(headerName);\n              }\n            },\n            status: request.status\n          };\n        }\n      } catch (ex) {}\n\n      return null;\n    };\n\n    this.setRemoteType = function (what) {\n      var h = null; // do a HEAD on the resource and look at Content-Type\n\n      try {\n        h = _this.getHeader(what['id']);\n      } catch (ex) {}\n\n      if (h && h.status == 200) {\n        var ct = h.headers.get('content-type');\n        what['format'] = ct; // as we have it...\n\n        ct = ct.toLowerCase();\n        var first = ct.split('/')[0];\n\n        if (CONTENT_TYPE_MAP.hasOwnProperty(first)) {\n          what['type'] = CONTENT_TYPE_MAP[first];\n        } else if (CONTENT_TYPE_MAP.hasOwnProperty(ct)) {\n          what['type'] = CONTENT_TYPE_MAP[ct];\n        } else if (ct.startsWith(\"application/json\") || ct.startsWith(\"application/ld+json\")) {\n          // Try and fetch and look for a type!\n          var data = _this.retrieveResource(what['id']);\n\n          if (data.hasOwnProperty('type')) {\n            what['type'] = data['type'];\n          } else if (data.hasOwnProperty('@type')) {\n            data = _this.fixType(data);\n            what['type'] = data['type'];\n          }\n        }\n      }\n    };\n\n    this.fixObject = function (what, typ) {\n      if (!isDictionary(what)) {\n        what = {\n          'id': what\n        };\n      } else if (isDictionary(what) && Object.keys(what).length === 0) {\n        return {};\n      }\n\n      var myid = what['id'] || what['@id'] || '';\n\n      if (!what.hasOwnProperty('type') && typ) {\n        what['type'] = typ;\n      } else if (!what.hasOwnProperty('type') && myid) {\n        if (_this.idTypeHash.hasOwnProperty(myid)) {\n          what['type'] = _this.idTypeHash[myid];\n        } else if (_this.deref_links === true) {\n          _this.setRemoteType(what);\n        } else {\n          // Try to guess from format\n          if (what.hasOwnProperty('format')) {\n            if (what['format'].startsWith('image/')) {\n              what['type'] = \"Image\";\n            } else if (what['format'].startsWith('video/')) {\n              what['type'] = \"Video\";\n            } else if (what['format'].startsWith('audio/')) {\n              what['type'] = \"Audio\";\n            } else if (what['format'].startsWith('text/')) {\n              what['type'] = \"Text\";\n            } else if (what['format'].startsWith('application/pdf')) {\n              what['type'] = \"Text\";\n            }\n          }\n\n          if (!what.hasOwnProperty('type') && myid.indexOf('.htm') > -1) {\n            what['type'] = \"Text\";\n          } else if (!what.hasOwnProperty('type')) ;\n        }\n      }\n\n      return what;\n    };\n\n    this.fixObjects = function (what) {\n      var _loop2 = function _loop2() {\n        var typ = OBJECT_PROPERTY_TYPES[p];\n\n        if (what.hasOwnProperty(p)) {\n          if (SET_PROPERTIES.includes(p)) {\n            // Assumes list :(\n            what[p] = what[p].map(function (v) {\n              return _this.fixObject(v, typ);\n            });\n          } else {\n            what[p] = _this.fixObject(what[p], typ);\n          }\n        }\n      };\n\n      for (var p in OBJECT_PROPERTY_TYPES) {\n        _loop2();\n      }\n\n      return what;\n    };\n\n    this.processGeneric = function (what) {\n      // process generic IIIF properties\n      if (what.hasOwnProperty('@id')) {\n        what['id'] = what['@id'];\n        delete what['@id'];\n      }\n\n      var typeRequiresAnId = what.hasOwnProperty('type') && TYPES_WITH_MANDATORY_ID.includes(what.type) && !what.hasOwnProperty('id');\n\n      if (typeRequiresAnId) {\n        // Add in id with a vanilla UUID\n        what['id'] = _this.mintURI();\n      } // @type already processed\n      // Now add to id/type hash for lookups\n\n\n      if (what.hasOwnProperty('id') && what.hasOwnProperty('type')) {\n        try {\n          _this.idTypeHash[what['id']] = what['type'];\n        } catch (e) {\n          throw \"ValueError: \".concat(what.id);\n        }\n      }\n\n      if (what.hasOwnProperty('license')) {\n        // License went from many to single\n        // Also requires CC or RSS, otherwise extension\n        // Put others into metadata\n        var lic = what['license'];\n\n        if (!isArray(lic)) {\n          lic = [lic];\n        }\n\n        var done = false;\n        lic.forEach(function (l) {\n          if (isDictionary(l)) {\n            l = l['@id'];\n          }\n\n          if (!done && (l.indexOf('creativecommons.org/') > -1 || l.indexOf('rightsstatements.org/') > -1)) {\n            // match\n            what['rights'] = l;\n            done = true;\n          } else {\n            // fixLanguages below will correct these to langMaps\n            var licstmt = {\n              \"label\": _this.license_label,\n              \"value\": l\n            };\n            var md = what['metadata'] || [];\n            md.push(licstmt);\n            what['metadata'] = md;\n          }\n        });\n        delete what['license'];\n      }\n\n      if (what.hasOwnProperty('attribution')) {\n        var label = _this.doLanguageMap(_this.attribution_label);\n\n        var val = _this.doLanguageMap(what['attribution']);\n\n        what['requiredStatement'] = {\n          \"label\": label,\n          \"value\": val\n        };\n        delete what['attribution'];\n      }\n\n      if (what.hasOwnProperty('viewingHint')) {\n        if (!what.hasOwnProperty('behavior')) {\n          what['behavior'] = what['viewingHint'];\n        } else {\n          // will already be a list\n          if (isArray(what['viewingHint'])) {\n            what['behavior'] = what['behavior'].concat(what['viewingHint']);\n          } else {\n            what['behavior'].push(what['viewingHint']);\n          }\n        }\n\n        delete what['viewingHint'];\n      }\n\n      if (what.hasOwnProperty('description')) {\n        if (_this.description_is_metadata) {\n          // Put it in metadata\n          var md = what['metadata'] || []; // NB this must happen before fixLanguages\n\n          md.push({\n            \"label\": \"Description\",\n            \"value\": what['description']\n          });\n          what['metadata'] = md;\n        } else {\n          // rename to summary\n          what['summary'] = what['description'];\n        }\n\n        delete what['description'];\n      }\n\n      if (what.hasOwnProperty('related')) {\n        var rels = what['related'];\n\n        if (!isArray(rels)) {\n          rels = [rels];\n        }\n\n        rels.forEach(function (rel) {\n          if (!_this.related_is_metadata && rel === rels[0]) {\n            // Assume first is homepage, rest to metadata\n            if (!isDictionary(rel)) {\n              rel = {\n                '@id': rel\n              };\n            }\n\n            what['homepage'] = rel;\n          } else {\n            var uri = '';\n            var _label = '';\n\n            if (isDictionary(rel)) {\n              uri = rel['@id'];\n\n              if (rel.hasOwnProperty('label')) {\n                _label = rel['label'];\n              }\n            } else {\n              uri = rel;\n            }\n\n            var _md = what['metadata'] || []; // NB this must happen before fixLanguages\n\n\n            _md.push({\n              label: 'Related',\n              value: '<a href=\\'' + uri + '\\'>' + _label + '</a>'\n            });\n\n            what['metadata'] = _md;\n          }\n        });\n        delete what['related'];\n      }\n\n      if (what.hasOwnProperty(\"otherContent\")) {\n        // otherContent is already AnnotationList, so no need to inject\n        what['annotations'] = what['otherContent'];\n        delete what['otherContent'];\n      }\n\n      if (what.hasOwnProperty(\"within\")) {\n        what['partOf'] = what['within'];\n        delete what['within'];\n      }\n\n      what = _this.fixLanguages(what);\n      what = _this.fixSets(what);\n      what = _this.fixObjects(what);\n      return what;\n    };\n\n    this.processService = function (what) {\n      what = _this.fixServiceType(what);\n\n      if (what.hasOwnProperty('@id')) {\n        what.id = what['@id'];\n        delete what['@id'];\n      }\n\n      if (what.hasOwnProperty('@type')) {\n        what.type = what['@type'];\n        delete what['@type'];\n      } // The only thing to traverse is further services\n      // everything else we leave alone\n\n\n      if (what.hasOwnProperty('service')) {\n        var ss = what['service'];\n\n        if (!isArray(ss)) {\n          what['service'] = [ss];\n        }\n\n        what['service'] = what['service'].map(function (s) {\n          return _this.processService(s);\n        });\n      } else if (Object.keys(what).length === 1 && what.hasOwnProperty('type')) {\n        return {};\n      }\n\n      return what;\n    };\n\n    this.processCollection = function (what) {\n      what = _this.processGeneric(what);\n\n      if (what.hasOwnProperty('members')) {\n        what['items'] = what['members'];\n        delete what['members'];\n      } else {\n        var colls = (what.hasOwnProperty('collections') ? what['collections'] : []).map(function (c) {\n          if (!isDictionary(c)) {\n            return {\n              'id': c,\n              'type': 'Collection'\n            };\n          } else if (!c.hasOwnProperty('type')) {\n            c['type'] = 'Collection';\n          }\n\n          return c;\n        });\n        var mfsts = (what.hasOwnProperty('manifests') ? what['manifests'] : []).map(function (m) {\n          if (!isDictionary(m)) {\n            return {\n              'id': m,\n              'type': 'Manifest'\n            };\n          } else if (!m.hasOwnProperty('type')) {\n            m['type'] = 'Manifest';\n          }\n\n          return m;\n        });\n        var nl = colls.concat(mfsts);\n\n        if (nl.length > 0) {\n          what['items'] = nl;\n        }\n      }\n\n      if (what.hasOwnProperty('manifests')) {\n        delete what['manifests'];\n      }\n\n      if (what.hasOwnProperty('collections')) {\n        delete what['collections'];\n      }\n\n      return what;\n    };\n\n    this.areSequencesNeeded = function (what) {\n      var sequences = what.sequences;\n      var sequencesLength = sequences.length; // TODO: add flag to not control this feature...\n\n      if (sequencesLength === 0) {\n        return false; // never be the case, just to be complete :D\n      } else if (sequencesLength > 1) {\n        return true;\n      } //else if (sequencesLength === 1) { //if we assume that sequencesLength is a positive integer.  {\n\n\n      var isNotDefaultViewingHint = sequences[0].hasOwnProperty('viewingHint') && sequences[0].viewingHint !== 'paged';\n      var isNotDefaultViewingDirection = sequences[0].hasOwnProperty('viewingDirection') && sequences[0].viewingDirection !== 'left-to-right';\n      var hasMetadata = sequences[0].hasOwnProperty('metadata');\n      return isNotDefaultViewingHint || isNotDefaultViewingDirection || hasMetadata;\n    };\n\n    this.processManifest = function (what) {\n      what = _this.processGeneric(what);\n\n      if (what.hasOwnProperty('startCanvas')) {\n        var v = what['startCanvas'];\n\n        if (!isDictionary(v)) {\n          what['start'] = {\n            'id': v,\n            'type': \"Canvas\"\n          };\n        } else {\n          v['type'] = \"Canvas\";\n          what['start'] = v;\n        }\n\n        delete what['startCanvas'];\n      } // Need to test as might not be top object\n\n\n      if (what.hasOwnProperty('sequences')) {\n        // No more sequences!\n        var seqs = what.sequences;\n\n        var keepingSequences = _this.areSequencesNeeded(what);\n\n        what.items = seqs[0].canvases;\n        delete what['sequences'];\n\n        if (keepingSequences) {\n          // Process to ranges\n          what['_structures'] = [];\n          seqs.forEach(function (s) {\n            // XXX Test here to see if we need to crawl\n            var rng = {\n              \"id\": s['@id'] || _this.mintURI(),\n              \"type\": \"Range\"\n            };\n            rng['behavior'] = ['sequence'];\n            rng['items'] = (s['canvases'] || []).map(function (c) {\n              if (isDictionary(c)) {\n                return {\n                  id: c['@id'],\n                  type: \"Canvas\"\n                };\n              } else if (typeof c === \"string\") {\n                return {\n                  id: c,\n                  type: \"Canvas\"\n                };\n              }\n            }); // Copy other properties and hand off to _generic\n\n            delete s['canvases'];\n            Object.keys(s).forEach(function (k) {\n              if (!['@id', '@type'].includes(k)) {\n                rng[k] = s[k];\n              }\n            });\n\n            _this.processGeneric(rng);\n\n            what['_structures'].push(rng);\n          });\n        }\n      }\n\n      return what;\n    };\n\n    this.processRange = function (what) {\n      what = _this.processGeneric(what);\n\n      if (what.hasOwnProperty('items')) ; else if (what.hasOwnProperty('members')) {\n        var its = what['members'];\n        delete what['members'];\n        what['items'] = its.map(function (i) {\n          if (!isDictionary(i)) {\n            // look in id/type hash\n            if (_this.idTypeHash.hasOwnProperty(i)) {\n              return {\n                \"id\": i,\n                \"type\": _this.idTypeHash[i]\n              };\n            } else {\n              return {\n                \"id\": i\n              };\n            }\n          } else {\n            return i;\n          }\n        });\n      } else {\n        var nl = [];\n        var rngs = what['ranges'] || [];\n        nl = rngs.map(function (r) {\n          if (!isDictionary(r)) {\n            return {\n              'id': r,\n              'type': 'Range'\n            };\n          } else if (!r.hasOwnProperty('type')) {\n            r['type'] = 'Range';\n          }\n\n          return r;\n        });\n        var cvs = what['canvases'] || [];\n        nl = nl.concat(cvs.map(function (c) {\n          if (!isDictionary(c)) {\n            return {\n              'id': c,\n              'type': 'Canvas'\n            };\n          } else if (c.hasOwnProperty('type')) {\n            c['type'] = 'Canvas';\n          }\n\n          return c;\n        }));\n        what['items'] = nl;\n      }\n\n      if (what.hasOwnProperty('canvases')) {\n        delete what['canvases'];\n      }\n\n      if (what.hasOwnProperty('ranges')) {\n        delete what['ranges'];\n      } // contentLayer\n\n\n      if (what.hasOwnProperty('contentLayer')) {\n        var v = what['contentLayer'];\n\n        if (isArray(v) && v.length === 1) {\n          v = v[0];\n        }\n\n        if (!isDictionary(v)) {\n          what['supplementary'] = {\n            id: v,\n            type: \"AnnotationCollection\"\n          };\n        } else {\n          v['type'] = \"AnnotationCollection\";\n          what['supplementary'] = v;\n        }\n\n        delete what['contentLayer'];\n      } // Remove redundant 'top' Range\n\n\n      if (what.hasOwnProperty('behavior') && what['behavior'].includes('top')) {\n        what['behavior'].splice(what['behavior'].indexOf('top'), 1); // if we're empty, remove it\n\n        if (what['behavior'].length === 0) {\n          delete what['behavior'];\n        }\n      }\n\n      if (what.hasOwnProperty('supplementary')) {\n        // single object\n        what['supplementary'] = _this.processResource(what['supplementary']);\n      }\n\n      return what;\n    };\n\n    this.processCanvas = function (what) {\n      // XXX process otherContent here before generic grabs it\n      what = _this.processGeneric(what);\n\n      if (what.hasOwnProperty('images')) {\n        what['items'] = [{\n          'type': 'AnnotationPage',\n          'items': what['images'].map(function (anno) {\n            return JSON.parse(JSON.stringify(anno));\n          })\n        }];\n        delete what['images'];\n      }\n\n      return what;\n    };\n\n    this.processLayer = function (what) {\n      return _this.processGeneric(what);\n    };\n\n    this.processAnnotationpage = function (what) {\n      what = _this.processGeneric(what);\n\n      if (what.hasOwnProperty('resources')) {\n        what['items'] = what['resources'];\n        delete what['resources'];\n      } else if (!what.hasOwnProperty('items')) {\n        what['items'] = [];\n      }\n\n      return what;\n    };\n\n    this.processAnnotationcollection = function (what) {\n      return _this.processGeneric(what);\n    };\n\n    this.processAnnotation = function (what) {\n      what = _this.processGeneric(what);\n\n      if (what.hasOwnProperty('on')) {\n        what['target'] = what['on'];\n        delete what['on'];\n      }\n\n      if (what.hasOwnProperty('resource')) {\n        what['body'] = what['resource'];\n        delete what['resource'];\n      }\n\n      var m = what['motivation'] || '';\n\n      if (m) {\n        if (m.startsWith('sc:')) {\n          m = m.replace('sc:', '');\n        } else if (m.startsWith('oa:')) {\n          m = m.replace('oa:', '');\n        }\n\n        what['motivation'] = m;\n      }\n\n      if (what.hasOwnProperty('stylesheet')) {\n        var ss = what['stylesheet'];\n\n        if (isDictionary(ss)) {\n          ss['@type'] = 'oa:CssStylesheet';\n\n          if (ss.hasOwnProperty('chars')) {\n            ss['value'] = ss['chars'];\n            delete ss['chars'];\n          }\n        } else {\n          // Just a link\n          what['stylesheet'] = {\n            '@id': ss,\n            '@type': 'oa:CssStylesheet'\n          };\n        }\n      }\n\n      return what;\n    };\n\n    this.processSpecificresource = function (what) {\n      what = _this.processGeneric(what);\n\n      if (what.hasOwnProperty('full')) {\n        // And if not, it's broken...\n        what['source'] = what['full'];\n        delete what['full'];\n      }\n\n      if (what.hasOwnProperty('style')) {\n        what['styleClass'] = what['style'];\n        delete what['style'];\n      }\n\n      return what;\n    };\n\n    this.processTextualbody = function (what) {\n      if (what.hasOwnProperty('chars')) {\n        what['value'] = what['chars'];\n        delete what['chars'];\n      }\n\n      return what;\n    };\n\n    this.processChoice = function (what) {\n      what = _this.processGeneric(what);\n      var newl = [];\n\n      if (what.hasOwnProperty('default')) {\n        newl.push(what['default']);\n        delete what['default'];\n      }\n\n      if (what.hasOwnProperty('item')) {\n        var v = what['item'];\n\n        if (!isArray(v)) {\n          v = [v];\n        }\n\n        newl = newl.concat(v);\n        delete what['item'];\n      }\n\n      what['items'] = newl;\n      return what;\n    };\n\n    this.postProcessGeneric = function (what) {\n      // test known properties of objects for type\n      if (what.hasOwnProperty('homepage') && !what['homepage'].hasOwnProperty('type')) {\n        what['homepage']['type'] = \"Text\";\n      } // drop empty values\n\n\n      var what2 = {};\n\n      for (var k in what) {\n        var v = what[k];\n\n        if (isArray(v)) {\n          v = v.filter(function (vi) {\n            return !(vi.constructor === Object && Object.keys(vi).length === 0) && vi !== undefined && vi !== null;\n          });\n\n          if (v.length === 0) {\n            v = false;\n          }\n        }\n\n        if (v) {\n          what2[k] = v;\n        }\n      }\n\n      if (what2.hasOwnProperty('type') && PARTOF_MAPPING.hasOwnProperty(what2.type) && what2.hasOwnProperty('partOf') && what2.partOf.constructor === Array) {\n        what2.partOf.forEach(function (item) {\n          if (!item.hasOwnProperty('type')) {\n            item.type = PARTOF_MAPPING[what2.type];\n          }\n        });\n      }\n\n      return what2;\n    };\n\n    this.postProcessManifest = function (what) {\n      what = _this.postProcessGeneric(what); // do ranges at this point, after everything else is traversed\n\n      var tops = [];\n      var rhash = {};\n      var structs = [];\n\n      if (what.hasOwnProperty('structures')) {\n        // Need to process from here, to have access to all info\n        // needed to unflatten them\n        what['structures'].forEach(function (r) {\n          var newStruct = _this.fixType(r);\n\n          newStruct = _this.processRange(newStruct);\n          rhash[newStruct['id']] = newStruct;\n          tops.push(newStruct['id']);\n        });\n        var newits = [];\n        what['structures'].forEach(function (rng) {\n          // first try to include our Range items\n          newits = [];\n          rng['items'].forEach(function (child) {\n            var c = {};\n\n            if (child.hasOwnProperty(\"@id\")) {\n              c = _this.fixType(child);\n              c = _this.processGeneric(c);\n            } else {\n              c = child;\n            }\n\n            if (c['type'] === \"Range\" && rhash.hasOwnProperty(c['id'])) {\n              newits.push(rhash[c['id']]);\n              delete rhash[c['id']];\n              tops.splice(tops.indexOf(c['id']), 1);\n            } else {\n              newits.push(c);\n            }\n          });\n          rng['items'] = newits; // Harvard has a strange within based pattern\n          // which will now be mapped to partOf\n\n          if (rng.hasOwnProperty('partOf')) {\n            tops.splice(tops.indexOf(rng['id']), 1);\n            var parid = rng['partOf'][0]['id'];\n            delete rng['partOf'];\n            var parent = rhash[parid];\n\n            if (!parent) {\n              // Just drop it on the floor?\n              _this.warn(\"Unknown parent range: %s\" % parid);\n            } else {\n              // e.g. Harvard has massive duplication of canvases\n              // not wrong, but don't need it any more\n              rng['items'].forEach(function (child) {\n                parent['items'] = parent['items'].filter(function (sibling) {\n                  return child['id'] !== sibling['id'];\n                });\n              });\n              parent['items'].push(rng);\n            }\n          }\n        });\n      }\n\n      if (what.hasOwnProperty('_structures')) {\n        structs = what['_structures'];\n        delete what['_structures'];\n      }\n\n      if (tops.length > 0) {\n        tops.forEach(function (t) {\n          if (rhash.hasOwnProperty(t)) {\n            structs.push(rhash[t]);\n          }\n        });\n      }\n\n      if (structs.length > 0) {\n        what['structures'] = structs;\n      }\n\n      return what;\n    };\n\n    this.processResource = function (what) {\n      var top = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n      var origContext = \"\";\n\n      if (top) {\n        // process @context\n        origContext = what[\"@context\"]; // could be a list with extensions etc\n\n        delete what['@context'];\n      } // First update types, so we can switch on it\n\n\n      what = _this.fixType(what);\n      var typeCapitalised = (what['type'] || '').split('').map(function (chr, idx) {\n        return idx === 0 ? chr.toUpperCase() : chr.toLowerCase();\n      }).join('');\n\n      var fn = _this[\"process\".concat(typeCapitalised)] || _this.processGeneric;\n\n      what = fn(what);\n      what = _this.traverse(what);\n\n      var fn2 = _this[\"postProcess\".concat(typeCapitalised)] || _this.postProcessGeneric;\n\n      what = fn2(what);\n\n      if (top) {\n        // Add back in the v3 context\n        if (isArray(origContext)) ; else {\n          what['@context'] = [\"http://www.w3.org/ns/anno.jsonld\", \"http://iiif.io/api/presentation/3/context.json\"];\n        }\n      }\n\n      return what;\n    };\n\n    this.processUri = function (uri) {\n      var top = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n\n      var what = _this.retrieveResource(uri);\n\n      return _this.processResource(what, top);\n    };\n\n    // bind all functions...\n    for (var key in this) {\n      if (typeof this[key] === 'function') {\n        this[key] = this[key].bind(this);\n      }\n    } // add properties\n\n\n    var info = null;\n\n    for (var flag in FLAGS) {\n      info = FLAGS[flag];\n      this[info['prop']] = flags.hasOwnProperty(flag) ? flags[flag] : info['default'];\n    }\n\n    this.idTypeHash = {};\n  }\n\n  _createClass(Upgrader, [{\n    key: \"doLanguageMap\",\n    value: function doLanguageMap(value) {\n      // TODO compare this with the original i feel what it does is wrong\n      var p3IString = {};\n      var defl = this.default_lang;\n\n      if (typeof value === \"string\") {\n        p3IString[defl] = [value];\n      } else if (isDictionary(value)) {\n        if (!p3IString.hasOwnProperty(value['@language'])) {\n          p3IString[value['@language']] = [];\n        }\n\n        p3IString[value['@language']].push(value['@value']);\n      } else if (isArray(value)) {\n        value.forEach(function (i) {\n          if (isDictionary(i)) {\n            var lang = i['@language'] || '@none';\n\n            if (!p3IString.hasOwnProperty(lang)) {\n              p3IString[lang] = [];\n            }\n\n            p3IString[lang].push(i['@value']);\n          } else if (isArray(i)) ; else {\n            // string value\n            if (!p3IString.hasOwnProperty(defl)) {\n              p3IString[defl] = [];\n            }\n\n            p3IString[defl].push(i);\n          }\n        });\n      }\n\n      return p3IString;\n    }\n    /*process_cached(fn, top=true) {\n      with open(fn, 'r') as fh:\n        data = fh.read()\n      what = json.loads(data)\n      return this.processResource(what, top)\n    }\n     reorder = (what) => {\n      new = {}\n      for (k,v) in what.items():\n        if type(v) == list:\n          nl = []\n          for i in v:\n            if type(i) == dict:\n              nl.append(this.reorder(i))\n            else:\n              nl.append(i)\n          new[k] = nl\n        else if (type(v) == dict:\n          new[k] = this.reorder(v)\n        else:\n          new[k] = v\n      return OrderedDict(sorted(new.items(), key=lambda x: KEY_ORDER_HASH.get(x[0], 1000)))\n    }*/\n\n  }]);\n\n  return Upgrader;\n}(); ///// TO DO:\n// Determine which annotations should be items and which annotations\n// -- this is non trivial, but also not common\n////// Cardinality Requirements\n// Check all presence of all MUSTs in the spec and maybe bail?\n// A Collection must have at least one label.\n// A Manifest must have at least one label.\n// An AnnotationCollection must have at least one label.\n// id on Collection, Manifest, Canvas, content, Range,\n//    AnnotationCollection, AnnotationPage, Annotation\n// type on all\n// width+height pair for Canvas, if either\n// items all the way down\n\n\nvar src = Upgrader;\n\nmodule.exports = src;\n"]}