openseadragon 1.0.15 → 1.0.17

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f4aac7d093e88b64486949bdbff2cd0a7a3242dbff6c7256909d8391ac3845e4
4
- data.tar.gz: ec7ccd99a5d1611070e26d6e1521738068ff81e742832d72e0d25f2ab8462460
3
+ metadata.gz: cce16176773e625a79a3994025e926638562accbad54fbe542a9ccb4d606d15d
4
+ data.tar.gz: cb111bf89121495c24fe796470bd28f7eea64afdb70c14f181afb0ef447f4579
5
5
  SHA512:
6
- metadata.gz: 7e7b34cf47a15292a567c807ed7ca2f09bf6d50b11c40713e2ddf2fc3a7856a45acf3202fafd2b9d0c8e19a28bf7fc3a1d66e334067f7834dff43650a54d3c6c
7
- data.tar.gz: 7a49c4fb48cc9501ea0e5ef2f0fdbfdbe1956344571d21ff0b9d0b1412ec5e9663c3cfe41ca0a2c141bbb62e4bbbf030bea5be7353ae07d686bb32e6d53f2ea8
6
+ metadata.gz: 7ba14b5c3bde93579a6114f1766745ff7524dd211bfc864d13ef7c8442ca91c3c221e150c6a6f3bef9ce19c1d67da9fb379970ff75b99cd835df58fdba64419d
7
+ data.tar.gz: 9162a7c3c05652925d3251b824e1e3354ccafa5d4fa7b3534a115509d618d1c0da8a1fbc9fd79b3c3a6e1c88337a0542ed70f54d266e366541ece3f217302703
@@ -71,4 +71,4 @@ import OpenSeadragon from 'openseadragon';
71
71
  addEventListener('load', () => initOpenSeadragon());
72
72
  }
73
73
  })();
74
- //# sourceMappingURL=index.esm.js.map
74
+ //# sourceMappingURL=openseadragon-rails.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openseadragon-rails.esm.js","sources":["../../../javascript/openseadragon-rails/dom.js","../../../javascript/openseadragon-rails/rails.js"],"sourcesContent":["import OpenSeadragon from 'openseadragon'\n\n(function() {\n let __osd_counter = 0;\n\n function generateOsdId() {\n __osd_counter++;\n return \"Openseadragon\" + __osd_counter;\n }\n\n function openseadragon() {\n this.forEach(function(picture) {\n // Ensure the element is an HTMLElement\n if (!(picture instanceof HTMLElement)) return;\n\n picture.classList.add('openseadragon-viewer');\n\n // Set ID if it doesn't exist\n if (!picture.id) {\n picture.id = generateOsdId();\n }\n\n // Retrieve openseadragon data attribute as JSON\n const collectionOptions = picture.dataset.openseadragon\n ? JSON.parse(picture.dataset.openseadragon)\n : {};\n\n // Find all <source> elements with media=\"openseadragon\"\n const sources = Array.from(picture.querySelectorAll('source[media=\"openseadragon\"]'));\n\n const tileSources = sources.map(source => {\n const osdData = source.dataset.openseadragon;\n return osdData ? JSON.parse(osdData) : source.getAttribute('src');\n });\n\n // Preserve height of the picture\n const height = window.getComputedStyle(picture).height;\n picture.style.height = height;\n\n // Initialize OpenSeadragon\n picture.osdViewer = OpenSeadragon({\n id: picture.id,\n ...collectionOptions,\n tileSources: tileSources\n });\n });\n\n return this;\n }\n\n // Attach the function to NodeList and HTMLElement prototypes for convenience\n NodeList.prototype.openseadragon = openseadragon;\n HTMLCollection.prototype.openseadragon = openseadragon;\n\n // For a single HTMLElement\n HTMLElement.prototype.openseadragon = function() {\n return openseadragon.call([this]);\n };\n\n})();\n","import 'openseadragon-rails/dom'\n\n(function() {\n function initOpenSeadragon() {\n document.querySelectorAll('picture[data-openseadragon]:not(:has(.openseadragon-container))').openseadragon();\n }\n\n if (typeof Turbo !== 'undefined') {\n addEventListener(\"turbo:load\", () => initOpenSeadragon())\n addEventListener(\"turbo:frame-load\", () => initOpenSeadragon())\n } else {\n addEventListener('load', () => initOpenSeadragon())\n }\n})();\n"],"names":[],"mappings":";;AAEA,CAAC,WAAW;AACZ,EAAE,IAAI,aAAa,GAAG,CAAC;;AAEvB,EAAE,SAAS,aAAa,GAAG;AAC3B,IAAI,aAAa,EAAE;AACnB,IAAI,OAAO,eAAe,GAAG,aAAa;AAC1C;;AAEA,EAAE,S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,aAAa;AAClD,EAAE,cAAc,CAAC,SAAS,CAAC,aAAa,GAAG,aAAa;;AAExD;AACA,EAAE,WAAW,CAAC,SAAS,CAAC,aAAa,GAAG,WAAW;AACnD,IAAI,OAAO,aAAa,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;AACrC,GAAG;;AAEH,CAAC,GAAG;;ACzDJ,CAAC,WAAW;AACZ,EAAE,SAAS,iBAAiB,GAAG;AAC/B,IAAI,QAAQ,CAAC,gBAAgB,CAAC,iEAAiE,CAAC,CAAC,aAAa,EAAE;AAChH;;AAEA,EAAE,IAAI,OAAO,KAAK,KAAK,WAAW,EAAE;AACpC,IAAI,gBAAgB,CAAC,YAAY,EAAE,MAAM,iBAAiB,EAAE;AAC5D,IAAI,gBAAgB,CAAC,kBAAkB,EAAE,MAAM,iBAAiB,EAAE;AAClE,GAAG,MAAM;AACT,IAAI,gBAAgB,CAAC,MAAM,EAAE,MAAM,iBAAiB,EAAE;AACtD;AACA,CAAC,GAAG"}
@@ -77,4 +77,4 @@
77
77
  })();
