@atlas-viewer/atlas 1.6.6 → 2.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/dist/index.es.js +2562 -1353
  2. package/dist/index.es.js.map +1 -1
  3. package/dist/index.js +2571 -1349
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.umd.js +73 -381
  6. package/dist/index.umd.js.map +1 -1
  7. package/dist/standalone.umd.js +17 -190
  8. package/dist/standalone.umd.js.map +1 -1
  9. package/dist/types/clean-objects/base.object.d.ts +31 -0
  10. package/dist/types/clean-objects/box.object.d.ts +17 -0
  11. package/dist/types/clean-objects/composite.object.d.ts +4 -0
  12. package/dist/types/clean-objects/container.object.d.ts +11 -0
  13. package/dist/types/clean-objects/image.object.d.ts +20 -0
  14. package/dist/types/clean-objects/texture.object.d.ts +0 -0
  15. package/dist/types/clean-objects/tiles.object.d.ts +0 -0
  16. package/dist/types/clean-objects/traits/container.d.ts +5 -0
  17. package/dist/types/clean-objects/traits/evented.d.ts +312 -0
  18. package/dist/types/clean-objects/traits/generic-object.d.ts +61 -0
  19. package/dist/types/clean-objects/traits/has-styles.d.ts +60 -0
  20. package/dist/types/clean-objects/traits/hosts.d.ts +59 -0
  21. package/dist/types/clean-objects/traits/layout.d.ts +61 -0
  22. package/dist/types/clean-objects/traits/paintable.d.ts +16 -0
  23. package/dist/types/clean-objects/traits/revision.d.ts +7 -0
  24. package/dist/types/clean-objects/traits/scheduled-updates.d.ts +9 -0
  25. package/dist/types/clean-objects/world.object.d.ts +15 -0
  26. package/dist/types/clean-objects/zone.object.d.ts +0 -0
  27. package/dist/types/events.d.ts +29 -29
  28. package/dist/types/index.d.ts +5 -0
  29. package/dist/types/modules/browser-event-manager/browser-event-manager.d.ts +6 -1
  30. package/dist/types/modules/canvas-renderer/canvas-renderer.d.ts +11 -1
  31. package/dist/types/modules/composite-renderer/composite-renderer.d.ts +9 -1
  32. package/dist/types/modules/debug-renderer/debug-renderer.d.ts +1 -0
  33. package/dist/types/modules/overlay-renderer/overlay-renderer.d.ts +21 -13
  34. package/dist/types/modules/react-reconciler/Atlas.d.ts +17 -7
  35. package/dist/types/modules/react-reconciler/components/AtlasAuto.d.ts +4 -8
  36. package/dist/types/modules/react-reconciler/components/AtlasContext.d.ts +4 -26
  37. package/dist/types/modules/react-reconciler/components/AtlasWithReconciler.d.ts +13 -0
  38. package/dist/types/modules/react-reconciler/components/RegionHighlight.d.ts +2 -2
  39. package/dist/types/modules/react-reconciler/hooks/use-atlas-image.d.ts +2 -2
  40. package/dist/types/modules/react-reconciler/hooks/use-atlas.d.ts +1 -1
  41. package/dist/types/modules/react-reconciler/hooks/use-canvas-position.d.ts +1 -0
  42. package/dist/types/modules/react-reconciler/hooks/use-classname.d.ts +1 -0
  43. package/dist/types/modules/react-reconciler/hooks/use-controlled-annotation-list.d.ts +0 -1
  44. package/dist/types/modules/react-reconciler/hooks/use-preset.d.ts +17 -0
  45. package/dist/types/modules/react-reconciler/hooks/use-resize-world-item.d.ts +0 -1
  46. package/dist/types/modules/react-reconciler/presets/_types.d.ts +23 -0
  47. package/dist/types/modules/react-reconciler/presets/default-preset.d.ts +10 -0
  48. package/dist/types/modules/react-reconciler/presets/index.d.ts +8 -0
  49. package/dist/types/modules/react-reconciler/presets/static-preset.d.ts +7 -0
  50. package/dist/types/modules/react-reconciler/reconciler.d.ts +4 -0
  51. package/dist/types/modules/react-reconciler/types.d.ts +11 -173
  52. package/dist/types/modules/static-renderer/static-renderer.d.ts +16 -1
  53. package/dist/types/modules/transition-manager/transition-manager.d.ts +63 -0
  54. package/dist/types/modules/webgl-renderer/webgl-renderer.d.ts +7 -1
  55. package/dist/types/objects/base-object.d.ts +2 -1
  56. package/dist/types/objects/box.d.ts +49 -1
  57. package/dist/types/objects/text.d.ts +8 -0
  58. package/dist/types/renderer/renderer.d.ts +11 -2
  59. package/dist/types/renderer/runtime.d.ts +44 -10
  60. package/dist/types/spacial-content/composite-resource.d.ts +13 -1
  61. package/dist/types/spacial-content/index.d.ts +1 -0
  62. package/dist/types/spacial-content/single-image.d.ts +6 -0
  63. package/dist/types/spacial-content/spacial-content.d.ts +4 -0
  64. package/dist/types/spacial-content/tiled-image.d.ts +6 -1
  65. package/dist/types/types.d.ts +17 -16
  66. package/dist/types/utility/are-inputs-equal.d.ts +1 -0
  67. package/dist/types/utility/easing-functions.d.ts +6 -0
  68. package/dist/types/utility/go-to-clamped.d.ts +1 -0
  69. package/dist/types/utility/hash.d.ts +1 -0
  70. package/dist/types/utility/merge-styles.d.ts +2 -0
  71. package/dist/types/utility/stylesheet.d.ts +17 -0
  72. package/dist/types/utility/to-box.d.ts +2 -0
  73. package/dist/types/utils.d.ts +1 -1
  74. package/dist/types/world-objects/world-object.d.ts +1 -1
  75. package/dist/types/world.d.ts +2 -1
  76. package/package.json +19 -27
  77. package/dist/types/modules/vanilla-controller/vanilla-controller.d.ts +0 -4
package/dist/index.umd.js CHANGED
@@ -1,6 +1,5 @@
1
- /*
2
- Modernizr 3.0.0pre (Custom Build) | MIT
3
- *****************************************************************************
1
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react"),require("react-reconciler"),require("scheduler"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","react","react-reconciler","scheduler","react-dom"],e):e((t=t||self).Atlas={},t.React,t.ReactReconciler,t.Scheduler,t.ReactDOM)}(this,(function(t,e,i,n,r){"use strict";var o="default"in e?e.default:e;i=i&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i;var s=["onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp","onTouchCancel","onTouchEnd","onTouchMove","onTouchStart","onPointerDown","onPointerMove","onPointerUp","onPointerCancel","onPointerEnter","onPointerLeave","onPointerOver","onPointerOut","onScroll","onWheel","onClick","onDragStart","onDragEnd","onDragEnter","onDragExit","onDrag","onDragOver"];function a(){return s.reduce((function(t,e){return t[e]=[],t}),{})}var c=s.reduce((function(t,e){return t[e.slice(2).toLowerCase()]=e,t[e]=e,t}),{}),h=function(t,e){return(h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(t,e)};
2
+ /*! *****************************************************************************
4
3
  Copyright (c) Microsoft Corporation.
5
4
 
6
5
  Permission to use, copy, modify, and/or distribute this software for any
@@ -13,384 +12,77 @@
13
12
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
14
13
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15
14
  PERFORMANCE OF THIS SOFTWARE.
16
- **************************************************************************** *****************************************************************************
17
- Copyright (c) Microsoft Corporation. All rights reserved.
18
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use
19
- this file except in compliance with the License. You may obtain a copy of the
20
- License at http://www.apache.org/licenses/LICENSE-2.0
15
+ ***************************************************************************** */function l(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function i(){this.constructor=t}h(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}var u=function(){return(u=Object.assign||function(t){for(var e,i=1,n=arguments.length;i<n;i++)for(var r in e=arguments[i])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};function d(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(t);r<n.length;r++)e.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(t,n[r])&&(i[n[r]]=t[n[r]])}return i}function p(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}function f(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{c(n.next(t))}catch(t){o(t)}}function a(t){try{c(n.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}c((n=n.apply(t,e||[])).next())}))}function g(t,e){var i,n,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(i)throw new TypeError("Generator is already executing.");for(;s;)try{if(i=1,n&&(r=2&o[0]?n.return:o[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,o[1])).done)return r;switch(n=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){s.label=o[1];break}if(6===o[0]&&s.label<r[1]){s.label=r[1],r=o;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],n=0}finally{i=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}function v(t){var e="function"==typeof Symbol&&Symbol.iterator,i=e&&t[e],n=0;if(i)return i.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function y(t,e){var i="function"==typeof Symbol&&t[Symbol.iterator];if(!i)return t;var n,r,o=i.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(t){r={error:t}}finally{try{n&&!n.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}return s}function m(t,e,i){if(i||2===arguments.length)for(var n,r=0,o=e.length;r<o;r++)!n&&r in e||(n||(n=Array.prototype.slice.call(e,0,r)),n[r]=e[r]);return t.concat(n||Array.prototype.slice.call(e))}const w=(t,e,i)=>{const n=t.length,r=i||b(n);for(let i=0;i<n;i++)r[i]=i%5==0?t[i+1]<e[3]&&t[i+3]>e[1]&&t[i+2]<e[4]&&t[i+4]>e[2]?1:0:t[i];return r};function b(t,e,i){return new Float32Array(t,e,i)}const x=(t,e,i)=>{const n=i||b(9);return n[0]=t[0]*e[0]+t[1]*e[3]+t[2]*e[6],n[1]=t[0]*e[1]+t[1]*e[4]+t[2]*e[7],n[2]=t[0]*e[2]+t[1]*e[5]+t[2]*e[8],n[3]=t[3]*e[0]+t[4]*e[3]+t[5]*e[6],n[4]=t[3]*e[1]+t[4]*e[4]+t[5]*e[7],n[5]=t[3]*e[2]+t[4]*e[5]+t[5]*e[8],n[6]=t[6]*e[0]+t[7]*e[3]+t[8]*e[6],n[7]=t[6]*e[1]+t[7]*e[4]+t[8]*e[7],n[8]=t[6]*e[2]+t[7]*e[5]+t[8]*e[8],n};class E{constructor(t){this.index=0,this.length=t,this.points=b(this.length)}static grid(t=1,e=1){return new E(5*t*e)}static point(t,e){const i=b(5);return i[0]=1,i[1]=t,i[2]=e,i[3]=t,i[4]=e,i}static positionPair(t){const e=b(5);return e[0]=1,e[1]=t.x1,e[2]=t.y1,e[3]=t.x2,e[4]=t.y2,e}static projection(t){return E.singleBox(t.width,t.height,t.x,t.y)}static singleBox(t,e,i=0,n=0){const r=b(5);return r[0]=1,r[1]=i,r[2]=n,r[3]=t+i,r[4]=e+n,r}row(t){return t(this)}addPoints(t,e,i,n){return this.points[this.index]=1,this.points[1+this.index]=t,this.points[2+this.index]=e,this.points[3+this.index]=i,this.points[4+this.index]=n,this.index+=5,this}addBox(t,e,i,n){return this.addPoints(t,e,t+i,e+n),this}build(){return this.points}}const S=(t,e)=>{const i=t.length;for(let n=0;n<i;n++)t[n]=n%5==0?e[6]*t[n+1]+e[7]*t[n+2]+e[8]*t[n]:n%5%2==1?e[0]*t[n]+e[1]*t[n+1]+e[2]:e[3]*t[n-1]+e[4]*t[n]+e[5];return t},O=t=>{const e=b(9);return e[0]=t,e[4]=t,e[8]=1,e},P=(t,e)=>{const i=b(9);return i[0]=1,i[2]=t,i[4]=1,i[5]=e,i[8]=1,i},C=(t,e,i)=>x(P((1-t)*e,(1-t)*i),O(t)),R=(t,e,i)=>{const n=t.length,r=i&&i.length>=n?i.slice(0,n):b(n);for(let i=0;i<n;i++)r[i]=i%5==0?e[6]*t[i+1]+e[7]*t[i+2]+e[8]*t[i]:i%5%2==1?e[0]*t[i]+e[1]*t[i+1]+e[2]:e[3]*t[i-1]+e[4]*t[i]+e[5];return r};let _=(t=21)=>{let e="",i=crypto.getRandomValues(new Uint8Array(t));for(;t--;){let n=63&i[t];e+=n<36?n.toString(36):n<62?(n-26).toString(36).toUpperCase():n<63?"_":"-"}return e};var A=function(){function t(){var t=this;this.__revision=0,this.__state={},this.scale=1,this.layers=[],this.time=[],this.addEventListener=function(e,i,n){var r=c[e];if(!t.eventHandlers[r])throw new Error("Unknown event ".concat(r));-1===t.eventHandlers[r].indexOf(i)&&t.eventHandlers[r].push(i)},this.removeEventListener=function(e,i){var n=c[e];t.eventHandlers[n]?-1!==t.eventHandlers[n].indexOf(i)&&(t.eventHandlers[n]=t.eventHandlers[n].filter((function(t){return t!==i}))):console.warn("Unknown event ".concat(n))},this.id=this.__id=_(),this.eventHandlers=a()}return t.prototype.getObjectsAt=function(t){return[]},t.prototype.getAllPointsAt=function(t,e,i){return[]},t.prototype.getScheduledUpdates=function(t,e){return null},t.prototype.dispatchEvent=function(t,e){var i=this.eventHandlers[t],n=i?i.length:0,r=!1;if(n)for(var o=0;o<n;o++)try{i[o](e),r=!0}catch(e){console.error(t,e)}return r},Object.defineProperty(t.prototype,"x",{get:function(){return this.points[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"y",{get:function(){return this.points[2]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"width",{get:function(){return this.points[3]-this.points[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this.points[4]-this.points[2]},enumerable:!1,configurable:!0}),t.prototype.translate=function(t,e){S(this.points,P(t,e))},t.prototype.atScale=function(t){S(this.points,C(t,this.x,this.y)),this.scale*=t},t.prototype.transform=function(t){S(this.points,t)},t.prototype.applyProps=function(t){this.__revision++},t.prototype.appendChild=function(t){},t.prototype.removeChild=function(t){},t.prototype.insertBefore=function(t,e){},t.prototype.hideInstance=function(){},t}(),T=function(t){function e(e){var i=t.call(this)||this;if(i.type="spacial-content",i.style={opacity:1},e){var n=e.scale||1;i.id=e.id||e.uri,i.uri=e.uri,i.points=E.singleBox(e.width,e.height,e.x,e.y),i.display={scale:n,width:e.width/n,height:e.height/n,points:1!==n?E.singleBox(e.width/n,e.height/n):i.points}}else i.id="",i.uri="",i.display={scale:1,width:0,height:0,points:b(5)},i.points=b(5);return i}return l(e,t),e.prototype.applyProps=function(t){var e=t.display?t.display.width:t.target.width,i=t.target.width/e;this.id=t.id||t.uri,this.uri=t.uri,this.points.set(E.singleBox(t.target.width,t.target.height,t.target.x,t.target.y)),t.style&&void 0!==t.style.opacity&&(this.style.opacity=t.style.opacity),this.display.scale=i,this.display.width=t.target.width/i,this.display.height=t.target.height/i,this.display.points=1!==i?E.singleBox(t.target.width/i,t.target.height/i):this.points},e.prototype.getAllPointsAt=function(t,e,i){return[[this,this.crop||this.points,e]]},e.fromSvg=function(t,i,n,r){return e.fromImage("data:image/svg+xml;base64,"+btoa(t),i,n,r)},e.fromImage=function(t,i,n,r){var o=new e;return o.applyProps({uri:t,id:r,display:n,target:i}),o},e.prototype.getImageUrl=function(){return this.uri},e}(A),I=function(t){function e(e){var i=t.call(this)||this;if(i.type="spacial-content",i.getTexture=function(){return{source:void 0,hash:-1}},e){var n=e.scale||1;i.id=e.id||e.uri,i.uri=e.uri,i.points=E.singleBox(e.width,e.height),i.display={scale:n,width:e.width/n,height:e.height/n,points:1!==n?E.singleBox(e.width/n,e.height/n):i.points}}else i.id="",i.uri="",i.display={scale:1,width:0,height:0,points:b(5)},i.points=b(5);return i}return l(e,t),e.prototype.applyProps=function(t){var e=t.display?t.display.width:t.target.width,i=t.target.width/e;this.id=t.id,this.points.set(E.singleBox(t.target.width,t.target.height)),this.display.scale=i,this.display.width=t.target.width/i,this.display.height=t.target.height/i,this.getTexture=t.getTexture,this.display.points=1!==i?E.singleBox(t.target.width/i,t.target.height/i):this.points},e.prototype.getAllPointsAt=function(t,e,i){return[[this,this.points,e]]},e}(A);"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function j(t,e,i){return t(i={path:e,exports:{},require:function(t,e){return M(null==e&&i.path)}},i.exports),i.exports}function M(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var L=function(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}(j((function(t,e){!function(i){var n=function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Memoize=function(t){return function(e,i,r){if(null!=r.value)r.value=n(r.value,t);else{if(null==r.get)throw"Only put a Memoize() decorator on a method or get accessor.";r.get=n(r.get,t)}}};var i=0;function n(t,e){var n=++i;return function(){for(var i=[],r=0;r<arguments.length;r++)i[r]=arguments[r];var o,s="__memoized_value_"+n,a="__memoized_map_"+n;if(e||i.length>0){this.hasOwnProperty(a)||Object.defineProperty(this,a,{configurable:!1,enumerable:!1,writable:!1,value:new Map});var c=this[a],h=void 0;h=e?e.apply(this,i):i[0],c.has(h)?o=c.get(h):(o=t.apply(this,i),c.set(h,o))}else this.hasOwnProperty(s)?o=this[s]:(o=t.apply(this,i),Object.defineProperty(this,s,{configurable:!1,enumerable:!1,writable:!1,value:o}));return o}}}(0,e);void 0!==n&&(t.exports=n)}()})));function k(t,e){return Math.abs(t-e)}var F=function(t){function e(e){var i,n,r=t.call(this)||this;return r.type="spacial-content",r.style={opacity:1},r.id=(i=e.url,n=i.length,i.indexOf("/info.json")===n-10?i.slice(0,-10):i),r.points=e.displayPoints?e.displayPoints:R(e.points,O(e.scaleFactor)),r.tileWidth=e.tileWidth,r.display={width:e.width/e.scaleFactor,height:e.height/e.scaleFactor,points:e.points,scale:e.scaleFactor},r}return l(e,t),e.prototype.applyProps=function(t){t.style&&void 0!==t.style.opacity&&(this.style.opacity=t.style.opacity),t.service!==this.service&&(this.service=t.service)},e.fromTile=function(t,i,n,r,o){n.height=n.height?n.height:n.width;for(var s=Math.ceil(i.width/r),a=Math.ceil(i.height/r),c=Math.ceil(s/n.width),h=Math.ceil(a/n.height),l=E.grid(c,h),u=E.grid(c,h),d=0;d<h;d++)for(var p=0;p<c;p++){var f=p*n.width,g=d*n.height;u.addPoints(f*r,g*r,p===c-1?i.width:(f+n.width)*r,d===h-1?i.height:(g+n.height)*r),l.addPoints(f,g,p===c-1?s:f+n.width,d===h-1?a:g+n.height)}var v=new e({url:t,scaleFactor:r,points:l.build(),displayPoints:u.build(),width:i.width,height:i.height,tileWidth:n.width});return v.applyProps({service:o}),v},e.prototype.getImageUrl=function(t){var e=this.points.slice(5*t,5*t+5),i=e[3]-e[1],n=e[4]-e[2],r=Math.ceil(i/this.display.scale);return"".concat(this.id,"/").concat(e[1],",").concat(e[2],",").concat(i,",").concat(n,"/").concat(r>this.tileWidth?this.tileWidth:r,",/0/default.jpg")},e.prototype.getAllPointsAt=function(t,e,i){return[[this,w(this.points,t),e]]},e.prototype.transform=function(t){S(this.points,t)},e.prototype.getScheduledUpdates=function(t,e){return null},function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);o>3&&s&&Object.defineProperty(e,i,s)}([L.Memoize(),p("design:type",Function),p("design:paramtypes",[Number]),p("design:returntype",String)],e.prototype,"getImageUrl",null),e}(A),D=function(t){function e(e){var i=t.call(this)||this;return i.images=[],i.allImages=[],i.scaleFactors=[],i.aggregateBuffer=b(9),i.isFullyLoaded=!1,i.maxScaleFactor=0,i._scheduleSortByScales=!1,i._sortByScales=function(){var t,e;i._scheduleSortByScales=!1,i.allImages.sort((function(t,e){return e.display.width-t.display.width})),i.images=[];var n=.1;try{for(var r=v(i.allImages),o=r.next();!o.done;o=r.next()){var s=o.value;if((!(s.display.width<i.renderOptions.minSize&&s.display.height<i.renderOptions.minSize)||s.priority)&&(!(s instanceof T&&(s.display.width>i.renderOptions.maxImageSize||s.display.height>i.renderOptions.maxImageSize))||s.priority)){if(Math.abs(s.display.scale-n)<.25||s.priority){var a=i.images.pop();a&&(a instanceof T||a.priority)?(s.priority&&i.images.push(s),i.images.push(a)):s&&i.images.push(s)}else s&&i.images.push(s);n=s.display.scale}}}catch(e){t={error:e}}finally{try{o&&!o.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}0===i.images.length&&(i.images=m([],y(i.allImages),!1)),i.scaleFactors=i.images.map((function(t){return t.display.scale})),i.maxScaleFactor=Math.max.apply(Math,m([],y(i.scaleFactors),!1))},i.loadFullResource=function(){return f(i,void 0,void 0,(function(){var t;return g(this,(function(e){switch(e.label){case 0:return this.isFullyLoaded?[2]:this.lazyLoader?(this.isFullyLoaded=!0,[4,this.lazyLoader()]):[3,2];case 1:t=e.sent(),this.addImages(t),e.label=2;case 2:return[2]}}))}))},i.fallback=[i.loadFullResource],i.id=e.id,i.points=E.singleBox(e.width,e.height),i.lazyLoader=e.loadFullImages,e.loadFullImages||(i.isFullyLoaded=!0),i.display={points:E.singleBox(e.width,e.height),height:e.height,width:e.width,scale:1},i.renderOptions=u({renderSmallestFallback:!0,renderLayers:2,minSize:256,maxImageSize:1024,quality:1},e.renderOptions||{}),i.addImages(e.images),i}return l(e,t),e.prototype.applyProps=function(t){void 0!==t.renderSmallestFallback&&t.renderSmallestFallback!==this.renderOptions.renderSmallestFallback&&(this.renderOptions.renderSmallestFallback=t.renderSmallestFallback),void 0!==t.renderLayers&&t.renderLayers!==this.renderOptions.renderLayers&&(this.renderOptions.renderLayers=t.renderLayers),void 0!==t.minSize&&t.minSize!==this.renderOptions.minSize&&(this.renderOptions.minSize=t.minSize),void 0!==t.maxImageSize&&t.maxImageSize!==this.renderOptions.maxImageSize&&(this.renderOptions.maxImageSize=t.maxImageSize),void 0!==t.quality&&t.quality!==this.renderOptions.quality&&(this.renderOptions.quality=t.quality)},e.prototype.appendChild=function(t){this.addImages([t])},e.prototype.removeChild=function(t){-1!==this.images.indexOf(t)&&(this.images=this.images.filter((function(e){return e!==t})),this.sortByScales())},e.prototype.insertBefore=function(t,e){this.addImages([t])},e.prototype.hideInstance=function(){},e.prototype.addImages=function(t){var e,i,n;try{for(var r=v(t),o=r.next();!o.done;o=r.next()){o.value.__parent=this}}catch(t){e={error:t}}finally{try{o&&!o.done&&(i=r.return)&&i.call(r)}finally{if(e)throw e.error}}(n=this.allImages).push.apply(n,m([],y(t.filter(Boolean)),!1)),this.sortByScales()},e.prototype.sortByScales=function(){this._scheduleSortByScales=!0},e.prototype.getScheduledUpdates=function(t,e){return this._scheduleSortByScales&&this._sortByScales(),this.isFullyLoaded?null:e>1/this.maxScaleFactor?this.fallback:null},e.prototype.getAllPointsAt=function(t,e,i){if(0===this.images.length)return[];var n=function(t,e,i){void 0===i&&(i=1);var n=e.length;if(0===n)throw new Error("No resources passed in.");for(var r=0,o=0;o<n&&(e[o]&&e[o].display);o++)r=Math.abs(e[o].display.scale-t)*i<Math.abs(e[r].display.scale-t)?o:r;return r}(1/(i||1)/(window.devicePixelRatio||1),this.images,this.renderOptions.quality),r=this.images.length,o=e?x(e,P(this.x,this.y)):P(this.x,this.y);if(n!==this.images.length-1&&this.images[n+1]){for(var s=[],a=r-1;a>=n;a--)s.push(a);var c=s[0];this.renderOptions.renderLayers&&(s=s.slice(-this.renderOptions.renderLayers)),this.renderOptions.renderSmallestFallback&&-1===s.indexOf(c)&&s.unshift(c);var h=[];for(a=0;a<s.length;a++)h.push.apply(h,m([],y(this.images[s[a]].getAllPointsAt(t,o,i)),!1));return h}return this.images[n].getAllPointsAt(t,o,i)},e}(function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="spacial-content",e}return l(e,t),e.prototype.getAllPointsAt=function(t,e,i){return[[this,this.points,e]]},e}(A)),z=function(t){function e(e,i){var n=t.call(this)||this;n.type="world-object",n.intersectionBuffer=b(5),n.aggregateBuffer=b(9),n.invertedBuffer=b(9),n._updatedList=[];var r=i||{},o=r.x,s=void 0===o?0:o,a=r.y,c=void 0===a?0:a;return e?(n.id=e.id||"",n.scale=1,n.layers=e.layers,n.points=b([1,s,c,e.width,e.height]),n.worldPoints=b([1,s,c,e.width,e.height]),n.filteredPointsBuffer=b(5*e.layers.length)):(n.id="",n.scale=1,n.layers=[],n.points=b(5),n.worldPoints=b(5),n.filteredPointsBuffer=b(5)),n}return l(e,t),e.createWithProps=function(t){var i=new e;return i.applyProps(t),i},e.prototype.applyProps=function(t){var e=t.x||0,i=t.y||0;this.id=t.id;var n=void 0!==t.scale?t.scale:this.scale;this.points[0]=1,this.points[1]=e,this.points[2]=i,this.points[3]=e+t.width,this.points[4]=i+t.height,this.worldPoints[3]=this.worldPoints[1]+t.width*n,this.worldPoints[4]=this.worldPoints[2]+t.height*n,t.scale&&1!==t.scale&&this.atScale(n),this.scale=n},e.prototype.appendChild=function(t){0===t.points[0]&&t.points.set(this.points),this.addLayers([t])},e.prototype.removeChild=function(t){this.layers=this.layers.filter((function(e){return e!==t})),this.filteredPointsBuffer=b(5*this.layers.length)},e.prototype.insertBefore=function(t,e){var i=this.layers.indexOf(e);if(-1!==i){var n=this.layers.slice(0,i-1),r=this.layers.slice(i);this.layers=m(m(m([],y(n),!1),[t],!1),y(r),!1)}},e.prototype.hideInstance=function(){console.warn("hideInstance: not yet implemented")},e.prototype.getObjectsAt=function(t,e){if(0===w(this.points,t,this.filteredPointsBuffer)[0])return[];for(var i=this.layers.length,n=[],r=0;r<i;r++){var o=this.layers[r];if(0!==w(R(o.points,P(this.x,this.y)),t,this.filteredPointsBuffer)[0]&&n.push(o),e){var s=o;n.push.apply(n,m([],y(s.getObjectsAt(t,e)),!1))}}return n},e.prototype.getAllPointsAt=function(t,e,i){for(var n=x(P(this.x,this.y),O(this.scale),this.aggregateBuffer),r=((t,e,i)=>{const n=t[1]<=e[3]&&t[3]>=e[1]&&t[2]<=e[4]&&t[4]>=e[2],r=i||b(5);return n?(r[0]=1,r[1]=Math.max(t[1],e[1]),r[2]=Math.max(t[2],e[2]),r[3]=Math.min(t[3],e[3]),r[4]=Math.min(t[4],e[4]),r):(r[0]=0,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r)})(t,this.points,this.intersectionBuffer),o=this.layers.length,s=[],a=R(r,x(O(1/this.scale),P(-this.x,-this.y),this.invertedBuffer)),c=e?x(e,n,this.aggregateBuffer):n,h=i*this.scale,l=0;l<o;l++)s.push.apply(s,m([],y(this.layers[l].getAllPointsAt(a,c,h)),!1));return s},e.prototype.addLayers=function(t){var e,i;try{for(var n=v(t),r=n.next();!r.done;r=n.next()){var o=r.value;5===o.points.length&&(o.points[1]<this.worldPoints[1]/this.scale||o.points[2]<this.worldPoints[2]/this.scale||o.points[3]>this.worldPoints[3]/this.scale||o.points[4]>this.worldPoints[4]/this.scale)&&(o.crop=b([1,Math.max(this.worldPoints[1]/this.scale,o.points[1]),Math.max(this.worldPoints[2]/this.scale,o.points[2]),Math.min(this.worldPoints[3]/this.scale,o.points[3]),Math.min(this.worldPoints[4]/this.scale,o.points[4])]))}}catch(t){e={error:t}}finally{try{r&&!r.done&&(i=n.return)&&i.call(n)}finally{if(e)throw e.error}}this.layers=this.layers.concat(t),this.filteredPointsBuffer=b(5*this.layers.length)},e.prototype.getScheduledUpdates=function(t,e){var i,n=this.layers.length;this._updatedList=[];for(var r=e*this.scale,o=0;o<n;o++){var s=this.layers[o].getScheduledUpdates(t,r);s&&(i=this._updatedList).push.apply(i,m([],y(s),!1))}return this._updatedList},e}(A),B=function(t){function e(e,i,n,r){void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=100),void 0===r&&(r="left-to-right");var o=t.call(this)||this;return o.id="world",o.aggregateBuffer=b(9),o.isDirty=!1,o.zones=[],o.triggerQueue=[],o.activatedEvents=[],o._updatedList=[],o.translationBuffer=b(9),o.needsRecalculate=!0,o.emptyPaintables=[],o.renderOrder=[],o.objects=[],o.subscriptions=[],o._propagateEventTargets=[],o._alreadyFlushed=[],o._width=e,o._height=i,o.aspectRatio=Number.isNaN(e/i)?1:e/i,o.viewingDirection=r,o.points=b(5*n),o.filteredPointsBuffer=b(5*n),o}return l(e,t),Object.defineProperty(e.prototype,"x",{get:function(){return 0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"y",{get:function(){return 0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return this._width},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this._height},enumerable:!1,configurable:!0}),e.withProps=function(t){var i=new e;return i.applyProps(t),i},e.prototype.applyProps=function(t){void 0===t.width||void 0===t.height||t.width===this._width&&t.height===this._height||this.resize(t.width,t.height),t.viewingDirection!==this.viewingDirection&&(this.viewingDirection=t.viewingDirection,this.triggerRepaint())},e.prototype.propagateTouchEvent=function(t,e,i){var n,r,o=this,s=[];try{for(var a=v(i),c=a.next();!c.done;c=a.next()){var h=c.value;if(h.x&&h.y){var l=E.singleBox(1,1,h.x,h.y);s.push(this.getObjectsAt(l,!0).reverse())}}}catch(t){n={error:t}}finally{try{c&&!c.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return s.map((function(i){return o.propagateEvent(t,e,i,{bubbles:!0,cancelable:!0})}))},e.prototype.propagatePointerEvent=function(t,e,i,n,r){void 0===r&&(r={});var o=E.singleBox(1,1,i,n),s=this.getObjectsAt(o,!0).reverse();return this.propagateEvent(t,e,s,r)},e.prototype.propagateEvent=function(t,e,i,n){var r=void 0===n?{}:n;r.bubbles,r.cancelable;e.atlasTarget=this,this._propagateEventTargets.length=1,this._propagateEventTargets[0]=this;var o=!1;e.stopPropagation=function(){o=!0};for(var s=i.length-1;s>=0;s--){this._propagateEventTargets.unshift(i[s][0]);var a=i[s][1].length;if(a)for(var c=0;c<a;c++)this._propagateEventTargets.unshift(i[s][1][c])}var h=this._propagateEventTargets.length,l=!1;for(c=0;c<h&&(e.atlasTarget=this._propagateEventTargets[c],e.atlasWorld=this,l=this._propagateEventTargets[c].dispatchEvent(t,e)||l,!o);c++);return l&&this.triggerRepaint(),this._propagateEventTargets},e.prototype.appendChild=function(t){var e=this.appendWorldObject(t);this.renderOrder.push(e/5)},e.prototype.removeChild=function(t){var e,i,n=this.objects.indexOf(t);if(-1!==n)this.objects[n]=null,this.renderOrder=this.renderOrder.filter((function(t){return t!==n})),this.points[5*n]=0,this.triggerRepaint(),this.needsRecalculate=!0;else try{for(var r=v(this.objects),o=r.next();!o.done;o=r.next()){var s=o.value;if(s&&s.id===t.id)return void this.removeChild(s)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(i=r.return)&&i.call(r)}finally{if(e)throw e.error}}},e.prototype.insertBefore=function(t,e){var i=this.objects.indexOf(e);if(-1!==i){var n=this.appendWorldObject(t);this.renderOrder.splice(i,0,n/5)}},e.prototype.hideInstance=function(){},e.prototype.asWorldObject=function(){return null},e.prototype.addZone=function(t){this.zones.push(t)},e.prototype.selectZone=function(t){if("string"==typeof t){for(var e=this.zones.length,i=0;i<e;i++)if(this.zones[i].id===t)return this.selectedZone=i,void this.trigger("zone-changed")}else this.zones[t]&&(this.selectedZone=t,this.trigger("zone-changed"))},e.prototype.deselectZone=function(){this.selectedZone=void 0},e.prototype.getActiveZone=function(){if(this.selectedZone)return this.zones[this.selectedZone]},e.prototype.hasActiveZone=function(){return void 0!==this.selectedZone},e.prototype.checkResizeInternalBuffer=function(){if((t=>t.length/5)(this.points)===this.objects.length){var t=this.points,e=b(2*this.points.length);e.set(t,0),this.points=e}},e.prototype.appendWorldObject=function(t){this.checkResizeInternalBuffer();var e=5*this.objects.length,i=t.points;return t.points=this.points.subarray(5*this.objects.length,5*this.objects.length+5),t.points[1]=i[1],t.points[2]=i[2],t.points[3]=i[3],t.points[4]=i[4],this.objects.push(t),this.filteredPointsBuffer=b(5*this.objects.length),this.needsRecalculate=!0,this.triggerRepaint(),e},e.prototype.recalculateWorldSize=function(){var t=!1;if(this.needsRecalculate){for(var e=new Int32Array(this.objects.length),i=new Int32Array(this.objects.length),n=this.objects.length,r=0;r<n;r++)this.objects[r]&&(e[r]=this.points[5*r+3],i[r]=this.points[5*r+4]);var o=Math.max.apply(Math,m([],y(e),!1));o!==this._width&&(this._width=o,t=!0);var s=Math.max.apply(Math,m([],y(i),!1));s!==this._height&&(this._height=s,t=!0),t&&this.trigger("recalculate-world-size",{width:o,height:s}),this.needsRecalculate=!1}return t},e.prototype.addObjectAt=function(t,e){e.width&&!e.height?e.height=e.width/t.width*t.height:e.height&&!e.width&&(e.width=e.height/t.height*t.width),e&&e.width&&e.height||(e.width=t.width,e.height=t.height);var i=e.width,n=e.x,r=e.y,o=i/t.width;this.checkResizeInternalBuffer(),this.points.set(E.singleBox(t.width,t.height,0,0),5*this.objects.length);var s=new z(t);return s.points=this.points.subarray(5*this.objects.length,5*this.objects.length+5),this.objects.push(s),this.scaleWorldObject(this.objects.length-1,o),this.translateWorldObject(this.objects.length-1,n,r),this.filteredPointsBuffer=b(2*this.points.length),this.triggerRepaint(),this.needsRecalculate=!0,s},e.prototype.scaleWorldObject=function(t,e){S(this.points.subarray(5*t,5*t+5),C(e,this.points[5*t+1],this.points[5*t+2]));var i=this.objects[t];i&&(i.atScale(e),this.triggerRepaint())},e.prototype.translateWorldObject=function(t,e,i){S(this.points.subarray(5*t,5*t+5),P(e,i));var n=this.objects[t];n&&(n.translate(e,i),this.triggerRepaint())},e.prototype.resize=function(t,e){return this._width=t,this._height=e,this.aspectRatio=t/e,this.triggerRepaint(),this},e.prototype.getObjects=function(){return this.objects},e.prototype.getPoints=function(){return this.points},e.prototype.getPointsFromViewer=function(t,e){var i=E.singleBox(t.width,t.height,t.x,t.y);return this.getPointsAt(i,e,t.scale)},e.prototype.addLayoutSubscriber=function(t){var e=this;return this.subscriptions.push(t),function(){e.subscriptions.splice(e.subscriptions.indexOf(t),1)}},e.prototype.getScheduledUpdates=function(t,e){var i,n=w(this.points,t,this.filteredPointsBuffer),r=this.objects.length;this._updatedList=[];for(var o=0;o<r;o++)if(0!==n[5*o]){if(!this.objects[o])continue;(i=this._updatedList).push.apply(i,m([],y(this.objects[o].getScheduledUpdates(t,e)),!1))}return this._updatedList},e.prototype.getObjectsAt=function(t,e){void 0===e&&(e=!1);for(var i=this.getActiveZone(),n=w(this.points,t,this.filteredPointsBuffer),r=this.renderOrder.length,o=[],s=0;s<r;s++){var a=this.renderOrder[s];if(0!==n[5*a]){var c=this.objects[a];if(!c||i&&-1===i.objects.indexOf(c))continue;if("world-object"!==c.type){o.push([c,[c]]);continue}e?o.push([c,c.getObjectsAt(t,e)]):o.push([c,this.emptyPaintables])}}return o},e.prototype.getPointsAt=function(t,e,i){void 0===i&&(i=1);for(var n=this.getObjectsAt(t),r=x(O(i),P(-t[1],-t[2]),this.translationBuffer),o=e?x(e,r,this.aggregateBuffer):r,s=n.length,a=[],c=0;c<s;c++)a.push.apply(a,m([],y(n[c][0].getAllPointsAt(t,o,i)),!1));return a},e.prototype.flushSubscriptions=function(){if(this.triggerQueue.length){this._alreadyFlushed=[];for(var t=this.triggerQueue.length,e=0;e<t;e++)if(-1===this._alreadyFlushed.indexOf(this.triggerQueue[e][0])){void 0===this.triggerQueue[e][1]&&this._alreadyFlushed.push(this.triggerQueue[e][0]);for(var i=this.subscriptions.length,n=0;n<i;n++)this.subscriptions[n].apply(null,this.triggerQueue[e])}this.triggerQueue=[]}},e.prototype.trigger=function(t,e){this.triggerQueue.push([t,e])},e.prototype.triggerEventActivation=function(){this.trigger("event-activation")},e.prototype.triggerRepaint=function(){this.trigger("repaint")},e.prototype.gotoRegion=function(t){this.trigger("goto-region",t)},e.prototype.goHome=function(t){void 0===t&&(t=!1),this.trigger("go-home",{immediate:t})},e.prototype.zoomTo=function(t,e,i){this.trigger("zoom-to",{point:e,factor:t,stream:i})},e.prototype.zoomIn=function(t){this.trigger("zoom-to",{point:t,factor:.5})},e.prototype.zoomOut=function(t){this.trigger("zoom-to",{point:t,factor:2})},e.prototype.constraintBounds=function(t){this.trigger("constrain-bounds",{immediate:t})},e}(A);var U,N={margin:0},W=function(){function t(t,e){void 0===e&&(e={}),this.id=t.map((function(t){return t.id})).join("$$"),this.config=u(u({},N),e),this.points=b(5),this.objects=t,this.recalculateBounds()}return t.prototype.recalculateBounds=function(){this.points.set([1,Math.min.apply(Math,m([],y(this.objects.map((function(t){return t.points[1]}))),!1))-this.config.margin,Math.min.apply(Math,m([],y(this.objects.map((function(t){return t.points[2]}))),!1))-this.config.margin,Math.max.apply(Math,m([],y(this.objects.map((function(t){return t.points[3]}))),!1))+this.config.margin,Math.max.apply(Math,m([],y(this.objects.map((function(t){return t.points[4]}))),!1))+this.config.margin])},t.prototype.getPointsAt=function(t,e,i){return[]},t}(),H=/([0-9]+(px|em)\s+)+(solid)\s+(.*)/g,q={},Q=["backgroundColor","opacity","boxShadow","borderColor","borderWidth","borderStyle","outlineColor","outlineWidth","outlineOffset","outlineStyle"],V=function(t){function e(){var e=t.call(this)||this;return e.type="spacial-content",e.hoverEvents=!1,e.activeEvents=!1,e.display={scale:1,width:-1,height:-1,points:b(5)},e._parsed={border:{id:null,match:[]},outline:{id:null,match:[]}},e.props={},e.addHover=function(){e.hovering=!0,e.__revision++},e.removeHover=function(){e.hovering=!1,e.pressing=!1,e.__revision++},e.addPress=function(){e.pressing=!0,e.__revision++},e.removePress=function(){e.pressing=!1,e.__revision++},e.id=_(12),e.points=b(5),e}return l(e,t),e.prototype.getAllPointsAt=function(t,e){return[[this,this.points,e]]},e.prototype.applyProps=function(t){var e,i;void 0===t&&(t={});var n=!1;if(t.interactive!==this.props.interactive&&(n=!0,this.props.interactive=t.interactive),t.style){var r,o=t.border||t.style.border;if(o!==this._parsed.border.id)if(o)(r=q[o]||H.exec(o)||H.exec(o))&&(this._parsed.border.id=o,this._parsed.border.match=q[o]=r);else this._parsed.border.id=null,this._parsed.border.match=[];if(this._parsed.border.id&&(t.style.borderWidth=this._parsed.border.match[1],t.style.borderStyle="solid",t.style.borderColor=this._parsed.border.match[4]),t.style.outline!==this._parsed.outline.id)if(t.style.outline)(r=q[t.style.outline]||H.exec(t.style.outline)||H.exec(t.style.outline))&&(this._parsed.outline.id=t.style.outline,this._parsed.outline.match=q[t.style.outline]=r);else this._parsed.outline.id=null,this._parsed.outline.match=[];this._parsed.outline.id&&(t.style.outlineWidth=this._parsed.outline.match[1],t.style.outlineStyle="solid",t.style.outlineColor=this._parsed.outline.match[4]),this.props.style=t.style,t.backgroundColor&&!this.props.style.backgroundColor&&(this.props.style.backgroundColor=t.backgroundColor,n=!0),t.style.background&&!this.props.style.backgroundColor&&(this.props.style.backgroundColor=t.style.background,n=!0);try{for(var s=v(Q),a=s.next();!a.done;a=s.next()){var c=a.value;if(this.props.style[c]!==t.style[c]){n=!0;break}}}catch(t){e={error:t}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(e)throw e.error}}t.style[":hover"]!==this.props.hoverStyles&&(this.props.hoverStyles=t.style[":hover"],this.hoverEvents||(this.hoverEvents=!0,this.addEventListener("pointerenter",this.addHover),this.addEventListener("pointerleave",this.removeHover)),n=!0),t.style[":active"]!==this.props.pressStyles&&(this.props.pressStyles=t.style[":active"],this.activeEvents||(this.activeEvents=!0,this.addEventListener("mousedown",this.addPress),this.addEventListener("mouseup",this.removePress)),n=!0)}t.className!==this.props.className&&(this.props.className=t.className,t.className&&!this.hoverEvents&&(this.hoverEvents=!0,this.addEventListener("pointerenter",this.addHover),this.addEventListener("pointerleave",this.removeHover)),t.className&&!this.activeEvents&&(this.activeEvents=!0,this.addEventListener("mousedown",this.addPress),this.addEventListener("mouseup",this.removePress)),n=!0),t.relativeSize!==this.props.relativeSize&&(this.props.relativeSize=t.relativeSize,n=!0),t.relativeStyle!==this.props.relativeStyle&&(this.props.relativeStyle=t.relativeStyle,n=!0),t.html!==this.props.html&&(this.props.html=t.html,n=!0),t.target&&(t.target.width===this.display.width&&t.target.height===this.display.height&&t.target.x===this.points[1]&&t.target.y===this.points[2]||(n=!0,this.points=E.singleBox(t.target.width,t.target.height,t.target.x,t.target.y),this.display.points=E.singleBox(t.target.width,t.target.height,t.target.x,t.target.y),this.display.width=t.target.width,this.display.height=t.target.height)),n&&this.__revision++},e}(A),X=function(t){function e(){var e=t.call(this)||this;return e.type="spacial-content",e.color="#000",e.text="",e.display={scale:1,width:100,height:100,points:b(5)},e.interactive=!1,e.props={font:"18px Arial, sans-serif",lineHeight:1,textAlign:"left",verticalAlign:"top",paddingX:0,paddingY:0,fitParent:!1,lineBreak:"auto",strokeText:!1,sizeToFill:!1,maxFontSizeToFill:void 0,allowNewLine:!0,justifyLines:!1,renderHDPI:!1,textDecoration:"none",interactive:!1,relativeSize:!1},e.id="",e.points=b(5),e}return l(e,t),e.prototype.getAllPointsAt=function(t,e){return[[this,this.points,e]]},e.prototype.applyProps=function(t){var e=t.id,i=t.target,n=t.text,r=t.color,o=t.backgroundColor,s=t.fontSize,a=void 0===s?18:s,c=t.interactive,h=t.fontFamily,l=void 0===h?"Arial, sans-serif":h,p=d(t,["id","target","text","color","backgroundColor","fontSize","interactive","fontFamily"]);p.font="".concat(a,"px ").concat(l),this.interactive=c||!1,void 0!==n&&(this.text=n||""),r&&(this.color=r),o&&(this.backgroundColor=o),e&&(this.id=e),i&&(this.points=E.singleBox(i.width,i.height,i.x,i.y),this.display.points=this.points,this.display.width=i.width,this.display.height=i.height),this.props=u(u({},this.props),p),this.__revision++},e}(A),Y=Math.pow,Z=Math.sqrt,$=Math.sin,G=Math.cos,K=Math.PI,J=1.70158,tt=1.525*J,et=2*K/3,it=2*K/4.5,nt=function(t){var e=7.5625,i=2.75;return t<1/i?e*t*t:t<2/i?e*(t-=1.5/i)*t+.75:t<2.5/i?e*(t-=2.25/i)*t+.9375:e*(t-=2.625/i)*t+.984375},rt={linear:function(t){return t},easeInQuad:function(t){return t*t},easeOutQuad:function(t){return 1-(1-t)*(1-t)},easeInOutQuad:function(t){return t<.5?2*t*t:1-Y(-2*t+2,2)/2},easeInCubic:function(t){return t*t*t},easeOutCubic:function(t){return 1-Y(1-t,3)},easeInOutCubic:function(t){return t<.5?4*t*t*t:1-Y(-2*t+2,3)/2},easeInQuart:function(t){return t*t*t*t},easeOutQuart:function(t){return 1-Y(1-t,4)},easeInOutQuart:function(t){return t<.5?8*t*t*t*t:1-Y(-2*t+2,4)/2},easeInQuint:function(t){return t*t*t*t*t},easeOutQuint:function(t){return 1-Y(1-t,5)},easeInOutQuint:function(t){return t<.5?16*t*t*t*t*t:1-Y(-2*t+2,5)/2},easeInSine:function(t){return 1-G(t*K/2)},easeOutSine:function(t){return $(t*K/2)},easeInOutSine:function(t){return-(G(K*t)-1)/2},easeInExpo:function(t){return 0===t?0:Y(2,10*t-10)},easeOutExpo:function(t){return 1===t?1:1-Y(2,-10*t)},easeInOutExpo:function(t){return 0===t?0:1===t?1:t<.5?Y(2,20*t-10)/2:(2-Y(2,-20*t+10))/2},easeInCirc:function(t){return 1-Z(1-Y(t,2))},easeOutCirc:function(t){return Z(1-Y(t-1,2))},easeInOutCirc:function(t){return t<.5?(1-Z(1-Y(2*t,2)))/2:(Z(1-Y(-2*t+2,2))+1)/2},easeInBack:function(t){return 2.70158*t*t*t-J*t*t},easeOutBack:function(t){return 1+2.70158*Y(t-1,3)+J*Y(t-1,2)},easeInOutBack:function(t){return t<.5?Y(2*t,2)*(7.189819*t-tt)/2:(Y(2*t-2,2)*((tt+1)*(2*t-2)+tt)+2)/2},easeInElastic:function(t){return 0===t?0:1===t?1:-Y(2,10*t-10)*$((10*t-10.75)*et)},easeOutElastic:function(t){return 0===t?0:1===t?1:Y(2,-10*t)*$((10*t-.75)*et)+1},easeInOutElastic:function(t){return 0===t?0:1===t?1:t<.5?-Y(2,20*t-10)*$((20*t-11.125)*it)/2:Y(2,-20*t+10)*$((20*t-11.125)*it)/2+1},easeInBounce:function(t){return 1-nt(1-t)},easeOutBounce:nt,easeInOutBounce:function(t){return t<.5?(1-nt(1-2*t))/2:(1+nt(2*t-1))/2}},ot=function(){function t(t){this.runtime=t,this.pendingTransition={from:b(5),to:b(5),elapsed_time:0,done:!0,total_time:0,timingFunction:rt.easeInOutQuad,constrain:!1}}return t.prototype.hasPending=function(){return!this.pendingTransition.done},t.prototype.getPendingTransition=function(){return this.pendingTransition},t.prototype.getPendingFrom=function(){return this.pendingTransition.from},t.prototype.customTransition=function(t){t(this.pendingTransition)},t.prototype.stopTransition=function(){this.pendingTransition.from=b(this.runtime.target),this.pendingTransition.to=b(this.runtime.target),this.pendingTransition.done=!0,this.pendingTransition.elapsed_time=0,this.pendingTransition.total_time=0},t.prototype.runTransition=function(t,e){if(!this.pendingTransition.done){var i=this.pendingTransition,n=(i.elapsed_time+e)/i.total_time,r=i.timingFunction(n>1?1:n);t[1]=i.from[1]+(i.to[1]-i.from[1])*r,t[2]=i.from[2]+(i.to[2]-i.from[2])*r,t[3]=i.from[3]+(i.to[3]-i.from[3])*r,t[4]=i.from[4]+(i.to[4]-i.from[4])*r,this.pendingTransition.elapsed_time+=e,this.pendingTransition.elapsed_time>=this.pendingTransition.total_time&&(this.pendingTransition.done=!0,this.pendingTransition.constrain&&this.constrainBounds({transition:{duration:0===this.pendingTransition.total_time?0:500,easing:rt.easeOutExpo}}))}},t.prototype.zoomTo=function(t,e){var i=void 0===e?{}:e,n=i.origin,r=(i.stream,i.transition),o=this.runtime.getZoomedPosition(t,{origin:n}),s=Math.abs(1-t);this.applyTransition(o,r,{duration:2e3*s,easing:rt.easeOutExpo,constrain:!0},{stream:!1})},t.prototype.constrainBounds=function(t){var e=void 0===t?{}:t,i=e.transition,n=e.panPadding,r=void 0===n?0:n,o=y(this.runtime.constrainBounds(this.runtime.target,{panPadding:r}),2),s=o[0],a=o[1];s&&(this.applyTransition(a,i,{duration:500,easing:rt.easeOutQuart,constrain:!1}),this.runtime.updateNextFrame())},t.prototype.applyTransition=function(t,e,i,n){var r=(void 0===n?{}:n).stream;this.pendingTransition.from=b(this.runtime.target),this.pendingTransition.to=t,r||(this.pendingTransition.elapsed_time=0),this.pendingTransition.done=!1,this.pendingTransition.total_time=void 0!==(null==e?void 0:e.duration)?e.duration:void 0!==(null==i?void 0:i.duration)?i.duration:1e3,this.pendingTransition.constrain=void 0!==(null==e?void 0:e.constrain)?e.constrain:void 0!==(null==i?void 0:i.constrain)&&i.constrain,this.pendingTransition.timingFunction=(null==e?void 0:e.easing)||(null==i?void 0:i.easing)||rt.easeInOutSine},t.prototype.goToRegion=function(t,e){var i=(void 0===e?{}:e).transition,n=this.runtime.clampRegion(t);this.applyTransition(E.singleBox(n.width,n.height,n.x,n.y),i,{duration:1e3,easing:rt.easeOutExpo,constrain:!0}),this.runtime.updateNextFrame()},t}(),st=function(){function t(t,e,i,n,r){var o=this;void 0===n&&(n=[]),this.ready=!1,this.transformBuffer=b(500),this.lastTarget=b(5),this.zoomBuffer=b(5),this.logNextRender=!1,this.pendingUpdate=!0,this.firstRender=!0,this.mode="explore",this.controllers=[],this.controllersRunning=!1,this.controllerStopFunctions=[],this.maxScaleFactor=1,this._viewerToWorld={x:0,y:0},this.hooks={useFrame:[],useBeforeFrame:[],useAfterPaint:[],useAfterFrame:[]},this._viewport={x:0,y:0,width:0,height:0},this.setViewport=function(t){var e=void 0===t.x?o.target[1]:t.x,i=void 0===t.y?o.target[2]:t.y;t.width?o.target[3]=e+t.width:o.target[3]=o.target[3]-o.target[1]+e,t.height?o.target[4]=i+t.height:o.target[4]=o.target[4]-o.target[2]+i,Math.abs(o.target[1]-e)>.01&&(o.target[1]=e),Math.abs(o.target[2]-i)>.01&&(o.target[2]=i),o.pendingUpdate=!0},this.render=function(t){var e=t-o.lastTime;if(o.fpsLimit&&e<1e3/o.fpsLimit)o.stopId=window.requestAnimationFrame(o.render);else{o.lastTime=t,o.world.flushSubscriptions(),o.stopId=window.requestAnimationFrame(o.render),o.hook("useFrame",e);var i=o.pendingUpdate,n=o.renderer.pendingUpdate();if(o.transitionManager.hasPending()&&(o.transitionManager.runTransition(o.target,e),o.pendingUpdate=!0,o.updateControllerPosition()),o.firstRender||i||n||o.target[0]!==o.lastTarget[0]||o.target[1]!==o.lastTarget[1]||o.target[2]!==o.lastTarget[2]||o.target[3]!==o.lastTarget[3]||o.target[4]!==o.lastTarget[4]){o.hook("useBeforeFrame",e),o.renderer.beforeFrame(o.world,e,o.target);for(var r=o.getScaleFactor(),s=o.renderer.getPointsAt(o.world,o.target,o.aggregate,r),a=s.length,c=0;c<a;c++){var h=s[c][0],l=s[c][1],u=s[c][2];o.renderer.prepareLayer(h);for(var d=u?R(l,u,o.transformBuffer):l,p=d.length/5,f=0;f<p;f++){var g=5*f;0!==d[g]&&(o.renderer.paint(h,f,d[g+1],d[g+2],d[g+3]-d[g+1],d[g+4]-d[g+2]),o.hook("useAfterPaint",h))}}o.renderer.afterFrame(o.world,e,o.target),o.hook("useAfterFrame",e),o.lastTarget[0]=o.target[0],o.lastTarget[1]=o.target[1],o.lastTarget[2]=o.target[2],o.lastTarget[3]=o.target[3],o.lastTarget[4]=o.target[4],o.firstRender=!1,o.pendingUpdate=!1,o.logNextRender=!1,o.renderer.isReady()&&(o.ready=!0,o.world.trigger("ready")),o.world.flushSubscriptions();var v=o.world.getScheduledUpdates(o.target,r),y=v.length;if(y>0)for(f=0;f<y;f++){var m=v[y-f]();m?m.then((function(){o.pendingUpdate=!0})):o.pendingUpdate=!0}}}},this.renderer=t,this.world=e,this.options=u({maxOverZoom:1,maxUnderZoom:1,visibilityRatio:1},r||{}),this.target=E.projection(i),this.manualHomePosition=!1,this.pendingUpdate=!0,this.homePosition=E.projection(this.world),this.manualFocalPosition=!1,this.focalPosition=this.target,this.updateFocalPosition(),this.transitionManager=new ot(this),this.aggregate=O(1),this.world.addLayoutSubscriber((function(t){"repaint"===t&&(o.pendingUpdate=!0),"recalculate-world-size"===t&&(o.manualHomePosition||(o.setHomePosition(),o.goHome()),o.updateFocalPosition())})),this.lastTime=performance.now(),this.controllers=n,this.render(this.lastTime),this.startControllers()}return Object.defineProperty(t.prototype,"x",{get:function(){return this.target[1]},set:function(t){this.target[1]=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"y",{get:function(){return this.target[2]},set:function(t){this.target[2]=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"x2",{get:function(){return this.target[3]},set:function(t){this.target[3]=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"y2",{get:function(){return this.target[4]},set:function(t){this.target[4]=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"width",{get:function(){return this.target[3]-this.target[1]},set:function(t){this.target[3]=this.target[1]+t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this.target[4]-this.target[2]},set:function(t){this.target[4]=this.target[2]=t},enumerable:!1,configurable:!0}),t.prototype.setHomePosition=function(t){this.homePosition.set(E.projection(t||this.world)),this.pendingUpdate=!0},t.prototype.startControllers=function(){var t,e;if(!this.controllersRunning){try{for(var i=v(this.controllers),n=i.next();!n.done;n=i.next()){var r=n.value;this.controllerStopFunctions.push(r.start(this))}}catch(e){t={error:e}}finally{try{n&&!n.done&&(e=i.return)&&e.call(i)}finally{if(t)throw t.error}}this.controllersRunning=!0}},t.prototype.stopControllers=function(){var t,e;if(this.controllersRunning){try{for(var i=v(this.controllerStopFunctions),n=i.next();!n.done;n=i.next()){(0,n.value)()}}catch(e){t={error:e}}finally{try{n&&!n.done&&(e=i.return)&&e.call(i)}finally{if(t)throw t.error}}this.controllersRunning=!1,this.controllerStopFunctions=[]}},t.prototype.updateControllerPosition=function(){var t,e;try{for(var i=v(this.controllers),n=i.next();!n.done;n=i.next()){n.value.updatePosition(this.x,this.y,this.width,this.height)}}catch(e){t={error:e}}finally{try{n&&!n.done&&(e=i.return)&&e.call(i)}finally{if(t)throw t.error}}},t.prototype.triggerResize=function(){this.renderer.triggerResize&&this.renderer.triggerResize(),this.pendingUpdate=!0},t.prototype.addController=function(t){this.controllers.push(t),this.controllersRunning&&t.start(this),this.pendingUpdate=!0},t.prototype.cover=function(){return this.goHome({cover:!0})},t.prototype.getRendererScreenPosition=function(){return this.renderer.getRendererScreenPosition()},t.prototype.updateRendererScreenPosition=function(){this.pendingUpdate=!0,this.renderer.resize()},t.prototype.goHome=function(t){if(void 0===t&&(t={}),!(this.world.width<=0||this.world.height<=0)){var e=this.getScaleFactor(),i=t.position?{x:t.position[1],y:t.position[2],width:t.position[3]-t.position[1],height:t.position[4]-t.position[2]}:{x:this.homePosition[1],y:this.homePosition[2],width:this.homePosition[3]-this.homePosition[1],height:this.homePosition[4]-this.homePosition[2]},n=this.width*e,r=this.height*e,o=i.width/n,s=i.height/r,a=n/r;if(t.cover?o>s:o<s){var c=a*i.height,h=(c-i.width)/2;this.target[1]=-h+i.x,this.target[2]=i.y,this.target[3]=c-h+i.x,this.target[4]=i.height+i.y}else{var l=i.width/a;h=(l-i.height)/2;this.target[1]=i.x,this.target[2]=i.y-h,this.target[3]=i.x+i.width,this.target[4]=i.y+l-h}this.constrainBounds(this.target),this.updateControllerPosition()}},t.prototype.resize=function(t,e,i,n){this.updateFocalPosition(t-e,i-n);var r=e/t,o=n/i;this.target[3]=this.target[1]+(this.target[3]-this.target[1])*r,this.target[4]=this.target[2]+(this.target[4]-this.target[2])*o,this.goHome({position:this.focalPosition}),this.renderer.resize(e,n),this.pendingUpdate=!0},t.prototype.updateFocalPosition=function(t,e){if(!this.manualFocalPosition){var i=this.width,n=this.height,r=Math.min(i,n),o=this.x+0,s=this.y+0;if(i<n){var a=this.height-this.width;this.focalPosition=E.projection({x:o,y:s+a/2,width:r-0,height:r-0}),this.pendingUpdate=!0}else{a=this.width-this.height;this.focalPosition=E.projection({x:o+a/2,y:s,width:r-0,height:r-0}),this.pendingUpdate=!0}}},t.prototype.getViewport=function(){return this._viewport.x=this.target[1],this._viewport.y=this.target[2],this._viewport.width=this.target[3]-this.target[1],this._viewport.height=this.target[4]-this.target[2],this._viewport},t.prototype.constrainBounds=function(t,e){var i=void 0===e?{}:e,n=i.panPadding,r=void 0===n?0:n,o=i.ref,s=void 0!==o&&o,a=this.getBounds({target:t,padding:r}),c=a.minX,h=a.maxX,l=a.minY,u=a.maxY,d=!1,p=s?t:b(t),f=t[3]-t[1],g=t[4]-t[2];return c>t[1]&&(d=!0,p[1]=c,p[3]=c+f),l>t[2]&&(d=!0,p[2]=l,p[4]=l+g),h<t[1]&&(d=!0,p[1]=h,p[3]=h+f),u<t[2]&&(d=!0,p[2]=u,p[4]=u+g),[d,p]},t.prototype.getBounds=function(t){var e=t.target||this.target,i=t.padding,n=this.options.visibilityRatio,r=Math.abs(1-n);if(this.world.hasActiveZone()){var o=this.world.getActiveZone();if(o){var s=e[3]-e[1]<o.points[3]-o.points[1],a=e[4]-e[2]<o.points[4]-o.points[2];return{minX:s?o.points[1]-i:o.points[1]+(o.points[3]-o.points[1])/2-(e[3]-e[1])/2,maxX:a?o.points[2]-i:o.points[2]+(o.points[4]-o.points[2])/2-(e[4]-e[2])/2,minY:s?o.points[3]+i:o.points[1]+(o.points[3]-o.points[1])/2-(e[3]-e[1])/2,maxY:a?o.points[4]+i:o.points[2]+(o.points[4]-o.points[2])/2-(e[4]-e[2])/2}}}var c=e[3]-e[1],h=-c*r,l=this.world.width-c-h,u=e[4]-e[2],d=-u*r,p=this.world.height-u-d,f=Math.max(h,l),g=Math.min(h,l),v=Math.max(d,p);return{minX:g,maxX:f,minY:Math.min(d,p),maxY:v}},t.prototype.getScaleFactor=function(t){return void 0===t&&(t=!1),this.renderer.getScale(this.target[3]-this.target[1],this.target[4]-this.target[2],t)},t.prototype.getZoomedPosition=function(t,e){var i,n=e.origin,r=e.fromPos,o=r?{width:r[3]-r[1],height:r[4]-r[2]}:void 0,s=o?this.renderer.getScale(o.width,o.height):this.getScaleFactor(),a=o?o.width:this.width,c=o?o.height:this.height,h=null===(i=this.getRendererScreenPosition())||void 0===i?void 0:i.width,l=this.world.width,u=h?h/l:1,d=this.options.maxUnderZoom,p=Math.max(u||1,this.options.maxOverZoom),f=1/t,g=s*f;if(f<1){var v=a*s,y=c*s;if(this.world.width/v>this.world.height/y)this.world.width*g<~~(a*s)*d&&(t=this.world.width*s/(a*s*d));else this.world.height*g<~~(c*s)*d&&(t=this.world.height*s/(c*s*d))}else g>1&&(t=s/p);var m=R(this.target,C(t,n?n.x:this.target[1]+(this.target[3]-this.target[1])/2,n?n.y:this.target[2]+(this.target[4]-this.target[2])/2),this.zoomBuffer);return this.constrainBounds(m,{ref:!0,panPadding:100}),m},t.prototype.clampRegion=function(t){var e=t.x,i=t.y,n=t.width,r=t.height,o=t.padding,s=void 0===o?0:o,a=this.width,c=this.height,h=e-s,l=i-s,u=n+2*s,d=r+2*s;if(n/a<r/c){var p=d/c*a;return{x:h-(p-u)/2,y:l,width:p,height:d}}var f=u/a*c;return{x:h,y:l-(f-d)/2,width:u,height:f}},t.prototype.viewerToWorld=function(t,e){var i=this.getScaleFactor();return this._viewerToWorld.x=this.target[1]+t/i,this._viewerToWorld.y=this.target[2]+e/i,this._viewerToWorld},t.prototype.worldToViewer=function(t,e,i,n){var r=E.singleBox(i,n,t,e);return S(r,x(O(this.getScaleFactor()),P(-this.target[1],-this.target[2]))),{x:r[1],y:r[2],width:r[3]-r[1],height:r[4]-r[2],strand:r}},t.prototype.setScale=function(t,e){S(this.target,C(t,e?e.x:this.target[1]+(this.target[3]-this.target[1])/2,e?e.y:this.target[2]+(this.target[4]-this.target[2])/2)),this.pendingUpdate=!0},t.prototype.syncTo=function(t){var e=this,i=this.target;return this.target=t.target,this.pendingUpdate=!0,function(){e.target=i}},t.prototype.stop=function(){var t=this;return void 0!==this.stopId&&(window.cancelAnimationFrame(this.stopId),this.stopId=void 0),function(){t.render(performance.now())}},t.prototype.selectZone=function(t){this.world.selectZone(t),this.pendingUpdate=!0},t.prototype.deselectZone=function(){this.world.deselectZone(),this.pendingUpdate=!0},t.prototype.hook=function(t,e){var i=this.hooks[t].length;if(0!==i)for(var n=0;n<i;n++)this.hooks[t][n](e)},t.prototype.registerHook=function(t,e){var i=this;return this.hooks[t].push(e),function(){i.hooks[t]=i.hooks[t].filter((function(t){return t!==e}))}},t.prototype.updateNextFrame=function(){this.pendingUpdate=!0},t}(),at=j((function(t,e){var i;t.exports=((i=function(){function t(t){return r.appendChild(t.dom),t}function e(t){for(var e=0;e<r.children.length;e++)r.children[e].style.display=e===t?"block":"none";n=t}var n=0,r=document.createElement("div");r.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000",r.addEventListener("click",(function(t){t.preventDefault(),e(++n%r.children.length)}),!1);var o=(performance||Date).now(),s=o,a=0,c=t(new i.Panel("FPS","#0ff","#002")),h=t(new i.Panel("MS","#0f0","#020"));if(self.performance&&self.performance.memory)var l=t(new i.Panel("MB","#f08","#201"));return e(0),{REVISION:16,dom:r,addPanel:t,showPanel:e,begin:function(){o=(performance||Date).now()},end:function(){a++;var t=(performance||Date).now();if(h.update(t-o,200),t>s+1e3&&(c.update(1e3*a/(t-s),100),s=t,a=0,l)){var e=performance.memory;l.update(e.usedJSHeapSize/1048576,e.jsHeapSizeLimit/1048576)}return t},update:function(){o=this.end()},domElement:r,setMode:e}}).Panel=function(t,e,i){var n=1/0,r=0,o=Math.round,s=o(window.devicePixelRatio||1),a=80*s,c=48*s,h=3*s,l=2*s,u=3*s,d=15*s,p=74*s,f=30*s,g=document.createElement("canvas");g.width=a,g.height=c,g.style.cssText="width:80px;height:48px";var v=g.getContext("2d");return v.font="bold "+9*s+"px Helvetica,Arial,sans-serif",v.textBaseline="top",v.fillStyle=i,v.fillRect(0,0,a,c),v.fillStyle=e,v.fillText(t,h,l),v.fillRect(u,d,p,f),v.fillStyle=i,v.globalAlpha=.9,v.fillRect(u,d,p,f),{dom:g,update:function(c,y){n=Math.min(n,c),r=Math.max(r,c),v.fillStyle=i,v.globalAlpha=1,v.fillRect(0,0,a,d),v.fillStyle=e,v.fillText(o(c)+" "+t+" ("+o(n)+"-"+o(r)+")",h,l),v.drawImage(g,u+s,d,p-s,f,u,d,p-s,f),v.fillRect(u+p-s,d,s,f),v.fillStyle=i,v.globalAlpha=.9,v.fillRect(u+p-s,d,s,o((1-c/y)*f))}}},i)})),ct=function(){return(ct=Object.assign||function(t){for(var e,i=1,n=arguments.length;i<n;i++)for(var r in e=arguments[i])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)},ht=function(t,e){return function(i){return Math.max(Math.min(i,e),t)}},lt=function(t){return t%1?Number(t.toFixed(5)):t},ut=/^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))$/i,dt={test:function(t){return"number"==typeof t},parse:parseFloat,transform:function(t){return t}},pt=ct(ct({},dt),{transform:ht(0,1)}),ft=(ct(ct({},dt),{default:1}),U="%",{test:function(t){return"string"==typeof t&&t.endsWith(U)&&1===t.split(" ").length},parse:parseFloat,transform:function(t){return""+t+U}}),gt=(ct(ct({},ft),{parse:function(t){return ft.parse(t)/100},transform:function(t){return ft.transform(100*t)}}),ht(0,255)),vt=ct(ct({},dt),{transform:function(t){return Math.round(gt(t))}});function yt(t,e){return t.startsWith(e)&&ut.test(t)}var mt,wt,bt={test:function(t){return"string"==typeof t?yt(t,"rgb"):function(t){return void 0!==t.red}(t)},parse:(mt=["red","green","blue","alpha"],function(t){if("string"!=typeof t)return t;for(var e,i={},n=(e=t,e.substring(e.indexOf("(")+1,e.lastIndexOf(")"))).split(/,\s*/),r=0;r<4;r++)i[mt[r]]=void 0!==n[r]?parseFloat(n[r]):1;return i}),transform:function(t){var e=t.red,i=t.green,n=t.blue,r=t.alpha,o=void 0===r?1:r;return function(t){var e=t.red,i=t.green,n=t.blue,r=t.alpha;return"rgba("+e+", "+i+", "+n+", "+(void 0===r?1:r)+")"}({red:vt.transform(e),green:vt.transform(i),blue:vt.transform(n),alpha:lt(pt.transform(o))})}},xt=(ct(ct({},bt),{test:function(t){return"string"==typeof t&&yt(t,"#")},parse:function(t){var e="",i="",n="";return t.length>4?(e=t.substr(1,2),i=t.substr(3,2),n=t.substr(5,2)):(e=t.substr(1,1),i=t.substr(2,1),n=t.substr(3,1),e+=e,i+=i,n+=n),{red:parseInt(e,16),green:parseInt(i,16),blue:parseInt(n,16),alpha:1}}}),0),Et="undefined"!=typeof window&&void 0!==window.requestAnimationFrame?function(t){return window.requestAnimationFrame(t)}:function(t){var e=Date.now(),i=Math.max(0,16.7-(e-xt));xt=e+i,setTimeout((function(){return t(xt)}),i)};!function(t){t.Read="read",t.Update="update",t.Render="render",t.PostRender="postRender",t.FixedUpdate="fixedUpdate"}(wt||(wt={}));var St,Ot,Pt,Ct,Rt,_t,At,Tt,It,jt,Mt,Lt,kt,Ft,Dt,zt,Bt=1/60*1e3,Ut=!0,Nt=!1,Wt=!1,Ht={delta:0,timestamp:0},qt=[wt.Read,wt.Update,wt.Render,wt.PostRender],Qt=function(t){return Nt=t},Vt=qt.reduce((function(t,e){var i=function(t){var e=[],i=[],n=0,r=!1,o=0,s=new WeakSet,a=new WeakSet,c={cancel:function(t){var e=i.indexOf(t);s.add(t),-1!==e&&i.splice(e,1)},process:function(h){var l,u;if(r=!0,e=(l=[i,e])[0],(i=l[1]).length=0,n=e.length)for(o=0;o<n;o++)(u=e[o])(h),!0!==a.has(u)||s.has(u)||(c.schedule(u),t(!0));r=!1},schedule:function(t,o,c){void 0===o&&(o=!1),void 0===c&&(c=!1);var h=c&&r,l=h?e:i;s.delete(t),o&&a.add(t),-1===l.indexOf(t)&&(l.push(t),h&&(n=e.length))}};return c}(Qt);return t.sync[e]=function(t,e,n){return void 0===e&&(e=!1),void 0===n&&(n=!1),Nt||$t(),i.schedule(t,e,n),t},t.cancelSync[e]=function(t){return i.cancel(t)},t.steps[e]=i,t}),{steps:{},sync:{},cancelSync:{}}),Xt=Vt.steps,Yt=(Vt.sync,Vt.cancelSync,function(t){return Xt[t].process(Ht)}),Zt=function(t){Nt=!1,Ht.delta=Ut?Bt:Math.max(Math.min(t-Ht.timestamp,40),1),Ut||(Bt=Ht.delta),Ht.timestamp=t,Wt=!0,qt.forEach(Yt),Wt=!1,Nt&&(Ut=!1,Et(Zt))},$t=function(){Nt=!0,Ut=!0,Wt||Et(Zt)},Gt={x:0,y:0,z:0},Kt=function(t){return"number"==typeof t},Jt=(St=function(t,e,i){return Math.min(Math.max(i,t),e)},function(t,e,i){return void 0!==i?St(t,e,i):function(i){return St(t,e,i)}}),te=function(t){return t.hasOwnProperty("x")&&t.hasOwnProperty("y")},ee=function(t){return te(t)&&t.hasOwnProperty("z")},ie=function(t,e){return Math.abs(t-e)},ne=(Jt(0,1),/(-?[0-9]+(px|em)\s+|0\s+)(-?[0-9]+(px|em)\s+|0\s+)(-?[0-9]+(px|em)\s+|0\s+)?(-?[0-9]+(px|em)\s+|0\s+)?(.*)/g),re={},oe={},se={},ae=function(){function t(t,e){var i=this;this.imagesPending=0,this.imagesLoaded=0,this.frameIsRendering=!1,this.firstMeaningfulPaint=!1,this.parallelTasks=16,this.frameTasks=5,this.isGPUBusy=!1,this.loadingQueueOrdered=!0,this.loadingQueue=[],this.currentTask=Promise.resolve(),this.tasksRunning=0,this.averageJobTime=1e3,this.visible=[],this.previousVisible=[],this._worker=function(){if(i.loadingQueue.length&&!i.isGPUBusy){var t=i.loadingQueue.pop();t&&(i.tasksRunning++,i.frameTasks++,i.currentTask=t.task().then((function(){i.tasksRunning--})).catch((function(){i.tasksRunning--})))}},this._scheduled=0,this._doWork=function(){(i.frameIsRendering||0===i.loadingQueue.length&&0===i.tasksRunning&&i._scheduled)&&(clearInterval(i._scheduled),i._scheduled=0),i._worker()},this.canvas=t,this.rendererPosition=t.getBoundingClientRect(),this.ctx=t.getContext("2d",{alpha:!1}),this.ctx.imageSmoothingEnabled=!0,this.options=e||{},this.canvas.style.opacity="0",this.canvas.style.transition="opacity .3s",this.dpi=(null==e?void 0:e.dpi)||1,this.options.debug&&(this.stats=new at,this.stats.showPanel(0),document&&document.body&&document.body.appendChild(this.stats.dom))}return t.prototype.getCanvasDims=function(){return{width:this.canvas.width/this.dpi,height:this.canvas.height/this.dpi}},t.prototype.resize=function(){this.rendererPosition=this.canvas.getBoundingClientRect()},t.prototype.isReady=function(){return this.firstMeaningfulPaint},t.prototype.afterFrame=function(t){this.frameIsRendering=!1,this.imagesPending=this.imagesPending-this.imagesLoaded,this.imagesLoaded=0,!this.loadingQueueOrdered&&this.loadingQueue.length>this.parallelTasks&&(this.loadingQueue=this.loadingQueue.sort((function(t,e){return t.scale-e.scale||e.distance-t.distance})),this.loadingQueueOrdered=!0),this.previousVisible=this.visible,this.doOffscreenWork(),this.options.debug&&this.stats&&this.stats.end()},t.prototype.doOffscreenWork=function(){this.frameTasks=0,this.isGPUBusy=!1,this.loadingQueue.length&&(this._worker(),this.loadingQueue.length&&this.tasksRunning<this.parallelTasks&&(this._scheduled||(this._scheduled=setInterval(this._doWork,0))))},t.prototype.getScale=function(t,e,i){var n=this.getCanvasDims(),r=n.width/t,o=n.height/e;return(r<o?o:r)*(i&&this.dpi||1)},t.prototype.beforeFrame=function(t,e,i){this.options.debug&&this.stats&&this.stats.begin(),this.frameIsRendering=!0,this.visible=[],this.options.beforeFrame&&this.options.beforeFrame(e);var n=this.getCanvasDims();this.ctx.globalAlpha=1,this.ctx.fillStyle="rgba(0, 0, 0, 1)",this.ctx.fillRect(0,0,n.width,n.height)},t.prototype.paint=function(t,e,i,n,r,o){var s,a,c=this.ctx.globalAlpha;if(t instanceof T||t instanceof F){if(this.visible.push(t),t.style,"undefined"!==t.style.opacity){if(!t.style.opacity)return;this.ctx.globalAlpha=t.style.opacity}try{var h=t.__host.canvas,l=this.getCanvasDims();if(-1===h.indices.indexOf(e)&&this.schedulePaintToCanvas(h,t,e,function(t,e){if(void 0===e&&(e=Gt),Kt(t)&&Kt(e))return ie(t,e);if(te(t)&&te(e)){var i=ie(t.x,e.x),n=ie(t.y,e.y),r=ee(t)&&ee(e)?ie(t.z,e.z):0;return Math.sqrt(Math.pow(i,2)+Math.pow(n,2)+Math.pow(r,2))}return 0}({x:i+r/2,y:n+r/2},{x:l.width/2,y:l.height/2})),!this.firstMeaningfulPaint)return;t.crop?t.crop[0]&&this.ctx.drawImage(h.canvas,t.crop[5*e+1],t.crop[5*e+2],t.crop[5*e+3]-t.crop[5*e+1]-1,t.crop[5*e+4]-t.crop[5*e+2]-1,i,n,r+Number.MIN_VALUE,o+Number.MIN_VALUE):this.ctx.drawImage(h.canvas,t.display.points[5*e+1],t.display.points[5*e+2],t.display.points[5*e+3]-t.display.points[5*e+1]-1,t.display.points[5*e+4]-t.display.points[5*e+2]-1,i,n,r+Number.MIN_VALUE,o+Number.MIN_VALUE)}catch(t){}}if(this.options.box&&t instanceof V&&!t.props.className&&!t.props.html){if(t.props.style){var u=Object.assign({},t.props.style||{},t.hovering?t.props.hoverStyles:{},t.pressing?t.props.pressStyles:{}),d=t.props.relativeStyle?1:r/t.width;void 0!==u.opacity&&(this.ctx.globalAlpha=u.opacity);var p=0;void 0!==u.borderWidth&&(p=parseInt(u.borderWidth,10)*d);var f=0;void 0!==u.outlineWidth&&(f=parseInt(u.outlineWidth,10)*d);var g=0;if(void 0!==u.outlineOffset&&(g=parseInt(u.outlineOffset,10)*d),u.borderColor&&(this.ctx.strokeStyle=u.borderColor),u.boxShadow){var y=u.boxShadow.split(/,(?![^(]*\))/);try{for(var m=v(y),w=m.next();!w.done;w=m.next()){var b=w.value,x=re[b]||ne.exec(b)||ne.exec(b);re[b]=x,x&&(this.ctx.save(),this.ctx.shadowOffsetX=parseInt(x[1])*this.dpi*d,this.ctx.shadowOffsetY=parseInt(x[3])*this.dpi*d,this.ctx.shadowBlur=parseInt(x[5])*this.dpi*d,this.ctx.shadowColor=x[9],this.ctx.fillStyle="rgba(0,0,0,1)",this.ctx.fillRect(i+p,n+p,r,o),this.ctx.restore())}}catch(t){s={error:t}}finally{try{w&&!w.done&&(a=m.return)&&a.call(m)}finally{if(s)throw s.error}}}this.ctx.fillStyle=u.backgroundColor||"transparent",this.ctx.lineWidth=p,p&&this.ctx.strokeRect(i+p/2,n+p/2,r+p,o+p),this.ctx.fillRect(i+p,n+p,r,o),f&&(u.outlineColor&&(this.ctx.strokeStyle=u.outlineColor),this.ctx.lineWidth=f,this.ctx.strokeRect(i-f/2-g,n-f/2-g,r+2*p+f+2*g,o+2*p+f+2*g))}this.ctx.globalAlpha=c}},t.prototype.loadImage=function(t,e,i){if(oe[t]&&oe[t].naturalWidth>0)e(oe[t]);else try{var n=document.createElement("img");n.decoding="auto",n.onload=function(){e(n),oe[t]=n,n.onload=null},this.options.crossOrigin&&(n.crossOrigin="anonymous"),n.src=t}catch(t){i(t)}},t.prototype.schedulePaintToCanvas=function(t,e,i,n){var r=this;this.imagesPending++,t.indices.push(i),e.__host.canvas.loading=!0;var o="".concat(e.id,"--").concat(e.display.scale);this.loadingQueueOrdered=!1,this.loadingQueue.push({id:o,scale:e.display.scale,distance:n,task:function(){return new Promise((function(s){if(-1===r.visible.indexOf(e))return r.imagesPending--,t.indices.splice(t.indices.indexOf(i),1),void s();var a=e.getImageUrl(i);r.loadImage(a,(function(a){r.loadingQueue.push({id:o,scale:e.display.scale,distance:n,task:function(){return new Promise((function(n){r.imagesLoaded++,t.loaded.push(i),t.loaded.length===t.indices.length&&(t.loading=!1);var o=e.display.points.slice(5*i,5*i+5);t.canvas.getContext("2d").drawImage(a,o[1],o[2],o[3]-o[1],o[4]-o[2]),r.isGPUBusy=!r.firstMeaningfulPaint&&!0,n()}))}}),s()}),(function(e){r.imagesPending--,t.indices.splice(t.indices.indexOf(i),1),console.log("Error loading image",e),s()}))}))}})},t.prototype.afterPaintLayer=function(t,e){},t.prototype.prepareLayer=function(t){t.__host&&t.__host.canvas||(t instanceof T||t instanceof F)&&this.createImageHost(t)},t.prototype.createImageHost=function(t){var e,i=document.createElement("canvas");i.width=t.display.width,i.height=t.display.height,null===(e=i.getContext("2d"))||void 0===e||e.clearRect(0,0,t.display.width,t.display.height),t.__host=t.__host?t.__host:{},t.__host.canvas={canvas:i,indices:[],loaded:[],loading:!1},se[t.id]=t.__host},t.prototype.getPointsAt=function(t,e,i,n){return t.getPointsAt(e,i,n)},t.prototype.getViewportBounds=function(t,e,i){var n=t.getActiveZone();if(n){var r=e[3]-e[1]<n.points[3]-n.points[1],o=e[4]-e[2]<n.points[4]-n.points[2];return{x1:r?n.points[1]-i:n.points[1]+(n.points[3]-n.points[1])/2-(e[3]-e[1])/2,y1:o?n.points[2]-i:n.points[2]+(n.points[4]-n.points[2])/2-(e[4]-e[2])/2,x2:r?n.points[3]+i:n.points[1]+(n.points[3]-n.points[1])/2-(e[3]-e[1])/2,y2:o?n.points[4]+i:n.points[2]+(n.points[4]-n.points[2])/2-(e[4]-e[2])/2}}return null},t.prototype.pendingUpdate=function(){var t=0===this.imagesPending&&0===this.loadingQueue.length&&0===this.tasksRunning;return!this.firstMeaningfulPaint&&t?(this.canvas.style.opacity="1",this.firstMeaningfulPaint=t,!0):!!this.options.debug||!t},t.prototype.getRendererScreenPosition=function(){return this.rendererPosition},t}(),ce=function(){function t(t){var e,i;this.renderers=[];try{for(var n=v(t),r=n.next();!r.done;r=n.next()){var o=r.value;o&&this.renderers.push(o)}}catch(t){e={error:t}}finally{try{r&&!r.done&&(i=n.return)&&i.call(n)}finally{if(e)throw e.error}}this.length=this.renderers.length}return t.prototype.afterFrame=function(t,e,i){for(var n=0;n<this.length;n++)this.renderers[n].afterFrame(t,e,i)},t.prototype.afterPaintLayer=function(t,e){for(var i=0;i<this.length;i++)this.renderers[i].afterPaintLayer(t,e)},t.prototype.beforeFrame=function(t,e,i){for(var n=0;n<this.length;n++)this.renderers[n].beforeFrame(t,e,i)},t.prototype.triggerResize=function(){for(var t=0;t<this.length;t++){var e=this.renderers[t];e.triggerResize&&e.triggerResize()}},t.prototype.getPointsAt=function(t,e,i,n){return this.renderers[0].getPointsAt(t,e,i,n)},t.prototype.getScale=function(t,e){return this.renderers[0].getScale(t,e)},t.prototype.getViewportBounds=function(t,e,i){return this.renderers[0].getViewportBounds(t,e,i)},t.prototype.getRendererScreenPosition=function(){return this.renderers[0].getRendererScreenPosition()},t.prototype.isReady=function(){for(var t=0;t<this.length;t++)if(!this.renderers[t].isReady())return!1;return!0},t.prototype.paint=function(t,e,i,n,r,o){for(var s=0;s<this.length;s++)this.renderers[s].paint(t,e,i,n,r,o)},t.prototype.pendingUpdate=function(){for(var t=0;t<this.length;t++)if(this.renderers[t].pendingUpdate())return!0;return!1},t.prototype.prepareLayer=function(t){for(var e=0;e<this.length;e++)this.renderers[e].prepareLayer(t)},t.prototype.resize=function(t,e){for(var i=0;i<this.length;i++)this.renderers[i].resize(t,e)},t}(),he=function(){function t(t){this.heightRatio=1,this.widthRatio=1,this.target=new Float32Array(5),this.canvas=t,this.initialWidth=t.width,this.initialHeight=t.height,this.context=t.getContext("2d")}return t.prototype.isReady=function(){return!0},t.prototype.resize=function(){},t.prototype.afterFrame=function(t,e,i){var n=this;this.context.clearRect(0,0,this.canvas.width,this.canvas.height);var r=this.initialWidth/t.width,o=this.initialHeight/t.height,s=this.widthRatio>this.heightRatio?r:o;this.canvas.height=t.height*s,this.canvas.width=t.width*s,this.target=i,t.getPoints().forEach((function(t,e,i){if(e%5==0&&t){var r={x1:i[e+1]*s,y1:i[e+2]*s,x2:i[e+3]*s,y2:i[e+4]*s,width:(i[e+3]-i[e+1])*s,height:(i[e+4]-i[e+2])*s};n.context.strokeStyle="red",n.context.strokeRect(r.x1,r.y1,r.width,r.height)}})),i&&(this.context.strokeStyle="green",this.context.strokeRect(i[1]*s,i[2]*s,(i[3]-i[1])*s,(i[4]-i[2])*s))},t.prototype.getActiveZone=function(t){return null},t.prototype.getPointsAt=function(t,e,i,n){return t.getPointsAt(e,i,n)},t.prototype.getScale=function(t,e){return 1},t.prototype.beforeFrame=function(t,e){},t.prototype.drawImage=function(){},t.prototype.afterPaintLayer=function(t,e){},t.prototype.paint=function(t,e,i,n,r,o){},t.prototype.prepareLayer=function(t){},t.prototype.pendingUpdate=function(){return!1},t.prototype.hasActiveZone=function(){return!1},t.prototype.getViewportBounds=function(t,e,i){return null},t.prototype.getRendererScreenPosition=function(){return this.canvas.getBoundingClientRect()},t}(),le=function(){function t(){this.autoWidth=!1,this.autoHeight=!0,this.content=[],this.viewingDirection="left-to-right",this.columns=4,this.spacing=20,this.reversed=!1,this.padding=20,this.world=B.withProps({width:0,height:0,viewingDirection:"left-to-right"}),this.width=0,this.height=0}return t.prototype.setViewingDirection=function(t){this.viewingDirection=t},t.prototype.addContent=function(t){var e,i=this;(e=this.content).push.apply(e,m([],y(t.map((function(t){return i.world.addObjectAt(t,{width:0,height:0,x:0,y:0})}))),!1))},t.prototype.setWidth=function(t){this.width=t},t.prototype.setHeight=function(t){this.height=t},t.prototype.setSpacing=function(t){this.spacing=t},t.prototype.setPadding=function(t){this.padding=t},t.prototype.setRows=function(t){this.autoWidth=!0,this.rows=t},t.prototype.setColumns=function(t){this.autoHeight=!0,this.columns=t},t.prototype.recalculate=function(){var t=this;if((0!==this.height||0!==this.width)&&0!==this.rows&&0!==this.columns){if(this.autoHeight&&!this.width)throw new Error("Cannot set auto height without setting a width");if(this.autoWidth&&!this.height)throw new Error("Cannot set auto width without setting a height");"left-to-right"!==this.viewingDirection&&"top-to-bottom"!==this.viewingDirection||!this.reversed||(this.reversed=!1,this.content.reverse()),"right-to-left"!==this.viewingDirection&&"bottom-to-top"!==this.viewingDirection||this.reversed||(this.reversed=!0,this.content.reverse());var e=this.content.length,i=function(){if(t.autoWidth&&t.rows){var i=e>t.rows?t.rows:e;return{columns:Math.ceil(e/i),rows:i}}if(t.autoHeight&&t.columns){var n=e>t.columns?t.columns:e;return{columns:n,rows:Math.ceil(e/n)}}throw new Error("Something went wrong.")}(),n=i.columns,r=i.rows,o=this.autoWidth?-1:this.width-2*this.padding,s=this.autoWidth?-1:(o-this.spacing*(n-1))/n;if(this.autoHeight&&!this.autoWidth){for(var a=0,c=this.padding,h=0;h<r&&a!==e;h++){for(var l=0,u=[],d=0;d<n;d++){var p=this.reversed?e-a:a;if(a===e)break;var f=this.content[p],g=f.width,v=s/(f.width/f.height);u.push([a,s,v,s/g]),v>l&&(l=v),a++}for(d=0;d<n&&u[d];d++){var y=this.world.getPoints(),m=u[d][0],w=(g=u[d][1],u[d][2]),b=u[d][3],x=this.padding+d*(this.spacing+g),E=c+(l-w)/2,S=y[5*(p=this.reversed?e-m:m)+1],O=y[5*p+2];this.world.scaleWorldObject(m,b),S===x&&O===E||this.world.translateWorldObject(p,x-S,E-O)}c+=l+this.spacing}return this.height=c+this.padding,void this.world.resize(this.width,this.height)}this.autoWidth&&this.autoHeight,!this.autoWidth&&this.autoHeight}},t.prototype.getWorld=function(){return this.world},t}(),ue=!1;function de(){if(!ue){ue=!0;var t=navigator.userAgent,e=/(?:MSIE.(\d+\.\d+))|(?:(?:Firefox|GranParadiso|Iceweasel).(\d+\.\d+))|(?:Opera(?:.+Version.|.)(\d+\.\d+))|(?:AppleWebKit.(\d+(?:\.\d+)?))|(?:Trident\/\d+\.\d+.*rv:(\d+\.\d+))/.exec(t),i=/(Mac OS X)|(Windows)|(Linux)/.exec(t);if(kt=/\b(iPhone|iP[ao]d)/.exec(t),Ft=/\b(iP[ao]d)/.exec(t),Mt=/Android/i.exec(t),Dt=/FBAN\/\w+;/i.exec(t),zt=/Mobile/i.exec(t),Lt=!!/Win64/.exec(t),e){(Ot=e[1]?parseFloat(e[1]):e[5]?parseFloat(e[5]):NaN)&&document&&document.documentMode&&(Ot=document.documentMode);var n=/(?:Trident\/(\d+.\d+))/.exec(t);At=n?parseFloat(n[1])+4:Ot,Pt=e[2]?parseFloat(e[2]):NaN,Ct=e[3]?parseFloat(e[3]):NaN,(Rt=e[4]?parseFloat(e[4]):NaN)?(e=/(?:Chrome\/(\d+\.\d+))/.exec(t),_t=e&&e[1]?parseFloat(e[1]):NaN):_t=NaN}else Ot=Pt=Ct=_t=Rt=NaN;if(i){if(i[1]){var r=/(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(t);Tt=!r||parseFloat(r[1].replace("_","."))}else Tt=!1;It=!!i[2],jt=!!i[3]}else Tt=It=jt=!1}}var pe,fe={ie:function(){return de()||Ot},ieCompatibilityMode:function(){return de()||At>Ot},ie64:function(){return fe.ie()&&Lt},firefox:function(){return de()||Pt},opera:function(){return de()||Ct},webkit:function(){return de()||Rt},safari:function(){return fe.webkit()},chrome:function(){return de()||_t},windows:function(){return de()||It},osx:function(){return de()||Tt},linux:function(){return de()||jt},iphone:function(){return de()||kt},mobile:function(){return de()||kt||Ft||Mt||zt},nativeApp:function(){return de()||Dt},android:function(){return de()||Mt},ipad:function(){return de()||Ft}},ge=fe,ve=!("undefined"==typeof window||!window.document||!window.document.createElement),ye={canUseDOM:ve,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:ve&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:ve&&!!window.screen,isInWorker:!ve};ye.canUseDOM&&(pe=document.implementation&&document.implementation.hasFeature&&!0!==document.implementation.hasFeature("",""))
16
+ /**
17
+ * Checks if an event is supported in the current execution environment.
18
+ *
19
+ * NOTE: This will not work correctly for non-generic events such as `change`,
20
+ * `reset`, `load`, `error`, and `select`.
21
+ *
22
+ * Borrows from Modernizr.
23
+ *
24
+ * @param {string} eventNameSuffix Event name, e.g. "click".
25
+ * @param {?boolean} capture Check if the capture phase is supported.
26
+ * @return {boolean} True if the event is supported.
27
+ * @internal
28
+ * @license Modernizr 3.0.0pre (Custom Build) | MIT
29
+ */;var me=function(t,e){if(!ye.canUseDOM||e&&!("addEventListener"in document))return!1;var i="on"+t,n=i in document;if(!n){var r=document.createElement("div");r.setAttribute(i,"return;"),n="function"==typeof r[i]}return!n&&pe&&"wheel"===t&&(n=document.implementation.hasFeature("Events.wheel","3.0")),n};function we(t){var e=0,i=0,n=0,r=0;return"detail"in t&&(i=t.detail),"wheelDelta"in t&&(i=-t.wheelDelta/120),"wheelDeltaY"in t&&(i=-t.wheelDeltaY/120),"wheelDeltaX"in t&&(e=-t.wheelDeltaX/120),"axis"in t&&t.axis===t.HORIZONTAL_AXIS&&(e=i,i=0),n=10*e,r=10*i,"deltaY"in t&&(r=t.deltaY),"deltaX"in t&&(n=t.deltaX),(n||r)&&t.deltaMode&&(1==t.deltaMode?(n*=40,r*=40):(n*=800,r*=800)),n&&!e&&(e=n<1?-1:1),r&&!i&&(i=r<1?-1:1),{spinX:e,spinY:i,pixelX:n,pixelY:r}}we.getEventType=function(){return ge.firefox()?"DOMMouseScroll":me("wheel")?"wheel":"mousewheel"};var be=we;var xe={zoomOutFactor:.8,zoomInFactor:1.25,maxZoomFactor:1,minZoomFactor:.05,zoomDuration:300,zoomWheelConstant:20,zoomClamp:.6,panBounceStiffness:120,panBounceDamping:15,panTimeConstant:240,panPower:.1,nudgeDistance:100,panPadding:0,devicePixelRatio:1,enableWheel:!0,enableClickToZoom:!1,onPanInSketchMode:function(){}},Ee=function(t){return void 0===t&&(t={}),{start:function(e){var i=u(u({},xe),t),n=i.zoomWheelConstant,r=i.enableWheel,o=i.enableClickToZoom,s={pointerStart:{x:0,y:0},isPressing:!1,mousemoveBuffer:b(5)};function a(){e.world.constraintBounds()}function c(t){"explore"===e.mode&&(t.preventDefault(),s.pointerStart.x=t.atlas.x,s.pointerStart.y=t.atlas.y,e.transitionManager.stopTransition(),s.isPressing=!0)}function h(){s.isPressing&&("explore"===e.mode&&e.world.constraintBounds(),s.isPressing=!1)}function l(t){if(s.isPressing){var i=e.getRendererScreenPosition();if(i){var n=e.viewerToWorld(t.clientX-i.x,t.clientY-i.y),r=n.x,o=n.y;e.transitionManager.customTransition((function(t){t.from=b(e.target),t.to=R(t.from,P(s.pointerStart.x-r,s.pointerStart.y-o),s.mousemoveBuffer),t.elapsed_time=0,t.total_time=0,t.timingFunction=rt.easeInOutExpo,t.done=!1}))}}}function d(t){"explore"===e.mode&&e.world.zoomIn(t.atlas)}function p(t){var i=1+be(t).spinY/n;e.world.zoomTo(i,t.atlas,!0)}e.world.activatedEvents.push("onMouseUp","onMouseDown","onMouseMove","onTouchStart","onTouchEnd","onTouchMove","onPointerUp","onPointerDown","onPointerMove"),e.world.addEventListener("mouseup",a),e.world.addEventListener("touchend",a),e.world.addEventListener("touchstart",c),e.world.addEventListener("mousedown",c),window.addEventListener("touchend",h),window.addEventListener("mouseup",h),window.addEventListener("mousemove",l),window.addEventListener("touchmove",(function(t){if(s.isPressing&&1===t.touches.length){var i=t.touches[0],n=e.getRendererScreenPosition();if(n){var r=e.viewerToWorld(i.clientX-n.x,i.clientY-n.y),o=r.x,a=r.y;e.transitionManager.customTransition((function(t){t.from=b(e.target),t.to=R(t.from,P(s.pointerStart.x-o,s.pointerStart.y-a),s.mousemoveBuffer),t.elapsed_time=0,t.total_time=0,t.timingFunction=rt.easeInOutExpo,t.done=!1}))}}})),o&&(e.world.activatedEvents.push("onClick"),e.world.addEventListener("click",d)),r&&(e.world.activatedEvents.push("onWheel"),e.world.addEventListener("wheel",p));var f=e.world.addLayoutSubscriber((function(t,i){if("zone-changed"===t&&e.transitionManager.constrainBounds({transition:{duration:0}}),"zoom-to"===t&&i&&e.transitionManager.zoomTo(i.factor,{origin:i.point,stream:i.stream}),"go-home"===t){var n=i.immediate?{duration:0}:void 0;e.transitionManager.goToRegion({x:(r=e.homePosition)[1],y:r[2],width:r[3]-r[1],height:r[4]-r[2]},{transition:n})}var r;if("goto-region"===t&&i){n=i.immediate?{duration:0}:{};e.transitionManager.goToRegion(i,{transition:n})}"constrain-bounds"===t&&e.transitionManager.constrainBounds({transition:(null==i?void 0:i.immediate)?{duration:0}:void 0})}));return function(){e.world.removeEventListener("mouseup",a),e.world.removeEventListener("touchend",a),e.world.removeEventListener("touchstart",c),e.world.removeEventListener("mousedown",c),window.removeEventListener("touchend",h),window.removeEventListener("mouseup",h),e.world.removeEventListener("mousemove",l),e.world.removeEventListener("touchmove",l),o&&e.world.removeEventListener("click",d),r&&e.world.removeEventListener("wheel",p),f()}},updatePosition:function(){}}},Se=o.createContext("explore"),Oe=function(){return e.useContext(Se)};function Pe(t,e,i){var n,r,o,s,a;function c(){var h=Date.now()-s;h<e&&h>=0?n=setTimeout(c,e-h):(n=null,i||(a=t.apply(o,r),o=r=null))}null==e&&(e=100);var h=function(){o=this,r=arguments,s=Date.now();var h=i&&!n;return n||(n=setTimeout(c,e)),h&&(a=t.apply(o,r),o=r=null),a};return h.clear=function(){n&&(clearTimeout(n),n=null)},h.flush=function(){n&&(a=t.apply(o,r),o=r=null,clearTimeout(n),n=null)},h}Pe.debounce=Pe;var Ce=Pe;function Re({debounce:t,scroll:i,polyfill:n}={debounce:0,scroll:!1}){const r=n||("undefined"==typeof window?class{}:window.ResizeObserver);if(!r)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[o,s]=e.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),a=e.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:o}),c=t?"number"==typeof t?t:t.scroll:null,h=t?"number"==typeof t?t:t.resize:null,[l,u,d]=e.useMemo(()=>{const t=()=>{if(!a.current.element)return;const{left:t,top:e,width:i,height:n,bottom:r,right:o,x:c,y:h}=a.current.element.getBoundingClientRect(),l={left:t,top:e,width:i,height:n,bottom:r,right:o,x:c,y:h};Object.freeze(l),Ae(a.current.lastBounds,l)||s(a.current.lastBounds=l)};return[t,h?Ce.debounce(t,h):t,c?Ce.debounce(t,c):t]},[s,c,h]);function p(){a.current.scrollContainers&&(a.current.scrollContainers.forEach(t=>t.removeEventListener("scroll",d,!0)),a.current.scrollContainers=null),a.current.resizeObserver&&(a.current.resizeObserver.disconnect(),a.current.resizeObserver=null)}function f(){a.current.element&&(a.current.resizeObserver=new r(d),a.current.resizeObserver.observe(a.current.element),i&&a.current.scrollContainers&&a.current.scrollContainers.forEach(t=>t.addEventListener("scroll",d,{capture:!0,passive:!0})))}var g,v,y;return g=d,v=Boolean(i),e.useEffect(()=>{if(v){const t=g;return window.addEventListener("scroll",t,{capture:!0,passive:!0}),()=>{window.removeEventListener("scroll",t,!0)}}},[g,v]),y=u,e.useEffect(()=>{const t=y;return window.addEventListener("resize",t),()=>{window.removeEventListener("resize",t)}},[y]),e.useEffect(()=>{p(),f()},[i,d,u]),e.useEffect(()=>p,[]),[t=>{t&&t!==a.current.element&&(p(),a.current.element=t,a.current.scrollContainers=function t(e){const i=[];if(!e||e===document.body)return i;const{overflow:n,overflowX:r,overflowY:o}=window.getComputedStyle(e);[n,r,o].some(t=>"auto"===t||"scroll"===t)&&i.push(e);return[...i,...t(e.parentElement)]}(t),f())},o,l]}const _e=["x","y","top","bottom","left","right","width","height"],Ae=(t,e)=>_e.every(i=>t[i]===e[i]);"undefined"!=typeof module&&Object.getOwnPropertyDescriptor&&Object.getOwnPropertyDescriptor(module,"exports").writable&&(module.exports=Re);var Te=o.createContext(null),Ie=o.createContext(null);function je(t,e){t&&t.appendChild&&e&&t.appendChild(e)}function Me(t,e){t&&t.removeChild&&e&&t.removeChild(e)}function Le(t,e,i){t&&t instanceof st&&(t=t.world),t&&t.insertBefore&&t.insertBefore(e,i)}function ke(t,e,i){var n,r;if(i&&(t.applyProps&&t.applyProps(i),t instanceof A))try{for(var o=v(s),a=o.next();!a.done;a=o.next()){var c=a.value,h=c.slice(2).toLowerCase();i[c]!==e[c]&&(e[c]&&t.removeEventListener(h,e[c]),t.addEventListener(h,i[c]))}}catch(t){n={error:t}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}}function Fe(t,e){var i,n,r=Object.keys(e),o=!1;try{for(var a=v(r),h=a.next();!h.done;h=a.next()){var l=h.value;if(-1!==s.indexOf(l)){var u=c[l];if(u){if(-1!==t.activatedEvents.indexOf(u))continue;o=!0,t.activatedEvents.push(u)}}}}catch(t){i={error:t}}finally{try{h&&!h.done&&(n=a.return)&&n.call(a)}finally{if(i)throw i.error}}o&&t.triggerEventActivation()}var De=new Map,ze={};var Be=i({now:n.unstable_now,createInstance:function(t,e,i,n,r){e.args;var o,s=d(e,["args"]);if(!(i instanceof st)&&r){var a=function(t){return t.return?a(t.return):t.stateNode&&t.stateNode.containerInfo};i=a(r)}var c=i.world;switch(t){case"world":(o=B.withProps({width:s.width,height:s.height,viewingDirection:"left-to-right"})).activatedEvents=c.activatedEvents,o.eventHandlers=c.eventHandlers,o.subscriptions=c.subscriptions,o.triggerEventActivation(),c=o;break;case"box":o=new V;break;case"worldObject":case"world-object":o=new z;break;case"worldImage":case"world-image":o=new T;break;case"texture":o=new I;break;case"compositeImage":case"composite-image":o=new D({id:s.id,width:s.width,height:s.height,images:[]});break;case"tiledImage":case"tiled-image":o=F.fromTile(s.uri,s.display,s.tile,s.scaleFactor);break;case"paragraph":(o=new X).text=s.children;break;default:return}return Fe(c,s),ke(o,{},s),o},removeChild:Me,appendChild:je,appendInitialChild:je,insertBefore:Le,warnsIfNotActing:!0,supportsMutation:!0,isPrimaryRenderer:!1,scheduleTimeout:"undefined"!=typeof setTimeout?setTimeout:void 0,cancelTimeout:"undefined"!=typeof clearTimeout?clearTimeout:void 0,setTimeout:"undefined"!=typeof setTimeout?setTimeout:void 0,clearTimeout:"undefined"!=typeof clearTimeout?clearTimeout:void 0,noTimeout:-1,appendChildToContainer:function(t,e){if(e instanceof B)t.world=e;else if(e instanceof z)t.world.appendChild(e);else if(e)throw new Error("Invalid root")},removeChildFromContainer:function(t,e){return Me(t.world,e)},createTextInstance:function(){},insertInContainerBefore:function(t,e,i){return Le(t.world,e,i)},prepareUpdate:function(t,e,i,n,r){return Fe(r.world,n),n},commitUpdate:function(t,e,i,n,r,o){t.applyProps&&e&&ke(t,n,e)},finalizeInitialChildren:function(t){return t.__handlers},getChildHostContext:function(){return ze},getRootHostContext:function(){return ze},prepareForCommit:function(){return null},hideInstance:function(t){t&&t.points&&(t.points[0]=0)},unhideInstance:function(t,e){t&&t.points&&(t.points[0]=1)},getPublicInstance:function(t){return t},hideTextInstance:function(){throw new Error("Text is not allowed in the react-three-fibre tree. You may have extraneous whitespace between components.")},resetAfterCommit:function(t){t.pendingUpdate=!0,t.world&&t.world.needsRecalculate&&(t.world.recalculateWorldSize(),t.world.triggerRepaint())},shouldSetTextContent:function(){return!1},clearContainer:function(){return!1}});function Ue(t,e){var i=De.get(t);i&&Be.updateContainer(null,i,null,(function(){De.delete(t),e&&e(t)}))}Be.injectIntoDevTools({bundleType:0,version:"17.0.2",rendererPackageName:"@atlas-viewer/atlas",findFiberByHostInstance:function(t){return null}});var Ne={render:function(t,e){var i=De.get(e);if(i)Be.updateContainer(t,i,null,(function(){}));else{var n=Be.createContainer(e,0,!1,null);Be.updateContainer(t,n,null,null),De.set(e,n)}}},We=o.memo((function(t){var i=t.children,n=t.setIsReady,r=t.onCreated,s=t.bounds,a=t.preset,c=t.mode,h=void 0===c?"explore":c,l=e.useCallback((function(t){var i=function(){n(!0)};return e.useEffect((function(){if(!a)return function(){};a.runtime.goHome();var t=r&&r(a);t&&t.then?t.then(i):i()}),[]),t.children}),[a]);return e.useLayoutEffect((function(){if(a){var t=a.runtime;h!==t.mode&&(t.mode=h),Ne.render(o.createElement(o.StrictMode,null,o.createElement(l,null,o.createElement(Ie.Provider,{value:s},o.createElement(Se.Provider,{value:h},o.createElement(Te.Provider,{value:a},i))))),t)}}),[a,h,i]),null})),He=function(){function t(t,e){this.fragmentShaderSource="\n precision mediump float;\n\n uniform sampler2D u_image;\n varying vec2 v_texCoord;\n\n void main() {\n gl_FragColor = texture2D(u_image, v_texCoord);\n }\n ",this.vertexShaderSource="\n attribute vec2 a_position;\n uniform vec2 u_resolution;\n varying vec4 v_color;\n uniform sampler2D u_texture;\n\n attribute vec2 a_texCoord;\n varying vec2 v_texCoord;\n\n void main() {\n\n // convert the position from pixels to 0.0 to 1.0\n vec2 zeroToOne = a_position / u_resolution;\n\n // convert from 0->1 to 0->2\n vec2 zeroToTwo = zeroToOne * 2.0;\n\n // convert from 0->2 to -1->+1 (clip space)\n vec2 clipSpace = zeroToTwo - 1.0;\n\n gl_Position = vec4(clipSpace * vec2(1, -1), 0, 1);\n \n v_texCoord = a_texCoord;\n }\n ",this.lastResize=0,this.canvas=t,this.rendererPosition=t.getBoundingClientRect(),this.gl=t.getContext("webgl2"),this.fragmentShader=this.createShader(this.gl.FRAGMENT_SHADER,this.fragmentShaderSource),this.vertexShader=this.createShader(this.gl.VERTEX_SHADER,this.vertexShaderSource),this.program=this.createProgram(this.vertexShader,this.fragmentShader),this.dpi=(null==e?void 0:e.dpi)||1,this.attributes={position:this.gl.getAttribLocation(this.program,"a_position"),texCoord:this.gl.getAttribLocation(this.program,"a_texCoord")},this.uniforms={resolution:this.gl.getUniformLocation(this.program,"u_resolution"),texture:this.gl.getUniformLocation(this.program,"u_texture")},this.buffers={position:this.createArrayBuffer(),texCoord:this.createArrayBuffer(new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1]))},this.rectBuffer=new Float32Array(12),this.resize(),this.gl.viewport(0,0,this.gl.canvas.width,this.gl.canvas.height),this.gl.clearColor(0,0,0,0),this.gl.clear(this.gl.COLOR_BUFFER_BIT),this.gl.useProgram(this.program),this.gl.enableVertexAttribArray(this.attributes.position)}return t.prototype.resize=function(){this.resizeCanvasToDisplaySize(),this.gl.viewport(0,0,this.gl.canvas.width,this.gl.canvas.height),this.rendererPosition=this.canvas.getBoundingClientRect()},t.prototype.isReady=function(){return!0},t.prototype.beforeFrame=function(t,e,i){this.gl.clearColor(0,0,0,0),this.gl.clear(this.gl.COLOR_BUFFER_BIT),this.gl.vertexAttribPointer(this.attributes.position,2,this.gl.FLOAT,!1,0,0),this.gl.uniform2f(this.uniforms.resolution,this.gl.canvas.width,this.gl.canvas.height),this.lastResize>1e3&&(this.lastResize=0,this.resizeCanvasToDisplaySize()),this.lastResize+=e},t.prototype.prepareLayer=function(t){t.__host&&t.__host.webgl||((t instanceof T||t instanceof F)&&this.createImageHost(t),t instanceof I&&this.createTextureHost(t))},t.prototype.createTextureHost=function(t){t.__host=t.__host?t.__host:{};var e,i=this.gl,n=this.gl.createTexture();if(i.bindTexture(i.TEXTURE_2D,n),i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,!1),t instanceof I){var r=t.getTexture();r.source&&i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,r.source),e=r}i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),t.__host.webgl={height:t.height,width:t.width,texture:n,lastImage:e}},t.prototype.createImageHost=function(t){var e=this,i=m([],y(new Array(t.points.length/5)),!1);t.__host=t.__host?t.__host:{},t.__host.webgl={height:t.height,width:t.width,textures:i,loading:[],loaded:[],lastLevelRendered:-1,onLoad:function(i,n){var r=e.gl,o=e.gl.createTexture();r.bindTexture(r.TEXTURE_2D,o),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,n),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.bindTexture(r.TEXTURE_2D,null),t.__host.webgl.textures[i]=o,t.__host.webgl.loaded.push(i)}}},t.prototype.paint=function(t,e,i,n,r,o){if("spacial-content"===t.type&&t.__host&&t.__host.webgl){if(t.getTexture){var s=null==t?void 0:t.getTexture();if(s&&t.__host.webgl.lastImage!==s.hash&&s.source&&!t.__host.webgl.error)try{var a=this.gl.RGBA,c=this.gl.RGBA,h=this.gl.UNSIGNED_BYTE;this.gl.bindTexture(this.gl.TEXTURE_2D,t.__host.webgl.texture),this.gl.texImage2D(this.gl.TEXTURE_2D,0,a,c,h,s.source),t.__host.webgl.lastImage=s.hash}catch(e){t.__host.webgl.error=e}}if(t.__host.webgl.loading&&-1===t.__host.webgl.loading.indexOf(e)&&t.getImageUrl){t.__host.webgl.loading.push(e);var l=document.createElement("img");l.decoding="async",l.crossOrigin="anonymous",l.src=t.getImageUrl(e),l.onload=function(){return l.onload=null,t.__host.webgl.onLoad(e,l)}}var u=t.__host.webgl.texture?t.__host.webgl.texture:t.__host.webgl.textures[e];u&&(this.gl.enableVertexAttribArray(this.attributes.texCoord),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.buffers.texCoord),this.gl.enableVertexAttribArray(this.attributes.texCoord),this.gl.vertexAttribPointer(this.attributes.texCoord,2,this.gl.FLOAT,!1,0,0),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.buffers.position),this.gl.enableVertexAttribArray(this.attributes.position),this.gl.vertexAttribPointer(this.attributes.position,2,this.gl.FLOAT,!1,0,0),this.gl.bindTexture(this.gl.TEXTURE_2D,u),this.gl.uniform1i(this.uniforms.texture,0),this.setRectangle(i,n,r,o),this.gl.drawArrays(this.gl.TRIANGLES,0,6))}},t.prototype.afterPaintLayer=function(t,e){},t.prototype.pendingUpdate=function(){return!0},t.prototype.getPointsAt=function(t,e,i,n){return t.getPointsAt(e,i,n)},t.prototype.afterFrame=function(){},t.prototype.getScale=function(t,e){var i=this.canvas.width/t,n=this.canvas.height/e;return i<n?n:i},t.prototype.getViewportBounds=function(t,e,i){return null},t.prototype.createShader=function(t,e){var i=this.gl.createShader(t);if(i){if(this.gl.shaderSource(i,e),this.gl.compileShader(i),this.gl.getShaderParameter(i,this.gl.COMPILE_STATUS))return i;var n=this.gl.getShaderInfoLog(i);if(this.gl.deleteShader(i),n)throw new Error(n)}throw new Error("Invalid shader")},t.prototype.createProgram=function(t,e){var i=this.gl.createProgram();if(i){if(this.gl.attachShader(i,t),this.gl.attachShader(i,e),this.gl.linkProgram(i),this.gl.getProgramParameter(i,this.gl.LINK_STATUS))return i;var n=this.gl.getProgramInfoLog(i);if(this.gl.deleteProgram(i),n)throw new Error(n)}throw new Error("Invalid program")},t.prototype.resizeCanvasToDisplaySize=function(){var t=this.gl.canvas,e=t.clientWidth,i=t.clientHeight,n=t.width!==e||t.height!==i;return n&&(t.width=e,t.height=i),n},t.prototype.createArrayBuffer=function(t){var e=this.gl.createBuffer();if(this.gl.bindBuffer(this.gl.ARRAY_BUFFER,e),t&&this.gl.bufferData(this.gl.ARRAY_BUFFER,t,this.gl.STATIC_DRAW),!e)throw new Error("Cannot create buffer");return e},t.prototype.setRectangle=function(t,e,i,n){this.gl.bufferData(this.gl.ARRAY_BUFFER,this.getRectangle(t,e,i,n),this.gl.STATIC_DRAW)},t.prototype.getRectangle=function(t,e,i,n){var r=t,o=t+i,s=e,a=e+n;return this.rectBuffer.set([r,s,o,s,r,a,r,a,o,s,o,a]),this.rectBuffer},t.prototype.getRendererScreenPosition=function(){return this.rendererPosition},t}();function qe(t,e){for(var i=e?t:JSON.stringify(t),n=5381,r=i.length;r;)n=33*n^i.charCodeAt(--r);var o=(n>>>0).toString(16);return o.length%2?"0"+o:o}var Qe=function(){function t(t){this.sheetPrefix=(null==t?void 0:t.sheetPrefix)||"a-",this.$element=document.createElement("style"),this.stylesheetClasses=[],this.activeStylesheetClasses=[],this.sheetsDidUpdate=!1,this.stylesheetEntries={}}return t.prototype.getElement=function(){return this.$element},t.prototype.addStylesheet=function(t){var e=t.replace(/\s\s+/g," ").replace(/: /g,":").replace(/; /g,";").trim(),i=this.sheetPrefix+qe(e,!0);return-1!==this.stylesheetClasses.indexOf(i)||(this.stylesheetClasses.push(i),this.activeStylesheetClasses.push(i),this.stylesheetEntries[i]=e,this.sheetsDidUpdate=!0),i},t.prototype.removeStylesheet=function(t){var e=this.sheetPrefix+qe(t,!0);this.stylesheetClasses.indexOf(e)&&(this.stylesheetClasses=this.stylesheetClasses.filter((function(t){return t!==e}))),this.sheetsDidUpdate=!0},t.prototype.clearClasses=function(){this.activeStylesheetClasses=[]},t.prototype.didUpdateActive=function(){var t,e,i,n;if(this.activeStylesheetClasses.length){try{for(var r=v(this.activeStylesheetClasses),o=r.next();!o.done;o=r.next()){var s=o.value;if(-1===this.stylesheetClasses.indexOf(s))return!0}}catch(e){t={error:e}}finally{try{o&&!o.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}try{for(var a=v(this.stylesheetClasses),c=a.next();!c.done;c=a.next()){s=c.value;if(-1===this.activeStylesheetClasses.indexOf(s))return!0}}catch(t){i={error:t}}finally{try{c&&!c.done&&(n=a.return)&&n.call(a)}finally{if(i)throw i.error}}}return!1},t.prototype.updateSheet=function(){var t=this;(this.sheetsDidUpdate||this.didUpdateActive())&&(this.$element.innerText=this.activeStylesheetClasses.map((function(e){return".".concat(e,"{").concat(t.stylesheetEntries[e],"}")})).join(""),this.sheetsDidUpdate=!1,this.stylesheetClasses=m([],y(this.activeStylesheetClasses),!1))},t}(),Ve=function(){function t(t,e){this.visible=[],this.previousVisible=[],this.htmlIds=[],this.firstMeaningfulPaint=!1,this.paintTx=1,this.zIndex=0,this.htmlContainer=t,this.htmlContainer.innerHTML="",this.rendererPosition=this.htmlContainer.getBoundingClientRect(),this.options=u({triggerResize:function(){},box:!1,text:!1,sheetPrefix:"",inlineStyles:!1},e||{}),this.stylesheet=new Qe({sheetPrefix:this.options.sheetPrefix}),this.options.inlineStyles||this.htmlContainer.appendChild(this.stylesheet.getElement()),this.classes={hostClassName:this.stylesheet.addStylesheet("\n position: absolute;\n overflow: hidden;\n transform-origin: 0px 0px;\n "),interactive:this.stylesheet.addStylesheet("pointer-events: all"),nonInteractive:this.stylesheet.addStylesheet("pointer-events: none")},this.stylesheet.updateSheet()}return t.prototype.createHtmlHost=function(t){if(this.htmlContainer&&(this.options.box||t.props.className||t.props.html)){var e=document.createElement("div");this.options.inlineStyles?(e.style.position="absolute",e.style.overflow="hidden",e.style.transformOrigin="0px 0px"):e.classList.add(this.classes.hostClassName),t.__host={element:e,revision:null,relative:!1},this.updateHtmlHost(t,t.width,t.height),t.__onCreate&&t.__onCreate()}},t.prototype.triggerResize=function(){this.options.triggerResize()},t.prototype.updateHtmlHost=function(t,e,i){if(t.__revision!==t.__host.revision){var n=t.__host.element,r=[this.classes.hostClassName];if(t.props.interactive?this.options.inlineStyles?n.style.pointerEvents="all":r.push(this.classes.interactive):this.options.inlineStyles?n.style.pointerEvents="none":r.push(this.classes.nonInteractive),t.props.className&&(r.push(t.props.className),t.hovering&&r.push("".concat(t.props.className,"--hover")),t.pressing&&r.push("".concat(t.props.className,"--active"))),t.props.relativeStyle?(n.style.width="".concat(e||t.width,"px"),n.style.height="".concat(i||t.height,"px")):(n.style.width="".concat(t.width,"px"),n.style.height="".concat(t.height,"px")),t.props.style)return void Object.assign(n.style,t.props.style||{},t.hovering&&t.props.hoverStyles||{},t.pressing&&t.props.pressStyles||{});if(this.options.text&&t instanceof X){t.text&&(n.innerText=t.text),t.backgroundColor&&(n.style.backgroundColor=t.backgroundColor),t.color&&(n.style.color=t.color),t.props.font&&(n.style.font=t.props.font),t.props.textAlign&&(n.style.textAlign=t.props.textAlign),t.__host.revision=t.__revision;var o=r.join(" ");n.className=o,n.part=o}t instanceof V&&(this.options.box||t.props.className||t.props.html)&&(t.props.backgroundColor&&(n.style.backgroundColor=t.props.backgroundColor),t.props.border!==n.style.border&&(n.style.border=t.props.border));var s=r.join(" ");n.className=s,n.part=s}},t.prototype.afterFrame=function(t,e,i){var n,r;this.stylesheet.updateSheet();try{for(var o=v(this.previousVisible),s=o.next();!s.done;s=o.next()){var a=s.value;-1===this.visible.indexOf(a)&&this.htmlContainer&&a.__id&&-1!==this.htmlIds.indexOf(a.__id)&&this.htmlContainer.removeChild(a.__host.element)}}catch(t){n={error:t}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}this.previousVisible=this.visible},t.prototype.afterPaintLayer=function(t,e){},t.prototype.beforeFrame=function(t,e,i){this.stylesheet.clearClasses(),this.paintTx++,this.zIndex=0,this.visible=[]},t.prototype.getPointsAt=function(t,e,i,n){return t.getPointsAt(e,i,n)},t.prototype.getScale=function(t,e){var i=this.rendererPosition.width/t,n=this.rendererPosition.height/e;return i<n?n:i},t.prototype.getViewportBounds=function(t,e,i){return null},t.prototype.isReady=function(){return!1},t.prototype.paint=function(t,e,i,n,r,o){if(this.zIndex++,(this.options.text&&t instanceof X||t instanceof V&&(this.options.box||t.props.className||t.props.html))&&t.__host.tx!==this.paintTx&&(this.visible.push(t),t.__host.tx=this.paintTx,this.htmlContainer)){this.updateHtmlHost(t,r,o);var s=r/t.width,a=t.__host.element;a.style.zIndex="".concat(this.zIndex),t.props.relativeStyle?a.style.transform="translate(".concat(Math.round(i),"px, ").concat(Math.round(n),"px)"):a.style.transform="translate(".concat(Math.round(i),"px, ").concat(Math.round(n),"px) scale(").concat(s,")"),-1===this.previousVisible.indexOf(t)&&this.htmlContainer.appendChild(a),-1===this.htmlIds.indexOf(t.__id)&&this.htmlIds.push(t.__id)}},t.prototype.pendingUpdate=function(){return!1},t.prototype.prepareLayer=function(t){t.__host||(t instanceof X||t instanceof V)&&this.createHtmlHost(t)},t.prototype.resize=function(t,e){void 0!==t&&void 0!==e&&(this.htmlContainer.style.width="".concat(t,"px"),this.htmlContainer.style.height="".concat(e,"px")),this.rendererPosition=this.htmlContainer.getBoundingClientRect()},t.prototype.getRendererScreenPosition=function(){return this.rendererPosition},t}(),Xe=function(){function t(t,e,i){var n=this;this.activatedEvents=[],this.eventHandlers=[],this.pointerMoveEvent=void 0,this.pointerEventState={isClicking:!1,isDragging:!1,isPressed:!1,mousedOver:[],itemsBeingDragged:[],mouseDownStart:{x:0,y:0},lastTouches:[]},this._realPointerMove=function(t){n.pointerMoveEvent=t},this.onWheelEvent=function(t){t.preventDefault(),n.onPointerEvent(t)},this.onTouchEvent=function(t){for(var e=c[t.type],i=[],r=t.touches.length,o=0;o<r;o++){var s=t.touches.item(o);if(s){var a=n.runtime.viewerToWorld(s.clientX-n.bounds.left,s.clientY-n.bounds.top),h=a.x,l=a.y,u={id:s.identifier,x:h,y:l};i.push(u)}}i.length&&n.assignToEvent(t,i[0].x,i[0].y),"onTouchEnd"!==e?(n.pointerEventState.lastTouches=i,t.atlasTouches=i,n.runtime.world.propagateTouchEvent(e,t,i)):(t.atlasTouches=[],n.runtime.world.propagateTouchEvent(e,t,n.pointerEventState.lastTouches),n.pointerEventState.lastTouches=[])},this.onPointerEvent=function(t){var e=c[t.type];if(e&&-1!==n.runtime.world.activatedEvents.indexOf(e)){var i=n.runtime.viewerToWorld(t.clientX-n.bounds.left,t.clientY-n.bounds.top),r=i.x,o=i.y;n.assignToEvent(t,r,o),n.runtime.world.propagatePointerEvent(e,t,r,o)}},this.onPointerDown=function(t){n.pointerEventState.isPressed=!0,n.pointerEventState.isClicking=!0,n.pointerEventState.mouseDownStart.x=t.clientX,n.pointerEventState.mouseDownStart.y=t.clientY,setTimeout((function(){n.runtime&&(n.pointerEventState.isClicking=!1)}),250),setTimeout((function(){if(n.runtime&&n.pointerEventState.isPressed&&!n.pointerEventState.isDragging){var e=n.runtime.viewerToWorld(n.pointerEventState.mouseDownStart.x-n.bounds.left,n.pointerEventState.mouseDownStart.y-n.bounds.top);n.pointerEventState.isDragging=!0,n.pointerEventState.itemsBeingDragged=n.runtime.world.propagatePointerEvent("onDragStart",t,e.x,e.y)}}),800),n.onPointerEvent(t)},this.onPointerUp=function(t){var e,i;if(n.pointerEventState.isClicking){var r=n.runtime.viewerToWorld(t.clientX-n.bounds.left,t.clientY-n.bounds.top),o=r.x,s=r.y;n.assignToEvent(t,o,s),n.runtime.world.propagatePointerEvent("onClick",t,o,s)}if(n.pointerEventState.isDragging){try{for(var a=v(n.pointerEventState.itemsBeingDragged),c=a.next();!c.done;c=a.next()){c.value.dispatchEvent("onDragEnd",t)}}catch(t){e={error:t}}finally{try{c&&!c.done&&(i=a.return)&&i.call(a)}finally{if(e)throw e.error}}n.pointerEventState.isDragging=!1}n.pointerEventState.isClicking=!1,n.pointerEventState.isPressed=!1,n.pointerEventState.itemsBeingDragged=[],n.onPointerEvent(t)},this.onPointerMove=function(t){var e,i,r,o,s,a;n.pointerMoveEvent=void 0;var c=n.runtime.viewerToWorld(t.clientX-n.bounds.left,t.clientY-n.bounds.top),h=c.x,l=c.y;n.assignToEvent(t,h,l),n.runtime.world.propagatePointerEvent("onPointerMove",t,h,l);var d=n.runtime.world.propagatePointerEvent("onMouseMove",t,h,l),p=[],f=[];try{for(var g=v(d),y=g.next();!y.done;y=g.next()){var m=y.value;p.push(m.id),f.push(m),-1===n.pointerEventState.mousedOver.indexOf(m)&&(m.dispatchEvent("onMouseEnter",t),m.dispatchEvent("onPointerEnter",t),m.dispatchEvent("onMouseOver",t),m.dispatchEvent("onPointerOver",t))}}catch(t){e={error:t}}finally{try{y&&!y.done&&(i=g.return)&&i.call(g)}finally{if(e)throw e.error}}try{for(var w=v(n.pointerEventState.mousedOver),b=w.next();!b.done;b=w.next()){var x=b.value;-1===p.indexOf(x.id)&&(x.dispatchEvent("onMouseLeave",t),x.dispatchEvent("onPointerLeave",t),x.dispatchEvent("onMouseOut",t),x.dispatchEvent("onPointerOut",t))}}catch(t){r={error:t}}finally{try{b&&!b.done&&(o=w.return)&&o.call(w)}finally{if(r)throw r.error}}if(n.pointerEventState.isDragging)try{for(var E=v(n.pointerEventState.itemsBeingDragged),S=E.next();!S.done;S=E.next()){(m=S.value).dispatchEvent("onDrag",t)}}catch(t){s={error:t}}finally{try{S&&!S.done&&(a=E.return)&&a.call(E)}finally{if(s)throw s.error}}if(n.pointerEventState.isPressed&&!n.pointerEventState.isDragging&&function(t,e){var i=k(t.x,e.x),n=k(t.y,e.y);return Math.sqrt(Math.pow(i,2)+Math.pow(n,2))}(n.pointerEventState.mouseDownStart,{x:t.clientX,y:t.clientY})>50){var O=n.runtime.viewerToWorld(n.pointerEventState.mouseDownStart.x-n.bounds.left,n.pointerEventState.mouseDownStart.y-n.bounds.top);n.pointerEventState.isDragging=!0,n.pointerEventState.itemsBeingDragged=n.runtime.world.propagatePointerEvent("onDragStart",u(u({},t),{atlas:{x:O.x,y:O.y}}),O.x,O.y)}n.pointerEventState.mousedOver=f},this.element=t,this.runtime=e,this.unsubscribe=e.world.addLayoutSubscriber(this.layoutSubscriber.bind(this)),this.bounds=t.getBoundingClientRect(),this.options=u({simulationRate:0},i||{});var r=0;e.registerHook("useFrame",(function(t){(r+=t)>n.options.simulationRate&&n.pointerMoveEvent&&(r=0,e.updateNextFrame())})),e.registerHook("useBeforeFrame",(function(){n.pointerMoveEvent&&n.onPointerMove(n.pointerMoveEvent)})),this.activateEvents()}return t.prototype.updateBounds=function(){this.bounds=this.element.getBoundingClientRect(),this.runtime.updateRendererScreenPosition()},t.prototype.layoutSubscriber=function(t){"event-activation"===t&&this.activateEvents()},t.prototype.assignToEvent=function(e,i,n){t.eventPool.atlas.x=i,t.eventPool.atlas.y=n,e.atlas=t.eventPool.atlas},t.prototype.activateEvents=function(){this.element.addEventListener("pointermove",this._realPointerMove),this.element.addEventListener("pointerup",this.onPointerUp),this.element.addEventListener("pointerdown",this.onPointerDown),this.element.addEventListener("mousedown",this.onPointerEvent),this.element.addEventListener("mouseup",this.onPointerEvent),this.element.addEventListener("pointercancel",this.onPointerEvent),this.element.addEventListener("wheel",this.onWheelEvent),this.element.addEventListener("touchstart",this.onTouchEvent),this.element.addEventListener("touchcancel",this.onTouchEvent),this.element.addEventListener("touchend",this.onTouchEvent),this.element.addEventListener("touchmove",this.onTouchEvent)},t.prototype.normalizeEventName=function(t){return t.startsWith("on")?t.slice(2).toLowerCase():t.toLowerCase()},t.prototype.stop=function(){var t,e;this.unsubscribe();try{for(var i=v(this.eventHandlers),n=i.next();!n.done;n=i.next()){var r=y(n.value,2),o=r[0],s=r[1];this.element.removeEventListener(this.normalizeEventName(o),s)}}catch(e){t={error:e}}finally{try{n&&!n.done&&(e=i.return)&&e.call(i)}finally{if(t)throw t.error}}},t.eventPool={atlas:{x:0,y:0}},t}();function Ye(t){var e=t.interactive,i=void 0===e||e,n=t.viewport,r=t.forceRefresh,o=t.canvasElement,s=t.overlayElement,a=t.controllerConfig,c=t.unstable_webglRenderer,h=t.dpi,l=t.canvasBox,d=void 0===l||l;if(!o)throw new Error("Invalid container");o.style.userSelect="none";var p=i?Ee(u({minZoomFactor:.5,maxZoomFactor:3,enableClickToZoom:!1},a||{})):void 0,f=new ce([c?new He(o):new ae(o,{dpi:h,debug:!1,box:d}),s?new Ve(s,{box:c||!d,text:!0,triggerResize:r}):void 0]),g=new st(f,new B(1024,1024),n,p?[p]:[]),v=new Xe(o,g);return{name:"default-preset",em:v,runtime:g,renderer:f,controller:p,canvas:o,unmount:function(){Ue(g),g.stopControllers(),g.stop(),v&&v.stop()}}}var Ze=function(){function t(t,e){this.pending=!0,this.zIndex=0,this.currentlyVisible=[],this.previouslyVisible=[],this.container=t,this.rendererPosition=t.getBoundingClientRect();var i=this.rendererPosition,n=i.width,r=i.height;this.width=n,this.height=r,this.options=u({addPart:!1,setDraggableFalse:!1,imageClass:"",widthStylesheet:!1,sheetPrefix:"position-"},e||{}),this.stylesheet=new Qe({sheetPrefix:this.options.sheetPrefix}),this.options.widthStylesheet&&this.container.appendChild(this.stylesheet.getElement())}return t.prototype.isReady=function(){return!0},t.prototype.resize=function(){this.rendererPosition=this.container.getBoundingClientRect(),this.width=this.rendererPosition.width,this.height=this.rendererPosition.height},t.prototype.getRendererScreenPosition=function(){return this.rendererPosition},t.prototype.afterFrame=function(t,e,i){var n,r,o,s;this.stylesheet.updateSheet();try{for(var a=v(this.previouslyVisible),c=a.next();!c.done;c=a.next()){var h=c.value;-1===this.currentlyVisible.indexOf(h)&&this.container.removeChild(h)}}catch(t){n={error:t}}finally{try{c&&!c.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}try{for(var l=v(this.currentlyVisible),u=l.next();!u.done;u=l.next()){h=u.value;-1===this.previouslyVisible.indexOf(h)&&this.container.appendChild(h)}}catch(t){o={error:t}}finally{try{u&&!u.done&&(s=l.return)&&s.call(l)}finally{if(o)throw o.error}}this.previouslyVisible=this.currentlyVisible,this.currentlyVisible=[]},t.prototype.afterPaintLayer=function(t,e){},t.prototype.beforeFrame=function(t,e,i){this.stylesheet.clearClasses(),this.zIndex=0},t.prototype.getPointsAt=function(t,e,i,n){return t.getPointsAt(e,i,n)},t.prototype.getScale=function(t,e){var i=this.width/t,n=this.height/e;return i<n?n:i},t.prototype.getViewportBounds=function(t,e,i){return null},t.prototype.createImage=function(){var t=document.createElement("img");return this.options.imageClass?(t.className=this.options.imageClass,this.options.addPart&&t.setAttribute("part",this.options.imageClass)):(t.style.position="absolute",t.style.pointerEvents="none",t.style.userSelect="none"),this.options.setDraggableFalse&&t.setAttribute("draggable","false"),t},t.prototype.paint=function(t,e,i,n,r,o){if(this.pending=!1,this.zIndex++,t instanceof T){if(!t.__host)(a=this.createImage()).src=t.uri,t.__host=a,this.container.appendChild(t.__host);var s=t.__host;this.currentlyVisible.push(s),s.style.zIndex="".concat(this.zIndex),s.style.opacity="".concat(t.style.opacity),this.options.widthStylesheet?s.className=this.options.imageClass+" "+this.stylesheet.addStylesheet("width:".concat((r+Number.MIN_VALUE).toFixed(2),"px;height:").concat((o+Number.MIN_VALUE).toFixed(2),"px;")):(s.style.width="".concat(r+Number.MIN_VALUE,"px"),s.style.height="".concat(o+Number.MIN_VALUE,"px")),s.style.transform="translate(".concat(i,"px, ").concat(n,"px)")}if(t instanceof F){if(t.__host||(t.__host={images:[]}),!t.__host.images[e]){var a,c=t.getImageUrl(e);(a=this.createImage()).src=c,t.__host.images[e]=a,this.container.appendChild(a)}(s=t.__host.images[e]).style.zIndex="".concat(this.zIndex),s.style.opacity="".concat(t.style.opacity),this.currentlyVisible.push(s),this.options.widthStylesheet?s.className=this.options.imageClass+" "+this.stylesheet.addStylesheet("width:".concat((r+Number.MIN_VALUE).toFixed(2),"px;height:").concat((o+Number.MIN_VALUE).toFixed(2),"px;")):(s.style.width="".concat(r+Number.MIN_VALUE,"px"),s.style.height="".concat(o+Number.MIN_VALUE,"px")),s.style.transform="translate(".concat(i,"px, ").concat(n,"px)")}},t.prototype.pendingUpdate=function(){return this.pending},t.prototype.prepareLayer=function(t){},t}();var $e={"default-preset":Ye,"static-preset":function(t){var e=t.interactive,i=t.viewport,n=t.forceRefresh,r=t.containerElement,o=t.overlayElement,s=t.controllerConfig;if(!r)throw new Error("Invalid container");r.style.userSelect="none";var a=e?Ee(u({minZoomFactor:.5,maxZoomFactor:3,enableClickToZoom:!1},s||{})):void 0,c=new Ze(r,{addPart:!1,setDraggableFalse:!1,imageClass:"atlas-static-image"}),h=o?new ce([c,new Ve(o,{box:!0,text:!0,triggerResize:n})]):c,l=new st(h,new B(1024,1024),i,a?[a]:[]),d=new Xe(r,l);return{name:"static-preset",em:d,runtime:l,renderer:h,controller:a,container:r,overlay:o,unmount:function(){Ue(l),l.stopControllers(),l.stop(),d&&d.stop()}}}},Ge={};function Ke(t,i){var n=e.useRef(),r=e.useRef(),o=e.useRef(),s=e.useRef({width:i.width,height:i.height,didUpdate:!0}),a=y(Array.isArray(t)?t||[]:[t],2),c=a[0],h=void 0===c?"default-preset":c,l=a[1],d=void 0===l?Ge:l,p=y(e.useState(null),2),f=p[0],g=p[1];e.useLayoutEffect((function(){var t=r.current,e=o.current,a=n.current,c=($e[h]||Ye)(u({containerElement:e,canvasElement:t,overlayElement:a,viewport:s.current,dpi:window.devicePixelRatio||1,forceRefresh:i.forceRefresh,unstable_webglRenderer:i.unstable_webglRenderer},d||{}));return g(c),function(){c&&c.unmount()}}),[h,d]);var v=e.useMemo((function(){return{canvas:r,overlay:n,container:o}}),[]);return[h,f,s,v]}var Je=function(t){var i=t.renderPreset,n=t.onCreated,r=t.mode,s=void 0===r?"explore":r,a=t.resetWorldOnChange,c=void 0===a||a,h=t.unstable_webglRenderer,l=void 0!==h&&h,p=t.unstable_noReconciler,f=void 0!==p&&p,g=t.hideInlineStyle,v=void 0!==g&&g,m=(t.controllerConfig,t.children),w=t.overlayStyle,b=t.containerStyle,x=t.className,E=t.containerProps,S=void 0===E?{}:E,O=t.homePosition,P=d(t,["renderPreset","onCreated","mode","resetWorldOnChange","unstable_webglRenderer","unstable_noReconciler","hideInlineStyle","controllerConfig","children","overlayStyle","containerStyle","className","containerProps","homePosition"]),C=y(e.useState(s),2),R=C[0],_=C[1],A=y(e.useState(!1),2),T=A[0],I=A[1],j=y(Re({scroll:!0}),3),M=j[0],L=j[1],k=j[2],F=y(Ke(i,{width:P.width,height:P.height,forceRefresh:k,unstable_webglRenderer:l}),4),D=F[0],z=F[1],B=F[2],U=F[3],N=y(e.useState(""),2),W=N[0],H=N[1];e.useEffect((function(){_(s)}),[s]),e.useEffect((function(){z&&z.em&&z.em.updateBounds()}),[z,L]),e.useEffect((function(){z&&z.runtime&&(z.runtime.mode=R),T&&z&&(z.ready=!0)}),[z,T,R]),e.useEffect((function(){z&&(z.runtime.manualHomePosition=!!O,z.runtime.setHomePosition(O))}),[z,O]),e.useEffect((function(){if(z){var t=z.runtime;t.resize(B.current.width,P.width,B.current.height,P.height),B.current.width=P.width,B.current.height=P.height,t.updateNextFrame(),B.current.didUpdate=!0}}),[z,P.width,P.height]),e.useLayoutEffect((function(){z&&(z.overlay&&(z.overlay.style.width="".concat(L.width,"px"),z.overlay.style.height="".concat(L.height,"px")),z.container&&(z.container.style.width="".concat(L.width,"px"),z.container.style.height="".concat(L.height,"px")))}),[z,L.height,L.width]),e.useLayoutEffect((function(){var t=function(){if(z){var t=z.runtime;B.current.width!==P.width&&B.current.height!==P.height&&(t.resize(B.current.width,P.width,B.current.height,P.height),B.current.width=P.width,B.current.height=P.height,t.updateNextFrame(),B.current.didUpdate=!0)}};return window.addEventListener("resize",t),function(){return window.removeEventListener("resize",t)}}),[z,P.height,P.width]);var q=e.useCallback((function(t){var i=function(){I(!0)};return e.useEffect((function(){if(!z)throw new Error("Invalid configuration - no runtime found");z.runtime.goHome();var t=n&&n(z);t&&t.then?t.then(i):i()}),[]),t.children}),[z]);e.useEffect((function(){if(z){var t=z.runtime;if(c)return t.world.addLayoutSubscriber((function(e){"recalculate-world-size"===e&&t.goHome()}))}return function(){}}),[c]),e.useEffect((function(){return z?z.runtime.registerHook("useBeforeFrame",(function(){var t;if(B.current.didUpdate&&z.canvas){var e=window.devicePixelRatio||1,i=B.current.width,n=B.current.height;z.canvas.width=i*e,z.canvas.height=n*e,z.canvas.style.width=i+"px",z.canvas.style.height=n+"px",null===(t=z.canvas.getContext("2d"))||void 0===t||t.scale(e,e),z&&z.em&&z.em.updateBounds(),B.current.didUpdate=!1}})):function(){}}),[z,c]),e.useEffect((function(){var t=function(){z&&(_("sketch"),H("mode-sketch")),window.removeEventListener("keyup",t)},e=function(e){if("Space"===e.code&&z&&"sketch"===z.runtime.mode){if(e.target&&e.target.tagName&&"input"===e.target.tagName.toLowerCase())return;e.preventDefault(),_("explore"),H("mode-explore"),window.addEventListener("keyup",t)}};return window.addEventListener("keydown",e),function(){window.removeEventListener("keydown",e),window.removeEventListener("keyup",t)}}),[z]);var Q,V=d(P,["height","width"]),X=(Q=[P.width,P.height],e.useMemo((function(){return qe(Q)}),Q));return o.createElement("div",{ref:M,className:["atlas",v?"":"atlas-width-".concat(X),W,x].filter(Boolean).join(" ").trim(),style:u(u({},b),v?{width:P.width,height:P.height}:{})},"static-preset"===D?o.createElement("div",u({className:"atlas-static-container",style:z&&z.controller?void 0:{pointerEvents:"none"},ref:U.container,tabIndex:0},S)):o.createElement("canvas",u({className:"atlas-canvas",tabIndex:0},V,S,{ref:U.canvas})),o.createElement("div",{className:"atlas-overlay",style:u({},w||{}),ref:U.overlay},f?o.createElement(q,null,o.createElement(Ie.Provider,{value:L},o.createElement(Se.Provider,{value:R},o.createElement(Te.Provider,{value:z},m)))):o.createElement(We,{bounds:L,preset:z,mode:R,setIsReady:I,onCreated:n},m)),v?null:o.createElement("style",null,"\n .atlas { position: relative; user-select: none; display: flex; background: #000; z-index: 10; touch-action: none; tab-index: -1 }\n .atlas-width-".concat(x," { width: ").concat(P.width,"px; height: ").concat(P.height,"px; }\n .atlas-canvas { flex: 1 1 0px; }\n .atlas-canvas:focus, .atlas-static-container:focus { outline: none }\n .atlas-canvas:focus-visible, .atlas-canvas-container:focus-visible { outline: 2px solid darkorange }\n .atlas-static-container { position: relative; overflow: hidden; flex: 1 1 0px; }\n .atlas-overlay { position: absolute; top: 0; left: 0; pointer-events: none; overflow: hidden; }\n .atlas-static-image { position: absolute; pointer-events: none; user-select: none; transform-origin: 0px 0px; }\n ")))},ti=function(){return e.useContext(Te)},ei=function(){var t=ti();return t?t.runtime:void 0},ii=function(t,i){void 0===i&&(i=[]);var n=ei();e.useEffect((function(){return n?n.registerHook("useAfterFrame",t):function(){}}),i)},ni=function(t,i){void 0===i&&(i=[]);var n=ei();e.useEffect((function(){return n?n.registerHook("useFrame",t):function(){}}),i)},ri=function(){var t=ti();return t&&t.canvas?t.canvas:void 0};function oi(){return e.useContext(Ie)}var si=o.forwardRef((function(t,i){var n=t.children,s=d(t,["children"]),a=e.useRef(),c=ei(),h=e.useRef(0),l=e.useRef();return ni((function(){if(s.relative){var t=a.current;if(t&&c){var e=c.getScaleFactor();h.current!==e&&(h.current=e,t.style.transformOrigin="0 0",t.style.transform="scale(".concat(1/h.current,")"),t.style.width="".concat(100*h.current,"%"),t.style.height="".concat(100*h.current,"%"))}}}),[s.relative]),e.useLayoutEffect((function(){var t=l.current;i&&t&&("function"==typeof i?i(t):i.current=t),t&&t.__host?s.relative?r.render(o.createElement("div",{ref:a},n),t.__host.element):r.render(n,t.__host.element):t&&(t.__onCreate=function(){s.relative?r.render(o.createElement("div",{ref:a},n),t.__host.element):r.render(n,t.__host.element)})}),[i,n,l,s.relative]),o.createElement("box",u({html:!0},s,{ref:l}))})),ai=function(t,i,n){void 0===n&&(n=[]);var r=ei(),o=r?r.world:void 0;e.useEffect((function(){if(r){var e=i,n=c[t];r.world.activatedEvents.push(n);var o=n.slice(2).toLowerCase();return r.world.addEventListener(o,e),function(){r.world.removeEventListener(o,e)}}return function(){}}),m([o,t],y(n),!1))},ci=function(t,i){var n=Oe(),r=ei(),o=oi(),s=e.useRef(),a=e.useRef(null),c=e.useRef(),h=y(e.useState(!1),2),l=h[0],u=h[1],d=e.useRef({north:0,south:0,east:0,west:0});ni((function(){c&&r&&r.updateNextFrame()})),e.useEffect((function(){r&&r.updateNextFrame()}),[r,l]);var p=e.useCallback((function(e){var i=e.atlasTouches?e.atlasTouches[0]:e.atlas?e.atlas:{x:e.pageX,y:e.pageY};if(r&&"sketch"===r.mode){var n=a.current;"translate"!==s.current&&"east"!==s.current&&"north-east"!==s.current&&"south-east"!==s.current||(d.current.east=i.x-(c.current?c.current.x:0)),"translate"!==s.current&&"west"!==s.current&&"north-west"!==s.current&&"south-west"!==s.current||(d.current.west=i.x-(c.current?c.current.x:0)),"translate"!==s.current&&"north"!==s.current&&"north-east"!==s.current&&"north-west"!==s.current||(d.current.north=i.y-(c.current?c.current.y:0)),"translate"!==s.current&&"south"!==s.current&&"south-west"!==s.current&&"south-east"!==s.current||(d.current.south=i.y-(c.current?c.current.y:0)),n&&(n.points[1]=d.current.west,n.points[2]=d.current.north,n.points[3]=t.width+d.current.east,n.points[4]=t.height+d.current.south,r.updateNextFrame())}}),[r,t.width,t.height]);ai("mousemove",p,[t.width,t.height]),ai("pointermove",p,[t.width,t.height]);var f=e.useRef();return e.useEffect((function(){f.current=function(){l&&(i({x:(t.x||0)+d.current.west,y:(t.y||0)+d.current.north,width:t.width+d.current.east-d.current.west,height:t.height+d.current.south-d.current.north}),s.current=void 0,c.current=void 0,d.current.east=0,d.current.west=0,d.current.north=0,d.current.south=0,u(!1))}}),[l,i,t.height,t.width,t.x,t.y]),e.useEffect((function(){var t=function(){f.current&&f.current()};return window.addEventListener("pointerup",t),window.addEventListener("touchend",t),function(){window.removeEventListener("pointerup",t),window.removeEventListener("touchend",t)}}),[]),{portalRef:a,mode:n,mouseEvent:function(t){return function(e){if(u(!0),o&&r){var i=o.top,n=o.left,a=r.viewerToWorld(e.pageX-n,e.pageY-i);c.current={x:a.x,y:a.y},s.current=t}}},onPointerMoveCallback:p,isEditing:l}},hi=function(t){var i=t.handleSize,n=void 0===i?9:i,r=t.resizable,s=t.onSave,a=t.children,c=d(t,["handleSize","resizable","onSave","children"]),h=ci({x:c.x||0,y:c.y||0,width:c.width,height:c.height},s),l=h.portalRef,p=h.mode,f=h.mouseEvent,g=h.isEditing,v=e.useMemo((function(){return f("translate")}),[f]),y=e.useMemo((function(){return f("east")}),[f]),m=e.useMemo((function(){return f("west")}),[f]),w=e.useMemo((function(){return f("south")}),[f]),b=e.useMemo((function(){return f("north")}),[f]),x=e.useMemo((function(){return f("south-east")}),[f]),E=e.useMemo((function(){return f("south-west")}),[f]),S=e.useMemo((function(){return f("north-east")}),[f]),O=e.useMemo((function(){return f("north-west")}),[f]);return o.createElement(o.Fragment,null,o.createElement("world-object",u({},c),a,"sketch"===p&&r?o.createElement(si,{ref:l,target:{x:0,y:0,height:c.height,width:c.width},relative:!0,interactive:!1},"sketch"===p&&r?o.createElement(o.Fragment,null,o.createElement("div",{onMouseDown:v,onTouchStart:v,style:{display:"block",width:"100%",height:"100%",border:"1px dashed #999",boxSizing:"border-box",pointerEvents:g?"none":"sketch"===p?"initial":"none"}}),o.createElement("div",{title:"east",onTouchStart:y,onMouseDown:y,style:{cursor:"e-resize",position:"absolute",background:"#fff",height:2*n,width:n,right:0,top:"50%",transform:"translate(".concat(n/2,"px, -").concat(n,"px)"),zIndex:999,boxShadow:"0px 2px 3px 0 rgba(0,0,0,0.5)",border:"1px solid #999",pointerEvents:g?"none":"sketch"===p?"initial":"none"}}),o.createElement("div",{title:"west",onMouseDown:m,style:{cursor:"w-resize",position:"absolute",background:"#fff",height:2*n,width:n,left:0,top:"50%",transform:"translate(-".concat(n/2,"px, -").concat(n,"px)"),zIndex:999,boxShadow:"0px 2px 3px 0 rgba(0,0,0,0.5)",border:"1px solid #999",pointerEvents:g?"none":"sketch"===p?"initial":"none"}}),o.createElement("div",{title:"north",onMouseDown:b,style:{cursor:"n-resize",position:"absolute",background:"#fff",height:n,width:2*n,left:"50%",top:0,transform:"translate(-".concat(n,"px, -").concat(n/2,"px)"),zIndex:999,boxShadow:"0px 2px 3px 0 rgba(0,0,0,0.5)",border:"1px solid rgba(0,0,0,.5)",pointerEvents:g?"none":"sketch"===p?"initial":"none"}}),o.createElement("div",{title:"south",onMouseDown:w,style:{cursor:"s-resize",position:"absolute",background:"#fff",height:n,width:2*n,left:"50%",bottom:0,transform:"translate(-".concat(n,"px, ").concat(n/2,"px)"),zIndex:999,boxShadow:"0px 2px 3px 0 rgba(0,0,0,0.5)",border:"1px solid #999",pointerEvents:g?"none":"sketch"===p?"initial":"none"}}),o.createElement("div",{title:"north-east",onMouseDown:S,style:{cursor:"ne-resize",position:"absolute",background:"#fff",height:n,width:n,right:0,top:0,transform:"translate(".concat(n/2,"px, -").concat(n/2,"px)"),zIndex:999,boxShadow:"0px 2px 3px 0 rgba(0,0,0,0.5)",border:"1px solid #999",pointerEvents:g?"none":"sketch"===p?"initial":"none"}}),o.createElement("div",{title:"south-east",onMouseDown:x,style:{cursor:"se-resize",position:"absolute",background:"#fff",height:n,width:n,bottom:0,right:0,transform:"translate(".concat(n/2,"px, ").concat(n/2,"px)"),zIndex:999,boxShadow:"0px 2px 3px 0 rgba(0,0,0,0.5)",border:"1px solid #999",pointerEvents:g?"none":"sketch"===p?"initial":"none"}}),o.createElement("div",{title:"south-west",onMouseDown:E,style:{cursor:"sw-resize",position:"absolute",background:"#fff",height:n,width:n,bottom:0,left:0,transform:"translate(-".concat(n/2,"px, ").concat(n/2,"px)"),zIndex:999,boxShadow:"0px 2px 3px 0 rgba(0,0,0,0.5)",border:"1px solid #999",pointerEvents:g?"none":"sketch"===p?"initial":"none"}}),o.createElement("div",{title:"north-west",onMouseDown:O,style:{cursor:"nw-resize",position:"absolute",background:"#fff",height:n,width:n,top:0,left:0,transform:"translate(-".concat(n/2,"px, -").concat(n/2,"px)"),zIndex:999,boxShadow:"0px 2px 3px 0 rgba(0,0,0,0.5)",border:"1px solid #999",pointerEvents:g?"none":"sketch"===p?"initial":"none"}})):null):null))},li=function(t){var i=t.width/t.tiles.width,n=t.tiles.imageService.tiles||[],r=t.tiles.imageService.sizes||[],s=e.useMemo((function(){var e=t.tiles.imageService.id||t.tiles.imageService["@id"];return e&&e.endsWith("/info.json")?e.slice(0,-1*"/info.json".length):e}),[t.tiles.imageService.id]);return o.createElement("world-object",{key:t.tiles.imageService.id,scale:i,height:t.tiles.height,width:t.tiles.width,x:t.x,y:t.y},o.createElement("composite-image",{key:t.tiles.imageService.id,id:t.tiles.imageService.id,width:t.tiles.width,height:t.tiles.height},t.tiles.thumbnail?o.createElement("world-image",{priority:!0,uri:t.tiles.thumbnail.id,target:{width:t.tiles.width,height:t.tiles.height},display:{width:t.tiles.thumbnail.width,height:t.tiles.thumbnail.height}}):null,r.map((function(e,i){return o.createElement("world-image",{key:i,uri:"".concat(s,"/full/").concat(e.width,",").concat(e.height,"/0/default.jpg"),target:{width:t.tiles.width,height:t.tiles.height},display:{width:e.width,height:e.height}})})),n.map((function(e){return(e.scaleFactors||[]).map((function(i){return o.createElement("tiled-image",{key:"".concat(t.tiles.imageService.id,"-tile-").concat(i),uri:t.tiles.imageService.id,display:{width:t.tiles.width,height:t.tiles.height},tile:e,scaleFactor:i})}))}))))};var ui=function(t){var e,i=t.Symbol;return"function"==typeof i?i.observable?e=i.observable:(e=i("observable"),i.observable=e):e="@@observable",e}("undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof module?module:Function("return this")()),di=function(){return Math.random().toString(36).substring(7).split("").join(".")},pi={INIT:"@@redux/INIT"+di(),REPLACE:"@@redux/REPLACE"+di(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+di()}};function fi(t){if("object"!=typeof t||null===t)return!1;for(var e=t;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}function gi(t,e,i){var n;if("function"==typeof e&&"function"==typeof i||"function"==typeof i&&"function"==typeof arguments[3])throw new Error("It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function.");if("function"==typeof e&&void 0===i&&(i=e,e=void 0),void 0!==i){if("function"!=typeof i)throw new Error("Expected the enhancer to be a function.");return i(gi)(t,e)}if("function"!=typeof t)throw new Error("Expected the reducer to be a function.");var r=t,o=e,s=[],a=s,c=!1;function h(){a===s&&(a=s.slice())}function l(){if(c)throw new Error("You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return o}function u(t){if("function"!=typeof t)throw new Error("Expected the listener to be a function.");if(c)throw new Error("You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api-reference/store#subscribelistener for more details.");var e=!0;return h(),a.push(t),function(){if(e){if(c)throw new Error("You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api-reference/store#subscribelistener for more details.");e=!1,h();var i=a.indexOf(t);a.splice(i,1),s=null}}}function d(t){if(!fi(t))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if(void 0===t.type)throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(c)throw new Error("Reducers may not dispatch actions.");try{c=!0,o=r(o,t)}finally{c=!1}for(var e=s=a,i=0;i<e.length;i++){(0,e[i])()}return t}function p(t){if("function"!=typeof t)throw new Error("Expected the nextReducer to be a function.");r=t,d({type:pi.REPLACE})}function f(){var t,e=u;return(t={subscribe:function(t){if("object"!=typeof t||null===t)throw new TypeError("Expected the observer to be an object.");function i(){t.next&&t.next(l())}return i(),{unsubscribe:e(i)}}})[ui]=function(){return this},t}return d({type:pi.INIT}),(n={dispatch:d,subscribe:u,getState:l,replaceReducer:p})[ui]=f,n}function vi(t,e){var i=e&&e.type;return"Given "+(i&&'action "'+String(i)+'"'||"an action")+', reducer "'+t+'" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.'}function yi(t){for(var e=Object.keys(t),i={},n=0;n<e.length;n++){var r=e[n];"function"==typeof t[r]&&(i[r]=t[r])}var o,s=Object.keys(i);try{!function(t){Object.keys(t).forEach((function(e){var i=t[e];if(void 0===i(void 0,{type:pi.INIT}))throw new Error('Reducer "'+e+"\" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.");if(void 0===i(void 0,{type:pi.PROBE_UNKNOWN_ACTION()}))throw new Error('Reducer "'+e+"\" returned undefined when probed with a random type. Don't try to handle "+pi.INIT+' or other actions in "redux/*" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.')}))}(i)}catch(t){o=t}return function(t,e){if(void 0===t&&(t={}),o)throw o;for(var n=!1,r={},a=0;a<s.length;a++){var c=s[a],h=i[c],l=t[c],u=h(l,e);if(void 0===u){var d=vi(c,e);throw new Error(d)}r[c]=u,n=n||u!==l}return(n=n||s.length!==Object.keys(t).length)?r:t}}function mi(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function wi(t,e){var i=Object.keys(t);return Object.getOwnPropertySymbols&&i.push.apply(i,Object.getOwnPropertySymbols(t)),e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i}function bi(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?wi(i,!0).forEach((function(e){mi(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):wi(i).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function xi(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return 0===e.length?function(t){return t}:1===e.length?e[0]:e.reduce((function(t,e){return function(){return t(e.apply(void 0,arguments))}}))}var Ei=j((function(t,e){!function(t){function e(t){return null==t}function i(t){throw new Error("Argument "+t+" is empty.")}function n(t){return"function"==typeof t&&"getType"in t}function r(t){throw new Error("Argument "+t+' is invalid, it should be an action-creator instance from "typesafe-actions"')}function o(t,e){if(null==t)throw new Error("Argument contains array with empty element at index "+e);if(null==t.getType)throw new Error("Argument contains array with invalid element at index "+e+', it should be an action-creator instance from "typesafe-actions"')}function s(t){return"string"==typeof t||"symbol"==typeof t}function a(t){return!s(t)}function c(t){throw new Error("Argument "+t+" is invalid, it should be an action type of type: string | symbol")}function h(t,e){if(null==t)throw new Error("Argument contains array with empty element at index "+e);if("string"!=typeof t&&"symbol"!=typeof t)throw new Error("Argument contains array with invalid element at index "+e+", it should be of type: string | symbol")}function l(t,n,o,s){return e(t)&&i(1),a(t)&&r(1),{type:t,payload:n,meta:o,error:s}}function u(t,n){return e(t)&&i(1),a(t)&&c(1),Object.assign((function(){var e=null!=n?n.apply(void 0,arguments):void 0;return Object.assign({type:t},e)}),{getType:function(){return t},toString:function(){return t}})}function d(t,n,r){return e(t)&&i(1),a(t)&&c(1),function(){return u(t,(function(){var t=arguments.length<=0?void 0:arguments[0],e=arguments.length<=1?void 0:arguments[1];return null==n&&null==r||(t=null!=n?n.apply(void 0,arguments):void 0,e=null!=r?r.apply(void 0,arguments):void 0),Object.assign({},void 0!==t&&{payload:t},{},void 0!==e&&{meta:e})}))}}function p(t){return e(t)&&i(1),n(t)||r(1),t.getType()}function f(t,n){e(t)&&i(1),a(t)&&c(1);var r=null!=n?n(t):function(){return{type:t}};return Object.assign(r,{getType:function(){return t},toString:function(){return t}})}var g={createAction:function(t,e){var i=null==e?function(){return l(t)}:e(l.bind(null,t));return Object.assign(i,{getType:function(){return t},toString:function(){return t}})},createCustomAction:f,createStandardAction:function(t){return e(t)&&i(1),a(t)&&c(1),Object.assign((function(){return f(t,(function(t){return function(e,i){return{type:t,payload:e,meta:i}}}))}),{map:function(e){return f(t,(function(t){return function(i,n){return Object.assign(e(i,n),{type:t})}}))}})}};t.action=l,t.createAction=d,t.createAsyncAction=function(t,e,i,n){return function(){var r=[t,e,i,n].map((function(t,e){return Array.isArray(t)?d(t[0],t[1],t[2])():"string"==typeof t||"symbol"==typeof t?d(t)():void(e<3&&function(t){throw new Error("Argument "+t+' is invalid, it should be an action type of "string | symbol" or a tuple of "[string | symbol, Function, Function?]"')}(e))}));return{request:r[0],success:r[1],failure:r[2],cancel:r[3]}}},t.createCustomAction=u,t.createReducer=function t(e,i){void 0===i&&(i={});var r=Object.assign({},i),o=function(i,o){var a=Array.isArray(i)?i:[i],c={};return a.map((function(t,e){return n(t)?p(t):s(t)?t:function(t){throw new Error("Argument "+t+' is invalid, it should be an action-creator instance from "typesafe-actions" or action type of type: string | symbol')}(e+1)})).forEach((function(t){return c[t]=o})),t(e,Object.assign({},r,{},c))};return Object.assign((function(t,i){if(void 0===t&&(t=e),r.hasOwnProperty(i.type)){var n=r[i.type];if("function"!=typeof n)throw Error('Reducer under "'+i.type+'" key is not a valid reducer');return n(t,i)}return t}),{handlers:Object.assign({},r),handleAction:o,handleType:o})},t.deprecated=g,t.getType=p,t.isActionOf=function(t,n){e(t)&&i(1);var r=Array.isArray(t)?t:[t];r.forEach(o);var s=function(t){return r.some((function(e){return t.type===e.getType()}))};return void 0===n?s:s(n)},t.isOfType=function(t,n){e(t)&&i(1);var r=Array.isArray(t)?t:[t];r.forEach(h);var o=function(t){return r.includes(t.type)};return void 0===n?o:o(n)}}(e)}));function Si(t){return t.endsWith("info.json")?t:t.endsWith("/")?t+"info.json":t+"/info.json"}const Oi="http://library.stanford.edu/iiif/image-api/compliance.html#level1",Pi="http://library.stanford.edu/iiif/image-api/compliance.html#level2",Ci="http://library.stanford.edu/iiif/image-api/conformance.html#level1",Ri="http://library.stanford.edu/iiif/image-api/conformance.html#level2",_i="http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level1",Ai="http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level2",Ti="http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level1",Ii="http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level2",ji="http://iiif.io/api/image/1/level1.json",Mi="http://iiif.io/api/image/1/profiles/level1.json",Li="http://iiif.io/api/image/1/level2.json",ki="http://iiif.io/api/image/1/profiles/level2.json",Fi="http://iiif.io/api/image/2/level1.json",Di="http://iiif.io/api/image/2/profiles/level1.json",zi="http://iiif.io/api/image/2/level2.json",Bi="http://iiif.io/api/image/2/profiles/level2.json",Ui="level1",Ni="level2",Wi="http://iiif.io/api/image/2/level1",Hi="http://iiif.io/api/image/2/level2",qi=[Hi,Pi,Ri,Ai,Ii,Li,ki,zi,Bi,Ni],Qi=[...qi,Wi,Oi,Ci,_i,Ti,ji,Mi,Fi,Di,Ui],Vi=["http://iiif.io/api/image/2/level0",Wi,Hi,"http://library.stanford.edu/iiif/image-api/compliance.html#level0",Oi,Pi,"http://library.stanford.edu/iiif/image-api/conformance.html#level0",Ci,Ri,"http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level0",_i,Ai,"http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level0",Ti,Ii,"http://iiif.io/api/image/1/level0.json","http://iiif.io/api/image/1/profiles/level0.json",ji,Mi,Li,ki,"http://iiif.io/api/image/2/level0.json","http://iiif.io/api/image/2/profiles/level0.json",Fi,Di,zi,Bi,"level0",Ui,Ni],Xi={extraFormats:["jpg"],extraQualities:["default"],extraFeatures:["sizeByWhListed"]},Yi={extraFormats:["jpg"],extraQualities:["default"],extraFeatures:["baseUriRedirect","cors","jsonldMediaType","regionByPx","regionSquare","sizeByWhListed","sizeByH","sizeByW","sizeByWh"]},Zi={extraFormats:["jpg","png"],extraQualities:["default"],extraFeatures:["baseUriRedirect","cors","jsonldMediaType","regionByPct","regionByPx","regionSquare","rotationBy90s","sizeByWhListed","sizeByConfinedWh","sizeByH","sizeByPct","sizeByW","sizeByWh"]};function $i(t){return-1!==qi.indexOf(t)?Zi:-1!==Qi.indexOf(t)?Yi:Xi}function Gi(t){try{if("full"===t)return{full:!0};if("square"===t)return{square:!0};const e=t.startsWith("pct:"),i=t.substr(e?4:0).split(",").map(t=>parseFloat(t));return{x:i[0],y:i[1],w:i[2],h:i[3],percent:e}}catch{throw new Error("Expected 'full', 'square' or 'x,y,w,h'. Found "+t)}}function Ki(t){const e={upscaled:!1,max:!1,confined:!1};if("^"===t[0]&&(e.upscaled=!0,t=t.slice(1)),"max"===t||"full"===t)return e.max=!0,e.serialiseAsFull="full"===t,e;if("!"===t[0]&&(e.confined=!0,t=t.slice(1)),"p"===t[0])return e.percentScale=parseFloat(t.slice(4)),e;const i=t.split(",").map(t=>t.trim());return i.length&&(""!==i[0]&&(e.width=parseInt(i[0],10)),""!==i[1]&&(e.height=parseInt(i[1],10))),e}function Ji(t){const e={angle:0};if("!"===t[0]&&(e.mirror=!0,t=t.substr(1)),e.angle=parseFloat(t)%360,Number.isNaN(e.angle))throw new Error("Invalid rotation "+t);return e}function tn(t){const e=function(t,e=""){const i=t.match(/^(([a-zA-Z]+):\/\/([^\/]+))?((.*)+)/);if(!i)throw new Error("Invalid or unknown input "+t);const n=i[2],r=i[3];let o=i[4];if("/"===o[0]&&(o=o.substr(1)),e.length>0){if("/"===e[0]&&(e=e.substr(1)),e!==o.substr(0,e.length))throw new Error(`Path does not start with prefix (path: ${o}, prefix: ${e})`);o=o.substr(e.length)}const s=o.split("/").reverse(),[a,c,h,l,...u]=s,d=u.reverse().filter(Boolean).join("/");if(1===s.length||""===a)return{type:"base",scheme:n,server:r,prefix:e,identifier:d};if("info.json"===a){const[,...t]=s;return{type:"info",scheme:n,server:r,prefix:e,identifier:t.reverse().filter(Boolean).join("/")}}const p=a.split(".");return{type:"image",scheme:n,server:r,prefix:e,identifier:d,originalPath:o,region:Gi(l),size:Ki(h),rotation:Ji(c),quality:p[0],format:p[1]}}(Si(t.id));if("info"!==e.type)throw new Error("Invalid service URL");const i=function(t){const e=t?Array.isArray(t.profile)?t.profile:[t.profile]:[],i={extraQualities:[],extraFormats:[],extraFeatures:[]};for(let t of e)if("string"==typeof t&&(t=$i(t)),t){if(t.formats)for(const e of t.formats)-1===i.extraFormats.indexOf(e)&&i.extraFormats.push(e);if(t.qualities)for(const e of t.qualities)-1===i.extraQualities.indexOf(e)&&i.extraQualities.push(e);if(t.supports)for(const e of t.supports)-1===i.extraFeatures.indexOf(e)&&i.extraFeatures.push(e);if(t.maxHeight&&(i.maxHeight=t.maxHeight),t.maxWidth&&(i.maxWidth=t.maxWidth),t.maxArea&&(i.maxArea=t.maxArea),t.extraFormats)for(const e of t.extraFormats)-1===i.extraFormats.indexOf(e)&&i.extraFormats.push(e);if(t.extraQualities)for(const e of t.extraQualities)-1===i.extraQualities.indexOf(e)&&i.extraQualities.push(e);if(t.extraFeatures)for(const e of t.extraFeatures)-1===i.extraFeatures.indexOf(e)&&i.extraFeatures.push(e);t.maxHeight&&(i.maxHeight=t.maxHeight),t.maxWidth&&(i.maxWidth=t.maxWidth),t.maxArea&&(i.maxArea=t.maxArea)}if(t.extraFormats)for(const e of t.extraFormats)-1===i.extraFormats.indexOf(e)&&i.extraFormats.push(e);if(t.extraFeatures)for(const e of t.extraFeatures)-1===i.extraFeatures.indexOf(e)&&i.extraFeatures.push(e);if(t.extraQualities)for(const e of t.extraQualities)-1===i.extraQualities.indexOf(e)&&i.extraQualities.push(e);return i}(t);return{identifier:e.identifier,originalPath:"",server:e.server,prefix:e.prefix,scheme:e.scheme,type:"image",quality:-1===i.extraQualities.indexOf("default")?i.extraQualities[0]:"default",region:{full:!0},size:{max:!0,upscaled:!1,confined:!1},format:"jpg",rotation:{angle:0}}}function en(t,e,i){const n=i.length,r=[];for(let e=0;e<n;e++){const n=i[e].width;r.push(t/n)}return r}function nn(t,e,i){const n=i.length,r=[];for(let o=0;o<n;o++){const n=i[o];r.push({width:Math.floor(t/n),height:Math.floor(e/n)})}return r}function rn(t){return t["@id"]?t["@id"]:t.id?t.id:void 0}function on(t){if(!t||!t.profile||!rn(t))return!1;const e=Array.isArray(t.profile)?t.profile:[t.profile];for(const t of e)if("string"==typeof t&&-1!==Vi.indexOf(t))return!0;return!1}function sn(t){if(!function(t){if(!on(t))return!1;const e=Array.isArray(t.profile)?t.profile:[t.profile];for(const t of e)if("string"==typeof t){if(-1!==Qi.indexOf(t))return!0}else{const e=[...t.supports||[],...t.extraFeatures||[]];if(-1!==e.indexOf("regionByPx")&&(-1!==e.indexOf("sizeByW")||-1!==e.indexOf("sizeByWh")))return!0}return!1}(t))return[];const e=[],i=Array.isArray(t.profile)?t.profile:[t.profile],n=i.length;for(let e=0;e<n;e++){const n=i[e];if("string"!=typeof n&&(n.maxHeight||n.maxWidth))return[{id:rn(t),type:"variable",minWidth:0,minHeight:0,maxHeight:n.maxHeight||n.maxWidth,maxWidth:n.maxWidth||n.maxHeight}]}if(t.tiles){const i=t.tiles.length;for(let n=0;n<i;n++){const i=t.tiles[n];(i.height||i.width)&&e.push({id:rn(t),type:"variable",minHeight:0,minWidth:0,maxHeight:i.height||i.width,maxWidth:i.width})}}return e}function an(t){const e=t.match(/^.*\/(full)\/(((\d+),(\d+)?)|max)\/(\d+)\/default\.(jpg|png|jpeg)$/);if(e){const i=e[1],n=parseInt(e[4],10),r=parseInt(e[5],10),o=e[7];if(("max"===i||"full"===i)&&n&&r&&o)return{type:"fixed",id:t,height:r,width:n}}return{type:"unknown",id:t}}function cn(t){if("string"==typeof t)return an(t);const e=function(t){return t["@type"]?t["@type"]:t.type?t.type:void 0}(t);if("Image"!==e&&"sc:Image"!==e)return null;const i=t,n=rn(i);return n?n&&i.width&&i.height?{id:n,type:"fixed",width:i.width,height:i.height,unsafe:!0}:an(n):null}function hn(t){return on(t)?(t&&t.sizes?t.sizes:[]).map(e=>({id:rn(t),type:"fixed-service",height:e.height,width:e.width})):[]}function ln(t){const e=[],i=t.length;for(let n=0;n<i;n++){const i=hn(t[n]);i.length&&e.push(...i);const r=sn(t[n]);r.length&&e.push(...r)}return e}function un(t){const e=t.service?Array.isArray(t.service)?t.service:[t.service]:[],i=e.length,n=[];for(let t=0;t<i;t++)on(e[t])&&n.push(e[t]);return n}function dn({x:t=0,y:e=0,w:i,h:n,full:r,square:o,percent:s}){if(r)return"full";if(o)return"square";if(typeof i>"u"||typeof n>"u")throw new Error("RegionParameter: invalid region");const a=`${t},${e},${i},${n}`;return s?"pct:"+a:a}function pn({max:t,percentScale:e,upscaled:i,confined:n,width:r,height:o,serialiseAsFull:s}){const a=[];return i&&a.push("^"),t?(a.push(s?"full":"max"),a.join("")):(n&&a.push("!"),e&&a.push("pct:"+e),r&&a.push(""+r),a.push(","),o&&a.push(""+o),a.join(""))}function fn(t){return`${t.mirror?"!":""}${(t.angle||0)%360}`}var gn=Object.defineProperty,vn=Object.defineProperties,yn=Object.getOwnPropertyDescriptors,mn=Object.getOwnPropertySymbols,wn=Object.prototype.hasOwnProperty,bn=Object.prototype.propertyIsEnumerable,xn=(t,e,i)=>e in t?gn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,En=(t,e)=>{for(var i in e||(e={}))wn.call(e,i)&&xn(t,i,e[i]);if(mn)for(var i of mn(e))bn.call(e,i)&&xn(t,i,e[i]);return t},Sn=(t,e)=>vn(t,yn(e));function On(t,e){const i=t.prefix.startsWith("/")?t.prefix.substr(1):t.prefix,n=`${t.scheme}://${t.server}/${i?i+"/":""}${t.identifier}`;if("base"===t.type)return n;if("info"===t.type)return n+"/info.json";let{region:r,size:o,rotation:s,format:a,quality:c}=t;if(e){const t=e["@context"]?Array.isArray(e["@context"])?e["@context"]:[e["@context"]]:[],i=-1!==t.indexOf("http://iiif.io/api/image/2/context.json"),n=-1!==t.indexOf("http://iiif.io/api/image/3/context.json");if((o.width===e.width&&!o.height||o.height===e.height&&!o.width||o.width===e.width&&o.height===e.height)&&(o=Sn(En({},o),{max:!0})),i&&(o.max&&!o.serialiseAsFull&&(o=Sn(En({},o),{serialiseAsFull:!0})),!o.max&&o.width&&o.height&&(o=Sn(En({},o),{height:void 0}))),n&&(o.max&&o.serialiseAsFull&&(o=Sn(En({},o),{serialiseAsFull:!1})),o.width&&!o.height&&e.width&&e.height)){const t=e.height/e.width;o=Sn(En({},o),{height:Math.ceil(o.width*t)})}}return[n,dn(r),pn(o),fn(s),`${c}.${a}`].filter(Boolean).join("/")}function Pn(t,e,i){const n=tn({id:Si(rn(t)),profile:"level2",type:"ImageService2"});if("image"!==n.type)throw new Error("Invalid service");return n.size.max=!1,n.size.width=e,n.size.height=i,{id:On(n),type:"fixed",width:e,height:i||t.height/(t.width||1)*e,unsafe:t.width>e}}function Cn(t){const e=t.replace(/(https?:\/\/)?(www.)?/i,"");return-1!==e.indexOf("/")?e.split("/")[0]:e}function Rn(t,e){const i=[],n=Object.assign({unsafeImageService:!1,atAnyCost:!0,fallback:!0,minHeight:64,minWidth:64,maxHeight:1/0,maxWidth:1/0,returnAllOptions:!1,preferFixedSize:!1,allowUnsafe:!1,explain:!1,height:0,width:0},t),r=[],o=[];let s=null;const a=(t,e)=>{if(function(t,e,i){const n=t.width?t.width:t.maxWidth;return i.height<=t.maxHeight&&i.width<=t.maxWidth&&i.height>=t.minHeight&&i.width>=t.minWidth&&(!e||Math.abs(i.width-n)<Math.abs(e.width-n))}(n,e,t)){if(n.preferFixedSize&&t.unsafe)return void o.push(t);n.returnAllOptions&&e&&o.push(e),s=t}else n.returnAllOptions&&o.push(t)},c=e.length;for(let t=0;t<c;t++){const i=e[t](),o=i.length;for(let t=0;t<o;t++){const e=i[t];if("unknown"===e.type&&n.atAnyCost&&r.push(e),"fixed"===e.type&&(e.unsafe?r.push(e):a(e,s)),"fixed-service"===e.type)if(n.unsafeImageService){a(Pn(e,n.width,n.height),s)}else{a(Pn(e,e.width,e.height),s)}if("variable"===e.type&&e.maxWidth){a(Pn({id:e.id,type:"fixed-service",width:e.maxWidth,height:e.maxWidth},e.maxWidth),s)}}if(s&&!n.returnAllOptions){if(s.unsafe||n.allowUnsafe)continue;break}}return n.atAnyCost&&0===o.length?{best:s||r[0],fallback:r.slice(1),log:i}:n.returnAllOptions?{best:n.atAnyCost?s||o[0]||r[0]:s||o[0],fallback:[...o,...r],log:i}:{best:s||o[0]||null,fallback:s?o:o.slice(1),log:i}}var _n=Object.defineProperty,An=Object.defineProperties,Tn=Object.getOwnPropertyDescriptors,In=Object.getOwnPropertySymbols,jn=Object.prototype.hasOwnProperty,Mn=Object.prototype.propertyIsEnumerable,Ln=(t,e,i)=>e in t?_n(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,kn=(t,e)=>{for(var i in e||(e={}))jn.call(e,i)&&Ln(t,i,e[i]);if(In)for(var i of In(e))Mn.call(e,i)&&Ln(t,i,e[i]);return t},Fn=(t,e)=>An(t,Tn(e));function Dn(t,e,i){const n=t>e?t:e,r=i.length,o=[];for(let t=0;t<r;t++){const e=i[t];let r=e.scaleFactors[0],s=n/r;const a=[r];for(;s>=e.width;)r*=2,a.push(r),s/=2;o.push(Fn(kn({},e),{scaleFactors:a}))}return o}var zn=(t,e,i)=>new Promise((n,r)=>{var o=t=>{try{a(i.next(t))}catch(t){r(t)}},s=t=>{try{a(i.throw(t))}catch(t){r(t)}},a=t=>t.done?n(t.value):Promise.resolve(t.value).then(o,s);a((i=i.apply(t,e)).next())});class Bn{constructor(){this.config={verificationsRequired:1,approximateServices:!0,enableFetching:!0,disableThrottling:!1},this.fetchingCount=0,this.imageServices={},this.knownImageServers={}}setConfig(t){Object.assign(this.config,t)}sample(t,e,i=!0){const n=Cn(rn(t)),r=Si(rn(t)),o=this.knownImageServers[n];return this.imageServices[r]=Object.assign(t,{real:!0}),o?this.verify(t):(this.knownImageServers[n]={verifications:0,malformed:!1,root:n,preLoaded:i,sampledId:rn(t),verified:!1,server:null,result:{context:t["@context"]||[],sampledProfile:t.profile,resourceServiceRatio:e&&t.height?e.height/t.height:1,sampledSizes:t.sizes||[],sizeRatios:en(t.width,t.height,t.sizes||[]),sampledTiles:t.tiles||[]}},!0)}preLoad(t,e=!0){this.knownImageServers[t.root]=t,e&&(this.knownImageServers[t.root].malformed=!1,this.knownImageServers[t.root].verifications=this.config.verificationsRequired)}predict(t,e=!1,i=!1){const n=Cn(rn(t)),r=this.knownImageServers[n];if(!r||!r.result||!i&&(r.malformed||r.verifications<this.config.verificationsRequired))return null;const o=Si(rn(t));return this.imageServices[o]||(this.imageServices[o]={"@context":r.result.context,"@id":rn(t),id:rn(t),protocol:"http://iiif.io/api/image",tiles:Dn(t.width,t.height,r.result.sampledTiles),sizes:nn(Math.floor(t.width/r.result.resourceServiceRatio),Math.floor(t.height/r.result.resourceServiceRatio),r.result.sizeRatios),profile:r.result.sampledProfile,height:t.height,width:t.width,real:!1}),this.imageServices[o]}getThumbnailFromResource(t,e){return zn(this,arguments,(function*(t,e,i=!0,n=[]){const r=yield this.getImageCandidates(t,i);return Rn(e,[()=>n,()=>r])}))}getImageCandidates(t,e=!0){return zn(this,null,(function*(){const i=t;if(e&&i.height&&i.width){const t=un(i);for(const e of t){const t={id:rn(e),width:e.width?e.width:i.width,height:e.height?e.height:i.height};yield this.loadService(t)}}return function(t,e=!0,i){const n=[],r=cn(t);if(null===r)return n;const o=t;if(n.push(r),e&&o.width&&o.height){const t=[],e=un(o);for(const n of e){const e={id:rn(n),width:o.width,height:o.height};if(i.canLoadSync(e)){const n=i.loadServiceSync(e);n&&(n.height||(n.height=o.height),n.width||(n.width=o.width),t.push(...ln([n])))}}if(t.length)return n.push(...t),n}return o.service&&n.push(...ln(o.service)),n}(t,e,this)}))}verify(t){return zn(this,null,(function*(){const e=this.predict(t,!1,!0),i=yield this.fetchService(rn(t));if(!e)return!1;const n=e.height===i.height&&e.width===i.width&&e["@context"]===i["@context"]&&function(t,e){if(t.length!==e.length)return!1;if(0===t.length&&0===e.length)return!0;const i=t.length;let n=!0;for(let r=0;r<i;r++){const i=t[r],o=e[r];if(i.width!==o.width||i.height!==o.height){n=!1;break}}if(n)return!0;let r=0;for(let n=0;n<i;n++)for(let o=0;o<i;o++)if(t[n].width===e[o].width&&t[n].height===e[o].height){r++;break}return r===i}(e.sizes||[],i.sizes||[]);if(n){const e=Cn(rn(t));this.knownImageServers[e].verifications+=1,this.knownImageServers[e].verifications>=this.config.verificationsRequired&&(this.knownImageServers[e].verified=!0)}return n}))}canLoadSync(t){const e="string"==typeof t?t:rn(t),i=Si(e);if(this.imageServices[i])return!0;const n=this.knownImageServers[Cn(e)];return n&&!n.malformed&&n.verifications>=this.config.verificationsRequired}markAsMalformed(t){return zn(this,null,(function*(){return this.knownImageServers[Cn(rn(t))].malformed=!0,this.loadService(t,!0)}))}fetchService(t,e=!1){return zn(this,null,(function*(){const i=Si(t);if(this.imageServices[i]&&(!e||this.imageServices[i].real))return this.imageServices[i];if(!this.config.enableFetching)throw new Error("Fetching is not enabled");const n=yield this.fetch(i).then(t=>t.json());return!n.id&&n["@id"]&&(n.id=n["@id"]),n.id!==t&&(n.id=t,n["@id"]&&(n["@id"]=t)),this.imageServices[i]=Object.assign(n,{real:!0}),this.imageServices[i]}))}fetch(t,e){return zn(this,null,(function*(){return fetch(t,e)}))}loadService(t,e=!1){return zn(this,null,(function*(){if(!this.config.disableThrottling){let t=!0;for(;t;){if(!(this.fetchingCount>=this.config.verificationsRequired)){t=!1;break}yield new Promise(t=>setTimeout(t,500))}}const i=this.knownImageServers[Cn(rn(t))];if(i&&!i.malformed&&!e){yield i.result;const e=this.loadServiceSync(t);if(e)return e}this.fetchingCount++;const n=yield this.fetchService(rn(t),e);return this.fetchingCount--,n.real&&this.sample(n,t),n}))}loadServiceSync(t){const e=Si(rn(t));return this.imageServices[e]?this.imageServices[e]:this.predict(t)}}const Un=["sc:Collection","sc:Manifest","sc:Canvas","oa:AnnotationList","oa:Annotation","sc:Range","sc:Layer","sc:Sequence","oa:Choice","Service","ContentResource"];class Nn{constructor(t,e={}){this.traversals=Object.assign({collection:[],manifest:[],canvas:[],annotationList:[],sequence:[],annotation:[],contentResource:[],choice:[],range:[],service:[],layer:[]},t),this.options=Object.assign({convertPropsToArray:!0,mergeMemberProperties:!0,allowUndefinedReturn:!1},e)}static all(t){return new Nn({collection:[t],manifest:[t],canvas:[t],annotationList:[t],sequence:[t],annotation:[t],contentResource:[t],choice:[t],range:[t],service:[t],layer:[t]})}traverseCollection(t){return this.traverseType(this.traverseDescriptive(this.traverseLinking(this.traverseCollectionItems(t))),this.traversals.collection)}traverseCollectionItems(t){if(this.options.mergeMemberProperties){const e=[...(t.manifests||[]).map(t=>"string"==typeof t?{"@id":t,"@type":"sc:Manifest"}:t),...(t.collections||[]).map(t=>"string"==typeof t?{"@id":t,"@type":"sc:Collection"}:t),...t.members||[]];delete t.collections,delete t.manifests,t.members=e}return t.manifests&&(t.manifests=t.manifests.map(t=>this.traverseManifest("string"==typeof t?{"@id":t,"@type":"sc:Manifest"}:t))),t.collections&&(t.collections=t.collections.map(t=>this.traverseCollection("string"==typeof t?{"@id":t,"@type":"sc:Collection"}:t))),t.members&&(t.members=t.members.map(t=>"string"==typeof t?t:this.traverseUnknown(t))),t}traverseManifest(t){return this.traverseType(this.traverseDescriptive(this.traverseLinking(this.traverseManifestItems(t))),this.traversals.manifest)}traverseManifestItems(t){return t.sequences&&(t.sequences=t.sequences.map(t=>this.traverseSequence(t))),t.structures&&(t.structures=t.structures.map(t=>this.traverseRange(t))),t}traverseSequence(t){return this.traverseType(this.traverseDescriptive(this.traverseLinking(this.traverseSequenceItems(t))),this.traversals.sequence)}traverseSequenceItems(t){return t.canvases&&(t.canvases=t.canvases.map(t=>this.traverseCanvas(t))),t}traverseCanvas(t){return this.traverseType(this.traverseDescriptive(this.traverseLinking(this.traverseCanvasItems(t))),this.traversals.canvas)}traverseCanvasItems(t){return t.images&&(t.images=t.images.map(t=>this.traverseAnnotation(t))),t.otherContent&&(t.otherContent=t.otherContent.map(t=>this.traverseAnnotationList(t))),t}traverseRange(t){return this.traverseType(this.traverseDescriptive(this.traverseLinking(this.traverseRangeItems(t))),this.traversals.range)}traverseRangeItems(t){if(this.options.mergeMemberProperties){const e=[...(t.ranges||[]).map(t=>"string"==typeof t?{"@id":t,"@type":"sc:Range"}:t),...(t.canvases||[]).map(t=>"string"==typeof t?{"@id":t,"@type":"sc:Canvas"}:t),...t.members||[]];delete t.ranges,delete t.canvases,t.members=e.length?e.map(t=>this.traverseUnknown(t)):void 0}return t}traverseAnnotationList(t){return this.traverseType(this.traverseDescriptive(this.traverseLinking(this.traverseAnnotationListItems(t))),this.traversals.annotationList)}traverseAnnotationListItems(t){return t.resources&&(t.resources=t.resources.map(t=>this.traverseAnnotation(t))),t}traverseAnnotation(t){return this.traverseType(this.traverseDescriptive(this.traverseLinking(this.traverseAnnotationItems(t))),this.traversals.annotation)}traverseAnnotationItems(t){return t.resource&&(t.resource=this.traverseContentResource(t.resource)),t.on,t}traverseLayer(t){return this.traverseType(this.traverseLinking(this.traverseLayerItems(t)),this.traversals.layer)}traverseLayerItems(t){return t.otherContent&&(t.otherContent=t.otherContent.map(t=>this.traverseAnnotationList(t))),t}traverseChoice(t){return this.traverseType(this.traverseChoiceItems(t),this.traversals.choice)}traverseChoiceItems(t){return t.default&&"rdf:nil"!==t.default&&(t.default=this.traverseContentResource(t.default)),t.item&&"rdf:nil"!==t.item&&(t.item=t.item.map(t=>this.traverseContentResource(t))),t}traverseService(t){return this.traverseType(this.traverseLinking(t),this.traversals.service)}traverseContentResource(t){return"oa:Choice"===t["@type"]?this.traverseChoice(t):this.traverseType(this.traverseDescriptive(this.traverseLinking(t)),this.traversals.contentResource)}traverseUnknown(t){if(!t["@type"]||"string"==typeof t)return t;switch(function(t){if(null==t)throw new Error("Null or undefined is not a valid entity.");if(Array.isArray(t))throw new Error("Array is not a valid entity");if("object"!=typeof t)throw new Error(typeof t+" is not a valid entity");if("string"==typeof t["@type"]){const e=Un.indexOf(t["@type"]);if(-1!==e)return Un[e]}if(t.profile)return"Service";if(t.format)return"ContentResource";if(t["@type"])return"ContentResource";throw new Error("Resource type is not known")}(t)){case"sc:Collection":return this.traverseCollection(t);case"sc:Manifest":return this.traverseManifest(t);case"sc:Canvas":return this.traverseCanvas(t);case"sc:Sequence":return this.traverseSequence(t);case"sc:Range":return this.traverseRange(t);case"oa:Annotation":return this.traverseAnnotation(t);case"oa:AnnotationList":return this.traverseAnnotationList(t);case"sc:Layer":return this.traverseLayer(t);case"Service":return this.traverseService(t);case"oa:Choice":return this.traverseChoice(t);case"ContentResource":return this.traverseContentResource(t)}return t.profile?this.traverseService(t):t}traverseImageResource(t){const e=Array.isArray(t),i=Array.isArray(t)?t:[t],n=[];for(const t of i)"string"==typeof t?n.push(this.traverseContentResource({"@id":t,"@type":"dctypes:Image"})):n.push(this.traverseContentResource(t));return e||this.options.convertPropsToArray?n:n[0]}traverseDescriptive(t){return t.thumbnail&&(t.thumbnail=this.traverseImageResource(t.thumbnail)),t.logo&&(t.logo=this.traverseImageResource(t.logo)),t}traverseOneOrMoreServices(t){const e=Array.isArray(t),i=Array.isArray(t)?t:[t],n=[];for(const t of i)n.push(this.traverseService(t));return e||this.options.convertPropsToArray?n:n[0]}traverseLinking(t){return t.related&&(t.related=this.traverseOneOrManyType(t.related,this.traversals.contentResource)),t.rendering&&(t.rendering=this.traverseOneOrManyType(t.rendering,this.traversals.contentResource)),t.service&&(t.service=this.traverseOneOrMoreServices(t.service)),t.seeAlso&&(t.seeAlso=this.traverseOneOrManyType(t.seeAlso,this.traversals.contentResource)),t.within&&("string"==typeof t.within||(t.within=this.traverseOneOrManyType(t.within,this.traversals.contentResource))),t.startCanvas&&("string"==typeof t.startCanvas?t.startCanvas=this.traverseType({"@id":t.startCanvas,"@type":"sc:Canvas"},this.traversals.canvas):t.startCanvas&&this.traverseType(t.startCanvas,this.traversals.canvas)),t.contentLayer&&("string"==typeof t.contentLayer?t.contentLayer=this.traverseLayer({"@id":t.contentLayer,"@type":"sc:Layer"}):t.contentLayer=this.traverseLayer(t.contentLayer)),t}traverseOneOrManyType(t,e){if(!Array.isArray(t)){if(!this.options.convertPropsToArray)return this.traverseType(t,e);t=[t]}return t.map(t=>this.traverseType(t,e))}traverseType(t,e){return e.reduce((t,e)=>{const i=e(t);return void 0!==i||this.options.allowUndefinedReturn?i:t},t)}}
30
+ /*! *****************************************************************************
31
+ Copyright (c) Microsoft Corporation.
32
+
33
+ Permission to use, copy, modify, and/or distribute this software for any
34
+ purpose with or without fee is hereby granted.
35
+
36
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
37
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
38
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
39
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
40
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
41
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
42
+ PERFORMANCE OF THIS SOFTWARE.
43
+ ***************************************************************************** */const Wn="Attribution",Hn="http://example.org/provider",qn="Unknown";function Qn(t,e="none"){if(!t)return{};const i=Array.isArray(t)?t:[t],n={};for(const t of i){if("string"==typeof t){n[e]=n[e]?n[e]:[],n[e].push(t||"");continue}if(!t["@language"]){n[e]=n[e]?n[e]:[],n[e].push(t["@value"]||"");continue}const i=t["@language"];n[i]=n[i]?n[i]:[],n[i].push(t["@value"]||"")}return n}function Vn(t){for(const e of["sc","oa","dcterms","dctypes","iiif"])if(t.startsWith(e+":"))return t.slice(e.length+1);return t}function Xn(t){const e=t["@id"]||t.id;let i=t["@type"]||t.type;const n=t.profile||void 0,r=t["@context"]||void 0;if(n){const t=function(t){switch(t){case"http://iiif.io/api/image/2/level0.json":case"http://iiif.io/api/image/2/level1.json":case"http://iiif.io/api/image/2/level2.json":return"ImageService2";case"http://iiif.io/api/auth/1/kiosk":case"http://iiif.io/api/auth/1/login":case"http://iiif.io/api/auth/1/clickthrough":case"http://iiif.io/api/auth/1/external":case"http://iiif.io/api/auth/0/kiosk":case"http://iiif.io/api/auth/0/login":case"http://iiif.io/api/auth/0/clickthrough":case"http://iiif.io/api/auth/0/external":return"AuthCookieService1";case"http://iiif.io/api/auth/1/token":case"http://iiif.io/api/auth/0/token":return"AuthTokenService1";case"http://iiif.io/api/auth/1/logout":case"http://iiif.io/api/auth/0/logout":return"AuthLogoutService1";case"http://iiif.io/api/search/1/search":case"http://iiif.io/api/search/0/search":return"SearchService1";case"http://iiif.io/api/search/1/autocomplete":case"http://iiif.io/api/search/0/autocomplete":return"AutoCompleteService1"}}(n);if(t)return t}if(r){const t=function(t){const e=Array.isArray(t)?t:[t];for(const t of e)switch(t){case"http://iiif.io/api/image/2/context.json":case"http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level2":return"ImageService2";case"http://iiif.io/api/image/1/context.json":case"http://library.stanford.edu/iiif/image-api/1.1/context.json":return"ImageService1";case"http://iiif.io/api/annex/openannotation/context.json":return"ImageApiSelector"}}(r);if(t)return t}if(i){if(Array.isArray(i)){if(-1!==i.indexOf("oa:CssStylesheet"))return"CssStylesheet";if(-1!==i.indexOf("cnt:ContentAsText"))return"TextualBody";i=i[0]}for(const t of["sc","oa","dcterms","dctypes","iiif"])if(i.startsWith(t+":")){i=i.slice(t.length+1);break}switch(i){case"Layer":return"AnnotationCollection";case"AnnotationList":return"AnnotationPage";case"cnt:ContentAsText":return"TextualBody"}}if(t.format){if(t.format.startsWith("image/"))return"Image";if(t.format.startsWith("text/"))return"Text";if("application/pdf"===t.format)return"Text";if(t.format.startsWith("application/"))return"Dataset"}return e&&(e.endsWith(".jpg")||e.endsWith(".png")||e.endsWith(".jpeg"))?"Image":i||"unknown"}const Yn=/http(s)?:\/\/(creativecommons.org|rightsstatements.org)[^"'\\<\n]+/gm;function Zn(t){const e=t.match(Yn);return e?e[0]:t}const $n=["http://iiif.io/api/presentation/2/context.json","http://iiif.io/api/image/2/context.json","http://iiif.io/api/image/1/context.json","http://library.stanford.edu/iiif/image-api/1.1/context.json","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","http://iiif.io/api/annex/openannotation/context.json"];function Gn(t){if(t){const e=Array.isArray(t)?t:[t],i=[];for(const t of e)"http://iiif.io/api/presentation/2/context.json"===t&&i.push("http://iiif.io/api/presentation/3/context.json"),-1===$n.indexOf(t)&&i.push(t);if(e.length)return 1===i.length?i[0]:i}}function Kn(t){for(const e in t)void 0!==t[e]&&null!==t[e]||delete t[e];return t}let Jn=0;function tr(t,e){const i=encodeURI(t.id||t["@id"]||"").trim();return i&&e?`${i}/${e}`:i||(Jn++,`http://example.org/${t["@type"]}${e?"/"+e:""}/${Jn}`)}function er(t){const e=[...t.behavior||[]];return t.viewingHint&&e.push(t.viewingHint),{"@context":t["@context"]?Gn(t["@context"]):void 0,id:(t["@id"]||tr(t)).trim(),type:Xn(t),behavior:e.length?e:void 0,height:t.height?t.height:void 0,width:t.width?t.width:void 0,motivation:t.motivation?Vn(t.motivation):void 0,viewingDirection:t.viewingDirection,profile:t.profile,format:t.format?t.format:void 0,duration:void 0,timeMode:void 0}}function ir(t){const[e,i]=function(t,e="Rights/License",i="none"){let n=null;const r=[],o=Array.isArray(t)?t:[t];for(const t of o){const o=t?Zn(t):void 0;!o||-1===o.indexOf("creativecommons.org")&&-1===o.indexOf("rightsstatements.org")?o&&r.push({label:{[i]:[e]},value:{[i]:[o]}}):n=o.startsWith("https://")?"http://"+o.slice(8):o}return[n,r]}(t.license),n=[...t.metadata?(r=t.metadata,r?r.map(t=>({label:Qn(t.label),value:Qn(t.value)})):[]):[],...i];var r;return{rights:e,metadata:n.length?n:void 0,label:t.label?Qn(t.label):void 0,requiredStatement:t.attribution?{label:Qn(Wn),value:Qn(t.attribution)}:void 0,navDate:t.navDate,summary:t.description?Qn(t.description):void 0,thumbnail:t.thumbnail}}function nr(t){if(!t.within)return;const e=Array.isArray(t.within)?t.within:[t.within],i=[];for(const n of e)if("string"==typeof n){if(n)switch(t["@type"]){case"sc:Manifest":i.push({id:n,type:"Collection"})}}else n["@id"]&&i.push({id:n["@id"],type:Xn(n)});return i.length?i:void 0}function rr(t){const e=t.related?Array.isArray(t.related)?t.related:[t.related]:[],i=t.contentLayer;return{provider:t.logo||e.length?[{id:Hn,type:"Agent",homepage:e.length?[e[0]]:void 0,logo:t.logo?Array.isArray(t.logo)?t.logo:[t.logo]:void 0,label:Qn(qn)}]:void 0,partOf:nr(t),rendering:t.rendering,seeAlso:t.seeAlso,start:t.startCanvas,service:t.service?(n=t.service,Array.isArray(n)?n:[n]):void 0,supplementary:i?[i]:void 0};var n}function or(t){const e=[];for(const i of t||[])e.push(...i);return e}const sr=new Nn({collection:[function(t){return Kn(Object.assign(Object.assign(Object.assign(Object.assign({},er(t)),ir(t)),rr(t)),{items:t.members}))}],manifest:[function(t){return Kn(Object.assign(Object.assign(Object.assign(Object.assign({},er(t)),ir(t)),rr(t)),{items:or(t.sequences||[]),structures:t.structures}))}],canvas:[function(t){return Kn(Object.assign(Object.assign(Object.assign(Object.assign({},er(t)),ir(t)),rr(t)),{items:t.images&&t.images.length?[{id:tr(t,"annotation-page"),type:"AnnotationPage",items:t.images}]:void 0}))}],annotationList:[function(t){return Kn(Object.assign(Object.assign(Object.assign(Object.assign({},er(t)),ir(t)),rr(t)),{items:t.resources}))}],sequence:[function(t){return t.canvases&&0!==t.canvases.length?t.canvases:[]}],annotation:[function(t){return Kn(Object.assign(Object.assign(Object.assign(Object.assign({},er(t)),ir(t)),rr(t)),{target:"string"==typeof t.on?encodeURI(t.on).trim():t.on,body:t.resource}))}],contentResource:[function(t){const e=t;return Kn(Object.assign(Object.assign(Object.assign({},er(e)),ir(e)),rr(e)))}],choice:[function(t){const e=[];return t.default&&"rdf:nil"!==t.default&&e.push(t.default),t.item&&"rdf:nil"!==t.item&&e.push(...t.item),Object.assign(Object.assign(Object.assign({},er(t)),ir(t)),{items:e})}],range:[function(t){return Kn(Object.assign(Object.assign(Object.assign(Object.assign({},er(t)),ir(t)),rr(t)),{items:t.members}))}],service:[function(t){const e=t,{"@id":i,"@type":n,"@context":r,profile:o}=e,s=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(t);r<n.length;r++)e.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(t,n[r])&&(i[n[r]]=t[n[r]])}return i}(e,["@id","@type","@context","profile"]);return i&&(s.id=i),s.type=Xn(t),"unknown"===s.type&&(s.type="Service"),o&&(s.profile=function t(e){return Array.isArray(e)?t(e.find(t=>"string"==typeof t)):-1!==Vi.indexOf(e)?"level2":-1!==Qi.indexOf(e)?"level1":"string"==typeof e?e:void 0}(o)),Kn(Object.assign(Object.assign({},s),ir(s)))}],layer:[function(t){return Kn(Object.assign(Object.assign(Object.assign({},er(t)),ir(t)),rr(t)))}]});const ar={id:"https://hyperion/annotation-page",type:"AnnotationPage",behavior:[],motivation:null,label:null,thumbnail:[],summary:null,requiredStatement:null,metadata:[],rights:null,provider:[],items:[],seeAlso:[],homepage:null,logo:[],rendering:[],service:[]},cr={id:"https://hyperion/empty-canvas",type:"Canvas",label:null,behavior:[],motivation:null,thumbnail:[],posterCanvas:null,accompanyingCanvas:null,placeholderCanvas:null,summary:null,requiredStatement:null,metadata:[],rights:null,navDate:null,provider:[],items:[],annotations:[],seeAlso:[],homepage:null,logo:[],partOf:[],rendering:[],service:[],duration:0,height:0,width:0},hr={id:"https://hyperion/empty-collection",type:"Collection",label:null,viewingDirection:"left-to-right",behavior:[],motivation:null,thumbnail:[],posterCanvas:null,accompanyingCanvas:null,placeholderCanvas:null,summary:null,requiredStatement:null,metadata:[],rights:null,navDate:null,provider:[],items:[],annotations:[],seeAlso:[],homepage:null,logo:[],partOf:[],rendering:[],service:[],services:[]},lr={id:"https://hyperion/empty-manifest",type:"Manifest",annotations:[],behavior:[],homepage:null,items:[],label:null,logo:[],metadata:[],motivation:null,navDate:null,provider:[],partOf:[],posterCanvas:null,accompanyingCanvas:null,placeholderCanvas:null,rendering:[],requiredStatement:null,rights:null,seeAlso:[],service:[],services:[],start:null,structures:[],summary:null,thumbnail:[],viewingDirection:"left-to-right"},ur={id:"https://hyperion/empty-canvas",type:"Range",label:null,behavior:[],motivation:null,thumbnail:[],posterCanvas:null,accompanyingCanvas:null,placeholderCanvas:null,summary:null,requiredStatement:null,metadata:[],rights:null,navDate:null,provider:[],items:[],annotations:[],seeAlso:[],homepage:null,logo:[],partOf:[],rendering:[],service:[],start:null,supplementary:null,viewingDirection:"left-to-right"},dr=["Collection","Manifest","Canvas","AnnotationPage","AnnotationCollection","Annotation","ContentResource","Range","Service","Selector"];class pr{constructor(t,e={}){this.traversals=Object.assign({collection:[],manifest:[],canvas:[],annotationCollection:[],annotationPage:[],annotation:[],contentResource:[],choice:[],range:[],service:[]},t),this.options=Object.assign({allowUndefinedReturn:!1},e)}static all(t){return new pr({collection:[t],manifest:[t],canvas:[t],annotationCollection:[t],annotationPage:[t],annotation:[t],contentResource:[t],choice:[t],range:[t],service:[t]})}traverseDescriptive(t){return t.thumbnail&&(t.thumbnail=t.thumbnail.map(t=>this.traverseType(t,this.traversals.contentResource))),t}traverseLinking(t){return t.seeAlso&&(t.seeAlso=t.seeAlso.map(t=>this.traverseType(t,this.traversals.contentResource))),t.service&&(t.service=t.service.map(t=>this.traverseType(t,this.traversals.service))),t.services&&(t.services=t.services.map(t=>this.traverseType(t,this.traversals.service))),t.logo&&(t.logo=t.logo.map(t=>this.traverseType(t,this.traversals.contentResource))),t.homepage&&(t.homepage=this.traverseType(t.homepage,this.traversals.contentResource)),t.partOf&&(t.partOf=t.partOf.map(t=>"string"!=typeof t&&t.type?"Canvas"===t.type?this.traverseType(t,this.traversals.canvas):"AnnotationCollection"===t.type?this.traverseType(t,this.traversals.annotationCollection):this.traverseType(t,this.traversals.contentResource):this.traverseType(t,this.traversals.contentResource))),t.start&&(t.start=t.start.map(t=>this.traverseType(t,this.traversals.canvas))),t.rendering&&(t.rendering=t.rendering.map(t=>this.traverseType(t,this.traversals.contentResource))),t.supplementary&&(t.supplementary=t.supplementary.map(t=>this.traverseType(t,this.traversals.contentResource))),t}traverseCollectionItems(t){return t.items.map(t=>"Collection"===t.type?this.traverseCollection(t):this.traverseManifest(t)),t}traverseCollection(t){return this.traverseType(this.traverseDescriptive(this.traverseLinking(this.traversePosterCanvas(this.traverseCollectionItems(t)))),this.traversals.collection)}traverseManifestItems(t){return t.items&&(t.items=t.items.map(t=>this.traverseCanvas(t))),t}traverseManifestStructures(t){return t.structures&&(t.structures=t.structures.map(t=>this.traverseRange(t))),t}traverseManifest(t){return this.traverseType(this.traverseManifestStructures(this.traversePosterCanvas(this.traverseDescriptive(this.traverseLinking(this.traverseManifestItems(t))))),this.traversals.manifest)}traverseCanvasItems(t){return t.items=(t.items||[]).map(t=>this.traverseAnnotationPage(t)),t}traverseCanvas(t){return this.traverseType(this.traversePosterCanvas(this.traverseDescriptive(this.traverseLinking(this.traverseCanvasItems(t)))),this.traversals.canvas)}traverseAnnotationPageItems(t){return t.items&&(t.items=t.items.map(t=>this.traverseAnnotation(t))),t}traverseAnnotationPage(t){return this.traverseType(this.traverseDescriptive(this.traverseLinking(this.traverseAnnotationPageItems(t))),this.traversals.annotationPage)}traverseAnnotationBody(t){return Array.isArray(t.body)?t.body=t.body.map(t=>this.traverseContentResource(t)):t.body&&(t.body=this.traverseContentResource(t.body)),t}traversePosterCanvas(t){return t.posterCanvas&&(t.posterCanvas=this.traverseType(t.posterCanvas,this.traversals.canvas)),t.placeholderCanvas&&(t.placeholderCanvas=this.traverseType(t.placeholderCanvas,this.traversals.canvas)),t.accompanyingCanvas&&(t.accompanyingCanvas=this.traverseType(t.accompanyingCanvas,this.traversals.canvas)),t}traverseAnnotation(t){return this.traverseType(this.traverseLinking(this.traverseAnnotationBody(t)),this.traversals.annotation)}traverseContentResourceLinking(t){return"string"!=typeof t&&t?(t&&t.service&&(t.service=(t.service||[]).map(t=>this.traverseType(t,this.traversals.service))),t):t}traverseContentResource(t){return this.traverseType(this.traverseContentResourceLinking(t),this.traversals.contentResource)}traverseRangeRanges(t){return t.items&&(t.items=t.items.map(t=>"string"==typeof t?this.traverseCanvas({id:t,type:"Canvas"}):"Manifest"===t.type?this.traverseManifest(t):this.traverseRange(t))),t}traverseRange(t){return this.traverseType(this.traversePosterCanvas(this.traverseDescriptive(this.traverseLinking(this.traverseRangeRanges(t)))),this.traversals.range)}traverseType(t,e){return e.reduce((t,e)=>{const i=e(t);return void 0!==i||this.options.allowUndefinedReturn?i:t},t)}traverseService(t){return this.traverseType(t,this.traversals.service)}traverseUnknown(t){const e=function(t){if(null==t)throw new Error("Null or undefined is not a valid entity.");if(Array.isArray(t))throw new Error("Array is not a valid entity");if("object"!=typeof t)throw new Error(typeof t+" is not a valid entity");if("string"==typeof t.type){const e=dr.indexOf(t.type);if(-1!==e)return dr[e]}if(t.profile)return"Service";throw new Error("Resource type is not known")}(t);switch(e){case"Collection":return this.traverseCollection(t);case"Manifest":return this.traverseManifest(t);case"Canvas":return this.traverseCanvas(t);case"AnnotationPage":return this.traverseAnnotationPage(t);case"Annotation":return this.traverseAnnotation(t);case"ContentResource":return this.traverseContentResource(t);case"Range":return this.traverseRange(t);case"Service":return this.traverseService(t);default:throw new Error("Unknown or unsupported resource type of "+e)}}}function fr(t,e){if("string"==typeof t)return{id:t,type:e};if(!t.id)throw new Error(`Invalid resource does not have an ID (${e})`);return t}function gr(t){const e=JSON.stringify(t);let i=5381,n=e.length;for(;n;)i=33*i^e.charCodeAt(--n);const r=(i>>>0).toString(16);return r.length%2?"0"+r:r}function vr(t){return e=>"string"==typeof e?{id:e,type:t}:e.id?e.type?e:Object.assign({type:t},e):Object.assign({id:gr(e),type:t},e)}function yr(t){return e=>Object.assign(Object.assign({},t),e)}function mr(t){return Array.isArray(t)?t:[t]}function wr(t){return t.body&&(t.body=mr(t.body)),t.seeAlso&&(t.seeAlso=mr(t.seeAlso)),t.body&&(t.body=mr(t.body)),t.audience&&(t.audience=mr(t.audience)),t.accessibility&&(t.accessibility=mr(t.accessibility)),t.motivation&&(t.motivation=mr(t.motivation)),t}function br(t){const e=function(t){return t&&t["@context"]&&("http://iiif.io/api/presentation/2/context.json"===t["@context"]||-1!==t["@context"].indexOf("http://iiif.io/api/presentation/2/context.json")||"http://www.shared-canvas.org/ns/context.json"===t["@context"])||"http://iiif.io/api/image/2/context.json"===t["@context"]?sr.traverseUnknown(t):t}(t),i={Collection:{},Manifest:{},Canvas:{},AnnotationPage:{},AnnotationCollection:{},Annotation:{},ContentResource:{},Range:{},Service:{},Selector:{}},n={},r=function(t){return(e,i)=>{const n=t[e]?t[e]:{};return t=>{const r=fr(t,i||e);return r&&r.id&&e?(n[r.id]=n[r.id]?Object.assign({},n[r.id],r):Object.assign({},r),{id:r.id,type:"ContentResource"===e?e:r.type}):r}}}(i),o=function(t){return(e,i)=>n=>{const{id:r,type:o}=fr(n,i||e);if(void 0===r)throw new Error("Found invalid entity without an ID.");return t[r]="ContentResource"===e?e:o,n}}(n);return{entities:i,resource:new pr({collection:[yr(hr),o("Collection"),r("Collection")],manifest:[yr(lr),o("Manifest"),r("Manifest")],canvas:[yr(cr),o("Canvas"),r("Canvas")],annotationPage:[vr("AnnotationPage"),yr(ar),o("AnnotationPage"),r("AnnotationPage")],annotation:[vr("Annotation"),wr,o("Annotation"),r("Annotation")],contentResource:[vr("ContentResource"),o("ContentResource"),r("ContentResource")],range:[yr(ur),o("Range","Canvas"),r("Range","Canvas")]}).traverseUnknown(e),mapping:n}}const xr="__$HF_UNSET$__";function Er(t,e,i){if(!e.type||!e.id)throw new Error("Unknown entity");if(!i[e.type])throw new Error("Serialiser not found for "+e.type);return function e(n){const r=i[n.type];if(!r)return xr;const o=function(t,e){const i=t.hyperion.requests[e],n=t.hyperion.mapping[e];if(n&&(!i||!i.resourceUri||t.hyperion.entities[n][i.resourceUri]))return t.hyperion.entities[n][i?i.resourceUri:e]}(t,n.id);if(!o)return xr;const s=r(o,t);let a=s.next();for(;!a.done;){const t=a.value;let i=xr;if(t)if(Array.isArray(t)){const n=[];for(const i of t)n.push(e(i));i=n}else i=e(t);a=s.next(i)}return a.value===xr?xr:function(t){const e={};for(const[i,n]of t){if("__$HF_UNWRAP$__"===i)return n;n!==xr&&null!=n&&(e[i]=n)}return e}(a.value)}(e)}function Sr(t){if(!t)return;const e=Object.keys(t);if(0!==e.length){if(1===e.length){const i=e[0];if(!i)return"";const n=(t[i]||[]).join("");return"@none"===i||"none"===i||"en"===i?n:{"@language":i,"@value":n}}return e.map(e=>({"@language":e,"@value":(t[e]||[]).join("")}))}}function Or(t){return Array.isArray(t)?t.map(t=>Or(t)):"string"==typeof t?t:t.type&&"Canvas"===t.type?t.id:t}function Pr(t,e=!1){if(t)return t.length>1&&!e?t:t[0]||void 0}function Cr(t){if(t){if("string"==typeof t)return{"@id":t};if("@id"in t){const e=Object.assign({},t);return delete e["@type"],e}return{"@context":"http://iiif.io/api/image/2/context.json","@id":t.id,profile:`http://iiif.io/api/image/2/profiles/${t.profile}.json`}}}function Rr(t,e){return[["@id",t.id],["@type",e],["format",t.format],["height",t.height],["width",t.width],["viewingDirection","left-to-right"!==t.viewingDirection?t.viewingDirection:void 0]]}function*_r(t){const e=t.provider?t.provider[0]:void 0;return[["label",Sr(t.label)],["metadata",t.metadata&&t.metadata.length?t.metadata.map(t=>({label:Sr(t.label)||"",value:Sr(t.value)||""})):void 0],["description",Sr(t.summary)],["thumbnail",Pr(yield t.thumbnail)],["navDate",t.navDate],["logo",e?Pr(e.logo):void 0],["homepage",e?e.homepage:void 0],["attribution",t.requiredStatement?Sr(t.requiredStatement.value):void 0]]}function*Ar(t){return[["seeAlso",Pr(yield t.seeAlso)],["service",Pr((t.service||[]).map(Cr))],["rendering",Pr(yield t.rendering)],["startCanvas",t.start?t.start.id:void 0]]}const Tr={Manifest:function*(t){return[...Rr(t,"sc:Manifest"),...yield*_r(t),...yield*Ar(t),["sequences",[{"@id":t.id+"/sequence0","@type":"sc:Sequence",canvases:yield t.items}]],["structures",yield t.structures]]},Canvas:function*(t){const e=(yield t.items)[0];return[...Rr(t,"sc:Canvas"),...yield*_r(t),...yield*Ar(t),["images",e?[e.resources]:void 0],["annotations",t.annotations&&t.annotations.length?Pr(yield t.annotations):void 0]]},AnnotationPage:function*(t){return[...Rr(t,"sc:AnnotationList"),...yield*_r(t),["resources",t.items&&t.items.length?Pr(yield t.items):void 0]]},Annotation:function*(t){return[["@id",t.id],["@type","oa:Annotation"],["motivation","sc:painting"],["on",Or(t.target)],["resource",Pr(yield t.body,!0)]]},ContentResource:function*(t){switch(t.type){case"Image":return[...Rr(t,"dctypes:Image"),...yield*_r(t),...yield*Ar(t)];case"Text":case"Dataset":default:return[...Rr(t,void 0),...yield*_r(t)]}},AnnotationCollection:function*(t){return[["@id",t.id],["@type","sc:Layer"],["label",Sr(t.label)]]},Collection:function*(t){return[...Rr(t,"sc:Collection"),...yield*_r(t),...yield*Ar(t),["members",yield*t.items]]},Range:function*(t){const e=[],i=[];if(t.items)for(const n of t.items){const r=yield n;e.push({"@id":n.id,"@type":n.type,label:r?r.label:void 0,within:t.id}),"Canvas"===n.type&&i.push(n.id)}return[...Rr(t,"sc:Range"),...yield*_r(t),...yield*Ar(t),["canvases",i.length===e.length?i:void 0],["members",i.length!==e.length?e:void 0]]}};
44
+ /*! *****************************************************************************
45
+ Copyright (c) Microsoft Corporation.
46
+
47
+ Permission to use, copy, modify, and/or distribute this software for any
48
+ purpose with or without fee is hereby granted.
49
+
50
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
51
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
52
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
53
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
54
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
55
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
56
+ PERFORMANCE OF THIS SOFTWARE.
57
+ ***************************************************************************** */function Ir(t){return[["id",t.id],["type",t.type],["format",t.format],["profile",t.profile],["height",t.height],["width",t.width],["duration",t.duration||void 0],["viewingDirection","left-to-right"!==t.viewingDirection?t.viewingDirection:void 0],["behavior",t.behavior&&t.behavior.length?t.behavior:void 0],["timeMode",t.timeMode],["motivation",t.motivation]]}function jr(t){if(t&&0!==t.length)return t}function Mr(t){if(t&&t.type&&"ImageService2"===t.type){const{id:e,type:i,profile:n}=t,r=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(t);r<n.length;r++)e.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(t,n[r])&&(i[n[r]]=t[n[r]])}return i}(t,["id","type","profile"]);return Object.assign({"@id":e,"@type":i,profile:n.startsWith("http")?n:`http://iiif.io/api/image/2/${n}.json`},r)}return t}function Lr(t){if(t&&0!==t.length)return t.map(Mr)}function*kr(t){return[["label",t.label],["metadata",jr(t.metadata)],["summary",t.summary],["requiredStatement",t.requiredStatement],["rights",t.rights],["navDate",t.navDate],["language",t.language],["thumbnail",jr(yield t.thumbnail)],["placeholderCanvas",yield t.placeholderCanvas],["accompanyingCanvas",yield t.accompanyingCanvas],["provider",jr(t.provider)]]}function*Fr(t){return[["seeAlso",jr(yield t.seeAlso)],["service",Lr(t.service)],["services",Lr(t.services)],["rendering",jr(yield t.rendering)],["supplementary",jr(yield t.supplementary)],["partOf",jr(t.partOf)],["start",t.start]]}const Dr={Manifest:function*(t){return[...Ir(t),...yield*kr(t),...yield*Fr(t),["items",yield t.items],["structures",jr(yield t.structures)]]},Canvas:function*(t){return[...Ir(t),...yield*kr(t),...yield*Fr(t),["items",yield t.items],["annotations",jr(yield t.annotations)]]},AnnotationPage:function*(t){return[...Object.entries(t).map(([t,e])=>[t,Array.isArray(e)?jr(e):e]).filter(([t,e])=>"items"!==t),...yield*Fr(t),["items",yield t.items]]},Service:function*(t){return[["__$HF_UNWRAP$__",Mr(t)]]},Annotation:function*(t){return[...Object.entries(t).map(([t,e])=>[t,Array.isArray(e)?jr(e):e]).filter(([t])=>"body"!==t),["body",yield t.body]]},ContentResource:function*(t){return[...Ir(t),...yield*kr(t),...yield*Fr(t)]},AnnotationCollection:function*(t){return[["id",t.id],["type","AnnotationCollection"],["label",t.label]]},Collection:function*(t){return[...Ir(t),...yield*kr(t),...yield*Fr(t),["items",yield*t.items]]},Range:function*(t){const e=[];for(const i of t.items)"Range"===i.type?e.push(yield i):e.push(i);return[...Ir(t),...yield*kr(t),...yield*Fr(t),["items",e],["annotations",jr(yield t.annotations)]]}},zr=Ei.createAction("@hyperion/ADD_MAPPING")(),Br=Ei.createAction("@hyperion/ADD_MAPPINGS")(),Ur=Ei.createAction("@hyperion/IMPORT_ENTITIES")(),Nr=Ei.createAction("@hyperion/MODIFY_ENTITY_FIELD")(),Wr={importEntities:Ur,modifyEntityField:Nr},Hr=Ei.createAction("@hyperion/REQUEST_RESOURCE")(),qr=Ei.createAction("@hyperion/REQUEST_ERROR")(),Qr=Ei.createAction("@hyperion/REQUEST_MISMATCH")(),Vr=Ei.createAction("@hyperion/REQUEST_COMPLETE")(),Xr=(Ei.createAction("@hyperion/REQUEST_OFFLINE_RESOURCE")(),yi({mapping:(t={},e)=>{switch(e.type){case"@hyperion/ADD_MAPPING":return Object.assign(Object.assign({},t),{[e.payload.id]:e.payload.type});case"@hyperion/ADD_MAPPINGS":return Object.assign(Object.assign({},t),e.payload.mapping);default:return t}},entities:(t={Collection:{},Manifest:{},Canvas:{},AnnotationPage:{},AnnotationCollection:{},Annotation:{},ContentResource:{},Range:{},Service:{},Selector:{}},e)=>{if("@hyperion/MODIFY_ENTITY_FIELD"===e.type){if(!t[e.payload.type]||!t[e.payload.type][e.payload.id])return t;const i=t[e.payload.type][e.payload.id];return"string"==typeof i?t:Object.assign(Object.assign({},t),{[e.payload.type]:Object.assign(Object.assign({},t[e.payload.type]),{[e.payload.id]:Object.assign(Object.assign({},i),{[e.payload.key]:e.payload.value})})})}return"@hyperion/IMPORT_ENTITIES"===e.type?{Collection:Object.assign(Object.assign({},t.Collection),e.payload.entities.Collection),Manifest:Object.assign(Object.assign({},t.Manifest),e.payload.entities.Manifest),Canvas:Object.assign(Object.assign({},t.Canvas),e.payload.entities.Canvas),AnnotationPage:Object.assign(Object.assign({},t.AnnotationPage),e.payload.entities.AnnotationPage),AnnotationCollection:Object.assign(Object.assign({},t.AnnotationCollection),e.payload.entities.AnnotationCollection),Annotation:Object.assign(Object.assign({},t.Annotation),e.payload.entities.Annotation),ContentResource:Object.assign(Object.assign({},t.ContentResource),e.payload.entities.ContentResource),Range:Object.assign(Object.assign({},t.Range),e.payload.entities.Range),Service:Object.assign(Object.assign({},t.Service),e.payload.entities.Service),Selector:Object.assign(Object.assign({},t.Selector),e.payload.entities.Selector)}:t},requests:(t={},e)=>{switch(e.type){case"@hyperion/REQUEST_RESOURCE":case"@hyperion/REQUEST_OFFLINE_RESOURCE":return Object.assign(Object.assign({},t),{[e.payload.id]:{requestUri:e.payload.id,loadingState:"RESOURCE_LOADING",uriMismatch:!1,resourceUri:e.payload.id}});case"@hyperion/REQUEST_MISMATCH":return Object.assign(Object.assign({},t),{[e.payload.requestId]:Object.assign(Object.assign({},t[e.payload.requestId]||{}),{uriMismatch:!0,resourceUri:e.payload.actualId}),[e.payload.actualId]:{requestUri:e.payload.requestId,loadingState:t[e.payload.requestId].loadingState,uriMismatch:!0,resourceUri:e.payload.actualId}});case"@hyperion/REQUEST_ERROR":return Object.assign(Object.assign({},t),{[e.payload.id]:Object.assign(Object.assign({},t[e.payload.id]||{}),{loadingState:"RESOURCE_ERROR",error:e.payload.message})});case"@hyperion/REQUEST_COMPLETE":return Object.assign(Object.assign({},t),{[e.payload.id]:Object.assign(Object.assign({},t[e.payload.id]||{}),{loadingState:"RESOURCE_READY",error:void 0})})}return t}})),Yr="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__||xi;function Zr(t={},e=[],i={}){return gi(yi(Object.assign({hyperion:Xr},t)),i,Yr(function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return function(t){return function(){var i=t.apply(void 0,arguments),n=function(){throw new Error("Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")},r={getState:i.getState,dispatch:function(){return n.apply(void 0,arguments)}},o=e.map((function(t){return t(r)}));return bi({},i,{dispatch:n=xi.apply(void 0,o)(i.dispatch)})}}}(...e)))}
58
+ /*! *****************************************************************************
59
+ Copyright (c) Microsoft Corporation.
21
60
 
22
- THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
23
- KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
24
- WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
25
- MERCHANTABLITY OR NON-INFRINGEMENT.
61
+ Permission to use, copy, modify, and/or distribute this software for any
62
+ purpose with or without fee is hereby granted.
26
63
 
27
- See the Apache Version 2.0 License for specific language governing permissions
28
- and limitations under the License.
29
- *****************************************************************************/
30
- 'use strict';!function(t,l){"object"==typeof exports&&"undefined"!=typeof module?l(exports,require("react"),require("react-reconciler"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","react","react-reconciler","react-dom"],l):l((t=t||self).Atlas={},t.React,t.ReactReconciler,t.ReactDOM)}(this,function(t,l,ua,eb){function N(a,b){function c(){this.constructor=a}Jc(a,b);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)}function T(a,b){var c={},d;for(d in a)Object.prototype.hasOwnProperty.call(a,
31
- d)&&0>b.indexOf(d)&&(c[d]=a[d]);if(null!=a&&"function"==typeof Object.getOwnPropertySymbols){var e=0;for(d=Object.getOwnPropertySymbols(a);e<d.length;e++)0>b.indexOf(d[e])&&Object.prototype.propertyIsEnumerable.call(a,d[e])&&(c[d[e]]=a[d[e]])}return c}function Bb(a,b){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(a,b)}function Ka(a,b,c,d){return new (c||(c=Promise))(function(e,f){function g(a){try{h(d.next(a))}catch(p){f(p)}}function k(a){try{h(d.throw(a))}catch(p){f(p)}}
32
- function h(a){a.done?e(a.value):function(a){return a instanceof c?a:new c(function(b){b(a)})}(a.value).then(g,k)}h((d=d.apply(a,b||[])).next())})}function La(a,b){function c(c){return function(g){return function(c){if(d)throw new TypeError("Generator is already executing.");for(;k;)try{if(d=1,e&&(f=2&c[0]?e.return:c[0]?e.throw||((f=e.return)&&f.call(e),0):e.next)&&!(f=f.call(e,c[1])).done)return f;switch(e=0,f&&(c=[2&c[0],f.value]),c[0]){case 0:case 1:f=c;break;case 4:return k.label++,{value:c[1],
33
- done:!1};case 5:k.label++;e=c[1];c=[0];continue;case 7:c=k.ops.pop();k.trys.pop();continue;default:if(!(f=k.trys,(f=0<f.length&&f[f.length-1])||6!==c[0]&&2!==c[0])){k=0;continue}if(3===c[0]&&(!f||c[1]>f[0]&&c[1]<f[3]))k.label=c[1];else if(6===c[0]&&k.label<f[1])k.label=f[1],f=c;else if(f&&k.label<f[2])k.label=f[2],k.ops.push(c);else{f[2]&&k.ops.pop();k.trys.pop();continue}}c=b.call(a,k)}catch(q){c=[6,q],e=0}finally{d=f=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,g])}}var d,e,
34
- f,g,k={label:0,sent:function(){if(1&f[0])throw f[1];return f[1]},trys:[],ops:[]};return g={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(g[Symbol.iterator]=function(){return this}),g}function F(a){var b="function"==typeof Symbol&&Symbol.iterator,c=b&&a[b],d=0;if(c)return c.call(a);if(a&&"number"==typeof a.length)return{next:function(){return a&&d>=a.length&&(a=void 0),{value:a&&a[d++],done:!a}}};throw new TypeError(b?"Object is not iterable.":"Symbol.iterator is not defined.");}function H(a,
35
- b){var c="function"==typeof Symbol&&a[Symbol.iterator];if(!c)return a;var d;a=c.call(a);var e=[];try{for(;(void 0===b||0<b--)&&!(d=a.next()).done;)e.push(d.value)}catch(g){var f={error:g}}finally{try{d&&!d.done&&(c=a.return)&&c.call(a)}finally{if(f)throw f.error;}}return e}function G(){for(var a=[],b=0;b<arguments.length;b++)a=a.concat(H(arguments[b]));return a}function Kc(){for(var a=0,b=0,c=arguments.length;b<c;b++)a+=arguments[b].length;a=Array(a);var d=0;for(b=0;b<c;b++)for(var e=arguments[b],
36
- f=0,g=e.length;f<g;f++,d++)a[d]=e[f];return a}function w(a,b,c){return new Float32Array(a,b,c)}function Cb(a,b,c){return a(c={path:b,exports:{},require:function(a,b){throw Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs");}},c.exports),c.exports}function Db(a,b){return a.startsWith(b)&&Lc.test(a)}function Mc(a){a=Ma.parse(a);for(var b=a.length,c=0,d=0,e=0,f=0;f<b;f++)c||"number"==typeof a[f]?c++:void 0!==a[f].hue?e++:d++;return{parsed:a,numNumbers:c,numRGB:d,numHSL:e}}
37
- function I(){if(!Nc){Nc=!0;var a=navigator.userAgent,b=/(?:MSIE.(\d+\.\d+))|(?:(?:Firefox|GranParadiso|Iceweasel).(\d+\.\d+))|(?:Opera(?:.+Version.|.)(\d+\.\d+))|(?:AppleWebKit.(\d+(?:\.\d+)?))|(?:Trident\/\d+\.\d+.*rv:(\d+\.\d+))/.exec(a),c=/(Mac OS X)|(Windows)|(Linux)/.exec(a);if(Eb=/\b(iPhone|iP[ao]d)/.exec(a),Fb=/\b(iP[ao]d)/.exec(a),Gb=/Android/i.exec(a),Oc=/FBAN\/\w+;/i.exec(a),Pc=/Mobile/i.exec(a),Qc=!!/Win64/.exec(a),b){(va=b[1]?parseFloat(b[1]):b[5]?parseFloat(b[5]):NaN)&&document&&document.documentMode&&
38
- (va=document.documentMode);var d=/(?:Trident\/(\d+.\d+))/.exec(a);Rc=d?parseFloat(d[1])+4:va;Hb=b[2]?parseFloat(b[2]):NaN;Ib=b[3]?parseFloat(b[3]):NaN;(Jb=b[4]?parseFloat(b[4]):NaN)?(b=/(?:Chrome\/(\d+\.\d+))/.exec(a),fb=b&&b[1]?parseFloat(b[1]):NaN):fb=NaN}else va=Hb=Ib=fb=Jb=NaN;c?(c[1]?(a=/(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(a),gb=!a||parseFloat(a[1].replace("_","."))):gb=!1,Kb=!!c[2],Lb=!!c[3]):gb=Kb=Lb=!1}}function Sc(a){var b=0,c=0,d=0,e=0;return"detail"in a&&(c=a.detail),"wheelDelta"in a&&
39
- (c=-a.wheelDelta/120),"wheelDeltaY"in a&&(c=-a.wheelDeltaY/120),"wheelDeltaX"in a&&(b=-a.wheelDeltaX/120),"axis"in a&&a.axis===a.HORIZONTAL_AXIS&&(b=c,c=0),d=10*b,e=10*c,"deltaY"in a&&(e=a.deltaY),"deltaX"in a&&(d=a.deltaX),(d||e)&&a.deltaMode&&(1==a.deltaMode?(d*=40,e*=40):(d*=800,e*=800)),d&&!b&&(b=1>d?-1:1),e&&!c&&(c=1>e?-1:1),{spinX:b,spinY:c,pixelX:d,pixelY:e}}function Tc(a,b){a&&a.appendChild&&b&&a.appendChild(b)}function Uc(a,b){a&&a.removeChild&&b&&a.removeChild(b)}function Vc(a,b,c){a&&a.insertBefore&&
40
- a.insertBefore(b,c)}function Wc(a,b,c){var d;if(a.applyProps&&a.applyProps(c),a instanceof W)try{for(var e=F(hb),f=e.next();!f.done;f=e.next()){var g=f.value,k=g.slice(2).toLowerCase();c[g]!==b[g]&&(b[g]&&a.removeEventListener(k,b[g]),a.addEventListener(k,c[g]))}}catch(m){var h={error:m}}finally{try{f&&!f.done&&(d=e.return)&&d.call(e)}finally{if(h)throw h.error;}}}function Xc(a,b){var c;b=Object.keys(b);var d=!1;try{for(var e=F(b),f=e.next();!f.done;f=e.next()){var g=f.value;if(-1!==hb.indexOf(g)){var k=
41
- wa[g];k&&-1===a.activatedEvents.indexOf(k)&&(d=!0,a.activatedEvents.push(k))}}}catch(m){var h={error:m}}finally{try{f&&!f.done&&(c=e.return)&&c.call(e)}finally{if(h)throw h.error;}}d&&a.triggerEventActivation()}function Yc(a,b,c){function d(){var m=Date.now()-k;m<b&&0<=m?e=setTimeout(d,b-m):(e=null,c||(h=a.apply(g,f),g=f=null))}var e,f,g,k,h;null==b&&(b=100);var m=function(){g=this;f=arguments;k=Date.now();var m=c&&!e;return e||(e=setTimeout(d,b)),m&&(h=a.apply(g,f),g=f=null),h};return m.clear=function(){e&&
42
- (clearTimeout(e),e=null)},m.flush=function(){e&&(h=a.apply(g,f),g=f=null,clearTimeout(e),e=null)},m}function Mb({debounce:a,scroll:b,polyfill:c}={debounce:0,scroll:!1}){function d(){h.current.scrollContainers&&(h.current.scrollContainers.forEach(a=>a.removeEventListener("scroll",n,!0)),h.current.scrollContainers=null);h.current.resizeObserver&&(h.current.resizeObserver.disconnect(),h.current.resizeObserver=null)}function e(){h.current.element&&(h.current.resizeObserver=new f(n),h.current.resizeObserver.observe(h.current.element),
43
- b&&h.current.scrollContainers&&h.current.scrollContainers.forEach(a=>a.addEventListener("scroll",n,{capture:!0,passive:!0})))}let f=c||("undefined"==typeof window?class{}:window.ResizeObserver);if(!f)throw Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");let [g,k]=l.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),h=l.useRef({element:null,scrollContainers:null,resizeObserver:null,
44
- lastBounds:g}),m=a?"number"==typeof a?a:a.scroll:null,p=a?"number"==typeof a?a:a.resize:null,[q,r,n]=l.useMemo(()=>{const a=()=>{if(h.current.element){var {left:a,top:b,width:c,height:d,bottom:e,right:f,x:g,y:m}=h.current.element.getBoundingClientRect(),n={left:a,top:b,width:c,height:d,bottom:e,right:f,x:g,y:m};Object.freeze(n);He(h.current.lastBounds,n)||k(h.current.lastBounds=n)}};return[a,p?$c.debounce(a,p):a,m?$c.debounce(a,m):a]},[k,m,p]);var y,v;return y=n,v=!!b,l.useEffect(()=>{if(v)return window.addEventListener("scroll",
45
- y,{capture:!0,passive:!0}),()=>{window.removeEventListener("scroll",y,!0)}},[y,v]),l.useEffect(()=>(window.addEventListener("resize",r),()=>{window.removeEventListener("resize",r)}),[r]),l.useEffect(()=>{d();e()},[b,n,r]),l.useEffect(()=>d,[]),[a=>{a&&a!==h.current.element&&(d(),h.current.element=a,h.current.scrollContainers=function z(a){let b=[];if(!a||a===document.body)return b;let {overflow:c,overflowX:d,overflowY:e}=window.getComputedStyle(a);[c,d,e].some(a=>"auto"===a||"scroll"===a)&&b.push(a);
46
- return[...b,...z(a.parentElement)]}(a),e())},g,q]}function ad(a,b,c,d){function e(){if(r)throw Error("You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return m}function f(a){if("function"!=typeof a)throw Error("Expected the listener to be a function.");if(r)throw Error("You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api-reference/store#subscribelistener for more details.");
47
- var b=!0;q===p&&(q=p.slice());return q.push(a),function(){if(b){if(r)throw Error("You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api-reference/store#subscribelistener for more details.");b=!1;q===p&&(q=p.slice());var c=q.indexOf(a);q.splice(c,1);p=null}}}function g(a){if("object"!=typeof a||null===a)var b=!1;else{for(b=a;null!==Object.getPrototypeOf(b);)b=Object.getPrototypeOf(b);b=Object.getPrototypeOf(a)===b}if(!b)throw Error("Actions must be plain objects. Use custom middleware for async actions.");
48
- if(void 0===a.type)throw Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(r)throw Error("Reducers may not dispatch actions.");try{r=!0,m=h(m,a)}finally{r=!1}b=p=q;for(var c=0;c<b.length;c++)(0,b[c])();return a}var k;if("function"==typeof b&&"function"==typeof c||"function"==typeof c&&"function"==typeof d)throw Error("It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function.");
49
- if("function"==typeof b&&void 0===c&&(c=b,b=void 0),void 0!==c){if("function"!=typeof c)throw Error("Expected the enhancer to be a function.");return c(ad)(a,b)}if("function"!=typeof a)throw Error("Expected the reducer to be a function.");var h=a,m=b,p=[],q=p,r=!1;return g({type:Na.INIT}),(k={dispatch:g,subscribe:f,getState:e,replaceReducer:function(a){if("function"!=typeof a)throw Error("Expected the nextReducer to be a function.");h=a;g({type:Na.REPLACE})}})[bd]=function(){var a;return(a={subscribe:function(a){function b(){a.next&&
50
- a.next(e())}if("object"!=typeof a||null===a)throw new TypeError("Expected the observer to be an object.");return b(),{unsubscribe:f(b)}}})[bd]=function(){return this},a},k}function cd(a){for(var b=Object.keys(a),c={},d=0;d<b.length;d++){var e=b[d];"function"==typeof a[e]&&(c[e]=a[e])}var f=Object.keys(c);try{!function(a){Object.keys(a).forEach(function(b){var c=a[b];if(void 0===c(void 0,{type:Na.INIT}))throw Error('Reducer "'+b+"\" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.");
51
- if(void 0===c(void 0,{type:Na.PROBE_UNKNOWN_ACTION()}))throw Error('Reducer "'+b+"\" returned undefined when probed with a random type. Don't try to handle "+Na.INIT+' or other actions in "redux/*" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.');})}(c)}catch(k){var g=k}return function(a,
52
- b){if(void 0===a&&(a={}),g)throw g;for(var d=!1,e={},h=0;h<f.length;h++){var k=f[h],n=a[k],y=(0,c[k])(n,b);if(void 0===y)throw a=b&&b.type,Error("Given "+(a&&'action "'+String(a)+'"'||"an action")+', reducer "'+k+'" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.');e[k]=y;d=d||y!==n}return d||f.length!==Object.keys(a).length?e:a}}function dd(a,b){var c=Object.keys(a);return Object.getOwnPropertySymbols&&
53
- c.push.apply(c,Object.getOwnPropertySymbols(a)),b&&(c=c.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c}function Ie(a){for(var b=1;b<arguments.length;b++){var c=null!=arguments[b]?arguments[b]:{};b%2?dd(c,!0).forEach(function(b){var d=c[b];b in a?Object.defineProperty(a,b,{value:d,enumerable:!0,configurable:!0,writable:!0}):a[b]=d}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(c)):dd(c).forEach(function(b){Object.defineProperty(a,
54
- b,Object.getOwnPropertyDescriptor(c,b))})}return a}function ed(){for(var a=arguments.length,b=Array(a),c=0;c<a;c++)b[c]=arguments[c];return 0===b.length?function(a){return a}:1===b.length?b[0]:b.reduce(function(a,b){return function(){return a(b.apply(void 0,arguments))}})}function R(a){for(var b=arguments.length,c=Array(1<b?b-1:0),d=1;d<b;d++)c[d-1]=arguments[d];throw Error("[Immer] minified error nr: "+a+(c.length?" "+c.map(function(a){return"'"+a+"'"}).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf");
55
- }function xa(a){return!!a&&!!a[K]}function ma(a){var b;if(b=!!a)a&&"object"==typeof a?(b=Object.getPrototypeOf(a),null===b?b=!0:(b=Object.hasOwnProperty.call(b,"constructor")&&b.constructor,b="function"==typeof b&&Function.toString.call(b)===Je)):b=!1,b=b||Array.isArray(a)||!!a[fd]||!!a.constructor[fd]||Ob&&a instanceof Map||Pb&&a instanceof Set;return b}function Oa(a,b,c){void 0===c&&(c=!1);0===ya(a)?(c?Object.keys:Qb)(a).forEach(function(d){c&&"symbol"==typeof d||b(d,a[d],a)}):a.forEach(function(c,
56
- e){return b(e,c,a)})}function ya(a){var b=a[K];return b?3<b.i?b.i-4:b.i:Array.isArray(a)?1:Ob&&a instanceof Map?2:Pb&&a instanceof Set?3:0}function Rb(a,b){return 2===ya(a)?a.has(b):Object.prototype.hasOwnProperty.call(a,b)}function gd(a,b,c){var d=ya(a);2===d?a.set(b,c):3===d?(a.delete(b),a.add(c)):a[b]=c}function na(a){return a.o||a.t}function Sb(a){if(Array.isArray(a))return Array.prototype.slice.call(a);var b=Ke(a);delete b[K];for(var c=Qb(b),d=0;d<c.length;d++){var e=c[d],f=b[e];!1===f.writable&&
57
- (f.writable=!0,f.configurable=!0);(f.get||f.set)&&(b[e]={configurable:!0,writable:!0,enumerable:f.enumerable,value:a[e]})}return Object.create(Object.getPrototypeOf(a),b)}function Tb(a,b){return void 0===b&&(b=!1),Ub(a)||xa(a)||!ma(a)||(1<ya(a)&&(a.set=a.add=a.clear=a.delete=Le),Object.freeze(a),b&&Oa(a,function(a,b){return Tb(b,!0)},!0)),a}function Le(){R(2)}function Ub(a){return null==a||"object"!=typeof a||Object.isFrozen(a)}function X(a){var b=Me[a];return b||R(18,a),b}function Vb(a,b){b&&(X("Patches"),
58
- a.u=[],a.s=[],a.v=b)}function ib(a){Wb(a);a.p.forEach(Ne);a.p=null}function Wb(a){a===ea&&(ea=a.l)}function Ne(a){a=a[K];0===a.i||1===a.i?a.j():a.g=!0}function Xb(a,b){b._=b.p.length;var c=b.p[0],d=void 0!==a&&a!==c;return b.h.O||X("ES5").S(b,a,d),d?(c[K].P&&(ib(b),R(4)),ma(a)&&(a=jb(b,a),b.l||kb(b,a)),b.u&&X("Patches").M(c[K],a,b.u,b.s)):a=jb(b,c,[]),ib(b),b.u&&b.v(b.u,b.s),a!==hd?a:void 0}function jb(a,b,c){if(Ub(b))return b;var d=b[K];if(!d)return Oa(b,function(e,g){return id(a,d,b,e,g,c)},!0),
59
- b;if(d.A!==a)return b;if(!d.P)return kb(a,d.t,!0),d.t;if(!d.I){d.I=!0;d.A._--;var e=4===d.i||5===d.i?d.o=Sb(d.k):d.o;Oa(3===d.i?new Set(e):e,function(b,g){return id(a,d,e,b,g,c)});kb(a,e,!1);c&&a.u&&X("Patches").R(d,c,a.u,a.s)}return d.o}function id(a,b,c,d,e,f){if(xa(e)){f=jb(a,e,f&&b&&3!==b.i&&!Rb(b.D,d)?f.concat(d):void 0);if(gd(c,d,f),!xa(f))return;a.m=!1}!ma(e)||Ub(e)||!a.h.F&&1>a._||(jb(a,e),b&&b.A.l||kb(a,e))}function kb(a,b,c){void 0===c&&(c=!1);a.h.F&&a.m&&Tb(b,c)}function Yb(a,b){var c=
60
- a[K];return(c?na(c):a)[b]}function jd(a,b){if(b in a)for(a=Object.getPrototypeOf(a);a;){var c=Object.getOwnPropertyDescriptor(a,b);if(c)return c;a=Object.getPrototypeOf(a)}}function Zb(a){a.P||(a.P=!0,a.l&&Zb(a.l))}function $b(a){a.o||(a.o=Sb(a.t))}function ac(a,b,c){if(Ob&&b instanceof Map)b=X("MapSet").N(b,c);else if(Pb&&b instanceof Set)b=X("MapSet").T(b,c);else if(a.O){a=Array.isArray(b);var d=b={i:a?1:0,A:c?c.A:ea,P:!1,I:!1,D:{},l:c,t:b,k:null,o:null,j:null,C:!1},e=lb;a&&(d=[b],e=mb);d=Proxy.revocable(d,
61
- e);a=d.revoke;d=d.proxy;b=(b.k=d,b.j=a,d)}else b=X("ES5").J(b,c);return(c?c.A:ea).p.push(b),b}function Oe(a){return xa(a)||R(22,a),function d(a){if(!ma(a))return a;var c=a[K],f=ya(a);if(c){if(!c.P&&(4>c.i||!X("ES5").K(c)))return c.t;c.I=!0;var g=kd(a,f);c.I=!1}else g=kd(a,f);return Oa(g,function(a,e){var f;if(f=c)f=c.t,f=(2===ya(f)?f.get(a):f[a])===e;f||gd(g,a,d(e))}),3===f?new Set(g):g}(a)}function kd(a,b){switch(b){case 2:return new Map(a);case 3:return Array.from(a)}return Sb(a)}function za(a){return a.endsWith("info.json")?
62
- a:a.endsWith("/")?a+"info.json":a+"/info.json"}function E(a){return a["@id"]?a["@id"]:a.id?a.id:void 0}function bc(a){if(!a||!a.profile||!E(a))return!1;a=Array.isArray(a.profile)?a.profile:[a.profile];for(let b of a)if("string"==typeof b&&-1!==ld.indexOf(b))return!0;return!1}function Pe(a){if(!function(a){if(!bc(a))return!1;a=Array.isArray(a.profile)?a.profile:[a.profile];for(let b of a)if("string"==typeof b){if(-1!==md.indexOf(b))return!0}else if(a=b.supports||[],-1!==a.indexOf("regionByPx")&&(-1!==
63
- a.indexOf("sizeByW")||-1!==a.indexOf("sizeByWh")))return!0;return!1}(a))return[];let b=[];var c=Array.isArray(a.profile)?a.profile:[a.profile],d=c.length;for(var e=0;e<d;e++){let b=c[e];if("string"!=typeof b&&(b.maxHeight||b.maxWidth))return[{id:E(a),type:"variable",minWidth:0,minHeight:0,maxHeight:b.maxHeight||b.maxWidth,maxWidth:b.maxWidth||b.maxHeight}]}if(a.tiles)for(c=a.tiles.length,d=0;d<c;d++)e=a.tiles[d],(e.height||e.width)&&b.push({id:E(a),type:"variable",minHeight:0,minWidth:0,maxHeight:e.height||
64
- e.width,maxWidth:e.width});return b}function nd(a){var b=a.match(/^.*\/(full)\/(((\d+),(\d+)?)|max)\/(\d+)\/default\.(jpg|png|jpeg)$/);if(b){let c=b[1],d=parseInt(b[4],10),e=parseInt(b[5],10);b=b[7];if(("max"===c||"full"===c)&&d&&e&&b)return{type:"fixed",id:a,height:e,width:d}}return{type:"unknown",id:a}}function cc(a){if("string"==typeof a)return nd(a);var b=(c=a)["@type"]?c["@type"]:c.type?c.type:void 0,c;return"Image"!==b&&"sc:Image"!==b?null:(b=E(a))?b&&a.width&&a.height?{id:b,type:"fixed",width:a.width,
65
- height:a.height,unsafe:!0}:nd(b):null}function Qe(a){return bc(a)?(a&&a.sizes?a.sizes:[]).map(b=>({id:E(a),type:"fixed-service",height:b.height,width:b.width})):[]}function od(a){let b=[],c=a.length;for(let e=0;e<c;e++){var d=Qe(a[e]);d.length&&b.push(...d);d=Pe(a[e]);d.length&&b.push(...d)}return b}function pd(a){let b=a.service?Array.isArray(a.service)?a.service:[a.service]:[],c=b.length,d=[];for(let e=0;e<c;e++)bc(b[e])&&a.width&&a.height&&d.push(b[e]);return d}function dc(a,b,c){return{id:[za(E(a)).slice(0,
66
- -10),"full",[b,c||""].join(),0,"default.jpg"].join("/"),type:"fixed",width:b,height:c||a.height/a.width*b,unsafe:a.width>b}}function Aa(a){a=a.replace(/(https?:\/\/)?(www.)?/i,"");return-1!==a.indexOf("/")?a.split("/")[0]:a}function Re(a,b){let c=[],d=Object.assign({unsafeImageService:!1,atAnyCost:!0,fallback:!0,minHeight:64,minWidth:64,maxHeight:1/0,maxWidth:1/0,returnAllOptions:!1,preferFixedSize:!1,allowUnsafe:!1,explain:!1,height:0,width:0},a);a=[];let e=[],f=null,g=(a,b)=>{var c=d.width?d.width:
67
- d.maxWidth;if(c=a.height<=d.maxHeight&&a.width<=d.maxWidth&&a.height>=d.minHeight&&a.width>=d.minWidth&&(!b||Math.abs(a.width-c)<Math.abs(b.width-c))){if(d.preferFixedSize&&a.unsafe)return void e.push(a);d.returnAllOptions&&b&&e.push(b);f=a}else d.returnAllOptions&&e.push(a)},k=b.length;for(let c=0;c<k;c++){let e=b[c](),k=e.length;for(let b=0;b<k;b++){let c=e[b];if("unknown"===c.type&&d.atAnyCost&&a.push(c),"fixed"===c.type&&(c.unsafe?a.push(c):g(c,f)),"fixed-service"===c.type)d.unsafeImageService?
68
- g(dc(c,d.width,d.height),f):g(dc(c,c.width,c.height),f);"variable"===c.type&&c.maxWidth&&g(dc({id:c.id,type:"fixed-service",width:c.maxWidth,height:c.maxWidth},c.maxWidth),f)}if(f&&!d.returnAllOptions&&!f.unsafe&&!d.allowUnsafe)break}return d.atAnyCost&&0===e.length?{best:f||a[0],fallback:a.slice(1),log:c}:d.returnAllOptions?{best:d.atAnyCost?f||e[0]||a[0]:f||e[0],fallback:[...e,...a],log:c}:{best:f||e[0]||null,fallback:f?e:e.slice(1),log:c}}function Ba(a,b,c,d){return new (c||(c=Promise))(function(e,
69
- f){function g(a){try{h(d.next(a))}catch(p){f(p)}}function k(a){try{h(d.throw(a))}catch(p){f(p)}}function h(a){a.done?e(a.value):function(a){return a instanceof c?a:new c(function(b){b(a)})}(a.value).then(g,k)}h((d=d.apply(a,b||[])).next())})}function oa(a,b="none"){if(!a)return{};var c=Array.isArray(a)?a:[a];a={};for(let d of c)"string"==typeof d?(a[b]=a[b]?a[b]:[],a[b].push(d||"")):d["@language"]?(c=d["@language"],a[c]=a[c]?a[c]:[],a[c].push(d["@value"]||"")):(a[b]=a[b]?a[b]:[],a[b].push(d["@value"]||
70
- ""));return a}function ec(a){let b=a["@id"]||a.id,c=a["@type"]||a.type;var d=a.profile||void 0,e=a["@context"]||void 0;if(d&&(d=function(a){switch(a){case "http://iiif.io/api/image/2/level0.json":case "http://iiif.io/api/image/2/level1.json":case "http://iiif.io/api/image/2/level2.json":return"ImageService2";case "http://iiif.io/api/auth/1/kiosk":case "http://iiif.io/api/auth/1/login":case "http://iiif.io/api/auth/1/clickthrough":case "http://iiif.io/api/auth/1/external":case "http://iiif.io/api/auth/0/kiosk":case "http://iiif.io/api/auth/0/login":case "http://iiif.io/api/auth/0/clickthrough":case "http://iiif.io/api/auth/0/external":return"AuthCookieService1";
71
- case "http://iiif.io/api/auth/1/token":case "http://iiif.io/api/auth/0/token":return"AuthTokenService1";case "http://iiif.io/api/auth/1/logout":case "http://iiif.io/api/auth/0/logout":return"AuthLogoutService1";case "http://iiif.io/api/search/1/search":case "http://iiif.io/api/search/0/search":return"SearchService1";case "http://iiif.io/api/search/1/autocomplete":case "http://iiif.io/api/search/0/autocomplete":return"AutoCompleteService1"}}(d)))return d;if(e&&(e=function(a){a=Array.isArray(a)?a:[a];
72
- for(const b of a)switch(b){case "http://iiif.io/api/image/2/context.json":case "http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level2":return"ImageService2";case "http://iiif.io/api/image/1/context.json":case "http://library.stanford.edu/iiif/image-api/1.1/context.json":return"ImageService1";case "http://iiif.io/api/annex/openannotation/context.json":return"ImageApiSelector"}}(e)))return e;if(c){if(Array.isArray(c)){if(-1!==c.indexOf("oa:CssStylesheet"))return"CssStylesheet";if(-1!==
73
- c.indexOf("cnt:ContentAsText"))return"TextualBody";c=c[0]}for(let a of["sc","oa","dcterms","dctypes","iiif"])if(c.startsWith(a+":")){c=c.slice(a.length+1);break}switch(c){case "Layer":return"AnnotationCollection";case "AnnotationList":return"AnnotationPage";case "cnt:ContentAsText":return"TextualBody"}}if(a.format){if(a.format.startsWith("image/"))return"Image";if(a.format.startsWith("text/")||"application/pdf"===a.format)return"Text";if(a.format.startsWith("application/"))return"Dataset"}return b&&
74
- (b.endsWith(".jpg")||b.endsWith(".png")||b.endsWith(".jpeg"))?"Image":c||"unknown"}function Y(a){for(let b in a)void 0!==a[b]&&null!==a[b]||delete a[b];return a}function qd(a,b){let c=encodeURI(a.id||a["@id"]||"").trim();return c&&b?`${c}/${b}`:c||(rd++,`http://example.org/${a["@type"]}${b?"/"+b:""}/${rd}`)}function Z(a){var b=[...a.behavior||[]];a.viewingHint&&b.push(a.viewingHint);if(a["@context"])a:{var c=a["@context"];if(c){c=Array.isArray(c)?c:[c];var d=[];for(e of c)"http://iiif.io/api/presentation/2/context.json"===
75
- e&&d.push("http://iiif.io/api/presentation/3/context.json"),-1===Se.indexOf(e)&&d.push(e);if(c.length){var e=1===d.length?d[0]:d;break a}}e=void 0}else e=void 0;c=(a["@id"]||qd(a)).trim();d=ec(a);b=b.length?b:void 0;var f=a.height?a.height:void 0,g=a.width?a.width:void 0;if(a.motivation)a:{var k=a.motivation;for(h of["sc","oa","dcterms","dctypes","iiif"])if(k.startsWith(h+":")){var h=k.slice(h.length+1);break a}h=k}else h=void 0;return{"@context":e,id:c,type:d,behavior:b,height:f,width:g,motivation:h,
76
- viewingDirection:a.viewingDirection,profile:a.profile,format:a.format?a.format:void 0,duration:void 0,timeMode:void 0}}function U(a){let [b,c]=function(a,b="Rights/License",c="none"){let d=null;const e=[];a=Array.isArray(a)?a:[a];for(const f of a){if(f){{a=f;let b=a.match(Te);a=b?b[0]:a}}else a=void 0;!a||-1===a.indexOf("creativecommons.org")&&-1===a.indexOf("rightsstatements.org")?a&&e.push({label:{[c]:[b]},value:{[c]:[a]}}):d=a.startsWith("https://")?"http://"+a.slice(8):a}return[d,e]}(a.license),
77
- d=[...a.metadata?(e=a.metadata,e?e.map(a=>({label:oa(a.label),value:oa(a.value)})):[]):[],...c];var e;return{rights:b,metadata:d.length?d:void 0,label:a.label?oa(a.label):void 0,requiredStatement:a.attribution?{label:oa("Attribution"),value:oa(a.attribution)}:void 0,navDate:a.navDate,summary:a.description?oa(a.description):void 0,thumbnail:a.thumbnail}}function fa(a){var b=a.related?Array.isArray(a.related)?a.related:[a.related]:[];let c=a.contentLayer;b=a.logo||b.length?[{id:"http://example.org/provider",
78
- type:"Agent",homepage:b.length?[b[0]]:void 0,logo:a.logo?Array.isArray(a.logo)?a.logo:[a.logo]:void 0,label:oa("Unknown")}]:void 0;if(a.within){var d=Array.isArray(a.within)?a.within:[a.within],e=[];for(f of d)if("string"==typeof f){if(f)switch(a["@type"]){case "sc:Manifest":e.push({id:f,type:"Collection"})}}else f["@id"]&&e.push({id:f["@id"],type:ec(f)});var f=e.length?e:void 0}else f=void 0;return{provider:b,partOf:f,rendering:a.rendering,seeAlso:a.seeAlso,start:a.startCanvas,service:a.service?
79
- (g=a.service,Array.isArray(g)?g:[g]):void 0,supplementary:c?[c]:void 0};var g}function Ue(a){let b=[];for(let c of a||[])b.push(...c);return b}function sd(a,b){if("string"==typeof a)return{id:a,type:b};if(!a.id)throw Error(`Invalid resource does not have an ID (${b})`);return a}function Ve(a){a=JSON.stringify(a);let b=5381,c=a.length;for(;c;)b=33*b^a.charCodeAt(--c);a=(b>>>0).toString(16);return a.length%2?"0"+a:a}function fc(a){return b=>"string"==typeof b?{id:b,type:a}:b.id?b.type?b:Object.assign({type:a},
80
- b):Object.assign({id:Ve(b),type:a},b)}function Pa(a){return b=>Object.assign(Object.assign({},a),b)}function Ca(a){return Array.isArray(a)?a:[a]}function We(a){return a.body&&(a.body=Ca(a.body)),a.seeAlso&&(a.seeAlso=Ca(a.seeAlso)),a.body&&(a.body=Ca(a.body)),a.audience&&(a.audience=Ca(a.audience)),a.accessibility&&(a.accessibility=Ca(a.accessibility)),a.motivation&&(a.motivation=Ca(a.motivation)),a}function Xe(a){a=function(a){return a&&a["@context"]&&("http://iiif.io/api/presentation/2/context.json"===
81
- a["@context"]||-1!==a["@context"].indexOf("http://iiif.io/api/presentation/2/context.json")||"http://www.shared-canvas.org/ns/context.json"===a["@context"])||"http://iiif.io/api/image/2/context.json"===a["@context"]?Ye.traverseUnknown(a):a}(a);let b={Collection:{},Manifest:{},Canvas:{},AnnotationPage:{},AnnotationCollection:{},Annotation:{},ContentResource:{},Range:{},Service:{},Selector:{}},c={},d=function(a){return(b,c)=>{const d=a[b]?a[b]:{};return a=>(a=sd(a,c||b))&&a.id&&b?(d[a.id]=d[a.id]?Object.assign({},
82
- d[a.id],a):Object.assign({},a),{id:a.id,type:"ContentResource"===b?b:a.type}):a}}(b),e=function(a){return(b,c)=>d=>{const {id:e,type:f}=sd(d,c||b);if(void 0===e)throw Error("Found invalid entity without an ID.");return a[e]="ContentResource"===b?b:f,d}}(c);return{entities:b,resource:(new td({collection:[Pa(Ze),e("Collection"),d("Collection")],manifest:[Pa($e),e("Manifest"),d("Manifest")],canvas:[Pa(af),e("Canvas"),d("Canvas")],annotationPage:[fc("AnnotationPage"),Pa(bf),e("AnnotationPage"),d("AnnotationPage")],
83
- annotation:[fc("Annotation"),We,e("Annotation"),d("Annotation")],contentResource:[fc("ContentResource"),e("ContentResource"),d("ContentResource")],range:[Pa(cf),e("Range","Canvas"),d("Range","Canvas")]})).traverseUnknown(a),mapping:c}}function df(a,b,c){if(!b.type||!b.id)throw Error("Unknown entity");if(!c[b.type])throw Error("Serialiser not found for "+b.type);return function f(b){var e=c[b.type];if(!e)return"__$HF_UNSET$__";b=function(a,b){const c=a.hyperion.requests[b],e=a.hyperion.mapping[b];
84
- if(e&&(!c||!c.resourceUri||a.hyperion.entities[e][c.resourceUri]))return a.hyperion.entities[e][c?c.resourceUri:b]}(a,b.id);if(!b)return"__$HF_UNSET$__";e=e(b,a);for(b=e.next();!b.done;){b=b.value;var k="__$HF_UNSET$__";if(b)if(Array.isArray(b)){k=[];for(let a of b)k.push(f(a))}else k=f(b);b=e.next(k)}return"__$HF_UNSET$__"===b.value?"__$HF_UNSET$__":function(a){let b={};for(let [c,e]of a){if("__$HF_UNWRAP$__"===c)return e;"__$HF_UNSET$__"!==e&&null!=e&&(b[c]=e)}return b}(b.value)}(b)}function Da(a){if(a){var b=
85
- Object.keys(a);if(0!==b.length){if(1===b.length){b=b[0];if(!b)return"";let c=(a[b]||[]).join("");return"@none"===b||"none"===b||"en"===b?c:{"@language":b,"@value":c}}return b.map(b=>({"@language":b,"@value":(a[b]||[]).join("")}))}}}function ud(a){return Array.isArray(a)?a.map(a=>ud(a)):"string"==typeof a?a:a.type&&"Canvas"===a.type?a.id:a}function ha(a,b=!1){if(a)return 1<a.length&&!b?a:a[0]||void 0}function ef(a){if(a)return"string"==typeof a?{"@id":a}:"@id"in a?(a=Object.assign({},a),delete a["@type"],
86
- a):{"@context":"http://iiif.io/api/image/2/context.json","@id":a.id,profile:`http://iiif.io/api/image/2/profiles/${a.profile}.json`}}function pa(a,b){return[["@id",a.id],["@type",b],["format",a.format],["height",a.height],["width",a.width],["viewingDirection","left-to-right"!==a.viewingDirection?a.viewingDirection:void 0]]}function*qa(a){let b=a.provider?a.provider[0]:void 0;return[["label",Da(a.label)],["metadata",a.metadata&&a.metadata.length?a.metadata.map(a=>({label:Da(a.label)||"",value:Da(a.value)||
87
- ""})):void 0],["description",Da(a.summary)],["thumbnail",ha(yield a.thumbnail)],["navDate",a.navDate],["logo",b?ha(b.logo):void 0],["homepage",b?b.homepage:void 0],["attribution",a.requiredStatement?Da(a.requiredStatement.value):void 0]]}function*Qa(a){return[["seeAlso",ha(yield a.seeAlso)],["service",ha((a.service||[]).map(ef))],["rendering",ha(yield a.rendering)],["startCanvas",a.start?a.start.id:void 0]]}function Ra(a){return[["id",a.id],["type",a.type],["format",a.format],["profile",a.profile],
88
- ["height",a.height],["width",a.width],["duration",a.duration||void 0],["viewingDirection","left-to-right"!==a.viewingDirection?a.viewingDirection:void 0],["behavior",a.behavior&&a.behavior.length?a.behavior:void 0],["timeMode",a.timeMode],["motivation",a.motivation]]}function J(a){if(a&&0!==a.length)return a}function*Sa(a){return[["label",a.label],["metadata",J(a.metadata)],["summary",a.summary],["requiredStatement",a.requiredStatement],["rights",a.rights],["navDate",a.navDate],["language",a.language],
89
- ["thumbnail",J(yield a.thumbnail)],["placeholderCanvas",yield a.placeholderCanvas],["accompanyingCanvas",yield a.accompanyingCanvas],["provider",J(a.provider)]]}function*Ea(a){return[["seeAlso",J(yield a.seeAlso)],["service",J(a.service)],["services",J(a.services)],["rendering",J(yield a.rendering)],["supplementary",J(yield a.supplementary)],["partOf",J(a.partOf)],["start",a.start]]}function ff(a={},b=[],c={}){return ad(cd(Object.assign({hyperion:gf},a)),c,hf(function(){for(var a=arguments.length,
90
- b=Array(a),c=0;c<a;c++)b[c]=arguments[c];return function(a){return function(){var c=a.apply(void 0,arguments),d=function(){throw Error("Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.");},e={getState:c.getState,dispatch:function(){return d.apply(void 0,arguments)}},f=b.map(function(a){return a(e)});return Ie({},c,{dispatch:d=ed.apply(void 0,f)(c.dispatch)})}}}(...b)))}function jf(a,b,c,d){return new (c||(c=Promise))(function(e,
91
- f){function g(a){try{h(d.next(a))}catch(p){f(p)}}function k(a){try{h(d.throw(a))}catch(p){f(p)}}function h(a){a.done?e(a.value):function(a){return a instanceof c?a:new c(function(b){b(a)})}(a.value).then(g,k)}h((d=d.apply(a,b||[])).next())})}function gc(a,b){let c=a.hyperion.requests[b];if((b=a.hyperion.mapping[b])&&a.hyperion.entities[b][c.resourceUri])return a.hyperion.entities[b][c.resourceUri]}function vd(a,b,{waitTimeout:c=30}={}){return(d,e)=>jf(this,void 0,void 0,function*(){var f=a.getState();
92
- let g=f.hyperion.requests[d];if(g)switch(g.loadingState){case "RESOURCE_LOADING":{let b;try{let e=yield Promise.race([new Promise((c,e)=>{b=a.subscribe(()=>{var b=a.getState();"RESOURCE_ERROR"!==b.hyperion.requests[d].loadingState?"RESOURCE_READY"===b.hyperion.requests[d].loadingState&&((b=gc(b,d))?c(b):e()):e()})}),new Promise((a,b)=>setTimeout(b,60*c))]);if(b&&b(),e)return e}catch(h){b&&b();break}break}case "RESOURCE_READY":if(f=gc(f,d))return f}a.dispatch(kf({id:d}));try{let c=yield b(d,e),f=((a,
93
- b)=>{const {entities:c,resource:d,mapping:e}=Xe(b);if(void 0===d.id)return[wd({id:a,message:"ID is not defined in resource."})];b=[xd({entities:c}),lf({mapping:e})];return d.id!==a&&(b.push(mf({id:a,type:d.type})),b.push(nf({requestId:a,actualId:d.id}))),b.push(of({id:a})),b})(d,c);for(let b of f)a.dispatch(b);return gc(a.getState(),d)}catch(k){throw a.dispatch(wd({id:d,message:k.toString()})),k;}})}function pf(a,b,c,d){return new (c||(c=Promise))(function(e,f){function g(a){try{h(d.next(a))}catch(p){f(p)}}
94
- function k(a){try{h(d.throw(a))}catch(p){f(p)}}function h(a){a.done?e(a.value):function(a){return a instanceof c?a:new c(function(b){b(a)})}(a.value).then(g,k)}h((d=d.apply(a,b||[])).next())})}function yd(a){return a.id||a["@id"]}function hc(a,b,c){return Ka(this,void 0,void 0,function(){var d;return La(this,function(e){switch(e.label){case 0:return[4,qf.loadService({id:a,width:b,height:c})];case 1:return[2,{id:yd(d=e.sent()),width:b,height:c,imageService:d,thumbnail:void 0}]}})})}function zd(a,b){return void 0===
95
- b&&(b=512),Ka(this,void 0,void 0,function(){var c,d,e,f,g,k,h,m,p,q,r,n,y,v,x,u;return La(this,function(l){switch(l.label){case 0:c=[],l.label=1;case 1:l.trys.push([1,13,14,15]),d=F(a.items),e=d.next(),l.label=2;case 2:if(e.done)return[3,12];f=e.value;l.label=3;case 3:l.trys.push([3,9,10,11]),x=void 0,g=F(ra.fromRef(f).items),k=g.next(),l.label=4;case 4:return k.done?[3,8]:(h=k.value,m=ra.fromRef(ra.fromRef(h).body[0]),[4,hc(m.service[0].id,a.width,a.height)]);case 5:return p=l.sent(),[4,ra.getThumbnail(a,
96
- {maxHeight:b,maxWidth:b},!0)];case 6:(q=l.sent().best)&&(p.thumbnail=q),c.push(p),l.label=7;case 7:return k=g.next(),[3,4];case 8:return[3,11];case 9:return r=l.sent(),x={error:r},[3,11];case 10:try{k&&!k.done&&(u=g.return)&&u.call(g)}finally{if(x)throw x.error;}return[7];case 11:return e=d.next(),[3,2];case 12:return[3,15];case 13:return n=l.sent(),y={error:n},[3,15];case 14:try{e&&!e.done&&(v=d.return)&&v.call(d)}finally{if(y)throw y.error;}return[7];case 15:return[2,c]}})})}function Ad(a){return Ka(this,
97
- void 0,void 0,function(){var b,c,d,e,f,g,k,h,m,p,q;return La(this,function(r){switch(r.label){case 0:b=[],r.label=1;case 1:r.trys.push([1,6,7,8]),c=F(a.items),d=c.next(),r.label=2;case 2:return d.done?[3,5]:(e=d.value,f=ra.fromRef(e),k=(g=b.push).apply,h=[b],[4,zd(f)]);case 3:k.apply(g,h.concat([G.apply(void 0,[r.sent()])])),r.label=4;case 4:return d=c.next(),[3,2];case 5:return[3,8];case 6:return m=r.sent(),p={error:m},[3,8];case 7:try{d&&!d.done&&(q=c.return)&&q.call(c)}finally{if(p)throw p.error;
98
- }return[7];case 8:return[2,b]}})})}var A="default"in l?l.default:l;ua=ua&&Object.prototype.hasOwnProperty.call(ua,"default")?ua.default:ua;var Jc=function(a,b){return(Jc=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,b){a.__proto__=b}||function(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c])})(a,b)},B=function(){return(B=Object.assign||function(a){for(var b,c=1,d=arguments.length;c<d;c++)for(var e in b=arguments[c])Object.prototype.hasOwnProperty.call(b,e)&&(a[e]=b[e]);return a}).apply(this,
99
- arguments)};let nb=(a,b,c)=>{const d=a.length;c=c||w(d);for(let e=0;e<d;e++)c[e]=0==e%5?a[e+1]<b[3]&&a[e+3]>b[1]&&a[e+2]<b[4]&&a[e+4]>b[2]?1:0:a[e];return c},ia=(a,b,c)=>{c=c||w(9);return c[0]=a[0]*b[0]+a[1]*b[3]+a[2]*b[6],c[1]=a[0]*b[1]+a[1]*b[4]+a[2]*b[7],c[2]=a[0]*b[2]+a[1]*b[5]+a[2]*b[8],c[3]=a[3]*b[0]+a[4]*b[3]+a[5]*b[6],c[4]=a[3]*b[1]+a[4]*b[4]+a[5]*b[7],c[5]=a[3]*b[2]+a[4]*b[5]+a[5]*b[8],c[6]=a[6]*b[0]+a[7]*b[3]+a[8]*b[6],c[7]=a[6]*b[1]+a[7]*b[4]+a[8]*b[7],c[8]=a[6]*b[2]+a[7]*b[5]+a[8]*b[8],
100
- c};class D{constructor(a){this.index=0;this.length=a;this.points=w(this.length)}static grid(a=1,b=1){return new D(5*a*b)}static point(a,b){let c=w(5);return c[0]=1,c[1]=a,c[2]=b,c[3]=a,c[4]=b,c}static positionPair(a){let b=w(5);return b[0]=1,b[1]=a.x1,b[2]=a.y1,b[3]=a.x2,b[4]=a.y2,b}static projection(a){return D.singleBox(a.width,a.height,a.x,a.y)}static singleBox(a,b,c=0,d=0){let e=w(5);return e[0]=1,e[1]=c,e[2]=d,e[3]=a+c,e[4]=b+d,e}row(a){return a(this)}addPoints(a,b,c,d){return this.points[this.index]=
101
- 1,this.points[1+this.index]=a,this.points[2+this.index]=b,this.points[3+this.index]=c,this.points[4+this.index]=d,this.index+=5,this}addBox(a,b,c,d){return this.addPoints(a,b,a+c,b+d),this}build(){return this.points}}let ja=(a,b)=>{const c=a.length;for(let d=0;d<c;d++)a[d]=0==d%5?b[6]*a[d+1]+b[7]*a[d+2]+b[8]*a[d]:1==d%5%2?b[0]*a[d]+b[1]*a[d+1]+b[2]:b[3]*a[d-1]+b[4]*a[d]+b[5];return a},sa=a=>{const b=w(9);return b[0]=a,b[4]=a,b[8]=1,b},V=(a,b)=>{const c=w(9);return c[0]=1,c[2]=a,c[4]=1,c[5]=b,c[8]=
102
- 1,c},ob=(a,b,c)=>ia(V((1-a)*b,(1-a)*c),sa(a)),Ta=(a,b,c)=>{const d=a.length;c=c&&c.length>=d?c.slice(0,d):w(d);for(let e=0;e<d;e++)c[e]=0==e%5?b[6]*a[e+1]+b[7]*a[e+2]+b[8]*a[e]:1==e%5%2?b[0]*a[e]+b[1]*a[e+1]+b[2]:b[3]*a[e-1]+b[4]*a[e]+b[5];return c},ic=(a=21)=>{let b="",c=crypto.getRandomValues(new Uint8Array(a));for(;a--;){let d=63&c[a];b+=36>d?d.toString(36):62>d?(d-26).toString(36).toUpperCase():63>d?"_":"-"}return b};var hb="onMouseDown onMouseEnter onMouseLeave onMouseMove onMouseOut onMouseOver onMouseUp onTouchCancel onTouchEnd onTouchMove onTouchStart onPointerDown onPointerMove onPointerUp onPointerCancel onPointerEnter onPointerLeave onPointerOver onPointerOut onScroll onWheel onClick onDragStart onDragEnd onDragEnter onDragExit onDrag onDragOver".split(" "),
103
- wa=hb.reduce(function(a,b){return a[b.slice(2).toLowerCase()]=b,a[b]=b,a},{}),W=function(){function a(){var a=this;this.__revision=0;this.scale=1;this.layers=[];this.time=[];this.addEventListener=function(b,d,e){b=wa[b];if(!a.eventHandlers[b])throw Error("Unknown event "+b);-1===a.eventHandlers[b].indexOf(d)&&a.eventHandlers[b].push(d)};this.removeEventListener=function(b,d){b=wa[b];a.eventHandlers[b]?-1!==a.eventHandlers[b].indexOf(d)&&(a.eventHandlers[b]=a.eventHandlers[b].filter(function(a){return a!==
104
- d})):console.warn("Unknown event "+b)};this.id=this.__id=ic();this.eventHandlers=hb.reduce(function(a,b){return a[b]=[],a},{})}return a.prototype.getObjectsAt=function(a){return[]},a.prototype.getAllPointsAt=function(a,c,d){return[]},a.prototype.getScheduledUpdates=function(a,c){return null},a.prototype.dispatchEvent=function(a,c){var b=(a=this.eventHandlers[a])?a.length:0;if(b)for(var e=0;e<b;e++)a[e](c)},Object.defineProperty(a.prototype,"x",{get:function(){return this.points[1]},enumerable:!1,
105
- configurable:!0}),Object.defineProperty(a.prototype,"y",{get:function(){return this.points[2]},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"width",{get:function(){return this.points[3]-this.points[1]},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"height",{get:function(){return this.points[4]-this.points[2]},enumerable:!1,configurable:!0}),a.prototype.translate=function(a,c){ja(this.points,V(a,c))},a.prototype.atScale=function(a){ja(this.points,ob(a,this.x,
106
- this.y));this.scale*=a},a.prototype.transform=function(a){ja(this.points,a)},a.prototype.applyProps=function(a){this.__revision++},a.prototype.appendChild=function(a){},a.prototype.removeChild=function(a){},a.prototype.insertBefore=function(a,c){},a.prototype.hideInstance=function(){},a}(),ta=function(a){function b(b){var c=a.call(this)||this;if(c.type="spacial-content",b){var e=b.scale||1;c.id=b.id||b.uri;c.uri=b.uri;c.points=D.singleBox(b.width,b.height,b.x,b.y);c.display={scale:e,width:b.width/
107
- e,height:b.height/e,points:1!==e?D.singleBox(b.width/e,b.height/e):c.points}}else c.id="",c.uri="",c.display={scale:1,width:0,height:0,points:w(5)},c.points=w(5);return c}return N(b,a),b.prototype.applyProps=function(a){var b=a.target.width/(a.display?a.display.width:a.target.width);this.id=a.id||a.uri;this.uri=a.uri;this.points.set(D.singleBox(a.target.width,a.target.height,a.target.x,a.target.y));this.display.scale=b;this.display.width=a.target.width/b;this.display.height=a.target.height/b;this.display.points=
108
- 1!==b?D.singleBox(a.target.width/b,a.target.height/b):this.points},b.prototype.getAllPointsAt=function(a,b,e){return[[this,this.crop||this.points,b]]},b.fromSvg=function(a,d,e,f){return b.fromImage("data:image/svg+xml;base64,"+btoa(a),d,e,f)},b.fromImage=function(a,d,e,f){var c=new b;return c.applyProps({uri:a,id:f,display:e,target:d}),c},b.prototype.getImageUrl=function(){return this.uri},b}(W);"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?
109
- global:"undefined"!=typeof self&&self;var rf=function(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}(Cb(function(a,b){!function(c){c=function(a,b){function c(a,b){var c=++d;return function(){for(var d=[],e=0;e<arguments.length;e++)d[e]=arguments[e];var f;e="__memoized_value_"+c;var g="__memoized_map_"+c;b||0<d.length?(this.hasOwnProperty(g)||Object.defineProperty(this,g,{configurable:!1,enumerable:!1,writable:!1,value:new Map}),e=this[g],g=b?b.apply(this,
110
- d):d[0],e.has(g)?f=e.get(g):(f=a.apply(this,d),e.set(g,f))):this.hasOwnProperty(e)?f=this[e]:(f=a.apply(this,d),Object.defineProperty(this,e,{configurable:!1,enumerable:!1,writable:!1,value:f}));return f}}Object.defineProperty(b,"__esModule",{value:!0});b.Memoize=function(a){return function(b,d,e){if(null!=e.value)e.value=c(e.value,a);else{if(null==e.get)throw"Only put a Memoize() decorator on a method or get accessor.";e.get=c(e.get,a)}}};var d=0}(0,b);void 0!==c&&(a.exports=c)}()})),Fa=function(a){function b(b){var c,
111
- e,f=a.call(this)||this;return f.type="spacial-content",f.id=(c=b.url,e=c.length,c.indexOf("/info.json")===e-10?c.slice(0,-10):c),f.points=b.displayPoints?b.displayPoints:Ta(b.points,sa(b.scaleFactor)),f.tileWidth=b.tileWidth,f.display={width:b.width/b.scaleFactor,height:b.height/b.scaleFactor,points:b.points,scale:b.scaleFactor},f}return N(b,a),b.prototype.applyProps=function(a){},b.fromTile=function(a,d,e,f){e.height=e.height?e.height:e.width;for(var c=Math.ceil(d.width/f),k=Math.ceil(d.height/f),
112
- h=Math.ceil(c/e.width),m=Math.ceil(k/e.height),p=D.grid(h,m),q=D.grid(h,m),r=0;r<m;r++)for(var n=0;n<h;n++){var y=n*e.width,v=r*e.height;q.addPoints(y*f,v*f,n===h-1?d.width:(y+e.width)*f,r===m-1?d.height:(v+e.height)*f);p.addPoints(y,v,n===h-1?c:y+e.width,r===m-1?k:v+e.height)}return new b({url:a,scaleFactor:f,points:p.build(),displayPoints:q.build(),width:d.width,height:d.height,tileWidth:e.width})},b.prototype.getImageUrl=function(a){a=this.points.slice(5*a,5*a+5);var b=a[3]-a[1],c=Math.ceil(b/
113
- this.display.scale);return this.id+"/"+a[1]+","+a[2]+","+b+","+(a[4]-a[2])+"/"+(c>this.tileWidth?this.tileWidth:c)+",/0/default.jpg"},b.prototype.getAllPointsAt=function(a,b,e){return[[this,nb(this.points,a),b]]},b.prototype.transform=function(a){ja(this.points,a)},b.prototype.getScheduledUpdates=function(a,b){return null},function(a,b,e,f){var c,d=arguments.length,h=3>d?b:null===f?f=Object.getOwnPropertyDescriptor(b,e):f;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)h=Reflect.decorate(a,
114
- b,e,f);else for(var m=a.length-1;0<=m;m--)(c=a[m])&&(h=(3>d?c(h):3<d?c(b,e,h):c(b,e))||h);3<d&&h&&Object.defineProperty(b,e,h)}([rf.Memoize(),Bb("design:type",Function),Bb("design:paramtypes",[Number]),Bb("design:returntype",String)],b.prototype,"getImageUrl",null),b}(W),Bd=function(a){function b(b){var c=a.call(this)||this;return c.images=[],c.scaleFactors=[],c.aggregateBuffer=w(9),c.isFullyLoaded=!1,c.maxScaleFactor=0,c.loadFullResource=function(){return Ka(c,void 0,void 0,function(){var a;return La(this,
115
- function(b){switch(b.label){case 0:return this.isFullyLoaded?[2]:this.lazyLoader?(this.isFullyLoaded=!0,[4,this.lazyLoader()]):[3,2];case 1:a=b.sent(),this.addImages(a),b.label=2;case 2:return[2]}})})},c.fallback=[c.loadFullResource],c.id=b.id,c.points=D.singleBox(b.width,b.height),c.lazyLoader=b.loadFullImages,b.loadFullImages||(c.isFullyLoaded=!0),c.display={points:D.singleBox(b.width,b.height),height:b.height,width:b.width,scale:1},c.addImages(b.images),c}return N(b,a),b.prototype.applyProps=function(a){},
116
- b.prototype.appendChild=function(a){this.addImages([a])},b.prototype.removeChild=function(a){-1!==this.images.indexOf(a)&&(this.images=this.images.filter(function(b){return b!==a}),this.sortByScales())},b.prototype.insertBefore=function(a,b){this.addImages([a])},b.prototype.hideInstance=function(){console.log("hideInstance: not yet implemented")},b.prototype.addImages=function(a){var b,c;try{for(var f=F(a),g=f.next();!g.done;g=f.next())g.value.__parent=this}catch(h){var k={error:h}}finally{try{g&&
117
- !g.done&&(b=f.return)&&b.call(f)}finally{if(k)throw k.error;}}(c=this.images).push.apply(c,G(a.filter(Boolean)));this.sortByScales()},b.prototype.sortByScales=function(){this.images.sort(function(a,b){return b.display.width-a.display.width});this.scaleFactors=this.images.map(function(a){return a.display.scale});this.maxScaleFactor=Math.max.apply(Math,G(this.scaleFactors))},b.prototype.getScheduledUpdates=function(a,b){return this.isFullyLoaded?null:b>1/this.maxScaleFactor?this.fallback:null},b.prototype.getAllPointsAt=
118
- function(a,b,e){var c=1/(e||1);var d=this.images,k=d.length;if(0===k)throw Error("No resources passed in.");for(var h=0,m=0;m<k&&d[m]&&d[m].display;m++)h=Math.abs(d[m].display.scale-c)<Math.abs(d[h].display.scale-c)?m:h;c=h;d=this.images.length;b=b?ia(b,V(this.x,this.y)):V(this.x,this.y);if(c!==this.images.length-1&&this.images[c+1]){k=[];for(--d;d>=c;d--)k.push.apply(k,G(this.images[d].getAllPointsAt(a,b,e)));return k}return this.images[c].getAllPointsAt(a,b,e)},b}(function(a){function b(){var b=
119
- null!==a&&a.apply(this,arguments)||this;return b.type="spacial-content",b}return N(b,a),b.prototype.getAllPointsAt=function(a,b,e){return[[this,this.points,b]]},b}(W)),Ua=function(a){function b(b,d){var c=a.call(this)||this;c.type="world-object";c.intersectionBuffer=w(5);c.aggregateBuffer=w(9);c.invertedBuffer=w(9);c._updatedList=[];var f=d||{};d=f.x;d=void 0===d?0:d;f=f.y;f=void 0===f?0:f;return b?(c.id=b.id||"",c.scale=1,c.layers=b.layers,c.points=w([1,d,f,b.width,b.height]),c.worldPoints=w([1,
120
- d,f,b.width,b.height]),c.filteredPointsBuffer=w(5*b.layers.length)):(c.id="",c.scale=1,c.layers=[],c.points=w(5),c.worldPoints=w(5),c.filteredPointsBuffer=w(5)),c}return N(b,a),b.createWithProps=function(a){var c=new b;return c.applyProps(a),c},b.prototype.applyProps=function(a){var b=a.x||0,c=a.y||0;this.id=a.id;var f=void 0!==a.scale?a.scale:this.scale;this.points[0]=1;this.points[1]=b;this.points[2]=c;this.points[3]=b+a.width;this.points[4]=c+a.height;this.worldPoints[3]=this.worldPoints[1]+a.width*
121
- f;this.worldPoints[4]=this.worldPoints[2]+a.height*f;a.scale&&1!==a.scale&&this.atScale(f);this.scale=f},b.prototype.appendChild=function(a){0===a.points[0]&&a.points.set(this.points);this.addLayers([a])},b.prototype.removeChild=function(a){this.layers=this.layers.filter(function(b){return b!==a});this.filteredPointsBuffer=w(5*this.layers.length)},b.prototype.insertBefore=function(a,b){var c=this.layers.indexOf(b);-1!==c&&(b=this.layers.slice(0,c-1),c=this.layers.slice(c),this.layers=G(b,[a],c))},
122
- b.prototype.hideInstance=function(){console.warn("hideInstance: not yet implemented")},b.prototype.getObjectsAt=function(a){if(0===nb(this.points,a,this.filteredPointsBuffer)[0])return[];for(var b=this.layers.length,c=[],f=0;f<b;f++){var g=this.layers[f];0!==nb(Ta(g.points,V(this.x,this.y)),a,this.filteredPointsBuffer)[0]&&c.push(g)}return c},b.prototype.getAllPointsAt=function(a,b,e){var c=ia(V(this.x,this.y),sa(this.scale),this.aggregateBuffer);{var d=this.points;var k=a[1]<=d[3]&&a[3]>=d[1]&&a[2]<=
123
- d[4]&&a[4]>=d[2];let b=this.intersectionBuffer||w(5);k=k?(b[0]=1,b[1]=Math.max(a[1],d[1]),b[2]=Math.max(a[2],d[2]),b[3]=Math.min(a[3],d[3]),b[4]=Math.min(a[4],d[4]),b):(b[0]=0,b[1]=0,b[2]=0,b[3]=0,b[4]=0,b)}a=this.layers.length;d=[];k=Ta(k,ia(sa(1/this.scale),V(-this.x,-this.y),this.invertedBuffer));b=b?ia(b,c,this.aggregateBuffer):c;e*=this.scale;for(c=0;c<a;c++)d.push.apply(d,G(this.layers[c].getAllPointsAt(k,b,e)));return d},b.prototype.addLayers=function(a){var b;try{for(var c=F(a),f=c.next();!f.done;f=
124
- c.next()){var g=f.value;5===g.points.length&&(g.points[1]<this.worldPoints[1]/this.scale||g.points[2]<this.worldPoints[2]/this.scale||g.points[3]>this.worldPoints[3]/this.scale||g.points[4]>this.worldPoints[4]/this.scale)&&(g.crop=w([1,Math.max(this.worldPoints[1]/this.scale,g.points[1]),Math.max(this.worldPoints[2]/this.scale,g.points[2]),Math.min(this.worldPoints[3]/this.scale,g.points[3]),Math.min(this.worldPoints[4]/this.scale,g.points[4])]))}}catch(h){var k={error:h}}finally{try{f&&!f.done&&
125
- (b=c.return)&&b.call(c)}finally{if(k)throw k.error;}}this.layers=this.layers.concat(a);this.filteredPointsBuffer=w(5*this.layers.length)},b.prototype.getScheduledUpdates=function(a,b){var c,d=this.layers.length;this._updatedList=[];b*=this.scale;for(var g=0;g<d;g++){var k=this.layers[g].getScheduledUpdates(a,b);k&&(c=this._updatedList).push.apply(c,G(k))}return this._updatedList},b}(W),Ga=function(a){function b(b,d,e,f){void 0===b&&(b=0);void 0===d&&(d=0);void 0===e&&(e=100);void 0===f&&(f="left-to-right");
126
- var c=a.call(this)||this;return c.id="world",c.aggregateBuffer=w(9),c.isDirty=!1,c.zones=[],c.triggerQueue=[],c.activatedEvents=[],c._updatedList=[],c.translationBuffer=w(9),c.needsRecalculate=!0,c.emptyPaintables=[],c.objects=[],c.subscriptions=[],c._propagateEventTargets=[],c._alreadyFlushed=[],c._width=b,c._height=d,c.aspectRatio=Number.isNaN(b/d)?1:b/d,c.viewingDirection=f,c.points=w(5*e),c.filteredPointsBuffer=w(5*e),c}return N(b,a),Object.defineProperty(b.prototype,"x",{get:function(){return 0},
127
- enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"y",{get:function(){return 0},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"width",{get:function(){return this._width},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"height",{get:function(){return this._height},enumerable:!1,configurable:!0}),b.withProps=function(a){var c=new b;return c.applyProps(a),c},b.prototype.applyProps=function(a){void 0===a.width||void 0===a.height||a.width===this._width&&
128
- a.height===this._height||this.resize(a.width,a.height);a.viewingDirection!==this.viewingDirection&&(this.viewingDirection=a.viewingDirection,this.triggerRepaint())},b.prototype.propagateTouchEvent=function(a,b,e){var c,d=this;if(-1===this.activatedEvents.indexOf(a))return[];var k=[];try{for(var h=F(e),m=h.next();!m.done;m=h.next()){var p=m.value;if(p.x&&p.y){var q=D.singleBox(1,1,p.x,p.y);k.push(this.getObjectsAt(q,!0).reverse())}}}catch(n){var r={error:n}}finally{try{m&&!m.done&&(c=h.return)&&c.call(h)}finally{if(r)throw r.error;
129
- }}return k.map(function(c){return d.propagateEvent(a,b,c,{bubbles:!0,cancelable:!0})})},b.prototype.propagatePointerEvent=function(a,b,e,f,g){void 0===g&&(g={});e=D.singleBox(1,1,e,f);e=this.getObjectsAt(e,!0).reverse();return this.propagateEvent(a,b,e,g)},b.prototype.propagateEvent=function(a,b,e,f){f=void 0===f?{}:f;f.bubbles;f.cancelable;b.atlasTarget=this;this._propagateEventTargets.length=1;this._propagateEventTargets[0]=this;var c=!1;b.stopPropagation=function(){c=!0};for(var d=e.length-1;0<=
130
- d;d--){this._propagateEventTargets.unshift(e[d][0]);var h=e[d][1].length;if(h)for(f=0;f<h;f++)this._propagateEventTargets.unshift(e[d][1][f])}e=this._propagateEventTargets.length;for(f=0;f<e&&(b.atlasTarget=this._propagateEventTargets[f],b.atlasWorld=this,this._propagateEventTargets[f].dispatchEvent(a,b),!c);f++);return this._propagateEventTargets},b.prototype.appendChild=function(a){this.appendWorldObject(a)},b.prototype.removeChild=function(a){var b,c=this.objects.indexOf(a);if(-1!==c)this.objects[c]=
131
- null,this.triggerRepaint(),this.needsRecalculate=!0;else try{for(var f=F(this.objects),g=f.next();!g.done;g=f.next()){var k=g.value;if(k&&k.id===a.id)return void this.removeChild(k)}}catch(m){var h={error:m}}finally{try{g&&!g.done&&(b=f.return)&&b.call(f)}finally{if(h)throw h.error;}}},b.prototype.insertBefore=function(a,b){-1!==this.objects.indexOf(b)&&(console.warn("insertBefore: Not fully implemented"),this.appendWorldObject(a))},b.prototype.hideInstance=function(){console.warn("hideInstance: Not yet implemented")},
132
- b.prototype.asWorldObject=function(){return null},b.prototype.addZone=function(a){this.zones.push(a)},b.prototype.selectZone=function(a){if("string"==typeof a)for(var b=this.zones.length,c=0;c<b;c++){if(this.zones[c].id===a)return this.selectedZone=c,void this.trigger("zone-changed")}else this.zones[a]&&(this.selectedZone=a,this.trigger("zone-changed"))},b.prototype.deselectZone=function(){this.selectedZone=void 0},b.prototype.getActiveZone=function(){if(this.selectedZone)return this.zones[this.selectedZone]},
133
- b.prototype.hasActiveZone=function(){return void 0!==this.selectedZone},b.prototype.checkResizeInternalBuffer=function(){if(this.points.length/5===this.objects.length){var a=this.points,b=w(2*this.points.length);b.set(a,0);this.points=b}},b.prototype.appendWorldObject=function(a){this.checkResizeInternalBuffer();var b=a.points;a.points=this.points.subarray(5*this.objects.length,5*this.objects.length+5);a.points[1]=b[1];a.points[2]=b[2];a.points[3]=b[3];a.points[4]=b[4];this.objects.push(a);this.filteredPointsBuffer=
134
- w(5*this.objects.length);this.recalculateWorldSize();this.needsRecalculate=!0;this.triggerRepaint()},b.prototype.recalculateWorldSize=function(){var a=!1;if(this.needsRecalculate){for(var b=new Int32Array(this.objects.length),e=new Int32Array(this.objects.length),f=this.objects.length,g=0;g<f;g++)this.objects[g]&&(b[g]=this.points[5*g+3],e[g]=this.points[5*g+4]);b=Math.max.apply(Math,G(b));b!==this._width&&(this._width=b,a=!0);e=Math.max.apply(Math,G(e));e!==this._height&&(this._height=e,a=!0);a&&
135
- this.trigger("recalculate-world-size",{width:b,height:e});this.needsRecalculate=!1}return a},b.prototype.addObjectAt=function(a,b){b.width&&!b.height?b.height=b.width/a.width*a.height:b.height&&!b.width&&(b.width=b.height/a.height*a.width);b&&b.width&&b.height||(b.width=a.width,b.height=a.height);var c=b.x,d=b.y;b=b.width/a.width;this.checkResizeInternalBuffer();this.points.set(D.singleBox(a.width,a.height,0,0),5*this.objects.length);a=new Ua(a);return a.points=this.points.subarray(5*this.objects.length,
136
- 5*this.objects.length+5),this.objects.push(a),this.scaleWorldObject(this.objects.length-1,b),this.translateWorldObject(this.objects.length-1,c,d),this.filteredPointsBuffer=w(2*this.points.length),this.triggerRepaint(),this.needsRecalculate=!0,a},b.prototype.scaleWorldObject=function(a,b){ja(this.points.subarray(5*a,5*a+5),ob(b,this.points[5*a+1],this.points[5*a+2]));(a=this.objects[a])&&(a.atScale(b),this.triggerRepaint())},b.prototype.translateWorldObject=function(a,b,e){ja(this.points.subarray(5*
137
- a,5*a+5),V(b,e));(a=this.objects[a])&&(a.translate(b,e),this.triggerRepaint())},b.prototype.resize=function(a,b){return this._width=a,this._height=b,this.aspectRatio=a/b,this.triggerRepaint(),this},b.prototype.getObjects=function(){return this.objects},b.prototype.getPoints=function(){return this.points},b.prototype.getPointsFromViewer=function(a,b){var c=D.singleBox(a.width,a.height,a.x,a.y);return this.getPointsAt(c,b,a.scale)},b.prototype.addLayoutSubscriber=function(a){var b=this;return this.subscriptions.push(a),
138
- function(){b.subscriptions.splice(b.subscriptions.indexOf(a),1)}},b.prototype.getScheduledUpdates=function(a,b){return[]},b.prototype.getObjectsAt=function(a,b){void 0===b&&(b=!1);for(var c=this.getActiveZone(),d=nb(this.points,a,this.filteredPointsBuffer),g=this.objects.length,k=[],h=0;h<g;h++)if(0!==d[5*h]){var m=this.objects[h];!m||c&&-1===c.objects.indexOf(m)||("world-object"!==m.type?k.push([m,[m]]):b?k.push([m,m.getObjectsAt(a)]):k.push([m,this.emptyPaintables]))}return k},b.prototype.getPointsAt=
139
- function(a,b,e){void 0===e&&(e=1);var c=this.getObjectsAt(a),d=ia(sa(e),V(-a[1],-a[2]),this.translationBuffer);b=b?ia(b,d,this.aggregateBuffer):d;d=c.length;for(var k=[],h=0;h<d;h++)k.push.apply(k,G(c[h][0].getAllPointsAt(a,b,e)));return k},b.prototype.flushSubscriptions=function(){if(this.triggerQueue.length){this._alreadyFlushed=[];for(var a=this.triggerQueue.length,b=0;b<a;b++)if(-1===this._alreadyFlushed.indexOf(this.triggerQueue[b][0])){void 0===this.triggerQueue[b][1]&&this._alreadyFlushed.push(this.triggerQueue[b][0]);
140
- for(var e=this.subscriptions.length,f=0;f<e;f++)this.subscriptions[f].apply(null,this.triggerQueue[b])}this.triggerQueue=[]}},b.prototype.trigger=function(a,b){this.triggerQueue.push([a,b])},b.prototype.triggerEventActivation=function(){this.trigger("event-activation")},b.prototype.triggerRepaint=function(){this.trigger("repaint")},b.prototype.gotoRegion=function(a){this.trigger("goto-region",a)},b.prototype.goHome=function(a){this.trigger("goto-region",{x:0,y:0,width:this._width,height:this._height})},
141
- b.prototype.zoomTo=function(a,b,e){this.trigger("zoom-to",{point:b,factor:a,stream:e})},b.prototype.zoomIn=function(a){this.trigger("zoom-to",{point:a,factor:.5})},b.prototype.zoomOut=function(a){this.trigger("zoom-to",{point:a,factor:2})},b.prototype.constraintBounds=function(a){this.trigger("constrain-bounds",{immediate:a})},b}(W),sf={margin:0},tf=function(){function a(a,c){void 0===c&&(c={});this.id=a.map(function(a){return a.id}).join("$$");this.config=B(B({},sf),c);this.points=w(5);this.objects=
142
- a;this.recalculateBounds()}return a.prototype.recalculateBounds=function(){this.points.set([1,Math.min.apply(Math,G(this.objects.map(function(a){return a.points[1]})))-this.config.margin,Math.min.apply(Math,G(this.objects.map(function(a){return a.points[2]})))-this.config.margin,Math.max.apply(Math,G(this.objects.map(function(a){return a.points[3]})))+this.config.margin,Math.max.apply(Math,G(this.objects.map(function(a){return a.points[4]})))+this.config.margin])},a.prototype.getPointsAt=function(a,
143
- c,d){return[]},a}(),jc=function(){function a(a,c,d,e){var b=this;void 0===e&&(e=[]);this.ready=!1;this.transformBuffer=w(500);this.lastTarget=w(5);this.zoomBuffer=w(5);this.pendingUpdate=this.logNextRender=!1;this.firstRender=!0;this.mode="explore";this.controllers=[];this.controllersRunning=!1;this.maxScaleFactor=1;this._viewerToWorld={x:0,y:0};this.hooks={useFrame:[],useBeforeFrame:[],useAfterPaint:[],useAfterFrame:[]};this._viewport={x:0,y:0,width:0,height:0};this.setViewport=function(a){var c=
144
- void 0===a.x?b.target[1]:a.x,d=void 0===a.y?b.target[2]:a.y;a.width?b.target[3]=c+a.width:b.target[3]=b.target[3]-b.target[1]+c;a.height?b.target[4]=d+a.height:b.target[4]=b.target[4]-b.target[2]+d;.01<Math.abs(b.target[1]-c)&&(b.target[1]=c);.01<Math.abs(b.target[2]-d)&&(b.target[2]=d)};this.render=function(a){var c=a-b.lastTime;if(b.fpsLimit&&c<1E3/b.fpsLimit)b.stopId=window.requestAnimationFrame(b.render);else{b.lastTime=a;b.world.flushSubscriptions();b.stopId=window.requestAnimationFrame(b.render);
145
- b.hook("useFrame",c);a=b.pendingUpdate;var d=b.renderer.pendingUpdate();if(b.firstRender||a||d||b.target[0]!==b.lastTarget[0]||b.target[1]!==b.lastTarget[1]||b.target[2]!==b.lastTarget[2]||b.target[3]!==b.lastTarget[3]||b.target[4]!==b.lastTarget[4]){b.hook("useBeforeFrame",c);b.renderer.beforeFrame(b.world,c,b.target);d=b.getScaleFactor();for(var e=b.renderer.getPointsAt(b.world,b.target,b.aggregate,d),f=e.length,g=0;g<f;g++){var r=e[g][0];a=e[g][1];var n=e[g][2];b.renderer.prepareLayer(r);n=n?Ta(a,
146
- n,b.transformBuffer):a;var y=n.length/5;for(a=0;a<y;a++){var v=5*a;0!==n[v]&&(b.renderer.paint(r,a,n[v+1],n[v+2],n[v+3]-n[v+1],n[v+4]-n[v+2]),b.hook("useAfterPaint",r))}}b.renderer.afterFrame(b.world,c,b.target);b.hook("useAfterFrame",c);b.lastTarget[0]=b.target[0];b.lastTarget[1]=b.target[1];b.lastTarget[2]=b.target[2];b.lastTarget[3]=b.target[3];b.lastTarget[4]=b.target[4];b.firstRender=!1;b.pendingUpdate=!1;b.logNextRender=!1;b.renderer.isReady()&&(b.ready=!0,b.world.trigger("ready"));b.world.flushSubscriptions();
147
- c=b.world.getScheduledUpdates(b.target,d);d=c.length;if(0<d)for(a=0;a<d;a++)(e=c[d-a]())?e.then(function(){b.pendingUpdate=!0}):b.pendingUpdate=!0}}};this.renderer=a;this.world=c;this.target=D.projection(d);this.aggregate=sa(1);this.world.addLayoutSubscriber(function(a){"repaint"===a&&(b.pendingUpdate=!0)});this.lastTime=performance.now();this.controllers=e;this.render(this.lastTime);this.startControllers()}return Object.defineProperty(a.prototype,"x",{get:function(){return this.target[1]},set:function(a){this.target[1]=
148
- a},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"y",{get:function(){return this.target[2]},set:function(a){this.target[2]=a},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"x2",{get:function(){return this.target[3]},set:function(a){this.target[3]=a},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"y2",{get:function(){return this.target[4]},set:function(a){this.target[4]=a},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"width",
149
- {get:function(){return this.target[3]-this.target[1]},set:function(a){this.target[3]=this.target[1]+a},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"height",{get:function(){return this.target[4]-this.target[2]},set:function(a){this.target[4]=this.target[2]=a},enumerable:!1,configurable:!0}),a.prototype.startControllers=function(){var a;if(!this.controllersRunning){try{for(var c=F(this.controllers),d=c.next();!d.done;d=c.next())d.value.start(this)}catch(f){var e={error:f}}finally{try{d&&
150
- !d.done&&(a=c.return)&&a.call(c)}finally{if(e)throw e.error;}}this.controllersRunning=!0}},a.prototype.stopControllers=function(){var a;if(this.controllersRunning)try{for(var c=F(this.controllers),d=c.next();!d.done;d=c.next())d.value.stop(this)}catch(f){var e={error:f}}finally{try{d&&!d.done&&(a=c.return)&&a.call(c)}finally{if(e)throw e.error;}}},a.prototype.updateControllerPosition=function(){var a;try{for(var c=F(this.controllers),d=c.next();!d.done;d=c.next())d.value.updatePosition(this.x,this.y,
151
- this.width,this.height)}catch(f){var e={error:f}}finally{try{d&&!d.done&&(a=c.return)&&a.call(c)}finally{if(e)throw e.error;}}},a.prototype.triggerResize=function(){this.renderer.triggerResize&&this.renderer.triggerResize()},a.prototype.addController=function(a){this.controllers.push(a);this.controllersRunning&&a.start(this)},a.prototype.cover=function(){return this.goHome(!0)},a.prototype.goHome=function(a){if(!(0>=this.world.width||0>=this.world.height)){var b=this.getScaleFactor(),d=this.width*
152
- b,e=this.height*b;b=this.world.width/d;var f=this.world.height/e;d/=e;(a?b>f:b<f)?(d*=this.world.height,a=(d-this.world.width)/2,this.target[1]=-a,this.target[2]=0,this.target[3]=d-a,this.target[4]=this.world.height):(d=this.world.width/d,a=(d-this.world.height)/2,this.target[1]=0,this.target[2]=-a,this.target[3]=this.world.width,this.target[4]=d-a);this.updateControllerPosition()}},a.prototype.resize=function(a,c,d,e){this.target[3]=this.target[1]+c/a*(this.target[3]-this.target[1]);this.target[4]=
153
- this.target[2]+e/d*(this.target[4]-this.target[2]);this.goHome();this.renderer.resize(c,e)},a.prototype.getViewport=function(){return this._viewport.x=this.target[1],this._viewport.y=this.target[2],this._viewport.width=this.target[3]-this.target[1],this._viewport.height=this.target[4]-this.target[2],this._viewport},a.prototype.getBounds=function(a){if(this.world.hasActiveZone()){var b=this.world.getActiveZone();if(b){var d=this.target[3]-this.target[1]<b.points[3]-b.points[1],e=this.target[4]-this.target[2]<
154
- b.points[4]-b.points[2];return{x1:d?b.points[1]-a:b.points[1]+(b.points[3]-b.points[1])/2-(this.target[3]-this.target[1])/2,y1:e?b.points[2]-a:b.points[2]+(b.points[4]-b.points[2])/2-(this.target[4]-this.target[2])/2,x2:d?b.points[3]+a:b.points[1]+(b.points[3]-b.points[1])/2-(this.target[3]-this.target[1])/2,y2:e?b.points[4]+a:b.points[2]+(b.points[4]-b.points[2])/2-(this.target[4]-this.target[2])/2}}}a=this.target[3]-this.target[1];b=this.world.width;d=b<a;e=this.target[4]-this.target[2];var f=this.world.height,
155
- g=f<e;return{x1:d?b-a:0,x2:d?0:b-this.width,y1:g?f-e:0,y2:g?0:f-this.height}},a.prototype.getScaleFactor=function(){return this.renderer.getScale(this.target[3]-this.target[1],this.target[4]-this.target[2])},a.prototype.getZoomedPosition=function(a,c){c=c.origin;var b=this.getScaleFactor(),e=1/a,f=b*e;1>e?this.world.width/(this.width*b)>this.world.height/(this.height*b)?this.world.width*f<~~(this.width*b)&&(a=this.world.width*b/(this.width*b)):this.world.height*f<~~(this.height*b)&&(a=this.world.height*
156
- b/(this.height*b)):1<f&&(a=b/1);return Ta(this.target,ob(a,c?c.x:this.target[1]+(this.target[3]-this.target[1])/2,c?c.y:this.target[2]+(this.target[4]-this.target[2])/2),this.zoomBuffer)},a.prototype.clampRegion=function(a){var b=a.width,d=a.height,e=a.padding,f=void 0===e?20:e,g=this.width,k=this.height;e=a.x-f;a=a.y-f;var h=b+2*f;f=d+2*f;if(b/g<d/k)return b=f/k*g,{x:e-(b-h)/2,y:a,width:b,height:f};b=h/g*k;return{x:e,y:a-(b-f)/2,width:h,height:b}},a.prototype.viewerToWorld=function(a,c){var b=this.getScaleFactor();
157
- return this._viewerToWorld.x=this.target[1]+a/b,this._viewerToWorld.y=this.target[2]+c/b,this._viewerToWorld},a.prototype.worldToViewer=function(a,c,d,e){a=D.singleBox(d,e,a,c);return ja(a,ia(sa(this.getScaleFactor()),V(-this.target[1],-this.target[2]))),{x:a[1],y:a[2],width:a[3]-a[1],height:a[4]-a[2],strand:a}},a.prototype.setScale=function(a,c){ja(this.target,ob(a,c?c.x:this.target[1]+(this.target[3]-this.target[1])/2,c?c.y:this.target[2]+(this.target[4]-this.target[2])/2))},a.prototype.syncTo=
158
- function(a){var b=this,d=this.target;return this.target=a.target,function(){b.target=d}},a.prototype.stop=function(){var a=this;return void 0!==this.stopId&&(window.cancelAnimationFrame(this.stopId),this.stopId=void 0),function(){a.render(performance.now())}},a.prototype.selectZone=function(a){this.world.selectZone(a);this.pendingUpdate=!0},a.prototype.deselectZone=function(){this.world.deselectZone();this.pendingUpdate=!0},a.prototype.hook=function(a,c){var b=this.hooks[a].length;if(0!==b)for(var e=
159
- 0;e<b;e++)this.hooks[a][e](c)},a.prototype.registerHook=function(a,c){var b=this;return this.hooks[a].push(c),function(){b.hooks[a]=b.hooks[a].filter(function(a){return a!==c})}},a.prototype.updateNextFrame=function(){this.pendingUpdate=!0},a}(),uf=Cb(function(a,b){a.exports=function(){var a=function(){function b(a){return g.appendChild(a.dom),a}function c(a){for(var b=0;b<g.children.length;b++)g.children[b].style.display=b===a?"block":"none";f=a}var f=0,g=document.createElement("div");g.style.cssText=
160
- "position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000";g.addEventListener("click",function(a){a.preventDefault();c(++f%g.children.length)},!1);var k=(performance||Date).now(),h=k,m=0,p=b(new a.Panel("FPS","#0ff","#002")),q=b(new a.Panel("MS","#0f0","#020"));if(self.performance&&self.performance.memory)var r=b(new a.Panel("MB","#f08","#201"));return c(0),{REVISION:16,dom:g,addPanel:b,showPanel:c,begin:function(){k=(performance||Date).now()},end:function(){m++;var a=(performance||Date).now();
161
- if(q.update(a-k,200),a>h+1E3&&(p.update(1E3*m/(a-h),100),h=a,m=0,r)){var b=performance.memory;r.update(b.usedJSHeapSize/1048576,b.jsHeapSizeLimit/1048576)}return a},update:function(){k=this.end()},domElement:g,setMode:c}};return a.Panel=function(a,b,c){var d=1/0,e=0,f=Math.round,m=f(window.devicePixelRatio||1),p=80*m,q=48*m,r=3*m,n=2*m,l=3*m,v=15*m,x=74*m,u=30*m,P=document.createElement("canvas");P.width=p;P.height=q;P.style.cssText="width:80px;height:48px";var z=P.getContext("2d");return z.font=
162
- "bold "+9*m+"px Helvetica,Arial,sans-serif",z.textBaseline="top",z.fillStyle=c,z.fillRect(0,0,p,q),z.fillStyle=b,z.fillText(a,r,n),z.fillRect(l,v,x,u),z.fillStyle=c,z.globalAlpha=.9,z.fillRect(l,v,x,u),{dom:P,update:function(g,k){d=Math.min(d,g);e=Math.max(e,g);z.fillStyle=c;z.globalAlpha=1;z.fillRect(0,0,p,v);z.fillStyle=b;z.fillText(f(g)+" "+a+" ("+f(d)+"-"+f(e)+")",r,n);z.drawImage(P,l+m,v,x-m,u,l,v,x-m,u);z.fillRect(l+x-m,v,m,u);z.fillStyle=c;z.globalAlpha=.9;z.fillRect(l+x-m,v,m,f((1-g/k)*u))}}},
163
- a}()}),S=function(){return(S=Object.assign||function(a){for(var b,c=1,d=arguments.length;c<d;c++)for(var e in b=arguments[c])Object.prototype.hasOwnProperty.call(b,e)&&(a[e]=b[e]);return a}).apply(this,arguments)},Cd=function(a,b){return function(c){return Math.max(Math.min(c,b),a)}},Va=function(a){return a%1?Number(a.toFixed(5)):a},kc=/(-)?(\d[\d\.]*)/g,pb=/(#[0-9a-f]{6}|#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi,Lc=/^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))$/i,
164
- O={test:function(a){return"number"==typeof a},parse:parseFloat,transform:function(a){return a}},Dd=S(S({},O),{transform:Cd(0,1)}),Wa=(S(S({},O),{default:1}),function(a){return{test:function(b){return"string"==typeof b&&b.endsWith(a)&&1===b.split(" ").length},parse:parseFloat,transform:function(b){return""+b+a}}}),vf=Wa("deg"),Ha=Wa("%"),wf=Wa("px"),xf=Wa("vh"),yf=Wa("vw"),zf=(S(S({},Ha),{parse:function(a){return Ha.parse(a)/100},transform:function(a){return Ha.transform(100*a)}}),Cd(0,255)),Ed=function(a){return function(b){if("string"!=
165
- typeof b)return b;var c={};b=b.substring(b.indexOf("(")+1,b.lastIndexOf(")")).split(/,\s*/);for(var d=0;4>d;d++)c[a[d]]=void 0!==b[d]?parseFloat(b[d]):1;return c}},lc=S(S({},O),{transform:function(a){return Math.round(zf(a))}}),Ia,Xa={test:function(a){return"string"==typeof a?Db(a,"rgb"):void 0!==a.red},parse:Ed(["red","green","blue","alpha"]),transform:function(a){var b=a.green,c=a.blue,d=a.alpha;d=void 0===d?1:d;a=lc.transform(a.red);b=lc.transform(b);c=lc.transform(c);d=Va(Dd.transform(d));return"rgba("+
166
- a+", "+b+", "+c+", "+(void 0===d?1:d)+")"}},Ya={test:function(a){return"string"==typeof a?Db(a,"hsl"):void 0!==a.hue},parse:Ed(["hue","saturation","lightness","alpha"]),transform:function(a){var b=a.lightness,c=a.alpha,d=void 0===c?1:c;c=Math.round(a.hue);a=Ha.transform(Va(a.saturation));b=Ha.transform(Va(b));d=Va(Dd.transform(d));return"hsla("+c+", "+a+", "+b+", "+(void 0===d?1:d)+")"}},mc=S(S({},Xa),{test:function(a){return"string"==typeof a&&Db(a,"#")},parse:function(a){var b="",c="",d="";return 4<
167
- a.length?(b=a.substr(1,2),c=a.substr(3,2),d=a.substr(5,2)):(b=a.substr(1,1),c=a.substr(2,1),d=a.substr(3,1),b+=b,c+=c,d+=d),{red:parseInt(b,16),green:parseInt(c,16),blue:parseInt(d,16),alpha:1}}}),Fd=function(a){return"string"==typeof a&&Lc.test(a)||void 0!==a.red||void 0!==a.hue},Af=function(a){return Xa.test(a)?Xa.parse(a):Ya.test(a)?Ya.parse(a):mc.test(a)?mc.parse(a):a},Bf=function(a){return void 0!==a.red?Xa.transform(a):void 0!==a.hue?Ya.transform(a):a},Cf=function(a){return"number"==typeof a?
168
- 0:a},Ma={test:function(a){if("string"!=typeof a||!isNaN(a))return!1;var b=0,c=a.match(kc);a=a.match(pb);return c&&(b+=c.length),a&&(b+=a.length),0<b},parse:function(a){var b=a;a=[];var c=b.match(pb);c&&(b=b.replace(pb,"${c}"),a.push.apply(a,c.map(Af)));b=b.match(kc);return b&&a.push.apply(a,b.map(O.parse)),a},createTransformer:function(a){var b=a,c=0,d=a.match(pb),e=d?d.length:0;if(d)for(a=0;a<e;a++)b=b.replace(d[a],"${c}"),c++;var f=(d=b.match(kc))?d.length:0;if(d)for(a=0;a<f;a++)b=b.replace(d[a],
169
- "${n}"),c++;return function(a){for(var d=b,f=0;f<c;f++)d=d.replace(f<e?"${c}":"${n}",f<e?Bf(a[f]):Va(a[f]));return d}},getAnimatableNone:function(a){var b=Ma.parse(a);return Ma.createTransformer(a)(b.map(Cf))}},nc=0,Gd="undefined"!=typeof window&&void 0!==window.requestAnimationFrame?function(a){return window.requestAnimationFrame(a)}:function(a){var b=Date.now(),c=Math.max(0,16.7-(b-nc));nc=b+c;setTimeout(function(){return a(nc)},c)};!function(a){a.Read="read";a.Update="update";a.Render="render";
170
- a.PostRender="postRender";a.FixedUpdate="fixedUpdate"}(Ia||(Ia={}));var oc,Hd=1/60*1E3,qb=!0,Za=!1,pc=!1,$a={delta:0,timestamp:0},Id=[Ia.Read,Ia.Update,Ia.Render,Ia.PostRender],Df=function(a){return Za=a},qc=Id.reduce(function(a,b){var c=function(a){var b=[],c=[],d=0,k=!1,h=0,m=new WeakSet,p=new WeakSet,q={cancel:function(a){var b=c.indexOf(a);m.add(a);-1!==b&&c.splice(b,1)},process:function(e){var f;if(k=!0,b=(f=[c,b])[0],(c=f[1]).length=0,d=b.length)for(h=0;h<d;h++)(f=b[h])(e),!0!==p.has(f)||m.has(f)||
171
- (q.schedule(f),a(!0));k=!1},schedule:function(a,e,f){void 0===e&&(e=!1);void 0===f&&(f=!1);var g=(f=f&&k)?b:c;m.delete(a);e&&p.add(a);-1===g.indexOf(a)&&(g.push(a),f&&(d=b.length))}};return q}(Df);return a.sync[b]=function(a,b,f){void 0===b&&(b=!1);void 0===f&&(f=!1);Za||(qb=Za=!0,pc||Gd(Jd));return c.schedule(a,b,f),a},a.cancelSync[b]=function(a){return c.cancel(a)},a.steps[b]=c,a},{steps:{},sync:{},cancelSync:{}}),Ef=qc.steps,Ff=(qc.sync,qc.cancelSync,function(a){return Ef[a].process($a)}),Jd=function(a){Za=
172
- !1;$a.delta=qb?Hd:Math.max(Math.min(a-$a.timestamp,40),1);qb||(Hd=$a.delta);$a.timestamp=a;pc=!0;Id.forEach(Ff);pc=!1;Za&&(qb=!1,Gd(Jd))},Kd=function(a){return function(b){return 1-a(1-b)}},Gf=function(a){return a},Ld=function(a){return function(b){return Math.pow(b,a)}}(2),Md=Kd(Ld),Nd=function(a){return function(b){return.5>=b?a(2*b)/2:(2-a(2*(1-b)))/2}}(Ld),Od={x:0,y:0,z:0},Pd=function(a,b){return void 0===b&&(b=Od),180*Math.atan2(b.y-a.y,b.x-a.x)/Math.PI},Qd=function(a,b){var c=!0;return void 0===
173
- b&&(b=a,c=!1),function(d){return c?d-a+b:(a=d,c=!0,b)}},rb=(oc=function(a,b,c){return Math.min(Math.max(c,a),b)},function(a,b,c){return void 0!==c?oc(a,b,c):function(c){return oc(a,b,c)}}),rc=function(a){return a.hasOwnProperty("x")&&a.hasOwnProperty("y")},Rd=function(a){return rc(a)&&a.hasOwnProperty("z")},sc=function(a,b){if(void 0===b&&(b=Od),"number"==typeof a&&"number"==typeof b)return Math.abs(a-b);if(rc(a)&&rc(b)){var c=Math.abs(a.x-b.x),d=Math.abs(a.y-b.y);a=Rd(a)&&Rd(b)?Math.abs(a.z-b.z):
174
- 0;return Math.sqrt(Math.pow(c,2)+Math.pow(d,2)+Math.pow(a,2))}return 0},ab=function(a,b,c){return-c*a+c*b+a},Sd=function(){return(Sd=Object.assign||function(a){for(var b,c=1,d=arguments.length;c<d;c++)for(var e in b=arguments[c])Object.prototype.hasOwnProperty.call(b,e)&&(a[e]=b[e]);return a}).apply(this,arguments)},Hf=function(a,b,c){a*=a;return Math.sqrt(Math.max(0,c*(b*b-a)+a))},If=[mc,Xa,Ya],Td=function(a){return If.find(function(b){return b.test(a)})},Ud=function(a,b){var c=Td(a),d=Td(b);c.transform;
175
- d.transform;var e=c.parse(a),f=d.parse(b),g=Sd({},e),k=c===Ya?ab:Hf;return function(a){for(var b in g)"alpha"!==b&&(g[b]=k(e[b],f[b],a));return g.alpha=ab(e.alpha,f.alpha,a),c.transform(g)}},Jf=function(a,b){return function(c){return b(a(c))}},Vd=function(){for(var a=[],b=0;b<arguments.length;b++)a[b]=arguments[b];return a.reduce(Jf)},Kf=function(a,b){var c=a.slice(),d=c.length,e=a.map(function(a,c){return d=a,e=b[c],"number"==typeof d?function(a){return ab(d,e,a)}:Fd(d)?Ud(d,e):Wd(d,e);var d,e});
176
- return function(a){for(var b=0;b<d;b++)c[b]=e[b](a);return c}},Wd=function(a,b){var c=Ma.createTransformer(b);a=Mc(a);b=Mc(b);return Vd(Kf(a.parsed,b.parsed),c)},sb=function(a,b){return b?1E3/b*a:0},tc=(rb(0,1),{}),uc=function(){function a(a,c){var b=this;this.imagesLoaded=this.imagesPending=0;this.firstMeaningfulPaint=this.frameIsRendering=!1;this.parallelTasks=8;this.frameTasks=3;this.isGPUBusy=!1;this.loadingQueueOrdered=!0;this.loadingQueue=[];this.currentTask=Promise.resolve();this.tasksRunning=
177
- 0;this.averageJobTime=1E3;this.visible=[];this.previousVisible=[];this._worker=function(){if(b.loadingQueue.length&&b.tasksRunning<b.parallelTasks&&b.frameTasks<b.parallelTasks&&!b.isGPUBusy){var a=b.loadingQueue.pop();a&&(b.tasksRunning++,b.frameTasks++,b.currentTask=a.task().then(function(){b.tasksRunning--}).catch(function(){b.tasksRunning--}))}};this._scheduled=0;this._doWork=function(){(b.frameIsRendering||0===b.loadingQueue.length&&0===b.tasksRunning&&b._scheduled)&&(clearInterval(b._scheduled),
178
- b._scheduled=0);b._worker()};this.canvas=a;this.ctx=a.getContext("2d");this.ctx.imageSmoothingEnabled=!0;this.options=c||{};this.canvas.style.opacity="0";this.canvas.style.transition="opacity .3s";this.options.debug&&(this.stats=new uf,this.stats.showPanel(0),document&&document.body&&document.body.appendChild(this.stats.dom))}return a.prototype.resize=function(){},a.prototype.isReady=function(){return this.firstMeaningfulPaint},a.prototype.afterFrame=function(a){this.frameIsRendering=!1;this.imagesPending-=
179
- this.imagesLoaded;this.imagesLoaded=0;!this.loadingQueueOrdered&&this.loadingQueue.length>this.parallelTasks&&(this.loadingQueue=this.loadingQueue.sort(function(a,b){return b.distance-a.distance}),this.loadingQueueOrdered=!0);this.previousVisible=this.visible;this.doOffscreenWork();this.options.debug&&this.stats&&this.stats.end()},a.prototype.doOffscreenWork=function(){this.frameTasks=0;this.isGPUBusy=!1;this.loadingQueue.length&&(this._worker(),this.loadingQueue.length&&this.tasksRunning<this.parallelTasks&&
180
- (this._scheduled||(this._scheduled=setInterval(this._doWork,6))))},a.prototype.getScale=function(a,c){a=this.canvas.width/a;c=this.canvas.height/c;return a<c?c:a},a.prototype.beforeFrame=function(a,c,d){this.options.debug&&this.stats&&this.stats.begin();this.frameIsRendering=!0;this.visible=[];this.options.beforeFrame&&this.options.beforeFrame(c);this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height)},a.prototype.paint=function(a,c,d,e,f,g){if(a instanceof ta||a instanceof Fa){this.visible.push(a);
181
- try{var b=a.__host.canvas;if(-1===b.indices.indexOf(c)&&this.schedulePaintToCanvas(b,a,c,sc({x:d+f/2,y:e+f/2},{x:this.canvas.width/2,y:this.canvas.height/2})),this.firstMeaningfulPaint)a.crop?a.crop[0]&&this.ctx.drawImage(b.canvas,a.crop[5*c+1],a.crop[5*c+2],a.crop[5*c+3]-a.crop[5*c+1]-1,a.crop[5*c+4]-a.crop[5*c+2]-1,d,e,f+.8,g+.8):this.ctx.drawImage(b.canvas,a.display.points[5*c+1],a.display.points[5*c+2],a.display.points[5*c+3]-a.display.points[5*c+1]-1,a.display.points[5*c+4]-a.display.points[5*
182
- c+2]-1,d,e,f+.8,g+.8)}catch(h){}}},a.prototype.loadImage=function(a,c,d){if(tc[a])c(tc[a]);else try{var b=document.createElement("img");b.decoding="async";b.onload=function(){c(b);tc[a]=b;b.onload=null};this.options.crossOrigin&&(b.crossOrigin="anonymous");b.src=a}catch(f){d(f)}},a.prototype.schedulePaintToCanvas=function(a,c,d,e){var b=this;this.imagesPending++;a.indices.push(d);c.__host.canvas.loading=!0;var g=c.id+"--"+c.display.scale;this.loadingQueueOrdered=!1;this.loadingQueue.push({id:g,distance:e,
183
- task:function(){return new Promise(function(f){if(-1===b.visible.indexOf(c))return b.imagesPending--,a.indices.splice(a.indices.indexOf(d),1),void f();var k=c.getImageUrl(d);b.loadImage(k,function(k){b.loadingQueue.push({id:g,distance:e,task:function(){return new Promise(function(e){b.imagesLoaded++;a.loaded.push(d);a.loaded.length===a.indices.length&&(a.loading=!1);var f=c.display.points.slice(5*d,5*d+5);a.canvas.getContext("2d").drawImage(k,f[1],f[2],f[3]-f[1],f[4]-f[2]);b.isGPUBusy=!b.firstMeaningfulPaint&&
184
- !0;e()})}});f()},function(c){b.imagesPending--;a.indices.splice(a.indices.indexOf(d),1);console.log("Error loading image",c);f()})})}})},a.prototype.afterPaintLayer=function(a,c){},a.prototype.prepareLayer=function(a){a.__host&&a.__host.canvas||(a instanceof ta||a instanceof Fa)&&this.createImageHost(a)},a.prototype.createImageHost=function(a){var b=document.createElement("canvas");b.width=a.display.width;b.height=a.display.height;a.__host=a.__host?a.__host:{};a.__host.canvas={canvas:b,indices:[],
185
- loaded:[],loading:!1}},a.prototype.getPointsAt=function(a,c,d,e){return a.getPointsAt(c,d,e)},a.prototype.getViewportBounds=function(a,c,d){if(a=a.getActiveZone()){var b=c[3]-c[1]<a.points[3]-a.points[1],f=c[4]-c[2]<a.points[4]-a.points[2];return{x1:b?a.points[1]-d:a.points[1]+(a.points[3]-a.points[1])/2-(c[3]-c[1])/2,y1:f?a.points[2]-d:a.points[2]+(a.points[4]-a.points[2])/2-(c[4]-c[2])/2,x2:b?a.points[3]+d:a.points[1]+(a.points[3]-a.points[1])/2-(c[3]-c[1])/2,y2:f?a.points[4]+d:a.points[2]+(a.points[4]-
186
- a.points[2])/2-(c[4]-c[2])/2}}return null},a.prototype.pendingUpdate=function(){var a=0===this.imagesPending&&0===this.loadingQueue.length&&0===this.tasksRunning;return!this.firstMeaningfulPaint&&a?(this.canvas.style.opacity="1",this.firstMeaningfulPaint=a,!0):!!this.options.debug||!a},a}(),Xd=function(){function a(a){var b;this.renderers=[];try{for(var d=F(a),e=d.next();!e.done;e=d.next()){var f=e.value;f&&this.renderers.push(f)}}catch(k){var g={error:k}}finally{try{e&&!e.done&&(b=d.return)&&b.call(d)}finally{if(g)throw g.error;
187
- }}this.length=this.renderers.length}return a.prototype.afterFrame=function(a,c,d){for(var b=0;b<this.length;b++)this.renderers[b].afterFrame(a,c,d)},a.prototype.afterPaintLayer=function(a,c){for(var b=0;b<this.length;b++)this.renderers[b].afterPaintLayer(a,c)},a.prototype.beforeFrame=function(a,c,d){for(var b=0;b<this.length;b++)this.renderers[b].beforeFrame(a,c,d)},a.prototype.triggerResize=function(){for(var a=0;a<this.length;a++){var c=this.renderers[a];c.triggerResize&&c.triggerResize()}},a.prototype.getPointsAt=
188
- function(a,c,d,e){return this.renderers[0].getPointsAt(a,c,d,e)},a.prototype.getScale=function(a,c){return this.renderers[0].getScale(a,c)},a.prototype.getViewportBounds=function(a,c,d){return this.renderers[0].getViewportBounds(a,c,d)},a.prototype.isReady=function(){for(var a=0;a<this.length;a++)if(!this.renderers[a].isReady())return!1;return!0},a.prototype.paint=function(a,c,d,e,f,g){for(var b=0;b<this.length;b++)this.renderers[b].paint(a,c,d,e,f,g)},a.prototype.pendingUpdate=function(){for(var a=
189
- 0;a<this.length;a++)if(this.renderers[a].pendingUpdate())return!0;return!1},a.prototype.prepareLayer=function(a){for(var b=0;b<this.length;b++)this.renderers[b].prepareLayer(a)},a.prototype.resize=function(a,c){for(var b=0;b<this.length;b++)this.renderers[b].resize(a,c)},a}(),Lf=function(){function a(a){this.widthRatio=this.heightRatio=1;this.target=new Float32Array(5);this.canvas=a;this.initialWidth=a.width;this.initialHeight=a.height;this.context=a.getContext("2d")}return a.prototype.isReady=function(){return!0},
190
- a.prototype.resize=function(){},a.prototype.afterFrame=function(a,c,d){var b=this;this.context.clearRect(0,0,this.canvas.width,this.canvas.height);c=this.initialWidth/a.width;var f=this.initialHeight/a.height,g=this.widthRatio>this.heightRatio?c:f;this.canvas.height=a.height*g;this.canvas.width=a.width*g;this.target=d;a.getPoints().forEach(function(a,c,d){if(0==c%5&&a){a=d[c+1]*g;var e=d[c+2]*g,f=(d[c+3]-d[c+1])*g;c=(d[c+4]-d[c+2])*g;b.context.strokeStyle="red";b.context.strokeRect(a,e,f,c)}});d&&
191
- (this.context.strokeStyle="green",this.context.strokeRect(d[1]*g,d[2]*g,(d[3]-d[1])*g,(d[4]-d[2])*g))},a.prototype.getActiveZone=function(a){return null},a.prototype.getPointsAt=function(a,c,d,e){return a.getPointsAt(c,d,e)},a.prototype.getScale=function(a,c){return 1},a.prototype.beforeFrame=function(a,c){},a.prototype.drawImage=function(){},a.prototype.afterPaintLayer=function(a,c){},a.prototype.paint=function(a,c,d,e,f,g){},a.prototype.prepareLayer=function(a){},a.prototype.pendingUpdate=function(){return!1},
192
- a.prototype.hasActiveZone=function(){return!1},a.prototype.getViewportBounds=function(a,c,d){return null},a}(),Mf=function(){function a(){this.autoWidth=!1;this.autoHeight=!0;this.content=[];this.viewingDirection="left-to-right";this.columns=4;this.spacing=20;this.reversed=!1;this.padding=20;this.world=Ga.withProps({width:0,height:0,viewingDirection:"left-to-right"});this.height=this.width=0}return a.prototype.setViewingDirection=function(a){this.viewingDirection=a},a.prototype.addContent=function(a){var b,
193
- d=this;(b=this.content).push.apply(b,G(a.map(function(a){return d.world.addObjectAt(a,{width:0,height:0,x:0,y:0})})))},a.prototype.setWidth=function(a){this.width=a},a.prototype.setHeight=function(a){this.height=a},a.prototype.setSpacing=function(a){this.spacing=a},a.prototype.setPadding=function(a){this.padding=a},a.prototype.setRows=function(a){this.autoWidth=!0;this.rows=a},a.prototype.setColumns=function(a){this.autoHeight=!0;this.columns=a},a.prototype.recalculate=function(){if((0!==this.height||
194
- 0!==this.width)&&0!==this.rows&&0!==this.columns){if(this.autoHeight&&!this.width)throw Error("Cannot set auto height without setting a width");if(this.autoWidth&&!this.height)throw Error("Cannot set auto width without setting a height");"left-to-right"!==this.viewingDirection&&"top-to-bottom"!==this.viewingDirection||!this.reversed||(this.reversed=!1,this.content.reverse());"right-to-left"!==this.viewingDirection&&"bottom-to-top"!==this.viewingDirection||this.reversed||(this.reversed=!0,this.content.reverse());
195
- var a=this.content.length;if(this.autoWidth&&this.rows){var c=a>this.rows?this.rows:a;var d=Math.ceil(a/c)}else if(this.autoHeight&&this.columns)d=c=a>this.columns?this.columns:a,c=Math.ceil(a/c);else throw Error("Something went wrong.");var e=this.autoWidth?-1:this.width-2*this.padding;e=this.autoWidth?-1:(e-this.spacing*(d-1))/d;if(this.autoHeight&&!this.autoWidth){for(var f=0,g=this.padding,k=0;k<c&&f!==a;k++){for(var h=0,m=[],p=0;p<d;p++){var q=this.reversed?a-f:f;if(f===a)break;var r=this.content[q],
196
- n=r.width;r=e/(r.width/r.height);m.push([f,e,r,e/n]);r>h&&(h=r);f++}for(p=0;p<d&&m[p];p++){var l=this.world.getPoints();r=m[p][0];q=(n=m[p][1],m[p][2]);var v=m[p][3];n=this.padding+p*(this.spacing+n);var x=g+(h-q)/2,u=l[5*(q=this.reversed?a-r:r)+1];l=l[5*q+2];this.world.scaleWorldObject(r,v);u===n&&l===x||this.world.translateWorldObject(q,n-u,x-l)}g+=h+this.spacing}return this.height=g+this.padding,void this.world.resize(this.width,this.height)}this.autoWidth&&this.autoHeight;!this.autoWidth&&this.autoHeight}},
197
- a.prototype.getWorld=function(){return this.world},a}(),vc=0,Yd="undefined"!=typeof window&&void 0!==window.requestAnimationFrame?function(a){return window.requestAnimationFrame(a)}:function(a){var b=Date.now(),c=Math.max(0,16.7-(b-vc));vc=b+c;setTimeout(function(){return a(vc)},c)},Zd=1/60*1E3,tb=!0,bb=!1,wc=!1,ka={delta:0,timestamp:0},ub=["read","update","preRender","render","postRender"],Nf=function(a){return bb=a},xc=ub.reduce(function(a,b){return a[b]=function(a){var b=[],c=[],f=0,g=!1,k=0,h=
198
- new WeakSet,m=new WeakSet,p={cancel:function(a){var b=c.indexOf(a);h.add(a);-1!==b&&c.splice(b,1)},process:function(d){var e;if(g=!0,b=(e=[c,b])[0],(c=e[1]).length=0,f=b.length)for(k=0;k<f;k++)(e=b[k])(d),!0!==m.has(e)||h.has(e)||(p.schedule(e),a(!0));g=!1},schedule:function(a,d,e){void 0===d&&(d=!1);void 0===e&&(e=!1);var k=(e=e&&g)?b:c;h.delete(a);d&&m.add(a);-1===k.indexOf(a)&&(k.push(a),e&&(f=b.length))}};return p}(Nf),a},{}),L=ub.reduce(function(a,b){var c=xc[b];return a[b]=function(a,b,f){void 0===
199
- b&&(b=!1);void 0===f&&(f=!1);bb||(tb=bb=!0,wc||Yd($d));return c.schedule(a,b,f),a},a},{}),aa=ub.reduce(function(a,b){return a[b]=xc[b].cancel,a},{}),Of=function(a){return xc[a].process(ka)},$d=function(a){bb=!1;ka.delta=tb?Zd:Math.max(Math.min(a-ka.timestamp,40),1);tb||(Zd=ka.delta);ka.timestamp=a;wc=!0;ub.forEach(Of);wc=!1;bb&&(tb=!1,Yd($d))},ae=function(){function a(a){void 0===a&&(a={});this.props=a}return a.prototype.applyMiddleware=function(a){return this.create(B(B({},this.props),{middleware:this.props.middleware?
200
- Kc([a],this.props.middleware):[a]}))},a.prototype.pipe=function(){for(var a=[],c=0;c<arguments.length;c++)a[c]=arguments[c];var d=1===a.length?a[0]:Vd.apply(void 0,a);return this.applyMiddleware(function(a){return function(b){return a(d(b))}})},a.prototype.while=function(a){return this.applyMiddleware(function(b,d){return function(c){return a(c)?b(c):d()}})},a.prototype.filter=function(a){return this.applyMiddleware(function(b){return function(c){return a(c)&&b(c)}})},a}(),Pf=function(){return function(a,
201
- b){var c=this,d=a.middleware;a=a.onComplete;this.isActive=!0;this.update=function(a){c.observer.update&&c.updateObserver(a)};this.complete=function(){c.observer.complete&&c.isActive&&c.observer.complete();c.onComplete&&c.onComplete();c.isActive=!1};this.error=function(a){c.observer.error&&c.isActive&&c.observer.error(a);c.isActive=!1};this.observer=b;this.updateObserver=function(a){return b.update(a)};this.onComplete=a;b.update&&d&&d.length&&d.forEach(function(a){return c.updateObserver=a(c.updateObserver,
202
- c.complete)})}}(),be=function(a,b,c){return new Pf({middleware:b.middleware,onComplete:c},"function"==typeof a?{update:a}:a)},Qf=function(a){function b(){return null!==a&&a.apply(this,arguments)||this}return N(b,a),b.prototype.create=function(a){return new b(a)},b.prototype.start=function(a){void 0===a&&(a={});var b=!1,c={stop:function(){}},f=this.props,g=f.init;f=T(f,["init"]);g=g(be(a,f,function(){b=!0;c.stop()}));return c=g?B(B({},c),g):c,a.registerParent&&a.registerParent(c),b&&c.stop(),c},b}(ae),
203
- ba=function(a){return new Qf({init:a})},Rf=function(a){function b(b){var c=a.call(this,b)||this;return c.scheduleVelocityCheck=function(){return L.postRender(c.velocityCheck)},c.velocityCheck=function(a){a.timestamp!==c.lastUpdated&&(c.prev=c.current)},c.prev=c.current=b.value||0,function(a){a=typeof a;return"string"===a||"number"===a}(c.current)?(c.updateCurrent=function(a){return c.current=a},c.getVelocityOfCurrent=function(){return c.getSingleVelocity(c.current,c.prev)}):Array.isArray(c.current)?
204
- (c.updateCurrent=function(a){return c.current=Kc(a)},c.getVelocityOfCurrent=function(){return c.getListVelocity()}):(c.updateCurrent=function(a){for(var b in c.current={},a)a.hasOwnProperty(b)&&(c.current[b]=a[b])},c.getVelocityOfCurrent=function(){return c.getMapVelocity()}),b.initialSubscription&&c.subscribe(b.initialSubscription),c}return N(b,a),b.prototype.create=function(a){return new b(a)},b.prototype.get=function(){return this.current},b.prototype.getVelocity=function(){return this.getVelocityOfCurrent()},
205
- b.prototype.update=function(b){a.prototype.update.call(this,b);this.prev=this.current;this.updateCurrent(b);b=ka.timestamp;this.timeDelta=ka.delta;this.lastUpdated=b;L.postRender(this.scheduleVelocityCheck)},b.prototype.subscribe=function(b){b=a.prototype.subscribe.call(this,b);return this.subscribers[this.subscribers.length-1].update(this.current),b},b.prototype.getSingleVelocity=function(a,b){return"number"==typeof a&&"number"==typeof b?sb(a-b,this.timeDelta):sb(parseFloat(a)-parseFloat(b),this.timeDelta)||
206
- 0},b.prototype.getListVelocity=function(){var a=this;return this.current.map(function(b,c){return a.getSingleVelocity(b,a.prev[c])})},b.prototype.getMapVelocity=function(){var a={},b;for(b in this.current)this.current.hasOwnProperty(b)&&(a[b]=this.getSingleVelocity(this.current[b],this.prev[b]));return a},b}(function(a){function b(){var b=null!==a&&a.apply(this,arguments)||this;return b.subscribers=[],b}return N(b,a),b.prototype.complete=function(){this.subscribers.forEach(function(a){return a.complete()})},
207
- b.prototype.error=function(a){this.subscribers.forEach(function(b){return b.error(a)})},b.prototype.update=function(a){for(var b=0;b<this.subscribers.length;b++)this.subscribers[b].update(a)},b.prototype.subscribe=function(a){var b=this,c=be(a,this.props);return this.subscribers.push(c),{unsubscribe:function(){var a=b.subscribers.indexOf(c);-1!==a&&b.subscribers.splice(a,1)}}},b.prototype.stop=function(){this.parent&&this.parent.stop()},b.prototype.registerParent=function(a){this.stop();this.parent=
208
- a},b}(ae)),ce=function(a){var b=a.getCount,c=a.getFirst,d=a.getOutput,e=a.mapApi,f=a.setProp,g=a.startActions;return function(a){return ba(function(k){var h=k.update,p=k.complete,q=k.error,r=b(a),n=d(),l=function(){return h(n)},v=0,x=g(a,function(a,b){var c=!1;return a.start({complete:function(){c||(c=!0,++v===r&&L.update(p))},error:q,update:function(a){f(n,b,a);L.update(l,!1,!0)}})});return Object.keys(c(x)).reduce(function(a,b){return a[b]=e(x,b),a},{})})}},Sf=ce({getOutput:function(){return{}},
209
- getCount:function(a){return Object.keys(a).length},getFirst:function(a){return a[Object.keys(a)[0]]},mapApi:function(a,b){return function(){for(var c=[],d=0;d<arguments.length;d++)c[d]=arguments[d];return Object.keys(a).reduce(function(d,f){var e;return a[f][b]&&(c[0]&&void 0!==c[0][f]?d[f]=a[f][b](c[0][f]):d[f]=(e=a[f])[b].apply(e,c)),d},{})}},setProp:function(a,b,c){return a[b]=c},startActions:function(a,b){return Object.keys(a).reduce(function(c,d){return c[d]=b(a[d],d),c},{})}}),Tf=ce({getOutput:function(){return[]},
210
- getCount:function(a){return a.length},getFirst:function(a){return a[0]},mapApi:function(a,b){return function(){for(var c=[],d=0;d<arguments.length;d++)c[d]=arguments[d];return a.map(function(a,d){if(a[b])return Array.isArray(c[0])?a[b](c[0][d]):a[b].apply(a,c)})}},setProp:function(a,b,c){return a[b]=c},startActions:function(a,b){return a.map(function(a,d){return b(a,d)})}}),Uf=function(){for(var a=[],b=0;b<arguments.length;b++)a[b]=arguments[b];return Tf(a)},Vf=[wf,Ha,vf,xf,yf],yc=function(a){return Vf.find(function(b){return b.test(a)})},
211
- de=function(a,b){return a(b)},Wf=function(a,b,c){var d=b[c[0]].map(function(d,f){f=c.reduce(function(a){return function(b,c){return b[c]=b[c][a],b}}(f),B({},b));return zc(d)(a,f)});return Uf.apply(void 0,d)},Xf=function(a,b,c){var d=c[0],e=Object.keys(b[d]).reduce(function(e,g){var f=c.reduce(function(a){return function(b,c){return b[c]=b[c][a],b}}(g),B({},b));return e[g]=zc(b[d][g])(a,f),e},{});return Sf(e)},Yf=function(a,b){var c=b.from,d=b.to;b=T(b,["from","to"]);var e=yc(c)||yc(d),f=e.transform;
212
- e=e.parse;return a(B(B({},b),{from:"string"==typeof c?e(c):c,to:"string"==typeof d?e(d):d})).pipe(f)},ee=function(a){return function(b,c){var d=c.from,e=c.to;c=T(c,["from","to"]);return b(B(B({},c),{from:0,to:1})).pipe(a(d,e))}},Zf=ee(Ud),$f=ee(Wd),fe=function(a,b){b=function(a){var b=Object.keys(a),c=function(b,c){return void 0!==b&&!a[c](b)};return{getVectorKeys:function(a){return b.reduce(function(b,d){return c(a[d],d)&&b.push(d),b},[])},testVectorProps:function(a){return a&&b.some(function(b){return c(a[b],
213
- b)})}}}(b);var c=b.testVectorProps,d=b.getVectorKeys;return function(b){if(!c(b))return a(b);var e=d(b);return zc(b[e[0]])(a,b,e)}},zc=function(a){return"number"==typeof a?de:Array.isArray(a)?Wf:yc(a)?Yf:Fd(a)?Zf:Ma.test(a)?$f:"object"==typeof a?Xf:de},ag=fe(function(a){var b=a.from,c=void 0===b?0:b;b=a.velocity;var d=void 0===b?0:b,e=a.min,f=a.max;b=a.power;var g=void 0===b?.8:b;b=a.timeConstant;var k=void 0===b?700:b;b=a.bounceStiffness;var h=void 0===b?500:b;b=a.bounceDamping;var m=void 0===b?
214
- 10:b;b=a.restDelta;var p=void 0===b?1:b,q=a.modifyTarget;return ba(function(a){var b,l,v=a.update,r=a.complete,u=c;a=function(a){return void 0!==e&&a<e||void 0!==f&&a>f};var P=function(a,c){b&&b.stop();b=a.start({update:v,complete:function(){c?c():r()}})},z=function(a){P(function(a){return void 0===a&&(a={}),ba(function(b){var c=b.update,d=b.complete;b=a.velocity;var e=void 0===b?0:b;b=a.from;b=void 0===b?0:b;var f=a.to,g=void 0===f?0:f;f=a.stiffness;var k=void 0===f?100:f;f=a.damping;var h=void 0===
215
- f?10:f;f=a.mass;var m=void 0===f?1:f;f=a.restSpeed;var n=void 0===f?.01:f;f=a.restDelta;var p=void 0===f?.01:f,q=e?-e/1E3:0,l=0,u=g-b,v=b,r=v,z=L.update(function(a){a=a.delta;l+=a;var b=h/(2*Math.sqrt(k*m)),f=Math.sqrt(k/m)/1E3;if(r=v,1>b){var x=Math.exp(-b*f*l),y=f*Math.sqrt(1-b*b);v=g-x*((q+b*f*u)/y*Math.sin(y*l)+u*Math.cos(y*l))}else x=Math.exp(-f*l),v=g-x*(u+(q+f*u)*l);e=sb(v-r,a);a=Math.abs(g-v)<=p;Math.abs(e)<=n&&a?(c(v=g),aa.update(z),d()):c(v)},!0);return{stop:function(){return aa.update(z)}}})}(B(B({},
216
- a),{stiffness:h,damping:m,restDelta:p})))};if(a(c))z({from:c,velocity:d,to:Math.abs(e-c)<Math.abs(f-c)?e:f});else{var C=g*d+c;void 0!==q&&(C=q(C),q=void 0,d=(C-c)/g);var t=(void 0===(l={from:c,velocity:d,timeConstant:k,power:g,restDelta:p,modifyTarget:q})&&(l={}),ba(function(a){var b=a.complete,c=a.update;a=l.velocity;var d=l.from;d=void 0===d?0:d;var e=l.power,f=l.timeConstant,g=void 0===f?350:f;f=l.restDelta;var k=void 0===f?.5:f;f=l.modifyTarget;var h=0,m=(void 0===e?.8:e)*(void 0===a?0:a);a=d+
217
- m;var n=void 0===f?a:f(a);n!==a&&(m=n-d);var p=L.update(function(a){h+=a.delta;a=-m*Math.exp(-h/g);var d=a>k||a<-k;c(d?n+a:n);d||(aa.update(p),b())},!0);return{stop:function(){return aa.update(p)}}})),Q=void 0;if(a(C)){var Nb=Math.abs(e-C)<Math.abs(f-C)?e:f,w=Nb==e?-1:1;t=t.while(function(a){return d=sb(a-u,ka.delta),u=a,0<Nb-a*w});Q=function(){return z({from:u,to:Nb,velocity:d})}}P(t,Q)}return{stop:function(){return b&&b.stop()}}})},{from:O.test,velocity:O.test,min:O.test,max:O.test,damping:O.test,
218
- stiffness:O.test,modifyTarget:function(a){return"function"==typeof a}}),ge=fe(function(a){var b=a.from,c=void 0===b?0:b;b=a.to;var d=void 0===b?1:b;b=a.ease;b=void 0===b?Gf:b;a=a.reverseEase;return void 0!==a&&a&&(b=Kd(b)),ba(function(a){var b=a.update;return{seek:function(a){return b(a)}}}).pipe(b,function(a){return ab(c,d,a)})},{ease:function(a){return"function"==typeof a},from:O.test,to:O.test}),bg=rb(0,1),he=function(a){return void 0===a&&(a={}),ba(function(b){var c,d=b.update,e=b.complete;b=
219
- a.duration;var f=void 0===b?300:b;b=a.ease;var g=void 0===b?Md:b;b=a.flip;var k=void 0===b?0:b;b=a.loop;var h=void 0===b?0:b;b=a.yoyo;var m=void 0===b?0:b;b=a.repeatDelay;var p=void 0===b?0:b;b=a.from;var q=void 0===b?0:b;b=a.to;var l=void 0===b?1:b;b=a.elapsed;var n=void 0===b?0:b;b=a.flipCount;var y=void 0===b?0:b;b=a.yoyoCount;var v=void 0===b?0:b;b=a.loopCount;var x=void 0===b?0:b,u=ge({from:q,to:l,ease:g}).start(d),t=0,z=!1,C=function(a){var b;void 0===a&&(a=!1);u=ge({from:q=(b=[l,q])[0],to:l=
220
- b[1],ease:g,reverseEase:a}).start(d)},Zc=function(){var a=f-0;t=bg(0===a?1:(n-0)/a);u.seek(t)},Q=function(){z=!0;c=L.update(function(a){var b;n+=a.delta;Zc();!(b=z&&n>f+p)||(!b||h||k||m)&&(n=f-(n-p),h&&x<h?(x++,1):k&&y<k?(y++,C(),1):m&&v<m&&(v++,C(0!=v%2),1))||(aa.update(c),e&&L.update(e,!1,!0))},!0)};return Q(),{isActive:function(){return z},getElapsed:function(){return rb(0,f,n)},getProgress:function(){return t},stop:function(){z=!1;c&&aa.update(c)},pause:function(){z=!1;c&&aa.update(c);return this},
221
- resume:function(){return z||Q(),this},seek:function(a){return n=ab(0,f,a),L.update(Zc,!1,!0),this},reverse:function(){return C(),this}}})},Ja=function(a,b,c){return ba(function(d){var e=d.update,f=b.split(" ").map(function(b){return a.addEventListener(b,e,c),b});return{stop:function(){return f.forEach(function(b){return a.removeEventListener(b,e,c)})}}})},ie=function(){return{clientX:0,clientY:0,pageX:0,pageY:0,x:0,y:0}},je=function(a,b){return void 0===b&&(b={clientX:0,clientY:0,pageX:0,pageY:0,
222
- x:0,y:0}),b.clientX=b.x=a.clientX,b.clientY=b.y=a.clientY,b.pageX=a.pageX,b.pageY=a.pageY,b},la=[ie()],Ac=!1;"undefined"!=typeof document&&Ja(document,"touchstart touchmove",{passive:!0,capture:!0}).start(function(a){a=a.touches;Ac=!0;for(var b=a.length,c=la.length=0;c<b;c++)la.push(je(a[c]))});var ke=ie(),le=!1;"undefined"!=typeof document&&Ja(document,"mousedown mousemove",!0).start(function(a){le=!0;je(a,ke)});var va,Hb,Ib,Jb,fb,Rc,gb,Kb,Lb,Gb,Qc,Eb,Fb,Oc,Pc,cg=function(a){return a[0]},me=function(a){return void 0===
223
- a&&(a={}),Ac?function(a){a=void 0===a?{}:a;var b=a.preventDefault,d=void 0===b||b;b=a.scale;var e=void 0===b?1:b;a=a.rotate;var f=void 0===a?0:a;return ba(function(a){var b=a.update,c={touches:la,scale:e,rotate:f},g=0,p=0,q=1<la.length;if(q){a=la[0];var l=la[1];g=sc(a,l);p=Pd(a,l)}var n=function(){if(q){var a=la[0],d=la[1],k=sc(a,d);a=Pd(a,d);c.scale=k/g*e;c.rotate=f+(a-p)}b(c)},y=Ja(document,"touchmove",{passive:!d}).start(function(a){(d||1<a.touches.length)&&a.preventDefault();L.update(n)});return Ac&&
224
- L.update(n),{stop:function(){aa.update(n);y.stop()}}})}(a).pipe(function(a){return a.touches},cg):function(a){a=(void 0===a?{}:a).preventDefault;var b=void 0===a||a;return ba(function(a){var c=a.update,d=function(){return c(ke)},g=Ja(document,"mousemove").start(function(a){b&&a.preventDefault();L.update(d)});return le&&L.update(d),{stop:function(){aa.update(d);g.stop()}}})}(a)},Nc=!1,ne,Bc={ie:function(){return I()||va},ieCompatibilityMode:function(){return I()||Rc>va},ie64:function(){return Bc.ie()&&
225
- Qc},firefox:function(){return I()||Hb},opera:function(){return I()||Ib},webkit:function(){return I()||Jb},safari:function(){return Bc.webkit()},chrome:function(){return I()||fb},windows:function(){return I()||Kb},osx:function(){return I()||gb},linux:function(){return I()||Lb},iphone:function(){return I()||Eb},mobile:function(){return I()||Eb||Fb||Gb||Pc},nativeApp:function(){return I()||Oc},android:function(){return I()||Gb},ipad:function(){return I()||Fb}},dg=Bc,oe=!("undefined"==typeof window||
226
- !window.document||!window.document.createElement);oe&&(ne=document.implementation&&document.implementation.hasFeature&&!0!==document.implementation.hasFeature("",""));Sc.getEventType=function(){if(dg.firefox())var a="DOMMouseScroll";else{if(oe){var b="onwheel"in document;b||(a=document.createElement("div"),a.setAttribute("onwheel","return;"),b="function"==typeof a.onwheel);a=(!b&&ne&&(b=document.implementation.hasFeature("Events.wheel","3.0")),b)}else a=!1;a=a?"wheel":"mousewheel"}return a};var pe=
227
- {zoomOutFactor:.8,zoomInFactor:1.25,maxZoomFactor:1,minZoomFactor:.05,zoomDuration:300,zoomWheelConstant:18,zoomClamp:.6,panBounceStiffness:120,panBounceDamping:15,panTimeConstant:240,panPower:.1,nudgeDistance:100,panPadding:0,devicePixelRatio:1,enableWheel:!0,enableClickToZoom:!1,onPanInSketchMode:function(){}},Cc=function(a){void 0===a&&(a={});var b=void 0;return{updatePosition:function(a,d,e,f){b&&(b.stop(),b.update({x:a,y:d,width:e,height:f}))},start:function(c){function d(a){void 0===a&&(a=!1);
228
- var b=c.getBounds(n),d=b.x1,e=b.x2,f=b.y1;b=b.y2;if(a)return u.stop(),void u.update({x:d,y:f});ag({min:{x:d,y:f},max:{x:e,y:b},bounceStiffness:m,bounceDamping:p,timeConstant:a?0:q,power:l,restSpeed:10,restDelta:.5,from:u.get(),velocity:u.getVelocity()}).start(u)}var e=B(B({},pe),a),f=e.zoomDuration,g=e.zoomWheelConstant,k=e.zoomClamp,h=e.minZoomFactor,m=e.panBounceStiffness,p=e.panBounceDamping,q=e.panTimeConstant,l=e.panPower,n=(e.nudgeDistance,e.panPadding),y=e.enableWheel,v=(e.enableClickToZoom,
229
- e.devicePixelRatio),x=e.onPanInSketchMode,u=function(a,b){return new Rf({value:a,initialSubscription:b})}({x:c.target[1],y:c.target[2],width:c.target[3]-c.target[1],height:c.target[4]-c.target[2]},c.setViewport);b=u;c.world.activatedEvents.push("onMouseDown","onTouchStart");var t=!1;Ja(c.world,"mousedown touchstart").start(function(a){var b=c.getScaleFactor();"explore"===c.mode?(a=u.get(),function(a){void 0===a&&(a={});var b=a.x,c=a.y;a=T(a,["x","y"]);if(void 0!==b||void 0!==c){var d=Qd(b||0),e=Qd(c||
230
- 0),f={x:0,y:0};return me(a).pipe(function(a){return f.x=d(a.x),f.y=e(a.y),f})}return me(a)}({x:-a.x*b/v,y:-a.y*b/v}).pipe(function(a){return{x:a.x*v,y:a.y*v}}).pipe(function(a){return{x:-a.x/b,y:-a.y/b}}).start(u)):t||(t=!0,x())});c.world.activatedEvents.push("onMouseUp","onTouchEnd");Ja(c.world,"mouseup touchend").start(function(){c.world.constraintBounds()});var z,C=!1;c.world.activatedEvents.push("onTouchStart");c.world.addEventListener("touchstart",function(a){"explore"===c.mode&&(C=!0)});window.addEventListener("touchend",
231
- function(a){C&&(c.world.constraintBounds(),C=!1)});c.world.activatedEvents.push("onMouseDown");c.world.addEventListener("mousedown",function(a){C=!0});window.addEventListener("mouseup",function(a){C&&("explore"===c.mode&&c.world.constraintBounds(),C=!1)});y&&(c.world.activatedEvents.push("onWheel"),c.world.addEventListener("wheel",function(a){var b=1+Sc(a).spinY/g;c.world.zoomTo(rb(1-k,1+k,b),a.atlas,!0)}));c.world.addLayoutSubscriber(function(a,b){"zone-changed"===a&&d(!0);if("zoom-to"===a){var e=
232
- b.factor,g=b.point,k=b.stream;void 0===k&&(k=!1);var m=c.getViewport();e=c.getZoomedPosition(e,{origin:g,minZoomFactor:h});z&&z.stop();z=he({from:m,to:Object.create({x:e[1],y:e[2],width:e[3]-e[1],height:e[4]-e[2]}),duration:f,ease:k?Md:Nd}).start(u)}if("goto-region"===a&&b){k=c.clampRegion(b);m=c.getViewport();if(b.immediate)return u.stop(),void u.update(k);he({from:m,to:k,duration:b.nudge?f:1E3,ease:Nd}).start(u)}"constrain-bounds"===a&&b&&d(b.immediate)})},stop:function(){}}},cb=function(a){function b(){var b=
233
- a.call(this)||this;return b.type="spacial-content",b.color="#000",b.text="",b.display={scale:1,width:100,height:100,points:w(5)},b.interactive=!1,b.props={font:"18px Arial, sans-serif",lineHeight:1,textAlign:"left",verticalAlign:"top",paddingX:0,paddingY:0,fitParent:!1,lineBreak:"auto",strokeText:!1,sizeToFill:!1,maxFontSizeToFill:void 0,allowNewLine:!0,justifyLines:!1,renderHDPI:!1,textDecoration:"none",interactive:!1},b.id="",b.points=w(5),b}return N(b,a),b.prototype.getAllPointsAt=function(a,b){return[[this,
234
- this.points,b]]},b.prototype.applyProps=function(a){var b=a.id,c=a.target,f=a.text,g=a.color,k=a.backgroundColor,h=a.fontSize;h=void 0===h?18:h;var m=a.interactive,p=a.fontFamily;p=void 0===p?"Arial, sans-serif":p;a=T(a,"id target text color backgroundColor fontSize interactive fontFamily".split(" "));a.font=h+"px "+p;this.interactive=m||!1;void 0!==f&&(this.text=f||"");g&&(this.color=g);k&&(this.backgroundColor=k);b&&(this.id=b);c&&(this.points=D.singleBox(c.width,c.height,c.x,c.y),this.display.points=
235
- this.points,this.display.width=c.width,this.display.height=c.height);this.props=B(B({},this.props),a);this.__revision++},b}(W),vb=function(a){function b(){var b=a.call(this)||this;return b.type="spacial-content",b.display={scale:1,width:-1,height:-1,points:w(5)},b.props={},b.id=ic(12),b.points=w(5),b}return N(b,a),b.prototype.getAllPointsAt=function(a,b){return[[this,this.points,b]]},b.prototype.applyProps=function(a){void 0===a&&(a={});var b=!1;a.interactive!==this.props.interactive&&(b=!0,this.props.interactive=
236
- a.interactive);a.target&&(a.target.width===this.display.width&&a.target.height===this.display.height&&a.target.x===this.points[1]&&a.target.y===this.points[2]||(b=!0,this.points=D.singleBox(a.target.width,a.target.height,a.target.x,a.target.y),this.display.points=D.singleBox(a.target.width,a.target.height,a.target.x,a.target.y),this.display.width=a.target.width,this.display.height=a.target.height));a.backgroundColor!==this.props.backgroundColor&&(b=!0,this.props.backgroundColor=a.backgroundColor);
237
- a.border!==this.props.border&&(b=!0,this.props.border=a.border);b&&this.__revision++},b}(W),Dc=function(a){function b(b){var c=a.call(this)||this;if(c.type="spacial-content",c.getTexture=function(){return{source:void 0,hash:-1}},b){var e=b.scale||1;c.id=b.id||b.uri;c.uri=b.uri;c.points=D.singleBox(b.width,b.height);c.display={scale:e,width:b.width/e,height:b.height/e,points:1!==e?D.singleBox(b.width/e,b.height/e):c.points}}else c.id="",c.uri="",c.display={scale:1,width:0,height:0,points:w(5)},c.points=
238
- w(5);return c}return N(b,a),b.prototype.applyProps=function(a){var b=a.target.width/(a.display?a.display.width:a.target.width);this.id=a.id;this.points.set(D.singleBox(a.target.width,a.target.height));this.display.scale=b;this.display.width=a.target.width/b;this.display.height=a.target.height/b;this.getTexture=a.getTexture;this.display.points=1!==b?D.singleBox(a.target.width/b,a.target.height/b):this.points},b.prototype.getAllPointsAt=function(a,b,e){return[[this,this.points,b]]},b}(W),qe=new Map,
239
- re={},wb=ua({supportsMutation:!0,isPrimaryRenderer:!1,warnsIfNotActing:!0,createInstance:function(a,b,c){c=c.world;switch(a){case "world":(a=Ga.withProps({width:b.width,height:b.height,viewingDirection:"left-to-right"})).activatedEvents=c.activatedEvents;a.eventHandlers=c.eventHandlers;a.subscriptions=c.subscriptions;a.triggerEventActivation();c=a;break;case "box":a=new vb;break;case "worldObject":case "world-object":a=new Ua;break;case "worldImage":case "world-image":a=new ta;break;case "texture":a=
240
- new Dc;break;case "compositeImage":case "composite-image":a=new Bd({id:b.id,width:b.width,height:b.height,images:[]});break;case "tiledImage":case "tiled-image":a=Fa.fromTile(b.uri,b.display,b.tile,b.scaleFactor);break;case "paragraph":(a=new cb).text=b.children;break;default:return}return Xc(c,b),Wc(a,{},b),a},createTextInstance:function(){},appendChildToContainer:function(a,b){if(b instanceof Ga)a.world=b;else if(b instanceof Ua)a.world.appendChild(b);else if(b)throw Error("Invalid root");},appendChild:Tc,
241
- appendInitialChild:Tc,removeChildFromContainer:Uc,removeChild:Uc,insertInContainerBefore:Vc,insertBefore:Vc,prepareUpdate:function(a,b,c,d,e){return Xc(e.world,d),a instanceof cb?B(B({},d),{text:d.children}):d},commitUpdate:function(a,b,c,d,e,f){a.applyProps&&Wc(a,d,b)},finalizeInitialChildren:function(a){return a.__handlers},getChildHostContext:function(){return re},getPublicInstance:function(a){return a},getRootHostContext:function(){return re},prepareForCommit:function(){return null},hideInstance:function(a){},
242
- unhideInstance:function(a,b){},hideTextInstance:function(){throw Error("Text is not allowed in the react-three-fibre tree. You may have extraneous whitespace between components.");},resetAfterCommit:function(a){a.pendingUpdate=!0;a.world&&a.world.needsRecalculate&&(a.world.recalculateWorldSize(),a.world.triggerRepaint())},shouldSetTextContent:function(){return!1},shouldDeprioritizeSubtree:function(){return!1}});wb.injectIntoDevTools({bundleType:0,findHostInstanceByFiber:function(){return null},version:"1.6.6",
243
- rendererPackageName:"@atlas-viewer/atlas"});var Ec={render:function(a,b){var c=qe.get(b);c?wb.updateContainer(a,c,null,function(){}):(c=wb.createContainer(b,0,!1,null),wb.updateContainer(a,c,null,null),qe.set(b,c))}},xb=A.createContext("explore"),yb=function(){return l.useContext(xb)},$c=Yc.debounce=Yc;let eg="x y top bottom left right width height".split(" "),He=(a,b)=>eg.every(c=>a[c]===b[c]);"undefined"!=typeof module&&Object.getOwnPropertyDescriptor&&Object.getOwnPropertyDescriptor(module,"exports").writable&&
244
- (module.exports=Mb);var zb=A.createContext(void 0),Fc=function(){function a(a,c){var b=this;this.activatedEvents=[];this.eventHandlers=[];this.pointerMoveEvent=void 0;this.pointerEventState={isClicking:!1,isDragging:!1,isPressed:!1,mousedOver:[],itemsBeingDragged:[],mouseDownStart:{x:0,y:0},lastTouches:[]};this._realPointerMove=function(a){b.pointerMoveEvent=a};this.onWheelEvent=function(a){a.preventDefault();b.onPointerEvent(a)};this.onTouchEvent=function(a){for(var c=wa[a.type],d=[],e=a.touches.length,
245
- h=0;h<e;h++){var m=a.touches.item(h);if(m){var p=b.runtime.viewerToWorld(m.pageX-b.bounds.left,m.pageY-b.bounds.top);d.push({id:m.identifier,x:p.x,y:p.y})}}b.assignToEvent(a,d[0].x,d[0].y);"onTouchEnd"!==c?(b.pointerEventState.lastTouches=d,a.atlasTouches=d,b.runtime.world.propagateTouchEvent(c,a,d)):(a.atlasTouches=[],b.runtime.world.propagateTouchEvent(c,a,b.pointerEventState.lastTouches),b.pointerEventState.lastTouches=[])};this.onPointerEvent=function(a){var c=wa[a.type];if(c&&-1!==b.runtime.world.activatedEvents.indexOf(c)){var d=
246
- b.runtime.viewerToWorld(a.clientX-b.bounds.left,a.clientY-b.bounds.top),e=d.x;d=d.y;b.assignToEvent(a,e,d);b.runtime.world.propagatePointerEvent(c,a,e,d)}};this.onPointerDown=function(a){b.pointerEventState.isPressed=!0;b.pointerEventState.isClicking=!0;b.pointerEventState.mouseDownStart.x=a.pageX;b.pointerEventState.mouseDownStart.y=a.pageY;setTimeout(function(){b.runtime&&(b.pointerEventState.isClicking=!1)},200);setTimeout(function(){if(b.runtime&&b.pointerEventState.isPressed&&!b.pointerEventState.isDragging){var c=
247
- b.runtime.viewerToWorld(b.pointerEventState.mouseDownStart.x-b.bounds.left,b.pointerEventState.mouseDownStart.y-b.bounds.top);b.pointerEventState.isDragging=!0;b.pointerEventState.itemsBeingDragged=b.runtime.world.propagatePointerEvent("onDragStart",a,c.x,c.y)}},600);b.onPointerEvent(a)};this.onPointerUp=function(a){var c;if(b.pointerEventState.isClicking){var d=b.runtime.viewerToWorld(a.pageX-b.bounds.left,a.pageY-b.bounds.top),e=d.x;d=d.y;b.assignToEvent(a,e,d);b.runtime.world.propagatePointerEvent("onClick",
248
- a,e,d)}if(b.pointerEventState.isDragging){try{for(var h=F(b.pointerEventState.itemsBeingDragged),m=h.next();!m.done;m=h.next())m.value.dispatchEvent("onDragEnd",a)}catch(q){var p={error:q}}finally{try{m&&!m.done&&(c=h.return)&&c.call(h)}finally{if(p)throw p.error;}}b.pointerEventState.isDragging=!1}b.pointerEventState.isClicking=!1;b.pointerEventState.isPressed=!1;b.pointerEventState.itemsBeingDragged=[];b.onPointerEvent(a)};this.onPointerMove=function(a){var c,d,e;b.pointerMoveEvent=void 0;var h=
249
- b.runtime.viewerToWorld(a.pageX-b.bounds.left,a.pageY-b.bounds.top),m=h.x;h=h.y;b.assignToEvent(a,m,h);b.runtime.world.propagatePointerEvent("onPointerMove",a,m,h);h=b.runtime.world.propagatePointerEvent("onMouseMove",a,m,h);var p=[];m=[];try{for(var l=F(h),r=l.next();!r.done;r=l.next()){var n=r.value;p.push(n.id);m.push(n);-1===b.pointerEventState.mousedOver.indexOf(n)&&(n.dispatchEvent("onMouseEnter",a),n.dispatchEvent("onPointerEnter",a),n.dispatchEvent("onMouseOver",a),n.dispatchEvent("onPointerOver",
250
- a))}}catch(Q){var y={error:Q}}finally{try{r&&!r.done&&(c=l.return)&&c.call(l)}finally{if(y)throw y.error;}}try{for(var v=F(b.pointerEventState.mousedOver),x=v.next();!x.done;x=v.next()){var u=x.value;-1===p.indexOf(u.id)&&(u.dispatchEvent("onMouseLeave",a),u.dispatchEvent("onPointerLeave",a),u.dispatchEvent("onMouseOut",a),u.dispatchEvent("onPointerOut",a))}}catch(Q){var t={error:Q}}finally{try{x&&!x.done&&(d=v.return)&&d.call(v)}finally{if(t)throw t.error;}}if(b.pointerEventState.isDragging)try{for(var z=
251
- F(b.pointerEventState.itemsBeingDragged),C=z.next();!C.done;C=z.next())C.value.dispatchEvent("onDrag",a)}catch(Q){var w={error:Q}}finally{try{C&&!C.done&&(e=z.return)&&e.call(z)}finally{if(w)throw w.error;}}if(y=b.pointerEventState.isPressed&&!b.pointerEventState.isDragging)y=b.pointerEventState.mouseDownStart,y=50<Math.sqrt(Math.pow(Math.abs(y.x-a.pageX),2)+Math.pow(Math.abs(y.y-a.pageY),2));y&&(y=b.runtime.viewerToWorld(b.pointerEventState.mouseDownStart.x-b.bounds.left,b.pointerEventState.mouseDownStart.y-
252
- b.bounds.top),b.pointerEventState.isDragging=!0,b.pointerEventState.itemsBeingDragged=b.runtime.world.propagatePointerEvent("onDragStart",B(B({},a),{atlas:{x:y.x,y:y.y}}),y.x,y.y));b.pointerEventState.mousedOver=m};this.element=a;this.runtime=c;this.unsubscribe=c.world.addLayoutSubscriber(this.layoutSubscriber.bind(this));this.bounds=a.getBoundingClientRect();c.registerHook("useFrame",function(){b.pointerMoveEvent&&c.updateNextFrame()});c.registerHook("useBeforeFrame",function(){b.pointerMoveEvent&&
253
- b.onPointerMove(b.pointerMoveEvent)});this.activateEvents()}return a.prototype.updateBounds=function(){this.bounds=this.element.getBoundingClientRect()},a.prototype.layoutSubscriber=function(a){"event-activation"===a&&this.activateEvents()},a.prototype.assignToEvent=function(b,c,d){a.eventPool.atlas.x=c;a.eventPool.atlas.y=d;b.atlas=a.eventPool.atlas},a.prototype.activateEvents=function(){this.element.addEventListener("pointermove",this._realPointerMove);this.element.addEventListener("pointerup",
254
- this.onPointerUp);this.element.addEventListener("pointerdown",this.onPointerDown);this.element.addEventListener("mousedown",this.onPointerEvent);this.element.addEventListener("mouseup",this.onPointerEvent);this.element.addEventListener("pointercancel",this.onPointerEvent);this.element.addEventListener("wheel",this.onWheelEvent);this.element.addEventListener("touchstart",this.onTouchEvent);this.element.addEventListener("touchcancel",this.onTouchEvent);this.element.addEventListener("touchend",this.onTouchEvent);
255
- this.element.addEventListener("touchmove",this.onTouchEvent)},a.prototype.normalizeEventName=function(a){return a.startsWith("on")?a.slice(2).toLowerCase():a.toLowerCase()},a.prototype.stop=function(){var a;this.unsubscribe();try{for(var c=F(this.eventHandlers),d=c.next();!d.done;d=c.next()){var e=H(d.value,2),f=e[1];this.element.removeEventListener(this.normalizeEventName(e[0]),f)}}catch(k){var g={error:k}}finally{try{d&&!d.done&&(a=c.return)&&a.call(c)}finally{if(g)throw g.error;}}},a.eventPool=
256
- {atlas:{x:0,y:0}},a}(),se=function(){function a(a){this.fragmentShaderSource="\n precision mediump float;\n\n uniform sampler2D u_image;\n varying vec2 v_texCoord;\n\n void main() {\n gl_FragColor = texture2D(u_image, v_texCoord);\n }\n ";this.vertexShaderSource="\n attribute vec2 a_position;\n uniform vec2 u_resolution;\n varying vec4 v_color;\n uniform sampler2D u_texture;\n\n attribute vec2 a_texCoord;\n varying vec2 v_texCoord;\n\n void main() {\n\n // convert the position from pixels to 0.0 to 1.0\n vec2 zeroToOne = a_position / u_resolution;\n\n // convert from 0->1 to 0->2\n vec2 zeroToTwo = zeroToOne * 2.0;\n\n // convert from 0->2 to -1->+1 (clip space)\n vec2 clipSpace = zeroToTwo - 1.0;\n\n gl_Position = vec4(clipSpace * vec2(1, -1), 0, 1);\n \n v_texCoord = a_texCoord;\n }\n ";
257
- this.lastResize=0;this.canvas=a;this.gl=a.getContext("webgl2");this.fragmentShader=this.createShader(this.gl.FRAGMENT_SHADER,this.fragmentShaderSource);this.vertexShader=this.createShader(this.gl.VERTEX_SHADER,this.vertexShaderSource);this.program=this.createProgram(this.vertexShader,this.fragmentShader);this.attributes={position:this.gl.getAttribLocation(this.program,"a_position"),texCoord:this.gl.getAttribLocation(this.program,"a_texCoord")};this.uniforms={resolution:this.gl.getUniformLocation(this.program,
258
- "u_resolution"),texture:this.gl.getUniformLocation(this.program,"u_texture")};this.buffers={position:this.createArrayBuffer(),texCoord:this.createArrayBuffer(new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1]))};this.rectBuffer=new Float32Array(12);this.resize();this.gl.viewport(0,0,this.gl.canvas.width,this.gl.canvas.height);this.gl.clearColor(0,0,0,0);this.gl.clear(this.gl.COLOR_BUFFER_BIT);this.gl.useProgram(this.program);this.gl.enableVertexAttribArray(this.attributes.position)}return a.prototype.resize=
259
- function(){this.resizeCanvasToDisplaySize();this.gl.viewport(0,0,this.gl.canvas.width,this.gl.canvas.height)},a.prototype.isReady=function(){return!0},a.prototype.beforeFrame=function(a,c,d){this.gl.clearColor(0,0,0,0);this.gl.clear(this.gl.COLOR_BUFFER_BIT);this.gl.vertexAttribPointer(this.attributes.position,2,this.gl.FLOAT,!1,0,0);this.gl.uniform2f(this.uniforms.resolution,this.gl.canvas.width,this.gl.canvas.height);1E3<this.lastResize&&(this.lastResize=0,this.resizeCanvasToDisplaySize());this.lastResize+=
260
- c},a.prototype.prepareLayer=function(a){a.__host&&a.__host.webgl||((a instanceof ta||a instanceof Fa)&&this.createImageHost(a),a instanceof Dc&&this.createTextureHost(a))},a.prototype.createTextureHost=function(a){a.__host=a.__host?a.__host:{};var b=this.gl,d=this.gl.createTexture();if(b.bindTexture(b.TEXTURE_2D,d),b.pixelStorei(b.UNPACK_FLIP_Y_WEBGL,!1),a instanceof Dc){var e=a.getTexture();e.source&&b.texImage2D(b.TEXTURE_2D,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,e.source)}b.texParameteri(b.TEXTURE_2D,
261
- b.TEXTURE_MAG_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);a.__host.webgl={height:a.height,width:a.width,texture:d,lastImage:e}},a.prototype.createImageHost=function(a){var b=this,d=G(Array(a.points.length/5));a.__host=a.__host?a.__host:{};a.__host.webgl={height:a.height,width:a.width,textures:d,loading:[],loaded:[],lastLevelRendered:-1,onLoad:function(c,
262
- d){var e=b.gl,f=b.gl.createTexture();e.bindTexture(e.TEXTURE_2D,f);e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!1);e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,d);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);e.bindTexture(e.TEXTURE_2D,null);a.__host.webgl.textures[c]=f;a.__host.webgl.loaded.push(c)}}},
263
- a.prototype.paint=function(a,c,d,e,f,g){if("spacial-content"===a.type&&a.__host&&a.__host.webgl){if(a.getTexture){var b=null==a?void 0:a.getTexture();if(b&&a.__host.webgl.lastImage!==b.hash&&b.source&&!a.__host.webgl.error)try{var h=this.gl.RGBA,m=this.gl.RGBA,l=this.gl.UNSIGNED_BYTE;this.gl.bindTexture(this.gl.TEXTURE_2D,a.__host.webgl.texture);this.gl.texImage2D(this.gl.TEXTURE_2D,0,h,m,l,b.source);a.__host.webgl.lastImage=b.hash}catch(r){a.__host.webgl.error=r}}if(a.__host.webgl.loading&&-1===
264
- a.__host.webgl.loading.indexOf(c)&&a.getImageUrl){a.__host.webgl.loading.push(c);var q=document.createElement("img");q.decoding="async";q.crossOrigin="anonymous";q.src=a.getImageUrl(c);q.onload=function(){return q.onload=null,a.__host.webgl.onLoad(c,q)}}(b=a.__host.webgl.texture?a.__host.webgl.texture:a.__host.webgl.textures[c])&&(this.gl.enableVertexAttribArray(this.attributes.texCoord),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.buffers.texCoord),this.gl.enableVertexAttribArray(this.attributes.texCoord),
265
- this.gl.vertexAttribPointer(this.attributes.texCoord,2,this.gl.FLOAT,!1,0,0),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.buffers.position),this.gl.enableVertexAttribArray(this.attributes.position),this.gl.vertexAttribPointer(this.attributes.position,2,this.gl.FLOAT,!1,0,0),this.gl.bindTexture(this.gl.TEXTURE_2D,b),this.gl.uniform1i(this.uniforms.texture,0),this.setRectangle(d,e,f,g),this.gl.drawArrays(this.gl.TRIANGLES,0,6))}},a.prototype.afterPaintLayer=function(a,c){},a.prototype.pendingUpdate=
266
- function(){return!0},a.prototype.getPointsAt=function(a,c,d,e){return a.getPointsAt(c,d,e)},a.prototype.afterFrame=function(){},a.prototype.getScale=function(a,c){a=this.canvas.width/a;c=this.canvas.height/c;return a<c?c:a},a.prototype.getViewportBounds=function(a,c,d){return null},a.prototype.createShader=function(a,c){if(a=this.gl.createShader(a)){if(this.gl.shaderSource(a,c),this.gl.compileShader(a),this.gl.getShaderParameter(a,this.gl.COMPILE_STATUS))return a;c=this.gl.getShaderInfoLog(a);if(this.gl.deleteShader(a),
267
- c)throw Error(c);}throw Error("Invalid shader");},a.prototype.createProgram=function(a,c){var b=this.gl.createProgram();if(b){if(this.gl.attachShader(b,a),this.gl.attachShader(b,c),this.gl.linkProgram(b),this.gl.getProgramParameter(b,this.gl.LINK_STATUS))return b;a=this.gl.getProgramInfoLog(b);if(this.gl.deleteProgram(b),a)throw Error(a);}throw Error("Invalid program");},a.prototype.resizeCanvasToDisplaySize=function(){var a=this.gl.canvas,c=a.clientWidth,d=a.clientHeight,e=a.width!==c||a.height!==
268
- d;return e&&(a.width=c,a.height=d),e},a.prototype.createArrayBuffer=function(a){var b=this.gl.createBuffer();if(this.gl.bindBuffer(this.gl.ARRAY_BUFFER,b),a&&this.gl.bufferData(this.gl.ARRAY_BUFFER,a,this.gl.STATIC_DRAW),!b)throw Error("Cannot create buffer");return b},a.prototype.setRectangle=function(a,c,d,e){this.gl.bufferData(this.gl.ARRAY_BUFFER,this.getRectangle(a,c,d,e),this.gl.STATIC_DRAW)},a.prototype.getRectangle=function(a,c,d,e){d=a+d;e=c+e;return this.rectBuffer.set([a,c,d,c,a,e,a,e,
269
- d,c,d,e]),this.rectBuffer},a}(),te=function(){function a(a,c){void 0===c&&(c={box:!0,text:!0});this.visible=[];this.previousVisible=[];this.htmlIds=[];this.firstMeaningfulPaint=!1;this.options={};this.htmlContainer=a;a=this.htmlContainer.getBoundingClientRect();var b=a.height;this.width=a.width;this.height=b;this.options=c}return a.prototype.createHtmlHost=function(a){if(this.htmlContainer){var b=document.createElement("div");b.style.position="absolute";a.__host={element:b,revision:null,relative:!1};
270
- this.updateHtmlHost(a);a.__onCreate&&a.__onCreate()}},a.prototype.triggerResize=function(){this.options&&this.options.triggerResize&&this.options.triggerResize()},a.prototype.updateHtmlHost=function(a){if(a.__revision!==a.__host.revision){var b=a.__host.element;b.style.width=a.width+"px";b.style.height=a.height+"px";a.props.interactive&&(b.style.pointerEvents="all");this.options.text&&a instanceof cb&&(a.text&&(b.innerText=a.text),a.backgroundColor&&(b.style.backgroundColor=a.backgroundColor),a.color&&
271
- (b.style.color=a.color),a.props.font&&(b.style.font=a.props.font),a.props.textAlign&&(b.style.textAlign=a.props.textAlign),a.__host.revision=a.__revision);this.options.box&&a instanceof vb&&(a.props.backgroundColor&&(b.style.backgroundColor=a.props.backgroundColor),a.props.border!==b.style.border&&(b.style.border=a.props.border),a.props.className&&(b.className=a.props.className))}},a.prototype.afterFrame=function(a,c,d){var b;try{for(var f=F(this.previousVisible),g=f.next();!g.done;g=f.next()){var k=
272
- g.value;-1===this.visible.indexOf(k)&&this.htmlContainer&&k.__id&&-1!==this.htmlIds.indexOf(k.__id)&&this.htmlContainer.removeChild(k.__host.element)}}catch(m){var h={error:m}}finally{try{g&&!g.done&&(b=f.return)&&b.call(f)}finally{if(h)throw h.error;}}this.previousVisible=this.visible},a.prototype.afterPaintLayer=function(a,c){},a.prototype.beforeFrame=function(a,c,d){this.visible=[]},a.prototype.getPointsAt=function(a,c,d,e){return a.getPointsAt(c,d,e)},a.prototype.getScale=function(a,c){a=this.width/
273
- a;c=this.height/c;return a<c?c:a},a.prototype.getViewportBounds=function(a,c,d){return null},a.prototype.isReady=function(){return!1},a.prototype.paint=function(a,c,d,e,f,g){(this.options.text&&a instanceof cb||this.options.box&&a instanceof vb)&&(this.visible.push(a),this.htmlContainer)&&(this.updateHtmlHost(a),c=a.__host.element,c.style.transform="translate("+Math.round(d)+"px, "+Math.round(e)+"px) scale("+f/a.width+")",c.style.transformOrigin="0px 0px",-1===this.previousVisible.indexOf(a)&&this.htmlContainer.appendChild(c),
274
- -1===this.htmlIds.indexOf(a.__id)&&this.htmlIds.push(a.__id))},a.prototype.pendingUpdate=function(){return!1},a.prototype.prepareLayer=function(a){a.__host||(a instanceof cb||a instanceof vb)&&this.createHtmlHost(a)},a.prototype.resize=function(a,c){this.htmlContainer.style.width=a+"px";this.htmlContainer.style.height=c+"px";this.width=a;this.height=c},a}(),ue=function(a){var b=a.onCreated,c=a.mode,d=void 0===c?"explore":c;c=a.resetWorldOnChange;var e=void 0===c||c;c=a.unstable_webglRenderer;var f=
275
- void 0!==c&&c,g=a.controllerConfig,k=a.children,h=T(a,"onCreated mode resetWorldOnChange unstable_webglRenderer controllerConfig children".split(" ")),m=l.useRef(),p=l.useRef();c=H(Mb({scroll:!0}),3);a=c[0];var q=c[1],r=c[2],n=l.useRef({ready:!1,viewport:{width:h.width,height:h.height,x:0,y:0,scale:1},renderer:void 0,runtime:void 0,controller:void 0,canvas:m,canvasPosition:void 0});c=H(l.useState(""),2);var y=c[0],v=c[1];l.useEffect(function(){n.current.canvasPosition=q;n.current.em&&n.current.em.updateBounds()},
276
- [q]);l.useEffect(function(){n.current&&n.current.runtime&&(n.current.runtime.mode=d)},[n,d]);l.useEffect(function(){if(n.current.runtime){var a=n.current.runtime;a.resize(n.current.viewport.width,h.width,n.current.viewport.height,h.height);n.current.viewport.width=h.width;n.current.viewport.height=h.height;a.updateNextFrame()}},[h.width,h.height]);l.useLayoutEffect(function(){var a=p.current;a&&(a.style.width=q.width+"px",a.style.height=q.height+"px",a.style.pointerEvents="none",a.style.overflow=
277
- "hidden")},[q.height,q.width]);l.useLayoutEffect(function(){var a=function(){if(n.current.runtime){var a=n.current.runtime;a.resize(n.current.viewport.width,h.width,n.current.viewport.height,h.height);n.current.viewport.width=h.width;n.current.viewport.height=h.height;a.updateNextFrame()}};return window.addEventListener("resize",a),function(){return window.removeEventListener("resize",a)}},[h.height,h.width]);var x=l.useCallback(function(a){var c=function(){n.current.ready=!0};return l.useEffect(function(){n.current.runtime&&
278
- n.current.runtime.goHome();var a=b&&b(n.current);a&&a.then?a.then(c):c()},[]),a.children},[]);return l.useLayoutEffect(function(){var a=m.current;if(!a)throw Error("Something went wrong mounting canvas.");a.style.userSelect="none";n.current.canvas=m;var b=Cc(B({minZoomFactor:.5,maxZoomFactor:3,enableClickToZoom:!1},g||{}));n.current.controller=b;var c=new Xd([f?new se(a):new uc(a,{debug:!1}),p.current?new te(p.current,{box:!0,text:!0,triggerResize:r}):void 0]);n.current.renderer=c;var d=new jc(c,
279
- new Ga(1024,1024),n.current.viewport,[b]);n.current.runtime=d;var e=new Fc(a,d);return n.current.em=e,function(){b.stop(d);d.stop();e.stop()}},[]),l.useEffect(function(){if(n.current&&n.current.runtime){var a=n.current.runtime;if(e)return a.world.addLayoutSubscriber(function(b){"recalculate-world-size"===b&&a.goHome()})}return function(){}},[e]),l.useLayoutEffect(function(){Ec.render(A.createElement(x,null,A.createElement(xb.Provider,{value:d},A.createElement(zb.Provider,{value:n.current},k))),n.current.runtime)},
280
- [n,d,k]),l.useEffect(function(){var a=function(){n.current.runtime&&"explore"===n.current.runtime.mode&&(n.current.runtime.mode="sketch",v("mode-sketch"));window.removeEventListener("keyup",a)},b=function(b){"Space"!==b.code||!n.current.runtime||"sketch"!==n.current.runtime.mode||b.target&&b.target.tagName&&"input"===b.target.tagName.toLowerCase()||(b.preventDefault(),n.current.runtime.mode="explore",v("mode-explore"),window.addEventListener("keyup",a))};return window.addEventListener("keydown",b),
281
- function(){window.removeEventListener("keydown",b);window.removeEventListener("keyup",a)}}),A.createElement("div",{ref:a,className:y,style:{position:"relative",userSelect:"none",display:"inline-block",background:"#000",width:h.width,height:h.height,zIndex:10,touchAction:"none"}},A.createElement("style",null,"\n .mode-explore { \n cursor: move; /* fallback if grab cursor is unsupported */\n cursor: grab;\n cursor: -moz-grab;\n cursor: -webkit-grab;\n }\n .mode-explore:active { \n cursor: grabbing;\n cursor: -moz-grabbing;\n cursor: -webkit-grabbing;\n }\n "),
282
- A.createElement("canvas",B({},h,{ref:m})),A.createElement("div",{style:{position:"absolute",top:0,left:0},ref:p}))},db=function(){var a=l.useContext(zb);if(void 0===a)throw Error("Cannot useAtlas outside of Atlas component");return a},ca=function(){return db().runtime},ve=function(a,b){void 0===b&&(b=[]);var c=ca();l.useEffect(function(){return c?c.registerHook("useAfterFrame",a):function(){}},b)},Ab=function(a,b){void 0===b&&(b=[]);var c=ca();l.useEffect(function(){return c?c.registerHook("useFrame",
283
- a):function(){}},b)},we=function(){var a=db().canvas;return a?a.current:void 0},xe=A.forwardRef(function(a,b){var c=a.children,d=T(a,["children"]),e=l.useRef(),f=ca(),g=l.useRef(0),k=l.useRef();return Ab(function(){if(d.relative){var a=e.current;if(a&&f){var b=f.getScaleFactor();g.current!==b&&(g.current=b,a.style.transformOrigin="0 0",a.style.transform="scale("+1/g.current+")",a.style.width=100*g.current+"%",a.style.height=100*g.current+"%")}}},[d.relative]),l.useLayoutEffect(function(){var a=k.current;
284
- b&&a&&("function"==typeof b?b(a):b.current=a);a&&a.__host?d.relative?eb.render(A.createElement("div",{ref:e},c),a.__host.element):eb.render(c,a.__host.element):a&&(a.__onCreate=function(){d.relative?eb.render(A.createElement("div",{ref:e},c),a.__host.element):eb.render(c,a.__host.element)})},[b,c,k,d.relative]),A.createElement("box",B({},d,{ref:k}))}),Gc=function(a,b,c){void 0===c&&(c=[]);var d=ca();l.useEffect(function(){if(d){var c=wa[a];d.world.activatedEvents.push(c);var f=c.slice(2).toLowerCase();
285
- return d.world.addEventListener(f,b),function(){d.world.removeEventListener(f,b)}}return function(){}},G([d?d.world:void 0,a],c))},ye=function(a,b){var c=yb(),d=ca(),e=db(),f=l.useRef(),g=l.useRef(null),k=l.useRef(),h=H(l.useState(!1),2),m=h[0],p=h[1],q=l.useRef({north:0,south:0,east:0,west:0});Ab(function(){k&&d&&d.updateNextFrame()});l.useEffect(function(){d&&d.updateNextFrame()},[d,m]);h=l.useCallback(function(b){b=b.atlasTouches?b.atlasTouches[0]:b.atlas?b.atlas:{x:b.pageX,y:b.pageY};if(d&&"sketch"===
286
- d.mode){var c=g.current;"translate"!==f.current&&"east"!==f.current&&"north-east"!==f.current&&"south-east"!==f.current||(q.current.east=b.x-(k.current?k.current.x:0));"translate"!==f.current&&"west"!==f.current&&"north-west"!==f.current&&"south-west"!==f.current||(q.current.west=b.x-(k.current?k.current.x:0));"translate"!==f.current&&"north"!==f.current&&"north-east"!==f.current&&"north-west"!==f.current||(q.current.north=b.y-(k.current?k.current.y:0));"translate"!==f.current&&"south"!==f.current&&
287
- "south-west"!==f.current&&"south-east"!==f.current||(q.current.south=b.y-(k.current?k.current.y:0));c&&(c.points[1]=q.current.west,c.points[2]=q.current.north,c.points[3]=a.width+q.current.east,c.points[4]=a.height+q.current.south,d.updateNextFrame())}},[d,a.width,a.height]);Gc("mousemove",h,[a.width,a.height]);Gc("pointermove",h,[a.width,a.height]);var r=l.useRef();return l.useEffect(function(){r.current=function(){m&&(b({x:(a.x||0)+q.current.west,y:(a.y||0)+q.current.north,width:a.width+q.current.east-
288
- q.current.west,height:a.height+q.current.south-q.current.north}),f.current=void 0,k.current=void 0,q.current.east=0,q.current.west=0,q.current.north=0,q.current.south=0,p(!1))}},[m,b,a.height,a.width,a.x,a.y]),l.useEffect(function(){var a=function(){r.current&&r.current()};return window.addEventListener("pointerup",a),window.addEventListener("touchend",a),function(){window.removeEventListener("pointerup",a);window.removeEventListener("touchend",a)}},[]),{portalRef:g,mode:c,mouseEvent:function(a){return function(b){if(p(!0),
289
- e.canvasPosition&&d){var c=e.canvasPosition;b=d.viewerToWorld(b.pageX-c.left,b.pageY-c.top);k.current={x:b.x,y:b.y};f.current=a}}},onPointerMoveCallback:h,isEditing:m}},ze=function(a){var b=a.handleSize;b=void 0===b?9:b;var c=a.resizable,d=a.onSave,e=a.children;a=T(a,["handleSize","resizable","onSave","children"]);var f=ye({x:a.x||0,y:a.y||0,width:a.width,height:a.height},d);d=f.portalRef;var g=f.mode,k=f.mouseEvent;f=f.isEditing;var h=l.useMemo(function(){return k("translate")},[k]),m=l.useMemo(function(){return k("east")},
290
- [k]),p=l.useMemo(function(){return k("west")},[k]),q=l.useMemo(function(){return k("south")},[k]),r=l.useMemo(function(){return k("north")},[k]),n=l.useMemo(function(){return k("south-east")},[k]),y=l.useMemo(function(){return k("south-west")},[k]),v=l.useMemo(function(){return k("north-east")},[k]),x=l.useMemo(function(){return k("north-west")},[k]);return A.createElement(A.Fragment,null,A.createElement("worldObject",B({},a),e,A.createElement(xe,{ref:d,target:{x:0,y:0,height:a.height,width:a.width},
291
- relative:!0,interactive:!1},"sketch"===g&&c?A.createElement(A.Fragment,null,A.createElement("div",{onMouseDown:h,onTouchStart:h,style:{display:"block",width:"100%",height:"100%",border:"1px dashed #999",boxSizing:"border-box",pointerEvents:f?"none":"sketch"===g?"initial":"none"}}),A.createElement("div",{title:"east",onTouchStart:m,onMouseDown:m,style:{cursor:"e-resize",position:"absolute",background:"#fff",height:2*b,width:b,right:0,top:"50%",transform:"translate("+b/2+"px, -"+b+"px)",zIndex:999,
292
- boxShadow:"0px 2px 3px 0 rgba(0,0,0,0.5)",border:"1px solid #999",pointerEvents:f?"none":"sketch"===g?"initial":"none"}}),A.createElement("div",{title:"west",onMouseDown:p,style:{cursor:"w-resize",position:"absolute",background:"#fff",height:2*b,width:b,left:0,top:"50%",transform:"translate(-"+b/2+"px, -"+b+"px)",zIndex:999,boxShadow:"0px 2px 3px 0 rgba(0,0,0,0.5)",border:"1px solid #999",pointerEvents:f?"none":"sketch"===g?"initial":"none"}}),A.createElement("div",{title:"north",onMouseDown:r,style:{cursor:"n-resize",
293
- position:"absolute",background:"#fff",height:b,width:2*b,left:"50%",top:0,transform:"translate(-"+b+"px, -"+b/2+"px)",zIndex:999,boxShadow:"0px 2px 3px 0 rgba(0,0,0,0.5)",border:"1px solid rgba(0,0,0,.5)",pointerEvents:f?"none":"sketch"===g?"initial":"none"}}),A.createElement("div",{title:"south",onMouseDown:q,style:{cursor:"s-resize",position:"absolute",background:"#fff",height:b,width:2*b,left:"50%",bottom:0,transform:"translate(-"+b+"px, "+b/2+"px)",zIndex:999,boxShadow:"0px 2px 3px 0 rgba(0,0,0,0.5)",
294
- border:"1px solid #999",pointerEvents:f?"none":"sketch"===g?"initial":"none"}}),A.createElement("div",{title:"north-east",onMouseDown:v,style:{cursor:"ne-resize",position:"absolute",background:"#fff",height:b,width:b,right:0,top:0,transform:"translate("+b/2+"px, -"+b/2+"px)",zIndex:999,boxShadow:"0px 2px 3px 0 rgba(0,0,0,0.5)",border:"1px solid #999",pointerEvents:f?"none":"sketch"===g?"initial":"none"}}),A.createElement("div",{title:"south-east",onMouseDown:n,style:{cursor:"se-resize",position:"absolute",
295
- background:"#fff",height:b,width:b,bottom:0,right:0,transform:"translate("+b/2+"px, "+b/2+"px)",zIndex:999,boxShadow:"0px 2px 3px 0 rgba(0,0,0,0.5)",border:"1px solid #999",pointerEvents:f?"none":"sketch"===g?"initial":"none"}}),A.createElement("div",{title:"south-west",onMouseDown:y,style:{cursor:"sw-resize",position:"absolute",background:"#fff",height:b,width:b,bottom:0,left:0,transform:"translate(-"+b/2+"px, "+b/2+"px)",zIndex:999,boxShadow:"0px 2px 3px 0 rgba(0,0,0,0.5)",border:"1px solid #999",
296
- pointerEvents:f?"none":"sketch"===g?"initial":"none"}}),A.createElement("div",{title:"north-west",onMouseDown:x,style:{cursor:"nw-resize",position:"absolute",background:"#fff",height:b,width:b,top:0,left:0,transform:"translate(-"+b/2+"px, -"+b/2+"px)",zIndex:999,boxShadow:"0px 2px 3px 0 rgba(0,0,0,0.5)",border:"1px solid #999",pointerEvents:f?"none":"sketch"===g?"initial":"none"}})):null)))},Ae=function(a){return A.createElement("worldObject",{key:a.tiles.imageService.id,scale:a.width/a.tiles.width,
297
- height:a.tiles.height,width:a.tiles.width,x:a.x,y:a.y},A.createElement("compositeImage",{key:a.tiles.imageService.id,id:a.tiles.imageService.id,width:a.tiles.width,height:a.tiles.height},a.tiles.thumbnail?A.createElement("worldImage",{uri:a.tiles.thumbnail.id,target:{width:a.tiles.width,height:a.tiles.height},display:{width:a.tiles.thumbnail.width,height:a.tiles.thumbnail.height}}):null,(a.tiles.imageService.tiles||[]).map(function(b){return(b.scaleFactors||[]).map(function(c){return A.createElement("tiledImage",
298
- {key:b+"-"+c,uri:a.tiles.imageService.id,display:{width:a.tiles.width,height:a.tiles.height},tile:b,scaleFactor:c})})})))},bd=function(a){var b;a=a.Symbol;return"function"==typeof a?a.observable?b=a.observable:(b=a("observable"),a.observable=b):b="@@observable",b}("undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof module?module:Function("return this")()),Hc=function(){return Math.random().toString(36).substring(7).split("").join(".")},
299
- Na={INIT:"@@redux/INIT"+Hc(),REPLACE:"@@redux/REPLACE"+Hc(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+Hc()}},Be,ea,Ic="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),Ob="undefined"!=typeof Map,Pb="undefined"!=typeof Set,Ce="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,hd=Ic?Symbol.for("immer-nothing"):((Be={})["immer-nothing"]=!0,Be),fd=Ic?Symbol.for("immer-draftable"):"__$immer_draftable",K=Ic?Symbol.for("immer-state"):"__$immer_state",
300
- Je=""+Object.prototype.constructor,Qb="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(a){return Object.getOwnPropertyNames(a).concat(Object.getOwnPropertySymbols(a))}:Object.getOwnPropertyNames,Ke=Object.getOwnPropertyDescriptors||function(a){var b={};return Qb(a).forEach(function(c){b[c]=Object.getOwnPropertyDescriptor(a,c)}),b},Me={},lb={get:function(a,b){if(b===K)return a;var c=na(a);if(!Rb(c,b)){var d;return(b=jd(c,b))?"value"in b?b.value:
301
- null===(d=b.get)||void 0===d?void 0:d.call(a.k):void 0}d=c[b];return a.I||!ma(d)?d:d===Yb(a.t,b)?($b(a),a.o[b]=ac(a.A.h,d,a)):d},has:function(a,b){return b in na(a)},ownKeys:function(a){return Reflect.ownKeys(na(a))},set:function(a,b,c){var d=jd(na(a),b);if(null==d?0:d.set)return d.set.call(a.k,c),!0;if(!a.P){d=Yb(na(a),b);var e=null==d?void 0:d[K];if(e&&e.t===c)return a.o[b]=c,a.D[b]=!1,!0;if((c===d?0!==c||1/c==1/d:c!=c&&d!=d)&&(void 0!==c||Rb(a.t,b)))return!0;$b(a);Zb(a)}return a.o[b]===c&&"number"!=
302
- typeof c||(a.o[b]=c,a.D[b]=!0,!0)},deleteProperty:function(a,b){return void 0!==Yb(a.t,b)||b in a.t?(a.D[b]=!1,$b(a),Zb(a)):delete a.D[b],a.o&&delete a.o[b],!0},getOwnPropertyDescriptor:function(a,b){var c=na(a),d=Reflect.getOwnPropertyDescriptor(c,b);return d?{writable:!0,configurable:1!==a.i||"length"!==b,enumerable:d.enumerable,value:c[b]}:d},defineProperty:function(){R(11)},getPrototypeOf:function(a){return Object.getPrototypeOf(a.t)},setPrototypeOf:function(){R(12)}},mb={};Oa(lb,function(a,b){mb[a]=
303
- function(){return arguments[0]=arguments[0][0],b.apply(this,arguments)}});mb.deleteProperty=function(a,b){return lb.deleteProperty.call(this,a[0],b)};mb.set=function(a,b,c){return lb.set.call(this,a[0],b,c,a[0])};var M=new (function(){function a(a){var b=this;this.O=Ce;this.F=!0;this.produce=function(a,c,d){if("function"==typeof a&&"function"!=typeof c){var e=c;c=a;return function(a){var d=this;void 0===a&&(a=e);for(var f=arguments.length,g=Array(1<f?f-1:0),k=1;k<f;k++)g[k-1]=arguments[k];return b.produce(a,
304
- function(a){var b;return(b=c).call.apply(b,[d,a].concat(g))})}}if("function"!=typeof c&&R(6),void 0!==d&&"function"!=typeof d&&R(7),ma(a)){var f=ea={p:[],l:ea,h:b,m:!0,_:0};a=ac(b,a,void 0);var g=!0;try{var l=c(a);g=!1}finally{g?ib(f):Wb(f)}return"undefined"!=typeof Promise&&l instanceof Promise?l.then(function(a){return Vb(f,d),Xb(a,f)},function(a){throw ib(f),a;}):(Vb(f,d),Xb(l,f))}if(!a||"object"!=typeof a)return(l=c(a))===hd?void 0:(void 0===l&&(l=a),b.F&&Tb(l,!0),l);R(21,a)};this.produceWithPatches=
305
- function(a,c){return"function"==typeof a?function(c){for(var d=arguments.length,e=Array(1<d?d-1:0),f=1;f<d;f++)e[f-1]=arguments[f];return b.produceWithPatches(c,function(b){return a.apply(void 0,[b].concat(e))})}:[b.produce(a,c,function(a,b){d=a;e=b}),d,e];var d,e};"boolean"==typeof(null==a?void 0:a.useProxies)&&this.setUseProxies(a.useProxies);"boolean"==typeof(null==a?void 0:a.autoFreeze)&&this.setAutoFreeze(a.autoFreeze)}var b=a.prototype;return b.createDraft=function(a){ma(a)||R(8);xa(a)&&(a=
306
- Oe(a));var b=ea={p:[],l:ea,h:this,m:!0,_:0};a=ac(this,a,void 0);return a[K].C=!0,Wb(b),a},b.finishDraft=function(a,b){a=(a&&a[K]).A;return Vb(a,b),Xb(void 0,a)},b.setAutoFreeze=function(a){this.F=a},b.setUseProxies=function(a){a&&!Ce&&R(20);this.O=a},b.applyPatches=function(a,b){var c;for(c=b.length-1;0<=c;c--){var d=b[c];if(0===d.path.length&&"replace"===d.op){a=d.value;break}}var g=X("Patches").$;return xa(a)?g(a,b):this.produce(a,function(a){return g(a,b.slice(c+1))})},a}()),De=M.produce,da=(M.produceWithPatches.bind(M),
307
- M.setAutoFreeze.bind(M),M.setUseProxies.bind(M),M.applyPatches.bind(M),M.createDraft.bind(M),M.finishDraft.bind(M),Cb(function(a,b){!function(a){function b(a){throw Error("Argument "+a+" is empty.");}function c(a){throw Error("Argument "+a+' is invalid, it should be an action-creator instance from "typesafe-actions"');}function f(a,b){if(null==a)throw Error("Argument contains array with empty element at index "+b);if(null==a.getType)throw Error("Argument contains array with invalid element at index "+
308
- b+', it should be an action-creator instance from "typesafe-actions"');}function g(a){return"string"==typeof a||"symbol"==typeof a}function k(a){throw Error("Argument "+a+" is invalid, it should be an action type of type: string | symbol");}function h(a,b){if(null==a)throw Error("Argument contains array with empty element at index "+b);if("string"!=typeof a&&"symbol"!=typeof a)throw Error("Argument contains array with invalid element at index "+b+", it should be of type: string | symbol");}function m(a,
309
- d,e,f){return null==a&&b(1),!g(a)&&c(1),{type:a,payload:d,meta:e,error:f}}function l(a,c){return null==a&&b(1),!g(a)&&k(1),Object.assign(function(){var b=null!=c?c.apply(void 0,arguments):void 0;return Object.assign({type:a},b)},{getType:function(){return a},toString:function(){return a}})}function q(a,c,d){return null==a&&b(1),!g(a)&&k(1),function(){return l(a,function(){var a=0>=arguments.length?void 0:arguments[0],b=1>=arguments.length?void 0:arguments[1];return null==c&&null==d||(a=null!=c?c.apply(void 0,
310
- arguments):void 0,b=null!=d?d.apply(void 0,arguments):void 0),Object.assign({},void 0!==a&&{payload:a},{},void 0!==b&&{meta:b})})}}function r(a){return null==a&&b(1),"function"==typeof a&&"getType"in a||c(1),a.getType()}function n(a,c){null==a&&b(1);!g(a)&&k(1);c=null!=c?c(a):function(){return{type:a}};return Object.assign(c,{getType:function(){return a},toString:function(){return a}})}var t={createAction:function(a,b){b=null==b?function(){return m(a)}:b(m.bind(null,a));return Object.assign(b,{getType:function(){return a},
311
- toString:function(){return a}})},createCustomAction:n,createStandardAction:function(a){return null==a&&b(1),!g(a)&&k(1),Object.assign(function(){return n(a,function(a){return function(b,c){return{type:a,payload:b,meta:c}}})},{map:function(b){return n(a,function(a){return function(c,d){return Object.assign(b(c,d),{type:a})}})}})}};a.action=m;a.createAction=q;a.createAsyncAction=function(a,b,c,d){return function(){var e=[a,b,c,d].map(function(a,b){if(Array.isArray(a))a=q(a[0],a[1],a[2])();else if("string"==
312
- typeof a||"symbol"==typeof a)a=q(a)();else{if(3>b)throw Error("Argument "+b+' is invalid, it should be an action type of "string | symbol" or a tuple of "[string | symbol, Function, Function?]"');a=void 0}return a});return{request:e[0],success:e[1],failure:e[2],cancel:e[3]}}};a.createCustomAction=l;a.createReducer=function P(a,b){void 0===b&&(b={});var c=Object.assign({},b);b=function(b,d){var e={};return(Array.isArray(b)?b:[b]).map(function(a,b){if("function"==typeof a&&"getType"in a)a=r(a);else if(!g(a))throw Error("Argument "+
313
- (b+1)+' is invalid, it should be an action-creator instance from "typesafe-actions" or action type of type: string | symbol');return a}).forEach(function(a){return e[a]=d}),P(a,Object.assign({},c,{},e))};return Object.assign(function(b,d){if(void 0===b&&(b=a),c.hasOwnProperty(d.type)){var e=c[d.type];if("function"!=typeof e)throw Error('Reducer under "'+d.type+'" key is not a valid reducer');return e(b,d)}return b},{handlers:Object.assign({},c),handleAction:b,handleType:b})};a.deprecated=t;a.getType=
314
- r;a.isActionOf=function(a,c){null==a&&b(1);var d=Array.isArray(a)?a:[a];d.forEach(f);a=function(a){return d.some(function(b){return a.type===b.getType()})};return void 0===c?a:a(c)};a.isOfType=function(a,c){null==a&&b(1);var d=Array.isArray(a)?a:[a];d.forEach(h);a=function(a){return d.includes(a.type)};return void 0===c?a:a(c)}}(b)}));let md="http://iiif.io/api/image/2/level1 http://iiif.io/api/image/2/level2 http://library.stanford.edu/iiif/image-api/compliance.html#level1 http://library.stanford.edu/iiif/image-api/compliance.html#level2 http://library.stanford.edu/iiif/image-api/conformance.html#level1 http://library.stanford.edu/iiif/image-api/conformance.html#level2 http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level1 http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level2 http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level1 http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level2 http://iiif.io/api/image/1/level1.json http://iiif.io/api/image/1/profiles/level1.json http://iiif.io/api/image/1/level2.json http://iiif.io/api/image/1/profiles/level2.json http://iiif.io/api/image/2/level1.json http://iiif.io/api/image/2/profiles/level1.json http://iiif.io/api/image/2/level2.json http://iiif.io/api/image/2/profiles/level2.json level1 level2".split(" "),
315
- ld="http://iiif.io/api/image/2/level0 http://iiif.io/api/image/2/level1 http://iiif.io/api/image/2/level2 http://library.stanford.edu/iiif/image-api/compliance.html#level0 http://library.stanford.edu/iiif/image-api/compliance.html#level1 http://library.stanford.edu/iiif/image-api/compliance.html#level2 http://library.stanford.edu/iiif/image-api/conformance.html#level0 http://library.stanford.edu/iiif/image-api/conformance.html#level1 http://library.stanford.edu/iiif/image-api/conformance.html#level2 http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level0 http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level1 http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level2 http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level0 http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level1 http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level2 http://iiif.io/api/image/1/level0.json http://iiif.io/api/image/1/profiles/level0.json http://iiif.io/api/image/1/level1.json http://iiif.io/api/image/1/profiles/level1.json http://iiif.io/api/image/1/level2.json http://iiif.io/api/image/1/profiles/level2.json http://iiif.io/api/image/2/level0.json http://iiif.io/api/image/2/profiles/level0.json http://iiif.io/api/image/2/level1.json http://iiif.io/api/image/2/profiles/level1.json http://iiif.io/api/image/2/level2.json http://iiif.io/api/image/2/profiles/level2.json level0 level1 level2".split(" ");
316
- class fg{constructor(){this.config={verificationsRequired:1,approximateServices:!0,enableFetching:!0,disableThrottling:!1};this.fetchingCount=0;this.imageServices={};this.knownImageServers={}}setConfig(a){Object.assign(this.config,a)}sample(a,b,c=!0){let d=Aa(E(a));var e=za(E(a)),f=this.knownImageServers[d];this.imageServices[e]=Object.assign(a,{real:!0});if(f)a=this.verify(a);else{e=this.knownImageServers;f=E(a);var g=a["@context"]||[],k=a.profile;b=b&&a.height?b.height/a.height:1;var h=a.sizes||
317
- [];{var m=a.width;var l=a.sizes||[];let b=l.length,c=[];for(let a=0;a<b;a++)c.push(m/l[a].width);m=c}a=(e[d]={verifications:0,malformed:!1,root:d,preLoaded:c,sampledId:f,verified:!1,server:null,result:{context:g,sampledProfile:k,resourceServiceRatio:b,sampledSizes:h,sizeRatios:m,sampledTiles:a.tiles||[]}},!0)}return a}preLoad(a,b=!0){this.knownImageServers[a.root]=a;b&&(this.knownImageServers[a.root].malformed=!1,this.knownImageServers[a.root].verifications=this.config.verificationsRequired)}predict(a,
318
- b,c=!1){b=Aa(E(a));b=this.knownImageServers[b];if(!b||!b.result||!c&&(b.malformed||b.verifications<this.config.verificationsRequired))return null;c=za(E(a));if(!this.imageServices[c]){var d=this.imageServices,e=b.result.context,f=E(a),g=E(a),k=a.width,h=a.height;var m=b.result.sampledTiles;k=k>h?k:h;h=m.length;var l=[];for(var q=0;q<h;q++){var r=m[q],n=r.scaleFactors[0],t=k/n;let a=[n];for(;t>=r.width;)n*=2,a.push(n),t/=2;l.push(Object.assign(Object.assign({},r),{scaleFactors:a}))}m=l;k=Math.floor(a.width/
319
- b.result.resourceServiceRatio);h=Math.floor(a.height/b.result.resourceServiceRatio);l=b.result.sizeRatios;q=l.length;r=[];for(n=0;n<q;n++)t=l[n],r.push({width:Math.floor(k/t),height:Math.floor(h/t)});k=r;d[c]={"@context":e,"@id":f,id:g,protocol:"http://iiif.io/api/image",tiles:m,sizes:k,profile:b.result.sampledProfile,height:a.height,width:a.width,real:!1}}return this.imageServices[c]}getThumbnailFromResource(a,b,c=!0,d=[]){return Ba(this,void 0,void 0,function*(){let e=yield this.getImageCandidates(a,
320
- c);return Re(b,[()=>d,()=>e])})}getImageCandidates(a,b=!0){return Ba(this,void 0,void 0,function*(){if(b&&a.height&&a.width){var c=pd(a);for(let b of c)c={id:E(b),width:b.width?b.width:a.width,height:b.height?b.height:a.height},yield this.loadService(c)}return function(a,b=!0,c){let d=[];var e=cc(a);if(null===e)return d;if(d.push(e),b&&a.width&&a.height){b=[];e=pd(a);for(let d of e)e={id:E(d),width:a.width,height:a.height},c.canLoadSync(e)&&(e=c.loadServiceSync(e))&&(e.height||(e.height=a.height),
321
- e.width||(e.width=a.width),b.push(...od([e])));if(b.length)return d.push(...b),d}return a.service&&d.push(...od(a.service)),d}(a,b,this)})}verify(a){return Ba(this,void 0,void 0,function*(){var b=this.predict(a,!1,!0),c=yield this.fetchService(E(a));if(!b)return!1;if(b=b.height===c.height&&b.width===c.width&&b["@context"]===c["@context"]&&function(a,b){if(a.length!==b.length)return!1;if(0===a.length&&0===b.length)return!0;const c=a.length;var d=!0;for(var e=0;e<c;e++){var h=a[e];const c=b[e];if(h.width!==
322
- c.width||h.height!==c.height){d=!1;break}}if(d)return!0;d=0;for(e=0;e<c;e++)for(h=0;h<c;h++)if(a[e].width===b[h].width&&a[e].height===b[h].height){d++;break}return d===c}(b.sizes||[],c.sizes||[]))c=Aa(E(a)),this.knownImageServers[c].verifications+=1,this.knownImageServers[c].verifications>=this.config.verificationsRequired&&(this.knownImageServers[c].verified=!0);return b})}canLoadSync(a){a="string"==typeof a?a:E(a);let b=za(a);return this.imageServices[b]?!0:(a=this.knownImageServers[Aa(a)])&&!a.malformed&&
323
- a.verifications>=this.config.verificationsRequired}markAsMalformed(a){return Ba(this,void 0,void 0,function*(){return this.knownImageServers[Aa(E(a))].malformed=!0,this.loadService(a,!0)})}fetchService(a,b=!1){return Ba(this,void 0,void 0,function*(){let c=za(a);if(this.imageServices[c]&&(!b||this.imageServices[c].real))return this.imageServices[c];if(!this.config.enableFetching)throw Error("Fetching is not enabled");let d=yield fetch(c).then(a=>a.json());return!d.id&&d["@id"]&&(d.id=d["@id"]),d.id!==
324
- a&&(d.id=a,d["@id"]&&(d["@id"]=a)),this.imageServices[c]=Object.assign(d,{real:!0}),this.imageServices[c]})}loadService(a,b=!1){return Ba(this,void 0,void 0,function*(){if(!this.config.disableThrottling)for(;this.fetchingCount>=this.config.verificationsRequired;)yield new Promise(a=>setTimeout(a,500));var c=this.knownImageServers[Aa(E(a))];if(c&&!c.malformed&&!b&&(yield c.result,c=this.loadServiceSync(a)))return c;this.fetchingCount++;c=yield this.fetchService(E(a),b);return this.fetchingCount--,
325
- c.real&&this.sample(c,a),c})}loadServiceSync(a){let b=za(E(a));return this.imageServices[b]?this.imageServices[b]:this.predict(a)}}let Ee="sc:Collection sc:Manifest sc:Canvas oa:AnnotationList oa:Annotation sc:Range sc:Layer sc:Sequence oa:Choice Service ContentResource".split(" ");class Fe{constructor(a,b={}){this.traversals=Object.assign({collection:[],manifest:[],canvas:[],annotationList:[],sequence:[],annotation:[],contentResource:[],choice:[],range:[],service:[],layer:[]},a);this.options=Object.assign({convertPropsToArray:!0,
326
- mergeMemberProperties:!0,allowUndefinedReturn:!1},b)}static all(a){return new Fe({collection:[a],manifest:[a],canvas:[a],annotationList:[a],sequence:[a],annotation:[a],contentResource:[a],choice:[a],range:[a],service:[a],layer:[a]})}traverseCollection(a){return this.traverseType(this.traverseDescriptive(this.traverseLinking(this.traverseCollectionItems(a))),this.traversals.collection)}traverseCollectionItems(a){if(this.options.mergeMemberProperties){let b=[...(a.manifests||[]).map(a=>"string"==typeof a?
327
- {"@id":a,"@type":"sc:Manifest"}:a),...(a.collections||[]).map(a=>"string"==typeof a?{"@id":a,"@type":"sc:Collection"}:a),...a.members||[]];delete a.collections;delete a.manifests;a.members=b}return a.manifests&&(a.manifests=a.manifests.map(a=>this.traverseManifest("string"==typeof a?{"@id":a,"@type":"sc:Manifest"}:a))),a.collections&&(a.collections=a.collections.map(a=>this.traverseCollection("string"==typeof a?{"@id":a,"@type":"sc:Collection"}:a))),a.members&&(a.members=a.members.map(a=>"string"==
328
- typeof a?a:this.traverseUnknown(a))),a}traverseManifest(a){return this.traverseType(this.traverseDescriptive(this.traverseLinking(this.traverseManifestItems(a))),this.traversals.manifest)}traverseManifestItems(a){return a.sequences&&(a.sequences=a.sequences.map(a=>this.traverseSequence(a))),a.structures&&(a.structures=a.structures.map(a=>this.traverseRange(a))),a}traverseSequence(a){return this.traverseType(this.traverseDescriptive(this.traverseLinking(this.traverseSequenceItems(a))),this.traversals.sequence)}traverseSequenceItems(a){return a.canvases&&
329
- (a.canvases=a.canvases.map(a=>this.traverseCanvas(a))),a}traverseCanvas(a){return this.traverseType(this.traverseDescriptive(this.traverseLinking(this.traverseCanvasItems(a))),this.traversals.canvas)}traverseCanvasItems(a){return a.images&&(a.images=a.images.map(a=>this.traverseAnnotation(a))),a.otherContent&&(a.otherContent=a.otherContent.map(a=>this.traverseAnnotationList(a))),a}traverseRange(a){return this.traverseType(this.traverseDescriptive(this.traverseLinking(this.traverseRangeItems(a))),
330
- this.traversals.range)}traverseRangeItems(a){if(this.options.mergeMemberProperties){let b=[...(a.ranges||[]).map(a=>"string"==typeof a?{"@id":a,"@type":"sc:Range"}:a),...(a.canvases||[]).map(a=>"string"==typeof a?{"@id":a,"@type":"sc:Canvas"}:a),...a.members||[]];delete a.ranges;delete a.canvases;a.members=b.length?b.map(a=>this.traverseUnknown(a)):void 0}return a}traverseAnnotationList(a){return this.traverseType(this.traverseDescriptive(this.traverseLinking(this.traverseAnnotationListItems(a))),
331
- this.traversals.annotationList)}traverseAnnotationListItems(a){return a.resources&&(a.resources=a.resources.map(a=>this.traverseAnnotation(a))),a}traverseAnnotation(a){return this.traverseType(this.traverseDescriptive(this.traverseLinking(this.traverseAnnotationItems(a))),this.traversals.annotation)}traverseAnnotationItems(a){return a.resource&&(a.resource=this.traverseContentResource(a.resource)),a.on,a}traverseLayer(a){return this.traverseType(this.traverseLinking(this.traverseLayerItems(a)),this.traversals.layer)}traverseLayerItems(a){return a.otherContent&&
332
- (a.otherContent=a.otherContent.map(a=>this.traverseAnnotationList(a))),a}traverseChoice(a){return this.traverseType(this.traverseChoiceItems(a),this.traversals.choice)}traverseChoiceItems(a){return a.default&&"rdf:nil"!==a.default&&(a.default=this.traverseContentResource(a.default)),a.item&&"rdf:nil"!==a.item&&(a.item=a.item.map(a=>this.traverseContentResource(a))),a}traverseService(a){return this.traverseType(this.traverseLinking(a),this.traversals.service)}traverseContentResource(a){return"oa:Choice"===
333
- a["@type"]?this.traverseChoice(a):this.traverseType(this.traverseDescriptive(this.traverseLinking(a)),this.traversals.contentResource)}traverseUnknown(a){if(!a["@type"]||"string"==typeof a)return a;a:{if(null==a)throw Error("Null or undefined is not a valid entity.");if(Array.isArray(a))throw Error("Array is not a valid entity");if("object"!=typeof a)throw Error(typeof a+" is not a valid entity");if("string"==typeof a["@type"]){var b=Ee.indexOf(a["@type"]);if(-1!==b){b=Ee[b];break a}}if(a.profile)b=
334
- "Service";else if(a.format||a["@type"])b="ContentResource";else throw Error("Resource type is not known");}switch(b){case "sc:Collection":return this.traverseCollection(a);case "sc:Manifest":return this.traverseManifest(a);case "sc:Canvas":return this.traverseCanvas(a);case "sc:Sequence":return this.traverseSequence(a);case "sc:Range":return this.traverseRange(a);case "oa:Annotation":return this.traverseAnnotation(a);case "oa:AnnotationList":return this.traverseAnnotationList(a);case "sc:Layer":return this.traverseLayer(a);
335
- case "Service":return this.traverseService(a);case "oa:Choice":return this.traverseChoice(a);case "ContentResource":return this.traverseContentResource(a)}return a.profile?this.traverseService(a):a}traverseImageResource(a){let b=Array.isArray(a);a=Array.isArray(a)?a:[a];let c=[];for(let b of a)"string"==typeof b?c.push(this.traverseContentResource({"@id":b,"@type":"dctypes:Image"})):c.push(this.traverseContentResource(b));return b||this.options.convertPropsToArray?c:c[0]}traverseDescriptive(a){return a.thumbnail&&
336
- (a.thumbnail=this.traverseImageResource(a.thumbnail)),a.logo&&(a.logo=this.traverseImageResource(a.logo)),a}traverseOneOrMoreServices(a){let b=Array.isArray(a);a=Array.isArray(a)?a:[a];let c=[];for(let b of a)c.push(this.traverseService(b));return b||this.options.convertPropsToArray?c:c[0]}traverseLinking(a){return a.related&&(a.related=this.traverseOneOrManyType(a.related,this.traversals.contentResource)),a.rendering&&(a.rendering=this.traverseOneOrManyType(a.rendering,this.traversals.contentResource)),
337
- a.service&&(a.service=this.traverseOneOrMoreServices(a.service)),a.seeAlso&&(a.seeAlso=this.traverseOneOrManyType(a.seeAlso,this.traversals.contentResource)),a.within&&("string"==typeof a.within||(a.within=this.traverseOneOrManyType(a.within,this.traversals.contentResource))),a.startCanvas&&("string"==typeof a.startCanvas?a.startCanvas=this.traverseType({"@id":a.startCanvas,"@type":"sc:Canvas"},this.traversals.canvas):a.startCanvas&&this.traverseType(a.startCanvas,this.traversals.canvas)),a.contentLayer&&
338
- ("string"==typeof a.contentLayer?a.contentLayer=this.traverseLayer({"@id":a.contentLayer,"@type":"sc:Layer"}):a.contentLayer=this.traverseLayer(a.contentLayer)),a}traverseOneOrManyType(a,b){if(!Array.isArray(a)){if(!this.options.convertPropsToArray)return this.traverseType(a,b);a=[a]}return a.map(a=>this.traverseType(a,b))}traverseType(a,b){return b.reduce((a,b)=>{b=b(a);return void 0!==b||this.options.allowUndefinedReturn?b:a},a)}}let Te=/http(s)?:\/\/(creativecommons.org|rightsstatements.org)[^"'\\<\n]+/gm,
339
- Se="http://iiif.io/api/presentation/2/context.json http://iiif.io/api/image/2/context.json http://iiif.io/api/image/1/context.json http://library.stanford.edu/iiif/image-api/1.1/context.json 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 http://iiif.io/api/annex/openannotation/context.json".split(" "),rd=0,Ye=new Fe({collection:[function(a){return Y(Object.assign(Object.assign(Object.assign(Object.assign({},
340
- Z(a)),U(a)),fa(a)),{items:a.members}))}],manifest:[function(a){return Y(Object.assign(Object.assign(Object.assign(Object.assign({},Z(a)),U(a)),fa(a)),{items:Ue(a.sequences||[]),structures:a.structures}))}],canvas:[function(a){return Y(Object.assign(Object.assign(Object.assign(Object.assign({},Z(a)),U(a)),fa(a)),{items:a.images&&a.images.length?[{id:qd(a,"annotation-page"),type:"AnnotationPage",items:a.images}]:void 0}))}],annotationList:[function(a){return Y(Object.assign(Object.assign(Object.assign(Object.assign({},
341
- Z(a)),U(a)),fa(a)),{items:a.resources}))}],sequence:[function(a){return a.canvases&&0!==a.canvases.length?a.canvases:[]}],annotation:[function(a){return Y(Object.assign(Object.assign(Object.assign(Object.assign({},Z(a)),U(a)),fa(a)),{target:"string"==typeof a.on?encodeURI(a.on).trim():a.on,body:a.resource}))}],contentResource:[function(a){return Y(Object.assign(Object.assign(Object.assign({},Z(a)),U(a)),fa(a)))}],choice:[function(a){const b=[];return a.default&&"rdf:nil"!==a.default&&b.push(a.default),
342
- a.item&&"rdf:nil"!==a.item&&b.push(...a.item),Object.assign(Object.assign(Object.assign({},Z(a)),U(a)),{items:b})}],range:[function(a){return Y(Object.assign(Object.assign(Object.assign(Object.assign({},Z(a)),U(a)),fa(a)),{items:a.members}))}],service:[function(a){const {"@id":b,profile:c}=a,d=function(a,b){var c={},d;for(d in a)Object.prototype.hasOwnProperty.call(a,d)&&0>b.indexOf(d)&&(c[d]=a[d]);if(null!=a&&"function"==typeof Object.getOwnPropertySymbols){var e=0;for(d=Object.getOwnPropertySymbols(a);e<
343
- d.length;e++)0>b.indexOf(d[e])&&Object.prototype.propertyIsEnumerable.call(a,d[e])&&(c[d[e]]=a[d[e]])}return c}(a,["@id","@type","@context","profile"]);return b&&(d.id=b),d.type=ec(a),"unknown"===d.type&&(d.type="Service"),c&&(d.profile=function g(a){return Array.isArray(a)?g(a.find(a=>"string"==typeof a)):-1!==ld.indexOf(a)?"level2":-1!==md.indexOf(a)?"level1":"string"==typeof a?a:void 0}(c)),Y(Object.assign(Object.assign({},d),U(d)))}],layer:[function(a){return Y(Object.assign(Object.assign(Object.assign({},
344
- Z(a)),U(a)),fa(a)))}]}),bf={id:"https://hyperion/annotation-page",type:"AnnotationPage",behavior:[],motivation:null,label:null,thumbnail:[],summary:null,requiredStatement:null,metadata:[],rights:null,provider:[],items:[],seeAlso:[],homepage:null,logo:[],rendering:[],service:[]},af={id:"https://hyperion/empty-canvas",type:"Canvas",label:null,behavior:[],motivation:null,thumbnail:[],posterCanvas:null,accompanyingCanvas:null,placeholderCanvas:null,summary:null,requiredStatement:null,metadata:[],rights:null,
345
- navDate:null,provider:[],items:[],annotations:[],seeAlso:[],homepage:null,logo:[],partOf:[],rendering:[],service:[],duration:0,height:0,width:0},Ze={id:"https://hyperion/empty-collection",type:"Collection",label:null,viewingDirection:"left-to-right",behavior:[],motivation:null,thumbnail:[],posterCanvas:null,accompanyingCanvas:null,placeholderCanvas:null,summary:null,requiredStatement:null,metadata:[],rights:null,navDate:null,provider:[],items:[],annotations:[],seeAlso:[],homepage:null,logo:[],partOf:[],
346
- rendering:[],service:[],services:[]},$e={id:"https://hyperion/empty-manifest",type:"Manifest",annotations:[],behavior:[],homepage:null,items:[],label:null,logo:[],metadata:[],motivation:null,navDate:null,provider:[],partOf:[],posterCanvas:null,accompanyingCanvas:null,placeholderCanvas:null,rendering:[],requiredStatement:null,rights:null,seeAlso:[],service:[],services:[],start:null,structures:[],summary:null,thumbnail:[],viewingDirection:"left-to-right"},cf={id:"https://hyperion/empty-canvas",type:"Range",
347
- label:null,behavior:[],motivation:null,thumbnail:[],posterCanvas:null,accompanyingCanvas:null,placeholderCanvas:null,summary:null,requiredStatement:null,metadata:[],rights:null,navDate:null,provider:[],items:[],annotations:[],seeAlso:[],homepage:null,logo:[],partOf:[],rendering:[],service:[],start:null,supplementary:null,viewingDirection:"left-to-right"},Ge="Collection Manifest Canvas AnnotationPage AnnotationCollection Annotation ContentResource Range Service Selector".split(" ");class td{constructor(a,
348
- b={}){this.traversals=Object.assign({collection:[],manifest:[],canvas:[],annotationCollection:[],annotationPage:[],annotation:[],contentResource:[],choice:[],range:[],service:[]},a);this.options=Object.assign({allowUndefinedReturn:!1},b)}static all(a){return new td({collection:[a],manifest:[a],canvas:[a],annotationCollection:[a],annotationPage:[a],annotation:[a],contentResource:[a],choice:[a],range:[a],service:[a]})}traverseDescriptive(a){return a.thumbnail&&(a.thumbnail=a.thumbnail.map(a=>this.traverseType(a,
349
- this.traversals.contentResource))),a}traverseLinking(a){return a.seeAlso&&(a.seeAlso=a.seeAlso.map(a=>this.traverseType(a,this.traversals.contentResource))),a.service&&(a.service=a.service.map(a=>this.traverseType(a,this.traversals.service))),a.services&&(a.services=a.services.map(a=>this.traverseType(a,this.traversals.service))),a.logo&&(a.logo=a.logo.map(a=>this.traverseType(a,this.traversals.contentResource))),a.homepage&&(a.homepage=this.traverseType(a.homepage,this.traversals.contentResource)),
350
- a.partOf&&(a.partOf=a.partOf.map(a=>"string"!=typeof a&&a.type?"Canvas"===a.type?this.traverseType(a,this.traversals.canvas):"AnnotationCollection"===a.type?this.traverseType(a,this.traversals.annotationCollection):this.traverseType(a,this.traversals.contentResource):this.traverseType(a,this.traversals.contentResource))),a.start&&(a.start=a.start.map(a=>this.traverseType(a,this.traversals.canvas))),a.rendering&&(a.rendering=a.rendering.map(a=>this.traverseType(a,this.traversals.contentResource))),
351
- a.supplementary&&(a.supplementary=a.supplementary.map(a=>this.traverseType(a,this.traversals.contentResource))),a}traverseCollectionItems(a){return a.items.map(a=>"Collection"===a.type?this.traverseCollection(a):this.traverseManifest(a)),a}traverseCollection(a){return this.traverseType(this.traverseDescriptive(this.traverseLinking(this.traversePosterCanvas(this.traverseCollectionItems(a)))),this.traversals.collection)}traverseManifestItems(a){return a.items&&(a.items=a.items.map(a=>this.traverseCanvas(a))),
352
- a}traverseManifestStructures(a){return a.structures&&(a.structures=a.structures.map(a=>this.traverseRange(a))),a}traverseManifest(a){return this.traverseType(this.traverseManifestStructures(this.traversePosterCanvas(this.traverseDescriptive(this.traverseLinking(this.traverseManifestItems(a))))),this.traversals.manifest)}traverseCanvasItems(a){return a.items=(a.items||[]).map(a=>this.traverseAnnotationPage(a)),a}traverseCanvas(a){return this.traverseType(this.traversePosterCanvas(this.traverseDescriptive(this.traverseLinking(this.traverseCanvasItems(a)))),
353
- this.traversals.canvas)}traverseAnnotationPageItems(a){return a.items&&(a.items=a.items.map(a=>this.traverseAnnotation(a))),a}traverseAnnotationPage(a){return this.traverseType(this.traverseDescriptive(this.traverseLinking(this.traverseAnnotationPageItems(a))),this.traversals.annotationPage)}traverseAnnotationBody(a){return Array.isArray(a.body)?a.body=a.body.map(a=>this.traverseContentResource(a)):a.body&&(a.body=this.traverseContentResource(a.body)),a}traversePosterCanvas(a){return a.posterCanvas&&
354
- (a.posterCanvas=this.traverseType(a.posterCanvas,this.traversals.canvas)),a.placeholderCanvas&&(a.placeholderCanvas=this.traverseType(a.placeholderCanvas,this.traversals.canvas)),a.accompanyingCanvas&&(a.accompanyingCanvas=this.traverseType(a.accompanyingCanvas,this.traversals.canvas)),a}traverseAnnotation(a){return this.traverseType(this.traverseLinking(this.traverseAnnotationBody(a)),this.traversals.annotation)}traverseContentResourceLinking(a){return"string"!=typeof a&&a?(a&&a.service&&(a.service=
355
- (a.service||[]).map(a=>this.traverseType(a,this.traversals.service))),a):a}traverseContentResource(a){return this.traverseType(this.traverseContentResourceLinking(a),this.traversals.contentResource)}traverseRangeRanges(a){return a.items&&(a.items=a.items.map(a=>"string"==typeof a?this.traverseCanvas({id:a,type:"Canvas"}):"Manifest"===a.type?this.traverseManifest(a):this.traverseRange(a))),a}traverseRange(a){return this.traverseType(this.traversePosterCanvas(this.traverseDescriptive(this.traverseLinking(this.traverseRangeRanges(a)))),
356
- this.traversals.range)}traverseType(a,b){return b.reduce((a,b)=>{b=b(a);return void 0!==b||this.options.allowUndefinedReturn?b:a},a)}traverseService(a){return this.traverseType(a,this.traversals.service)}traverseUnknown(a){a:{if(null==a)throw Error("Null or undefined is not a valid entity.");if(Array.isArray(a))throw Error("Array is not a valid entity");if("object"!=typeof a)throw Error(typeof a+" is not a valid entity");if("string"==typeof a.type){var b=Ge.indexOf(a.type);if(-1!==b){b=Ge[b];break a}}if(a.profile)b=
357
- "Service";else throw Error("Resource type is not known");}switch(b){case "Collection":return this.traverseCollection(a);case "Manifest":return this.traverseManifest(a);case "Canvas":return this.traverseCanvas(a);case "AnnotationPage":return this.traverseAnnotationPage(a);case "Annotation":return this.traverseAnnotation(a);case "ContentResource":return this.traverseContentResource(a);case "Range":return this.traverseRange(a);case "Service":return this.traverseService(a);default:throw Error("Unknown or unsupported resource type of "+
358
- b);}}}let gg={Manifest:function*(a){return[...pa(a,"sc:Manifest"),...yield*qa(a),...yield*Qa(a),["sequences",[{"@id":a.id+"/sequence0","@type":"sc:Sequence",canvases:yield a.items}]],["structures",yield a.structures]]},Canvas:function*(a){const b=(yield a.items)[0];return[...pa(a,"sc:Canvas"),...yield*qa(a),...yield*Qa(a),["images",b?[b.resources]:void 0],["annotations",a.annotations&&a.annotations.length?ha(yield a.annotations):void 0]]},AnnotationPage:function*(a){return[...pa(a,"sc:AnnotationList"),
359
- ...yield*qa(a),["resources",a.items&&a.items.length?ha(yield a.items):void 0]]},Annotation:function*(a){return[["@id",a.id],["@type","oa:Annotation"],["motivation","sc:painting"],["on",ud(a.target)],["resource",ha(yield a.body,!0)]]},ContentResource:function*(a){switch(a.type){case "Image":return[...pa(a,"dctypes:Image"),...yield*qa(a),...yield*Qa(a)];default:return[...pa(a,void 0),...yield*qa(a)]}},AnnotationCollection:function*(a){return[["@id",a.id],["@type","sc:Layer"],["label",Da(a.label)]]},
360
- Collection:function*(a){return[...pa(a,"sc:Collection"),...yield*qa(a),...yield*Qa(a),["members",yield*a.items]]},Range:function*(a){const b=[],c=[];if(a.items)for(const d of a.items){const e=yield d;b.push({"@id":d.id,"@type":d.type,label:e?e.label:void 0,within:a.id});"Canvas"===d.type&&c.push(d.id)}return[...pa(a,"sc:Range"),...yield*qa(a),...yield*Qa(a),["canvases",c.length===b.length?c:void 0],["members",c.length!==b.length?b:void 0]]}},hg={Manifest:function*(a){return[...Ra(a),...yield*Sa(a),
361
- ...yield*Ea(a),["items",yield a.items],["structures",J(yield a.structures)]]},Canvas:function*(a){return[...Ra(a),...yield*Sa(a),...yield*Ea(a),["items",yield a.items],["annotations",J(yield a.annotations)]]},AnnotationPage:function*(a){return[...Object.entries(a).map(([a,c])=>[a,Array.isArray(c)?J(c):c]).filter(([a])=>"items"!==a),...yield*Ea(a),["items",yield a.items]]},Service:function*(a){return[["__$HF_UNWRAP$__",a]]},Annotation:function*(a){return[...Object.entries(a).map(([a,c])=>[a,Array.isArray(c)?
362
- J(c):c]).filter(([a])=>"body"!==a),["body",yield a.body]]},ContentResource:function*(a){return[...Ra(a),...yield*Sa(a),...yield*Ea(a)]},AnnotationCollection:function*(a){return[["id",a.id],["type","AnnotationCollection"],["label",a.label]]},Collection:function*(a){return[...Ra(a),...yield*Sa(a),...yield*Ea(a),["items",yield*a.items]]},Range:function*(a){const b=[];for(const c of a.items)"Range"===c.type?b.push(yield c):b.push(c);return[...Ra(a),...yield*Sa(a),...yield*Ea(a),["items",b],["annotations",
363
- J(yield a.annotations)]]}},mf=da.createAction("@hyperion/ADD_MAPPING")(),lf=da.createAction("@hyperion/ADD_MAPPINGS")(),xd=da.createAction("@hyperion/IMPORT_ENTITIES")(),ig=da.createAction("@hyperion/MODIFY_ENTITY_FIELD")(),jg={importEntities:xd,modifyEntityField:ig},kf=da.createAction("@hyperion/REQUEST_RESOURCE")(),wd=da.createAction("@hyperion/REQUEST_ERROR")(),nf=da.createAction("@hyperion/REQUEST_MISMATCH")(),of=da.createAction("@hyperion/REQUEST_COMPLETE")(),gf=(da.createAction("@hyperion/REQUEST_OFFLINE_RESOURCE")(),
364
- cd({mapping:(a={},b)=>De(a,c=>{switch(b.type){case "@hyperion/ADD_MAPPING":return c[b.payload.id]=b.payload.type,c;case "@hyperion/ADD_MAPPINGS":return Object.assign(Object.assign({},a),b.payload.mapping)}return c}),entities:(a={Collection:{},Manifest:{},Canvas:{},AnnotationPage:{},AnnotationCollection:{},Annotation:{},ContentResource:{},Range:{},Service:{},Selector:{}},b)=>{if("@hyperion/MODIFY_ENTITY_FIELD"===b.type){if(!a[b.payload.type]||!a[b.payload.type][b.payload.id])return a;const c=a[b.payload.type][b.payload.id];
365
- return"string"==typeof c?a:Object.assign(Object.assign({},a),{[b.payload.type]:Object.assign(Object.assign({},a[b.payload.type]),{[b.payload.id]:Object.assign(Object.assign({},c),{[b.payload.key]:b.payload.value})})})}return"@hyperion/IMPORT_ENTITIES"===b.type?{Collection:Object.assign(Object.assign({},a.Collection),b.payload.entities.Collection),Manifest:Object.assign(Object.assign({},a.Manifest),b.payload.entities.Manifest),Canvas:Object.assign(Object.assign({},a.Canvas),b.payload.entities.Canvas),
366
- AnnotationPage:Object.assign(Object.assign({},a.AnnotationPage),b.payload.entities.AnnotationPage),AnnotationCollection:Object.assign(Object.assign({},a.AnnotationCollection),b.payload.entities.AnnotationCollection),Annotation:Object.assign(Object.assign({},a.Annotation),b.payload.entities.Annotation),ContentResource:Object.assign(Object.assign({},a.ContentResource),b.payload.entities.ContentResource),Range:Object.assign(Object.assign({},a.Range),b.payload.entities.Range),Service:Object.assign(Object.assign({},
367
- a.Service),b.payload.entities.Service),Selector:Object.assign(Object.assign({},a.Selector),b.payload.entities.Selector)}:a},requests:(a={},b)=>De(a,c=>{switch(b.type){case "@hyperion/REQUEST_RESOURCE":case "@hyperion/REQUEST_OFFLINE_RESOURCE":c[b.payload.id]={requestUri:b.payload.id,loadingState:"RESOURCE_LOADING",uriMismatch:!1,resourceUri:b.payload.id};break;case "@hyperion/REQUEST_MISMATCH":c[b.payload.requestId].uriMismatch=!0;c[b.payload.requestId].resourceUri=b.payload.actualId;c[b.payload.actualId]=
368
- {requestUri:b.payload.requestId,loadingState:a[b.payload.requestId].loadingState,uriMismatch:!0,resourceUri:b.payload.actualId};break;case "@hyperion/REQUEST_ERROR":c[b.payload.id].loadingState="RESOURCE_ERROR";c[b.payload.id].error=b.payload.message;break;case "@hyperion/REQUEST_COMPLETE":c[b.payload.id].loadingState="RESOURCE_READY"}return c})})),hf="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__||ed;var ra=new class{constructor(a,b){this.defaultFetcher=a=>fetch(a).then(a=>
369
- a.json());this.middleware=a=>b=>c=>{this.emitter.emit(c.type,{action:c,state:a.getState()});let d=b(c);return this.emitter.emit("after:"+c.type,{action:c,state:a.getState()}),d};this.options=Object.assign({reducers:{},middleware:[],defaultState:{},customFetcher:this.defaultFetcher},a||{});this.store=b||ff(this.options.reducers,[...this.options.middleware,this.middleware],this.options.defaultState);this.emitter=function(a){return{all:a=a||new Map,on:function(b,c){var d=a.get(b);d&&d.push(c)||a.set(b,
370
- [c])},off:function(b,c){(b=a.get(b))&&b.splice(b.indexOf(c)>>>0,1)},emit:function(b,c){(a.get(b)||[]).slice().map(function(a){a(c)});(a.get("*")||[]).slice().map(function(a){a(b,c)})}}}();this.imageService=new fg;this.remoteFetcher=vd(this.store,this.options.customFetcher);this.staticFetcher=vd(this.store,(a,b)=>b)}modifyEntityField(a,b,c){this.store.dispatch(jg.modifyEntityField({id:a.id,type:a.type,key:b,value:c}))}serialise(a,b){return df(this.getState(),a,b)}toPresentation2(a){return this.serialise(a,
371
- gg)}toPresentation3(a){return this.serialise(a,hg)}fromRef(a,b){let c=this.getState();a=c.hyperion.entities[a.type]&&c.hyperion.entities[a.type][a.id]?c.hyperion.entities[a.type][a.id]:a;return b?b(c,a):a}allFromRef(a,b){return a.map(a=>this.fromRef(a,b))}select(a){return a(this.getState())}getStore(){return this.store}getState(){return this.store.getState()}getImageService(){return this.imageService}loadManifest(a,b){return this.load(a,b)}loadCollection(a,b){return this.load(a,b)}getThumbnail(a,
372
- b,c,d=[],e){return pf(this,void 0,void 0,function*(){if("string"==typeof a)return{best:cc(a),fallback:[],log:[]};var f=this.fromRef(a);if("string"==typeof f)return{best:cc(f),fallback:[],log:[]};switch(f.type){case "Annotation":return f=this.fromRef(f.body[0]),e&&!f.width&&(f.width=e.width,f.height=e.height),yield this.imageService.getThumbnailFromResource(f,b,c,d);case "Canvas":if(f.thumbnail&&f.thumbnail.length){var g=this.fromRef(f.thumbnail[0]);(g=yield this.imageService.getImageCandidates(g,
373
- c))&&g.length&&d.push(...g)}return this.getThumbnail(f.items[0],b,c,d,{width:f.width,height:f.height});case "AnnotationPage":return this.getThumbnail(f.items[0],b,c,d,e);case "Choice":return this.getThumbnail(f.items[0],b,c,d,e);case "Collection":return this.getThumbnail(f.items[0],b,c,d,e);case "Manifest":return this.getThumbnail(f.items[0],b,c,d,e);case "SpecificResource":case "Image":case "Dataset":case "Sound":case "Text":case "TextualBody":case "Video":return e&&!f.width&&(f.width=e.width,f.height=
374
- e.height),this.imageService.getThumbnailFromResource(f,b,c,d)}return{best:void 0,fallback:[],log:[]}})}load(a,b){return b?this.staticFetcher(a,b):this.remoteFetcher(a)}subscribe(a,b){let c;return this.store.subscribe(()=>{var d=this.store.getState();d=a(d);c!==d&&b(d,this);c=d})}},qf=ra.getImageService(),kg=function(){function a(a){this.pending=!0;this.currentlyVisible=[];this.previouslyVisible=[];this.container=a;a=a.getBoundingClientRect();var b=a.height;this.width=a.width;this.height=b}return a.prototype.isReady=
375
- function(){return!0},a.prototype.resize=function(){},a.prototype.afterFrame=function(a,c,d){var b,f;try{for(var g=F(this.previouslyVisible),k=g.next();!k.done;k=g.next())k.value.style.display="none"}catch(r){var h={error:r}}finally{try{k&&!k.done&&(b=g.return)&&b.call(g)}finally{if(h)throw h.error;}}try{for(var m=F(this.currentlyVisible),l=m.next();!l.done;l=m.next())l.value.style.display="block"}catch(r){var q={error:r}}finally{try{l&&!l.done&&(f=m.return)&&f.call(m)}finally{if(q)throw q.error;}}this.previouslyVisible=
376
- this.currentlyVisible;this.currentlyVisible=[]},a.prototype.afterPaintLayer=function(a,c){},a.prototype.beforeFrame=function(a,c,d){},a.prototype.getPointsAt=function(a,c,d,e){return a.getPointsAt(c,d,e)},a.prototype.getScale=function(a,c){a=this.width/a;c=this.height/c;return a<c?c:a},a.prototype.getViewportBounds=function(a,c,d){return null},a.prototype.paint=function(a,c,d,e,f,g){if(a instanceof ta){a.__host||(this.pending=!1,(g=document.createElement("img")).src=a.uri,g.style.position="absolute",
377
- a.__host=g,this.container.appendChild(a.__host));g=f/a.width;var b=a.__host;this.currentlyVisible.push(b);this.previouslyVisible.unshift(b);b.style.display="block";b.style.transform="translate("+Math.round(d)+"px, "+Math.round(e)+"px) scale("+g+")";b.style.transformOrigin="0px 0px"}a instanceof Fa&&((a.__host||(a.__host={images:[]}),a.__host.images[c])||(b=a.getImageUrl(c),(g=document.createElement("img")).src=b,g.style.position="absolute",a.__host.images[c]=g,this.container.appendChild(g)),g=f/a.display.width,
378
- b=a.__host.images[c],this.currentlyVisible.push(b),this.previouslyVisible.unshift(b),b.style.width=a.display.width+.8+"px",b.style.height=a.display.height+.8+"px",b.style.display="block",b.style.top=Math.floor(e)+"px",b.style.left=Math.floor(d)+"px",b.style.transform="scale("+1.001*g+")",b.style.transformOrigin="0px 0px")},a.prototype.pendingUpdate=function(){return this.pending},a.prototype.prepareLayer=function(a){},a}();t.Atlas=ue;t.AtlasAuto=function(a){var b=a.style,c=a.resizeHash;a=T(a,["style",
379
- "resizeHash"]);var d=H(Mb(),3),e=d[0],f=d[1],g=d[2];d=b||{};return l.useEffect(function(){g()},[d.width,d.height,c,g]),A.createElement("div",{ref:e,style:B({width:"100%",height:600},b)},A.createElement(ue,B({width:f.width||100,height:f.height||100},a),a.children))};t.AtlasContext=zb;t.BrowserEventManager=Fc;t.CanvasRenderer=uc;t.CompositeRenderer=Xd;t.CompositeResource=Bd;t.DebugRenderer=Lf;t.DrawBox=function(a){var b=a.onCreate,c=l.useRef({x:0,y:0}),d=we(),e=ca(),f=db();a=H(l.useState(),2);var g=
380
- a[0],k=a[1];a=H(l.useState(),2);var h=a[0],m=a[1],p=yb();return Ab(function(){e&&g&&!h&&(e.pendingUpdate=!0)},[g,h]),ve(function(){if(g&&d&&e){var a=d.getContext("2d");if(a){var b=e.worldToViewer(g.x,g.y,(h?h.x:c.current.x)-g.x,(h?h.y:c.current.y)-g.y),f=b.x,k=b.y,m=b.width;b=b.height;a.lineWidth=h?3:1;a.strokeStyle="#fff";a.strokeRect(f,k,m,b);a.lineWidth=h?3:1;a.strokeStyle="#000";a.strokeRect(f+1,k+1,m-2,b-2)}}},[g,h]),l.useEffect(function(){var a=function(a){if(f.canvasPosition&&e){a=e.viewerToWorld(a.clientX-
381
- f.canvasPosition.left,a.clientY-f.canvasPosition.top);var b=a.y;c.current.x=~~a.x;c.current.y=~~b}};return d?(d.addEventListener("mousemove",a),function(){return d.removeEventListener("mousemove",a)}):function(){}},[f.canvasPosition,d,e]),l.useEffect(function(){var a=function(a){"sketch"===p&&(k({x:Math.round(c.current.x),y:Math.round(c.current.y)}),m(void 0))};return d?(d.addEventListener("mousedown",a),function(){return d.removeEventListener("mousedown",a)}):function(){}},[d,p]),l.useEffect(function(){var a=
382
- function(a){g&&!h&&m({x:Math.round(c.current.x),y:Math.round(c.current.y)})};return d?(d.addEventListener("mouseup",a),function(){return d.removeEventListener("mouseup",a)}):function(){}},[d,g,h]),l.useEffect(function(){g&&h&&b({x:Math.min(g.x,h.x),y:Math.min(g.y,h.y),width:Math.abs(h.x-g.x),height:Math.abs(h.y-g.y)})},[g,b,h]),null};t.GridBuilder=Mf;t.HTMLPortal=xe;t.ImageService=function(a){var b=H(l.useState(),2),c=b[0],d=b[1];return l.useEffect(function(){hc(a.id,a.width,a.height).then(function(a){d(a)})},
383
- [a.height,a.id,a.width]),c?A.createElement(Ae,{tiles:c,x:a.x||0,y:a.y||0,width:a.width,height:a.height}):A.createElement(A.Fragment,null)};t.ModeContext=xb;t.OverlayRenderer=te;t.ReactAtlas=Ec;t.RegionHighlight=function(a){var b=a.interactive,c=a.region,d=a.onClick,e=a.onSave,f=a.isEditing,g=a.border;g=void 0===g?"none":g;a=a.background;a=void 0===a?"rgba(0,0,0,.4)":a;var k=yb(),h=l.useCallback(function(a){e(B({id:c.id,x:c.x,y:c.y,height:c.height,width:c.width},a))},[e,c.id,c.x,c.y,c.height,c.width]);
384
- return A.createElement(ze,{x:c.x,y:c.y,width:c.width,height:c.height,resizable:f,onSave:h},A.createElement("box",{interactive:b,onClick:"explore"===k?function(a){a.preventDefault();a.stopPropagation();d(c)}:function(){},target:{x:0,y:0,width:c.width,height:c.height},backgroundColor:a,border:g}))};t.ResizeWorldItem=ze;t.Runtime=jc;t.SingleImage=ta;t.StaticRenderer=kg;t.TileSet=Ae;t.TiledImage=Fa;t.WebGLRenderer=se;t.World=Ga;t.WorldObject=Ua;t.Zone=tf;t.canDrag=function(a){return"sketch"===a.current};
385
- t.defaultConfig=pe;t.fromImage=function(a){var b=a.src,c=a.target,d=c?c.width:a.width;c=c?c.height:a.height;return new Ua({id:b,height:c,width:d,layers:[ta.fromImage(b,{height:c,width:d},{width:a.width,height:a.height})]})};t.getId=yd;t.getTileFromCanvas=zd;t.getTileFromImageService=hc;t.getTiles=function(a){return Ka(this,void 0,void 0,function(){var b,c;return La(this,function(d){switch(d.label){case 0:return d.trys.push([0,2,,3]),[4,ra.loadManifest(a)];case 1:return(b=d.sent())?[2,Ad(b)]:[2,[]];
386
- case 2:return c=d.sent(),console.log("ERR",c),[2,[]];case 3:return[2]}})})};t.getTilesFromManifest=Ad;t.popmotionController=Cc;t.useAfterFrame=ve;t.useAfterPaint=function(a,b){void 0===b&&(b=[]);var c=ca();l.useEffect(function(){return c?c.registerHook("useAfterPaint",a):function(){}},b)};t.useAtlas=db;t.useAtlasImage=function(a,b){var c=b.onCreated,d=b.resetWorldOnChange,e=void 0===d||d;d=b.mode;var f=void 0===d?"explore":d,g=b.cover,k=b.containerRef,h=T(b,["onCreated","resetWorldOnChange","mode",
387
- "cover","containerRef"]);d=H(l.useState(!1),2);b=d[0];var m=d[1],p=H(l.useState(void 0),2);d=p[0];var q=p[1];p=H(l.useState(void 0),2);var r=p[0],n=p[1],t=l.useRef(),v=l.useRef(),x=l.useMemo(function(){return{width:h.width,height:h.height}},[h.width,h.height]),u=l.useRef({ready:!1,viewport:{width:h.width,height:h.height,x:0,y:0,scale:1},renderer:void 0,runtime:void 0,controller:void 0,canvas:t,canvasPosition:void 0});l.useLayoutEffect(function(){var a=document.createElement("canvas");a.height=x.height;
388
- a.width=x.width;t.current=a},[]);l.useLayoutEffect(function(){var a=t.current;a&&(a.height=x.height,a.width=x.width)},[x.width,x.height]);l.useEffect(function(){var a=u.current.runtime;return a?a.registerHook("useAfterFrame",function(){if(t.current)try{q(t.current.toDataURL())}catch(C){n(C.message)}}):function(){}},[]);l.useEffect(function(){var a=u.current.runtime;return a?a.world.addLayoutSubscriber(function(a){"ready"===a&&m(!0)}):function(){}},[]);l.useEffect(function(){u.current.canvasPosition=
389
- x;u.current.em&&u.current.em.updateBounds()},[x]);l.useEffect(function(){u.current&&u.current.runtime&&(u.current.runtime.mode=f)},[u,f]);l.useEffect(function(){if(u.current.runtime){var a=u.current.runtime;a.resize(u.current.viewport.width,h.width,u.current.viewport.height,h.height);g?a.cover():a.goHome();u.current.viewport.width=h.width;u.current.viewport.height=h.height;a.updateNextFrame()}},[h.width,h.height]);l.useLayoutEffect(function(){var a=v.current;a&&(a.style.width=x.width+"px",a.style.height=
390
- x.height+"px",a.style.pointerEvents="none",a.style.overflow="hidden")},[x.height,x.width]);l.useLayoutEffect(function(){var a=function(){if(u.current.runtime){var a=u.current.runtime;a.resize(u.current.viewport.width,h.width,u.current.viewport.height,h.height);u.current.viewport.width=h.width;u.current.viewport.height=h.height;a.updateNextFrame()}};return window.addEventListener("resize",a),function(){return window.removeEventListener("resize",a)}},[h.height,h.width]);var w=l.useCallback(function(a){var b=
391
- function(){u.current.ready=!0};return l.useEffect(function(){var a=c&&c(u.current);a&&a.then?a.then(b):b()},[]),a.children},[]);return l.useLayoutEffect(function(){var a=t.current;if(!a)throw Error("Something went wrong mounting canvas.");a.style.userSelect="none";u.current.canvas=t;var b=[];if(k&&k.current){var c=Cc({minZoomFactor:.5,maxZoomFactor:3,enableClickToZoom:!1});u.current.controller=c;b.push(c)}a=new uc(a,{crossOrigin:!0,debug:!1});u.current.renderer=a;var d=new jc(a,new Ga,u.current.viewport,
392
- b);u.current.runtime=d;var e=void 0;return k&&k.current&&(e=new Fc(k.current,d),u.current.em=e),function(){b.forEach(function(a){a.stop(d)});d.stop();e&&e.stop()}},[]),l.useEffect(function(){if(u.current&&u.current.runtime){var a=u.current.runtime;if(e)return a.world.addLayoutSubscriber(function(b){"recalculate-world-size"===b&&a.goHome(g)})}return function(){}},[g,e]),l.useLayoutEffect(function(){Ec.render(A.createElement(w,null,A.createElement(xb.Provider,{value:f},A.createElement(zb.Provider,{value:u.current},
393
- a))),u.current.runtime)},[u,f,a]),{loading:!d&&b,uri:d,imageError:r}};t.useBeforeFrame=function(a,b){void 0===b&&(b=[]);var c=ca();l.useEffect(function(){return c?c.registerHook("useBeforeFrame",a):function(){}},b)};t.useCanvas=we;t.useControlledAnnotationList=function(a){void 0===a&&(a=[]);var b=H(l.useState(a),2);a=b[0];var c=b[1],d=H(l.useState(!1),2);b=d[0];var e=d[1],f=H(l.useState(),2);d=f[0];var g=f[1];f=l.useCallback(function(){e(!0);g(void 0)},[]);var k=l.useCallback(function(a){e(!0);g(a)},
394
- []),h=l.useCallback(function(a){var b=ic();c(function(c){return G(c,[B({id:b},a)])});e(!1);g(void 0)},[]);return{isEditing:b,onDeselect:l.useCallback(function(){e(!1);g(void 0)},[]),selectedAnnotation:d,onCreateNewAnnotation:h,annotations:a,onUpdateAnnotation:function(a){c(function(b){return b.map(function(b){return b.id===a.id?a:b})})},setIsEditing:e,setSelectedAnnotation:g,editAnnotation:k,addNewAnnotation:f}};t.useFrame=Ab;t.useMode=yb;t.useResizeWorldItem=ye;t.useRuntime=ca;t.useWorldEvent=Gc;
395
- Object.defineProperty(t,"__esModule",{value:!0})})
64
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
65
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
66
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
67
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
68
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
69
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
70
+ PERFORMANCE OF THIS SOFTWARE.
71
+ ***************************************************************************** */
72
+ function $r(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{c(n.next(t))}catch(t){o(t)}}function a(t){try{c(n.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}c((n=n.apply(t,e||[])).next())}))}function Gr(t,e){const i=t.hyperion.requests[e],n=t.hyperion.mapping[e];if(n&&t.hyperion.entities[n][i.resourceUri])return t.hyperion.entities[n][i.resourceUri]}function Kr(t,e,{waitTimeout:i=30}={}){return(n,r)=>$r(this,void 0,void 0,(function*(){const o=t.getState(),s=o.hyperion.requests[n];if(s)switch(s.loadingState){case"RESOURCE_ERROR":break;case"RESOURCE_LOADING":{let e;try{const r=yield Promise.race([new Promise((i,r)=>{e=t.subscribe(()=>{const e=t.getState();if("RESOURCE_ERROR"!==e.hyperion.requests[n].loadingState){if("RESOURCE_READY"===e.hyperion.requests[n].loadingState){const t=Gr(e,n);t?i(t):r()}}else r()})}),new Promise((t,e)=>setTimeout(e,60*i))]);if(e&&e(),r)return r}catch(t){e&&e();break}break}case"RESOURCE_READY":{const t=Gr(o,n);if(t)return t;break}}t.dispatch(Hr({id:n}));try{const i=yield e(n,r),o=((t,e)=>{const{entities:i,resource:n,mapping:r}=br(e);if(void 0===n.id)return[qr({id:t,message:"ID is not defined in resource."})];const o=[Ur({entities:i}),Br({mapping:r})];return n.id!==t&&(o.push(zr({id:t,type:n.type})),o.push(Qr({requestId:t,actualId:n.id}))),o.push(Vr({id:t})),o})(n,i);for(const e of o)t.dispatch(e);return Gr(t.getState(),n)}catch(e){throw t.dispatch(qr({id:n,message:e.toString()})),e}}))}
73
+ /*! *****************************************************************************
74
+ Copyright (c) Microsoft Corporation.
75
+
76
+ Permission to use, copy, modify, and/or distribute this software for any
77
+ purpose with or without fee is hereby granted.
78
+
79
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
80
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
81
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
82
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
83
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
84
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
85
+ PERFORMANCE OF THIS SOFTWARE.
86
+ ***************************************************************************** */
87
+ function Jr(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{c(n.next(t))}catch(t){o(t)}}function a(t){try{c(n.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}c((n=n.apply(t,e||[])).next())}))}class to{constructor(t,e){var i;this.defaultFetcher=t=>fetch(t).then(t=>t.json()),this.middleware=t=>e=>i=>{this.emitter.emit(i.type,{action:i,state:t.getState()});const n=e(i);return this.emitter.emit("after:"+i.type,{action:i,state:t.getState()}),n},this.options=Object.assign({reducers:{},middleware:[],defaultState:{},customFetcher:this.defaultFetcher},t||{}),this.store=e||Zr(this.options.reducers,[...this.options.middleware,this.middleware],this.options.defaultState),this.emitter={all:i=i||new Map,on:function(t,e){var n=i.get(t);n&&n.push(e)||i.set(t,[e])},off:function(t,e){var n=i.get(t);n&&n.splice(n.indexOf(e)>>>0,1)},emit:function(t,e){(i.get(t)||[]).slice().map((function(t){t(e)})),(i.get("*")||[]).slice().map((function(i){i(t,e)}))}},this.imageService=new Bn,this.remoteFetcher=Kr(this.store,this.options.customFetcher),this.staticFetcher=Kr(this.store,(t,e)=>e)}modifyEntityField(t,e,i){this.store.dispatch(Wr.modifyEntityField({id:t.id,type:t.type,key:e,value:i}))}serialise(t,e){return Er(this.getState(),t,e)}toPresentation2(t){return this.serialise(t,Tr)}toPresentation3(t){return this.serialise(t,Dr)}fromRef(t,e){const i=this.getState(),n=i.hyperion.entities[t.type]&&i.hyperion.entities[t.type][t.id]?i.hyperion.entities[t.type][t.id]:t;return e?e(i,n):n}allFromRef(t,e){return t.map(t=>this.fromRef(t,e))}select(t){return t(this.getState())}getStore(){return this.store}getState(){return this.store.getState()}getImageService(){return this.imageService}loadManifest(t,e){return this.load(t,e)}loadCollection(t,e){return this.load(t,e)}getThumbnail(t,e,i,n=[],r){return Jr(this,void 0,void 0,(function*(){if("string"==typeof t)return{best:cn(t),fallback:[],log:[]};const o=this.fromRef(t);if("string"==typeof o)return{best:cn(o),fallback:[],log:[]};switch(o.type){case"Annotation":{const t=o.body,s=this.fromRef(t[0]);return r&&!s.width&&(s.width=r.width,s.height=r.height),yield this.imageService.getThumbnailFromResource(s,e,i,n)}case"Canvas":{const t=o;if(t.thumbnail&&t.thumbnail.length){const e=this.fromRef(t.thumbnail[0]),r=yield this.imageService.getImageCandidates(e,i);r&&r.length&&n.push(...r)}return this.getThumbnail(t.items[0],e,i,n,{width:t.width,height:t.height})}case"AnnotationPage":{const t=o;return this.getThumbnail(t.items[0],e,i,n,r)}case"Choice":{const t=o;return this.getThumbnail(t.items[0],e,i,n,r)}case"Collection":{const t=o.items[0];return this.getThumbnail(t,e,i,n,r)}case"Manifest":{const t=o.items[0];return this.getThumbnail(t,e,i,n,r)}case"SpecificResource":case"Image":case"Dataset":case"Sound":case"Text":case"TextualBody":case"Video":return r&&!o.width&&(o.width=r.width,o.height=r.height),this.imageService.getThumbnailFromResource(o,e,i,n);case"Service":case"Range":case"AnnotationCollection":case"CanvasReference":case"ContentResource":return{best:void 0,fallback:[],log:[]}}return{best:void 0,fallback:[],log:[]}}))}load(t,e){return e?this.staticFetcher(t,e):this.remoteFetcher(t)}subscribe(t,e){let i;return this.store.subscribe(()=>{const n=this.store.getState(),r=t(n);i!==r&&e(r,this),i=r})}}function eo(t,e,i){return Jr(this,void 0,void 0,(function*(){return function(t){try{let t=globalThis?globalThis.__hyperionVault__:"undefined"!=typeof window&&window.__hyperionVault__?window.__hyperionVault__:null;try{!t&&global&&global.__hyperionVault__&&(t=global.__hyperionVault__)}catch(t){}if(t)return t}catch(t){}const e=new to(t);try{"undefined"!=typeof globalThis&&(globalThis.__hyperionVault__=e)}catch(t){}try{"undefined"!=typeof global&&(global.__hyperionVault__=e)}catch(t){}return"undefined"!=typeof window&&(window.__hyperionVault__=e),e}().getThumbnail(t,e,i)}))}function io(t){return t.id||t["@id"]}var no=new to,ro=new Bn;function oo(t,e,i){return f(this,void 0,void 0,(function(){var n;return g(this,(function(r){switch(r.label){case 0:return[4,ro.loadService({id:t,width:e,height:i})];case 1:return[2,{id:io(n=r.sent()),width:e,height:i,imageService:n,thumbnail:void 0}]}}))}))}function so(t,e){return f(this,void 0,void 0,(function(){var e,i,n,r,o,s,a,c,h,l,u,d,p,f,y,m;return g(this,(function(g){switch(g.label){case 0:e=[],g.label=1;case 1:g.trys.push([1,13,14,15]),i=v(t.items),n=i.next(),g.label=2;case 2:if(n.done)return[3,12];r=n.value,g.label=3;case 3:g.trys.push([3,9,10,11]),y=void 0,o=v(no.fromRef(r).items),s=o.next(),g.label=4;case 4:return s.done?[3,8]:(a=s.value,c=no.fromRef(no.fromRef(a).body[0]),[4,oo(c.service[0].id,t.width,t.height)]);case 5:return h=g.sent(),[4,eo(no,ro,t)];case 6:(l=g.sent().best)&&(h.thumbnail=l),e.push(h),g.label=7;case 7:return s=o.next(),[3,4];case 8:return[3,11];case 9:return u=g.sent(),y={error:u},[3,11];case 10:try{s&&!s.done&&(m=o.return)&&m.call(o)}finally{if(y)throw y.error}return[7];case 11:return n=i.next(),[3,2];case 12:return[3,15];case 13:return d=g.sent(),p={error:d},[3,15];case 14:try{n&&!n.done&&(f=i.return)&&f.call(i)}finally{if(p)throw p.error}return[7];case 15:return[2,e]}}))}))}function ao(t){return f(this,void 0,void 0,(function(){var e,i,n,r,o,s,a,c,h,l,u,d;return g(this,(function(p){switch(p.label){case 0:e=[],p.label=1;case 1:p.trys.push([1,6,7,8]),i=v(t.items),n=i.next(),p.label=2;case 2:return n.done?[3,5]:(r=n.value,o=no.fromRef(r),a=(s=e.push).apply,c=[e],h=[[]],[4,so(o)]);case 3:a.apply(s,c.concat([m.apply(void 0,h.concat([y.apply(void 0,[p.sent()]),!1]))])),p.label=4;case 4:return n=i.next(),[3,2];case 5:return[3,8];case 6:return l=p.sent(),u={error:l},[3,8];case 7:try{n&&!n.done&&(d=i.return)&&d.call(i)}finally{if(u)throw u.error}return[7];case 8:return[2,e]}}))}))}t.Atlas=Je,t.AtlasAuto=function(t){var i=t.resizeHash,n=t.aspectRatio,r=t.containerProps,s=void 0===r?{}:r,a=d(t,["resizeHash","aspectRatio","containerProps"]),c=y(Re(),3),h=c[0],l=c[1],p=c[2],f=a,g=f.height,v=f.width,m=d(f,["height","width"]);e.useEffect((function(){p()}),[v,g,i,p]);var w=e.useMemo((function(){return n?(l.width||1)/(l.height||1)<n?{width:l.width,height:l.width*(1/n)}:{height:l.height,width:l.height*n}:l}),[l,n]);return o.createElement("div",u({ref:h,style:{width:v||"100%",height:g||600}},s),w.width?o.createElement(Je,u({width:w.width||100,height:w.height||100},m),a.children):null)},t.AtlasContext=Te,t.BoundsContext=Ie,t.Box=V,t.BrowserEventManager=Xe,t.CanvasRenderer=ae,t.CompositeRenderer=ce,t.CompositeResource=D,t.DebugRenderer=he,t.DrawBox=function(t){var i=t.onCreate,n=e.useRef({x:0,y:0}),r=ri(),o=oi(),s=ei(),a=y(e.useState(),2),c=a[0],h=a[1],l=y(e.useState(),2),u=l[0],d=l[1],p=Oe();return ni((function(){s&&c&&!u&&(s.pendingUpdate=!0)}),[c,u]),ii((function(){if(c&&r&&s){var t=r.getContext("2d");if(t){var e=s.worldToViewer(c.x,c.y,(u?u.x:n.current.x)-c.x,(u?u.y:n.current.y)-c.y),i=e.x,o=e.y,a=e.width,h=e.height;t.lineWidth=u?3:1,t.strokeStyle="#fff",t.strokeRect(i,o,a,h),t.lineWidth=u?3:1,t.strokeStyle="#000",t.strokeRect(i+1,o+1,a-2,h-2)}}}),[c,u]),e.useEffect((function(){var t=function(t){if(o&&s){var e=s.viewerToWorld(t.clientX-o.left,t.clientY-o.top),i=e.x,r=e.y;n.current.x=~~i,n.current.y=~~r}};return r?(r.addEventListener("mousemove",t),function(){return r.removeEventListener("mousemove",t)}):function(){}}),[o,r,s]),e.useEffect((function(){var t=function(t){"sketch"===p&&(h({x:Math.round(n.current.x),y:Math.round(n.current.y)}),d(void 0))};return r?(r.addEventListener("mousedown",t),function(){return r.removeEventListener("mousedown",t)}):function(){}}),[r,p]),e.useEffect((function(){var t=function(t){c&&!u&&d({x:Math.round(n.current.x),y:Math.round(n.current.y)})};return r?(r.addEventListener("mouseup",t),function(){return r.removeEventListener("mouseup",t)}):function(){}}),[r,c,u]),e.useEffect((function(){c&&u&&i({x:Math.min(c.x,u.x),y:Math.min(c.y,u.y),width:Math.abs(u.x-c.x),height:Math.abs(u.y-c.y)})}),[c,i,u]),null},t.GridBuilder=le,t.HTMLPortal=si,t.ImageService=function(t){var i=y(e.useState(),2),n=i[0],r=i[1];return e.useEffect((function(){oo(t.id,t.width,t.height).then((function(t){r(t)}))}),[t.height,t.id,t.width]),o.createElement("world-object",{x:t.x||0,y:t.y||0,width:t.width,height:t.height},n?o.createElement(li,{tiles:n,x:0,y:0,width:t.width,height:t.height}):null)},t.ImageTexture=I,t.ModeContext=Se,t.OverlayRenderer=Ve,t.ReactAtlas=Ne,t.RegionHighlight=function(t){var i=t.interactive,n=t.region,r=t.onClick,s=t.onSave,a=t.isEditing,c=t.style,h=void 0===c?{backgroundColor:"rgba(0,0,0,.5)"}:c,l=(Oe(),e.useCallback((function(t){s(u({id:n.id,x:n.x,y:n.y,height:n.height,width:n.width},t))}),[s,n.id,n.x,n.y,n.height,n.width]));return o.createElement(hi,{x:n.x,y:n.y,width:n.width,height:n.height,resizable:a,onSave:l},o.createElement("box",{interactive:i,onClick:function(t){t.preventDefault(),t.stopPropagation(),r(n)},target:{x:0,y:0,width:n.width,height:n.height},style:h}))},t.ResizeWorldItem=hi,t.Runtime=st,t.SingleImage=T,t.StaticRenderer=Ze,t.Text=X,t.TileSet=li,t.TiledImage=F,t.WebGLRenderer=He,t.World=B,t.WorldObject=z,t.Zone=W,t.activateEvents=Fe,t.applyProps=ke,t.bounceOut=nt,t.canDrag=function(t){return"sketch"===t.current},t.createDefaultEventMap=a,t.defaultConfig=xe,t.easingFunctions=rt,t.fromImage=function(t){var e=t.src,i=t.target,n=i?i.width:t.width,r=i?i.height:t.height;return new z({id:e,height:r,width:n,layers:[T.fromImage(e,{height:r,width:n},{width:t.width,height:t.height})]})},t.getId=io,t.getTileFromCanvas=so,t.getTileFromImageService=oo,t.getTiles=function(t){return f(this,void 0,void 0,(function(){var e,i;return g(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,no.loadManifest(t)];case 1:return(e=n.sent())?[2,ao(e)]:[2,[]];case 2:return i=n.sent(),console.log("ERR",i),[2,[]];case 3:return[2]}}))}))},t.getTilesFromManifest=ao,t.mergeStyles=function(t,e){return t?e?u(u(u({},t),e||{}),{":hover":t[":hover"]?Object.assign(t[":hover"]||{},e[":hover"]||{}):e[":hover"],":active":t[":active"]?Object.assign(t[":active"]||{},e[":active"]||{}):e[":hover"]}):t:e},t.popmotionController=Ee,t.supportedEventAttributes=s,t.supportedEventMap=c,t.unmountComponentAtNode=Ue,t.useAfterFrame=ii,t.useAfterPaint=function(t,i){void 0===i&&(i=[]);var n=ei();e.useEffect((function(){return n?n.registerHook("useAfterPaint",t):function(){}}),i)},t.useAtlas=ti,t.useAtlasImage=function(t,i){var n=i.onCreated,r=i.resetWorldOnChange,s=void 0===r||r,a=i.mode,c=void 0===a?"explore":a,h=i.cover,l=(i.containerRef,d(i,["onCreated","resetWorldOnChange","mode","cover","containerRef"])),u=y(e.useState(!1),2),p=u[0],f=u[1],g=y(e.useState(void 0),2),v=g[0],m=g[1],w=y(e.useState(void 0),2),b=w[0],x=w[1],E=e.useRef(),S=e.useRef(),O=e.useMemo((function(){return{width:l.width,height:l.height}}),[l.width,l.height]),P=y(Ke(void 0,{width:l.width,height:l.height}),4),C=(P[0],P[1]),R=P[2];P[3];e.useLayoutEffect((function(){var t=document.createElement("canvas");t.height=O.height,t.width=O.width,E.current=t}),[]),e.useLayoutEffect((function(){var t=E.current;t&&(t.height=O.height,t.width=O.width)}),[O.width,O.height]),e.useEffect((function(){return C?C.runtime.registerHook("useAfterFrame",(function(){if(E.current)try{m(E.current.toDataURL())}catch(t){t instanceof Error&&x(t.message)}})):function(){}}),[]),e.useEffect((function(){return C?C.runtime.world.addLayoutSubscriber((function(t){"ready"===t&&f(!0)})):function(){}}),[]),e.useEffect((function(){C&&C.em&&C.em.updateBounds()}),[O]),e.useEffect((function(){C&&(C.runtime.mode=c)}),[c]),e.useEffect((function(){if(C){var t=C.runtime;t.resize(R.current.width,l.width,R.current.height,l.height),h?t.cover():t.goHome(),R.current.width=l.width,R.current.height=l.height,t.updateNextFrame()}}),[l.width,l.height]),e.useLayoutEffect((function(){var t=S.current;t&&(t.style.width="".concat(O.width,"px"),t.style.height="".concat(O.height,"px"),t.style.pointerEvents="none",t.style.overflow="hidden")}),[O.height,O.width]),e.useLayoutEffect((function(){var t=function(){if(C&&C.runtime){var t=C.runtime;t.resize(R.current.width,l.width,R.current.height,l.height),R.current.width=l.width,R.current.height=l.height,t.updateNextFrame()}};return window.addEventListener("resize",t),function(){return window.removeEventListener("resize",t)}}),[C,l.height,l.width]);var _=e.useCallback((function(t){var i=function(){C&&(C.ready=!0)};return e.useEffect((function(){if(!C)return function(){};var t=n&&n(C);t&&t.then?t.then(i):i()}),[]),t.children}),[C]);return e.useEffect((function(){if(C&&C.runtime){var t=C.runtime;if(s)return t.world.addLayoutSubscriber((function(e){"recalculate-world-size"===e&&t.goHome({cover:h})}))}return function(){}}),[C,h,s]),e.useLayoutEffect((function(){C&&Ne.render(o.createElement(_,null,o.createElement(Se.Provider,{value:c},o.createElement(Te.Provider,{value:C},t))),C.runtime)}),[C,c,t]),{loading:!v&&p,uri:v,imageError:b}},t.useBeforeFrame=function(t,i){void 0===i&&(i=[]);var n=ei();e.useEffect((function(){return n?n.registerHook("useBeforeFrame",t):function(){}}),i)},t.useCanvas=ri,t.useControlledAnnotationList=function(t){void 0===t&&(t=[]);var i=y(e.useState(t),2),n=i[0],r=i[1],o=y(e.useState(!1),2),s=o[0],a=o[1],c=y(e.useState(),2),h=c[0],l=c[1],d=e.useCallback((function(){a(!0),l(void 0)}),[]),p=e.useCallback((function(t){a(!0),l(t)}),[]),f=e.useCallback((function(t){var e=_();r((function(i){return m(m([],y(i),!1),[u({id:e},t)],!1)})),a(!1),l(void 0)}),[]);return{isEditing:s,onDeselect:e.useCallback((function(){a(!1),l(void 0)}),[]),selectedAnnotation:h,onCreateNewAnnotation:f,annotations:n,onUpdateAnnotation:function(t){r((function(e){return e.map((function(e){return e.id===t.id?t:e}))}))},setIsEditing:a,setSelectedAnnotation:l,editAnnotation:p,addNewAnnotation:d}},t.useFrame=ni,t.useMode=Oe,t.useResizeWorldItem=ci,t.useRuntime=ei,t.useWorldEvent=ai,Object.defineProperty(t,"__esModule",{value:!0})}));
396
88
  //# sourceMappingURL=index.umd.js.map