78
78
 
79
79
  }));
80
- //# sourceMappingURL=index.js.map
80
+ //# sourceMappingURL=openseadragon-rails.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openseadragon-rails.js","sources":["../../../javascript/openseadragon-rails/dom.js","../../../javascript/openseadragon-rails/rails.js"],"sourcesContent":["import OpenSeadragon from 'openseadragon'\n\n(function() {\n let __osd_counter = 0;\n\n function generateOsdId() {\n __osd_counter++;\n return \"Openseadragon\" + __osd_counter;\n }\n\n function openseadragon() {\n this.forEach(function(picture) {\n // Ensure the element is an HTMLElement\n if (!(picture instanceof HTMLElement)) return;\n\n picture.classList.add('openseadragon-viewer');\n\n // Set ID if it doesn't exist\n if (!picture.id) {\n picture.id = generateOsdId();\n }\n\n // Retrieve openseadragon data attribute as JSON\n const collectionOptions = picture.dataset.openseadragon\n ? JSON.parse(picture.dataset.openseadragon)\n : {};\n\n // Find all <source> elements with media=\"openseadragon\"\n const sources = Array.from(picture.querySelectorAll('source[media=\"openseadragon\"]'));\n\n const tileSources = sources.map(source => {\n const osdData = source.dataset.openseadragon;\n return osdData ? JSON.parse(osdData) : source.getAttribute('src');\n });\n\n // Preserve height of the picture\n const height = window.getComputedStyle(picture).height;\n picture.style.height = height;\n\n // Initialize OpenSeadragon\n picture.osdViewer = OpenSeadragon({\n id: picture.id,\n ...collectionOptions,\n tileSources: tileSources\n });\n });\n\n return this;\n }\n\n // Attach the function to NodeList and HTMLElement prototypes for convenience\n NodeList.prototype.openseadragon = openseadragon;\n HTMLCollection.prototype.openseadragon = openseadragon;\n\n // For a single HTMLElement\n HTMLElement.prototype.openseadragon = function() {\n return openseadragon.call([this]);\n };\n\n})();\n","import 'openseadragon-rails/dom'\n\n(function() {\n function initOpenSeadragon() {\n document.querySelectorAll('picture[data-openseadragon]:not(:has(.openseadragon-container))').openseadragon();\n }\n\n if (typeof Turbo !== 'undefined') {\n addEventListener(\"turbo:load\", () => initOpenSeadragon())\n addEventListener(\"turbo:frame-load\", () => initOpenSeadragon())\n } else {\n addEventListener('load', () => initOpenSeadragon())\n }\n})();\n"],"names":[],"mappings":";;;;;;EAEA,CAAC,WAAW;EACZ,EAAE,IAAI,aAAa,GAAG,CAAC;;EAEvB,EAAE,SAAS,aAAa,GAAG;EAC3B,IAAI,aAAa,EAAE;EACnB,IAAI,OAAO,eAAe,GAAG,aAAa;EAC1C;;EAEA,EAAE,SAAS,aAAa,GAAG;EAC3B,IAAI,IAAI,CAAC,OAAO,CAAC,SAAS,OAAO,EAAE;EACnC;EACA,MAAM,IAAI,EAAE,OAAO,YAAY,WAAW,CAAC,EAAE;;EAE7C,MAAM,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,sBAAsB,CAAC;;EAEnD;EACA,MAAM,IAAI,CAAC,OAAO,CAAC,EAAE,EAAE;EACvB,QAAQ,OAAO,CAAC,EAAE,GAAG,aAAa,EAAE;EACpC;;EAEA;EACA,MAAM,MAAM,iBAAiB,GAAG,OAA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ChH;;EAEA,EAAE,IAAI,OAAO,KAAK,KAAK,WAAW,EAAE;EACpC,IAAI,gBAAgB,CAAC,YAAY,EAAE,MAAM,iBAAiB,EAAE;EAC5D,IAAI,gBAAgB,CAAC,kBAAkB,EAAE,MAAM,iBAAiB,EAAE;EAClE,GAAG,MAAM;EACT,IAAI,gBAAgB,CAAC,MAAM,EAAE,MAAM,iBAAiB,EAAE;EACtD;EACA,CAAC,GAAG;;;;;;"}
@@ -1,4 +1,4 @@
1
- import './dom'
1
+ import 'openseadragon-rails/dom'
2
2
 
3
3
  (function() {
4
4
  function initOpenSeadragon() {
@@ -27,6 +27,15 @@ module Openseadragon
27
27
  end
28
28
  end
29
29
 
30
+ def add_default_style
31
+ copy_file 'openseadragon.css', 'app/assets/stylesheets/openseadragon.css'
32
+
33
+ if (scss_file = %w[app/assets/stylesheets/application.bootstrap.scss
34
+ app/assets/stylesheets/application.scss].find { |f| File.exist?(f) })
35
+ append_to_file scss_file, "\n@import 'openseadragon';\n"
36
+ end
37
+ end
38
+
30
39
  def inject_helper
31
40
  inject_into_class 'app/controllers/application_controller.rb', ApplicationController do
32
41
  " helper Openseadragon::OpenseadragonHelper\n"
@@ -1,3 +1,3 @@
1
- /*
2
- *= require openseadragon/openseadragon
3
- */
1
+ .openseadragon-viewer {
2
+ min-height: 500px;
3
+ }
@@ -1,3 +1,3 @@
1
1
  module Openseadragon
2
- VERSION = '1.0.15'
2
+ VERSION = '1.0.17'
3
3
  end
data/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "openseadragon-rails",
3
- "version": "1.0.15",
3
+ "version": "1.0.17",
4
4
  "description": "Openseadragon support for Rails apps",
5
5
  "exports": {
6
6
  ".": "./app/javascript/openseadragon-rails/index.js",
7
7
  "./*": "./app/javascript/openseadragon-rails/*.js"
8
8
  },
9
- "main": "app/assets/javascripts/openseadragon-rails/index.js",
9
+ "main": "app/assets/javascripts/openseadragon-rails/openseadragon-rails.js",
10
10
  "module": "app/javascript/openseadragon-rails/index.js",
11
11
  "files": [
12
12
  "app/javascript/openseadragon-rails/*.js",
data/rollup.config.js CHANGED
@@ -4,7 +4,7 @@ import commonjs from '@rollup/plugin-commonjs';
4
4
  const BUNDLE = process.env.BUNDLE === 'true'
5
5
  const ESM = process.env.ESM === 'true'
6
6
 
7
- const fileDest = `index${ESM ? '.esm' : ''}`
7
+ const fileDest = `openseadragon-rails${ESM ? '.esm' : ''}`
8
8
  const external = [
9
9
  'openseadragon',
10
10
  ]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openseadragon
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.15
4
+ version: 1.0.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Coyne
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2025-01-10 00:00:00.000000000 Z
13
+ date: 2025-01-29 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -127,10 +127,10 @@ files:
127
127
  - LICENSE
128
128
  - README.md
129
129
  - Rakefile
130
- - app/assets/javascripts/openseadragon-rails/index.esm.js
131
- - app/assets/javascripts/openseadragon-rails/index.esm.js.map
132
- - app/assets/javascripts/openseadragon-rails/index.js
133
- - app/assets/javascripts/openseadragon-rails/index.js.map
130
+ - app/assets/javascripts/openseadragon-rails/openseadragon-rails.esm.js
131
+ - app/assets/javascripts/openseadragon-rails/openseadragon-rails.esm.js.map
132
+ - app/assets/javascripts/openseadragon-rails/openseadragon-rails.js
133
+ - app/assets/javascripts/openseadragon-rails/openseadragon-rails.js.map
134
134
  - app/assets/stylesheets/openseadragon/openseadragon.css
135
135
  - app/helpers/openseadragon/openseadragon_helper.rb
136
136
  - app/javascript/openseadragon-rails/dom.js
@@ -174,7 +174,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
174
174
  - !ruby/object:Gem::Version
175
175
  version: '0'
176
176
  requirements: []
177
- rubygems_version: 3.5.23
177
+ rubygems_version: 3.5.11
178
178
  signing_key:
179
179
  specification_version: 4
180
180
  summary: OpenSeadragon assets and helpers for Rails. http://openseadragon.github.io/
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.esm.js","sources":["../../../javascript/openseadragon-rails/dom.js","../../../javascript/openseadragon-rails/rails.js"],"sourcesContent":["import OpenSeadragon from 'openseadragon'\n\n(function() {\n let __osd_counter = 0;\n\n function generateOsdId() {\n __osd_counter++;\n return \"Openseadragon\" + __osd_counter;\n }\n\n function openseadragon() {\n this.forEach(function(picture) {\n // Ensure the element is an HTMLElement\n if (!(picture instanceof HTMLElement)) return;\n\n picture.classList.add('openseadragon-viewer');\n\n // Set ID if it doesn't exist\n if (!picture.id) {\n picture.id = generateOsdId();\n }\n\n // Retrieve openseadragon data attribute as JSON\n const collectionOptions = picture.dataset.openseadragon\n ? JSON.parse(picture.dataset.openseadragon)\n : {};\n\n // Find all <source> elements with media=\"openseadragon\"\n const sources = Array.from(picture.querySelectorAll('source[media=\"openseadragon\"]'));\n\n const tileSources = sources.map(source => {\n const osdData = source.dataset.openseadragon;\n return osdData ? JSON.parse(osdData) : source.getAttribute('src');\n });\n\n // Preserve height of the picture\n const height = window.getComputedStyle(picture).height;\n picture.style.height = height;\n\n // Initialize OpenSeadragon\n picture.osdViewer = OpenSeadragon({\n id: picture.id,\n ...collectionOptions,\n tileSources: tileSources\n });\n });\n\n return this;\n }\n\n // Attach the function to NodeList and HTMLElement prototypes for convenience\n NodeList.prototype.openseadragon = openseadragon;\n HTMLCollection.prototype.openseadragon = openseadragon;\n\n // For a single HTMLElement\n HTMLElement.prototype.openseadragon = function() {\n return openseadragon.call([this]);\n };\n\n})();\n","import './dom'\n\n(function() {\n function initOpenSeadragon() {\n document.querySelectorAll('picture[data-openseadragon]:not(:has(.openseadragon-container))').openseadragon();\n }\n\n if (typeof Turbo !== 'undefined') {\n addEventListener(\"turbo:load\", () => initOpenSeadragon())\n addEventListener(\"turbo:frame-load\", () => initOpenSeadragon())\n } else {\n addEventListener('load', () => initOpenSeadragon())\n }\n})();\n"],"names":[],"mappings":";;AAEA,CAAC,WAAW;AACZ,EAAE,IAAI,aAAa,GAAG,CAAC;;AAEvB,EAAE,SAAS,aAAa,GAAG;AAC3B,IAAI,aAAa,EAAE;AACnB,IAAI,OAAO,eAAe,GAAG,aAAa;AAC1C;;AAEA,EAAE,SAAS,aAAa,GAAG;AAC3B,IAAI,IAAI,CAAC,OAAO,CAAC,SAAS,OAAO,EAAE;AACnC;AACA,MAAM,IAAI,EAAE,OAAO,YAAY,WAAW,CAAC,EAAE;;AAE7C,MAAM,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,sBAAsB,CAAC;;AAEnD;AACA,MAAM,IAAI,CAAC,OAAO,CAAC,EAAE,EAAE;AACvB,QAAQ,OAAO,CAAC,EAAE,GAAG,aAAa,EAAE;AACpC;;AAEA;AACA,MAAM,MAAM,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC;AAChD,UAAU,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,aAAa;AAClD,UAAU,EAAE;;AAEZ;AACA,MAAM,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,+BAA+B,CAAC,CAAC;;AAE3F,MAAM,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,IAAI;AAChD,QAAQ,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,aAAa;AACpD,QAAQ,OAAO,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC;AACzE,OAAO,CAAC;;AAER;AACA,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,MAAM;AAC5D,MAAM,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,MAAM;;AAEnC;AACA,MAAM,OAAO,CAAC,SAAS,GAAG,aAAa,CAAC;AACxC,QAAQ,EAAE,EAAE,OAAO,CAAC,EAAE;AACtB,QAAQ,GAAG,iBAAiB;AAC5B,QAAQ,WAAW,EAAE;AACrB,OAAO,CAAC;AACR,KAAK,CAAC;;AAEN,IAAI,OAAO,IAAI;AACf;;AAEA;AACA,EAAE,QAAQ,CAAC,SAAS,CAAC,aAAa,GAAG,aAAa;AAClD,EAAE,cAAc,CAAC,SAAS,CAAC,aAAa,GAAG,aAAa;;AAExD;AACA,EAAE,WAAW,CAAC,SAAS,CAAC,aAAa,GAAG,WAAW;AACnD,IAAI,OAAO,aAAa,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;AACrC,GAAG;;AAEH,CAAC,GAAG;;ACzDJ,CAAC,WAAW;AACZ,EAAE,SAAS,iBAAiB,GAAG;AAC/B,IAAI,QAAQ,CAAC,gBAAgB,CAAC,iEAAiE,CAAC,CAAC,aAAa,EAAE;AAChH;;AAEA,EAAE,IAAI,OAAO,KAAK,KAAK,WAAW,EAAE;AACpC,IAAI,gBAAgB,CAAC,YAAY,EAAE,MAAM,iBAAiB,EAAE;AAC5D,IAAI,gBAAgB,CAAC,kBAAkB,EAAE,MAAM,iBAAiB,EAAE;AAClE,GAAG,MAAM;AACT,IAAI,gBAAgB,CAAC,MAAM,EAAE,MAAM,iBAAiB,EAAE;AACtD;AACA,CAAC,GAAG"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":["../../../javascript/openseadragon-rails/dom.js","../../../javascript/openseadragon-rails/rails.js"],"sourcesContent":["import OpenSeadragon from 'openseadragon'\n\n(function() {\n let __osd_counter = 0;\n\n function generateOsdId() {\n __osd_counter++;\n return \"Openseadragon\" + __osd_counter;\n }\n\n function openseadragon() {\n this.forEach(function(picture) {\n // Ensure the element is an HTMLElement\n if (!(picture instanceof HTMLElement)) return;\n\n picture.classList.add('openseadragon-viewer');\n\n // Set ID if it doesn't exist\n if (!picture.id) {\n picture.id = generateOsdId();\n }\n\n // Retrieve openseadragon data attribute as JSON\n const collectionOptions = picture.dataset.openseadragon\n ? JSON.parse(picture.dataset.openseadragon)\n : {};\n\n // Find all <source> elements with media=\"openseadragon\"\n const sources = Array.from(picture.querySelectorAll('source[media=\"openseadragon\"]'));\n\n const tileSources = sources.map(source => {\n const osdData = source.dataset.openseadragon;\n return osdData ? JSON.parse(osdData) : source.getAttribute('src');\n });\n\n // Preserve height of the picture\n const height = window.getComputedStyle(picture).height;\n picture.style.height = height;\n\n // Initialize OpenSeadragon\n picture.osdViewer = OpenSeadragon({\n id: picture.id,\n ...collectionOptions,\n tileSources: tileSources\n });\n });\n\n return this;\n }\n\n // Attach the function to NodeList and HTMLElement prototypes for convenience\n NodeList.prototype.openseadragon = openseadragon;\n HTMLCollection.prototype.openseadragon = openseadragon;\n\n // For a single HTMLElement\n HTMLElement.prototype.openseadragon = function() {\n return openseadragon.call([this]);\n };\n\n})();\n","import './dom'\n\n(function() {\n function initOpenSeadragon() {\n document.querySelectorAll('picture[data-openseadragon]:not(:has(.openseadragon-container))').openseadragon();\n }\n\n if (typeof Turbo !== 'undefined') {\n addEventListener(\"turbo:load\", () => initOpenSeadragon())\n addEventListener(\"turbo:frame-load\", () => initOpenSeadragon())\n } else {\n addEventListener('load', () => initOpenSeadragon())\n }\n})();\n"],"names":[],"mappings":";;;;;;EAEA,CAAC,WAAW;EACZ,EAAE,IAAI,aAAa,GAAG,CAAC;;EAEvB,EAAE,SAAS,aAAa,GAAG;EAC3B,IAAI,aAAa,EAAE;EACnB,IAAI,OAAO,eAAe,GAAG,aAAa;EAC1C;;EAEA,EAAE,SAAS,aAAa,GAAG;EAC3B,IAAI,IAAI,CAAC,OAAO,CAAC,SAAS,OAAO,EAAE;EACnC;EACA,MAAM,IAAI,EAAE,OAAO,YAAY,WAAW,CAAC,EAAE;;EAE7C,MAAM,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,sBAAsB,CAAC;;EA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