@annotorious/svelte 3.0.0-rc.9 → 3.0.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 (43) hide show
  1. package/dist/MouseOverTooltip.svelte.d.ts +1 -1
  2. package/dist/annotorious-svelte.es.js +17 -14
  3. package/dist/annotorious-svelte.es.js.map +1 -1
  4. package/dist/annotorious-svelte.es10.js +2 -122
  5. package/dist/annotorious-svelte.es10.js.map +1 -1
  6. package/dist/annotorious-svelte.es11.js +2 -2
  7. package/dist/annotorious-svelte.es11.js.map +1 -1
  8. package/dist/annotorious-svelte.es12.js +101 -15
  9. package/dist/annotorious-svelte.es12.js.map +1 -1
  10. package/dist/annotorious-svelte.es14.js +54 -7
  11. package/dist/annotorious-svelte.es14.js.map +1 -1
  12. package/dist/annotorious-svelte.es2.js +30 -25
  13. package/dist/annotorious-svelte.es2.js.map +1 -1
  14. package/dist/annotorious-svelte.es3.js +114 -2
  15. package/dist/annotorious-svelte.es3.js.map +1 -1
  16. package/dist/annotorious-svelte.es4.js +127 -9
  17. package/dist/annotorious-svelte.es4.js.map +1 -1
  18. package/dist/annotorious-svelte.es5.js +66 -1264
  19. package/dist/annotorious-svelte.es5.js.map +1 -1
  20. package/dist/annotorious-svelte.es6.js +37 -105
  21. package/dist/annotorious-svelte.es6.js.map +1 -1
  22. package/dist/annotorious-svelte.es7.js +24 -118
  23. package/dist/annotorious-svelte.es7.js.map +1 -1
  24. package/dist/annotorious-svelte.es8.js +17 -307
  25. package/dist/annotorious-svelte.es8.js.map +1 -1
  26. package/dist/annotorious-svelte.es9.js +89 -22133
  27. package/dist/annotorious-svelte.es9.js.map +1 -1
  28. package/dist/index.d.ts +9 -11
  29. package/dist/osd/OpenSeadragonAnnotator.svelte.d.ts +1 -1
  30. package/dist/osd/OpenSeadragonPopup.svelte.d.ts +1 -1
  31. package/dist/osd/index.d.ts +0 -1
  32. package/package.json +20 -14
  33. package/src/index.ts +42 -22
  34. package/src/osd/OpenSeadragonAnnotator.svelte +2 -2
  35. package/tsconfig.json +2 -3
  36. package/vite.config.js +8 -5
  37. package/dist/annotorious-svelte.es13.js +0 -7
  38. package/dist/annotorious-svelte.es13.js.map +0 -1
  39. package/dist/annotorious-svelte.es15.js +0 -10
  40. package/dist/annotorious-svelte.es15.js.map +0 -1
  41. package/dist/index.d.ts.map +0 -1
  42. package/dist/osd/index.d.ts.map +0 -1
  43. /package/dist/{style.css → annotorious-svelte.css} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"annotorious-svelte.es6.js","sources":["../src/osd/OpenSeadragonAnnotator.svelte"],"sourcesContent":["<script lang=\"ts\">\n import { setContext } from 'svelte';\n import { SvelteAnnotator, SvelteAnnotatorState, toSvelteStore } from '@annotorious/core';\n import { createOSDAnnotator, ImageAnnotation } from '@annotorious/openseadragon';\n import type OpenSeadragon from 'openseadragon';\n\n /** props **/\n export let viewer: OpenSeadragon.Viewer;\n export let opts = {};\n export let anno: SvelteAnnotator<ImageAnnotation> = undefined;\n\n $: init(viewer);\n\n const init = (viewer: OpenSeadragon.Viewer) => {\n if (viewer) {\n const annotator = createOSDAnnotator(viewer, opts);\n\n // Wrap the store for Svelte reactivity\n const svelteStore = toSvelteStore(annotator.state.store);\n\n const shim = {\n ...annotator,\n state: {\n ...annotator.state,\n store: svelteStore\n } as SvelteAnnotatorState<ImageAnnotation>\n } as SvelteAnnotator<ImageAnnotation>\n\n setContext('anno', shim);\n setContext('viewer', viewer);\n\n anno = shim;\n }\n }\n</script>\n\n{#if viewer}\n <slot />\n{/if}\n"],"names":["ctx","create_if_block","viewer","$$props","opts","anno","init","annotator","createOSDAnnotator","svelteStore","toSvelteStore","shim","setContext","$$invalidate"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAoCKA,EAAM,CAAA,KAAAC,EAAAD,CAAA;AAAA;;;;;;;;;;MAANA,EAAM,CAAA;;;;;;;;;;;;;;;;;6CA7BE,QAAAE,EAA4B,IAAAC,KAC5B,MAAAC,IAAI,GAAA,IAAAD,GACJ,EAAA,MAAAE,IAAyC,OAAS,IAAAF;AAIvD,QAAAG,IAAQ,CAAAJ,MAA4B;QACpCA,GAAM;AACF,YAAAK,IAAYC,EAAmBN,GAAQE,CAAI,GAG3CK,IAAcC,EAAcH,EAAU,MAAM,KAAK,GAEjDI,IAAI;AAAA,WACLJ;AAAA,QACH,YACKA,EAAU,OACb,OAAOE,EAAA;AAAA;AAIX,MAAAG,EAAW,QAAQD,CAAI,GACvBC,EAAW,UAAUV,CAAM,GAE3BW,EAAA,GAAAR,IAAOM,CAAI;AAAA;;;;;;SApBZL,EAAKJ,CAAM;AAAA;;;;;;;;"}
1
+ {"version":3,"file":"annotorious-svelte.es6.js","sources":["../../../node_modules/svelte/src/runtime/internal/dom.js"],"sourcesContent":["import { contenteditable_truthy_values, has_prop } from './utils.js';\n\nimport { ResizeObserverSingleton } from './ResizeObserverSingleton.js';\n\n// Track which nodes are claimed during hydration. Unclaimed nodes can then be removed from the DOM\n// at the end of hydration without touching the remaining nodes.\nlet is_hydrating = false;\n\n/**\n * @returns {void}\n */\nexport function start_hydrating() {\n\tis_hydrating = true;\n}\n\n/**\n * @returns {void}\n */\nexport function end_hydrating() {\n\tis_hydrating = false;\n}\n\n/**\n * @param {number} low\n * @param {number} high\n * @param {(index: number) => number} key\n * @param {number} value\n * @returns {number}\n */\nfunction upper_bound(low, high, key, value) {\n\t// Return first index of value larger than input value in the range [low, high)\n\twhile (low < high) {\n\t\tconst mid = low + ((high - low) >> 1);\n\t\tif (key(mid) <= value) {\n\t\t\tlow = mid + 1;\n\t\t} else {\n\t\t\thigh = mid;\n\t\t}\n\t}\n\treturn low;\n}\n\n/**\n * @param {NodeEx} target\n * @returns {void}\n */\nfunction init_hydrate(target) {\n\tif (target.hydrate_init) return;\n\ttarget.hydrate_init = true;\n\t// We know that all children have claim_order values since the unclaimed have been detached if target is not <head>\n\n\tlet children = /** @type {ArrayLike<NodeEx2>} */ (target.childNodes);\n\t// If target is <head>, there may be children without claim_order\n\tif (target.nodeName === 'HEAD') {\n\t\tconst my_children = [];\n\t\tfor (let i = 0; i < children.length; i++) {\n\t\t\tconst node = children[i];\n\t\t\tif (node.claim_order !== undefined) {\n\t\t\t\tmy_children.push(node);\n\t\t\t}\n\t\t}\n\t\tchildren = my_children;\n\t}\n\t/*\n\t * Reorder claimed children optimally.\n\t * We can reorder claimed children optimally by finding the longest subsequence of\n\t * nodes that are already claimed in order and only moving the rest. The longest\n\t * subsequence of nodes that are claimed in order can be found by\n\t * computing the longest increasing subsequence of .claim_order values.\n\t *\n\t * This algorithm is optimal in generating the least amount of reorder operations\n\t * possible.\n\t *\n\t * Proof:\n\t * We know that, given a set of reordering operations, the nodes that do not move\n\t * always form an increasing subsequence, since they do not move among each other\n\t * meaning that they must be already ordered among each other. Thus, the maximal\n\t * set of nodes that do not move form a longest increasing subsequence.\n\t */\n\t// Compute longest increasing subsequence\n\t// m: subsequence length j => index k of smallest value that ends an increasing subsequence of length j\n\tconst m = new Int32Array(children.length + 1);\n\t// Predecessor indices + 1\n\tconst p = new Int32Array(children.length);\n\tm[0] = -1;\n\tlet longest = 0;\n\tfor (let i = 0; i < children.length; i++) {\n\t\tconst current = children[i].claim_order;\n\t\t// Find the largest subsequence length such that it ends in a value less than our current value\n\t\t// upper_bound returns first greater value, so we subtract one\n\t\t// with fast path for when we are on the current longest subsequence\n\t\tconst seq_len =\n\t\t\t(longest > 0 && children[m[longest]].claim_order <= current\n\t\t\t\t? longest + 1\n\t\t\t\t: upper_bound(1, longest, (idx) => children[m[idx]].claim_order, current)) - 1;\n\t\tp[i] = m[seq_len] + 1;\n\t\tconst new_len = seq_len + 1;\n\t\t// We can guarantee that current is the smallest value. Otherwise, we would have generated a longer sequence.\n\t\tm[new_len] = i;\n\t\tlongest = Math.max(new_len, longest);\n\t}\n\t// The longest increasing subsequence of nodes (initially reversed)\n\n\t/**\n\t * @type {NodeEx2[]}\n\t */\n\tconst lis = [];\n\t// The rest of the nodes, nodes that will be moved\n\n\t/**\n\t * @type {NodeEx2[]}\n\t */\n\tconst to_move = [];\n\tlet last = children.length - 1;\n\tfor (let cur = m[longest] + 1; cur != 0; cur = p[cur - 1]) {\n\t\tlis.push(children[cur - 1]);\n\t\tfor (; last >= cur; last--) {\n\t\t\tto_move.push(children[last]);\n\t\t}\n\t\tlast--;\n\t}\n\tfor (; last >= 0; last--) {\n\t\tto_move.push(children[last]);\n\t}\n\tlis.reverse();\n\t// We sort the nodes being moved to guarantee that their insertion order matches the claim order\n\tto_move.sort((a, b) => a.claim_order - b.claim_order);\n\t// Finally, we move the nodes\n\tfor (let i = 0, j = 0; i < to_move.length; i++) {\n\t\twhile (j < lis.length && to_move[i].claim_order >= lis[j].claim_order) {\n\t\t\tj++;\n\t\t}\n\t\tconst anchor = j < lis.length ? lis[j] : null;\n\t\ttarget.insertBefore(to_move[i], anchor);\n\t}\n}\n\n/**\n * @param {Node} target\n * @param {Node} node\n * @returns {void}\n */\nexport function append(target, node) {\n\ttarget.appendChild(node);\n}\n\n/**\n * @param {Node} target\n * @param {string} style_sheet_id\n * @param {string} styles\n * @returns {void}\n */\nexport function append_styles(target, style_sheet_id, styles) {\n\tconst append_styles_to = get_root_for_style(target);\n\tif (!append_styles_to.getElementById(style_sheet_id)) {\n\t\tconst style = element('style');\n\t\tstyle.id = style_sheet_id;\n\t\tstyle.textContent = styles;\n\t\tappend_stylesheet(append_styles_to, style);\n\t}\n}\n\n/**\n * @param {Node} node\n * @returns {ShadowRoot | Document}\n */\nexport function get_root_for_style(node) {\n\tif (!node) return document;\n\tconst root = node.getRootNode ? node.getRootNode() : node.ownerDocument;\n\tif (root && /** @type {ShadowRoot} */ (root).host) {\n\t\treturn /** @type {ShadowRoot} */ (root);\n\t}\n\treturn node.ownerDocument;\n}\n\n/**\n * @param {Node} node\n * @returns {CSSStyleSheet}\n */\nexport function append_empty_stylesheet(node) {\n\tconst style_element = element('style');\n\t// For transitions to work without 'style-src: unsafe-inline' Content Security Policy,\n\t// these empty tags need to be allowed with a hash as a workaround until we move to the Web Animations API.\n\t// Using the hash for the empty string (for an empty tag) works in all browsers except Safari.\n\t// So as a workaround for the workaround, when we append empty style tags we set their content to /* empty */.\n\t// The hash 'sha256-9OlNO0DNEeaVzHL4RZwCLsBHA8WBQ8toBp/4F5XV2nc=' will then work even in Safari.\n\tstyle_element.textContent = '/* empty */';\n\tappend_stylesheet(get_root_for_style(node), style_element);\n\treturn style_element.sheet;\n}\n\n/**\n * @param {ShadowRoot | Document} node\n * @param {HTMLStyleElement} style\n * @returns {CSSStyleSheet}\n */\nfunction append_stylesheet(node, style) {\n\tappend(/** @type {Document} */ (node).head || node, style);\n\treturn style.sheet;\n}\n\n/**\n * @param {NodeEx} target\n * @param {NodeEx} node\n * @returns {void}\n */\nexport function append_hydration(target, node) {\n\tif (is_hydrating) {\n\t\tinit_hydrate(target);\n\t\tif (\n\t\t\ttarget.actual_end_child === undefined ||\n\t\t\t(target.actual_end_child !== null && target.actual_end_child.parentNode !== target)\n\t\t) {\n\t\t\ttarget.actual_end_child = target.firstChild;\n\t\t}\n\t\t// Skip nodes of undefined ordering\n\t\twhile (target.actual_end_child !== null && target.actual_end_child.claim_order === undefined) {\n\t\t\ttarget.actual_end_child = target.actual_end_child.nextSibling;\n\t\t}\n\t\tif (node !== target.actual_end_child) {\n\t\t\t// We only insert if the ordering of this node should be modified or the parent node is not target\n\t\t\tif (node.claim_order !== undefined || node.parentNode !== target) {\n\t\t\t\ttarget.insertBefore(node, target.actual_end_child);\n\t\t\t}\n\t\t} else {\n\t\t\ttarget.actual_end_child = node.nextSibling;\n\t\t}\n\t} else if (node.parentNode !== target || node.nextSibling !== null) {\n\t\ttarget.appendChild(node);\n\t}\n}\n\n/**\n * @param {Node} target\n * @param {Node} node\n * @param {Node} [anchor]\n * @returns {void}\n */\nexport function insert(target, node, anchor) {\n\ttarget.insertBefore(node, anchor || null);\n}\n\n/**\n * @param {NodeEx} target\n * @param {NodeEx} node\n * @param {NodeEx} [anchor]\n * @returns {void}\n */\nexport function insert_hydration(target, node, anchor) {\n\tif (is_hydrating && !anchor) {\n\t\tappend_hydration(target, node);\n\t} else if (node.parentNode !== target || node.nextSibling != anchor) {\n\t\ttarget.insertBefore(node, anchor || null);\n\t}\n}\n\n/**\n * @param {Node} node\n * @returns {void}\n */\nexport function detach(node) {\n\tif (node.parentNode) {\n\t\tnode.parentNode.removeChild(node);\n\t}\n}\n\n/**\n * @returns {void} */\nexport function destroy_each(iterations, detaching) {\n\tfor (let i = 0; i < iterations.length; i += 1) {\n\t\tif (iterations[i]) iterations[i].d(detaching);\n\t}\n}\n\n/**\n * @template {keyof HTMLElementTagNameMap} K\n * @param {K} name\n * @returns {HTMLElementTagNameMap[K]}\n */\nexport function element(name) {\n\treturn document.createElement(name);\n}\n\n/**\n * @template {keyof HTMLElementTagNameMap} K\n * @param {K} name\n * @param {string} is\n * @returns {HTMLElementTagNameMap[K]}\n */\nexport function element_is(name, is) {\n\treturn document.createElement(name, { is });\n}\n\n/**\n * @template T\n * @template {keyof T} K\n * @param {T} obj\n * @param {K[]} exclude\n * @returns {Pick<T, Exclude<keyof T, K>>}\n */\nexport function object_without_properties(obj, exclude) {\n\tconst target = /** @type {Pick<T, Exclude<keyof T, K>>} */ ({});\n\tfor (const k in obj) {\n\t\tif (\n\t\t\thas_prop(obj, k) &&\n\t\t\t// @ts-ignore\n\t\t\texclude.indexOf(k) === -1\n\t\t) {\n\t\t\t// @ts-ignore\n\t\t\ttarget[k] = obj[k];\n\t\t}\n\t}\n\treturn target;\n}\n\n/**\n * @template {keyof SVGElementTagNameMap} K\n * @param {K} name\n * @returns {SVGElement}\n */\nexport function svg_element(name) {\n\treturn document.createElementNS('http://www.w3.org/2000/svg', name);\n}\n\n/**\n * @param {string} data\n * @returns {Text}\n */\nexport function text(data) {\n\treturn document.createTextNode(data);\n}\n\n/**\n * @returns {Text} */\nexport function space() {\n\treturn text(' ');\n}\n\n/**\n * @returns {Text} */\nexport function empty() {\n\treturn text('');\n}\n\n/**\n * @param {string} content\n * @returns {Comment}\n */\nexport function comment(content) {\n\treturn document.createComment(content);\n}\n\n/**\n * @param {EventTarget} node\n * @param {string} event\n * @param {EventListenerOrEventListenerObject} handler\n * @param {boolean | AddEventListenerOptions | EventListenerOptions} [options]\n * @returns {() => void}\n */\nexport function listen(node, event, handler, options) {\n\tnode.addEventListener(event, handler, options);\n\treturn () => node.removeEventListener(event, handler, options);\n}\n\n/**\n * @returns {(event: any) => any} */\nexport function prevent_default(fn) {\n\treturn function (event) {\n\t\tevent.preventDefault();\n\t\t// @ts-ignore\n\t\treturn fn.call(this, event);\n\t};\n}\n\n/**\n * @returns {(event: any) => any} */\nexport function stop_propagation(fn) {\n\treturn function (event) {\n\t\tevent.stopPropagation();\n\t\t// @ts-ignore\n\t\treturn fn.call(this, event);\n\t};\n}\n\n/**\n * @returns {(event: any) => any} */\nexport function stop_immediate_propagation(fn) {\n\treturn function (event) {\n\t\tevent.stopImmediatePropagation();\n\t\t// @ts-ignore\n\t\treturn fn.call(this, event);\n\t};\n}\n\n/**\n * @returns {(event: any) => void} */\nexport function self(fn) {\n\treturn function (event) {\n\t\t// @ts-ignore\n\t\tif (event.target === this) fn.call(this, event);\n\t};\n}\n\n/**\n * @returns {(event: any) => void} */\nexport function trusted(fn) {\n\treturn function (event) {\n\t\t// @ts-ignore\n\t\tif (event.isTrusted) fn.call(this, event);\n\t};\n}\n\n/**\n * @param {Element} node\n * @param {string} attribute\n * @param {string} [value]\n * @returns {void}\n */\nexport function attr(node, attribute, value) {\n\tif (value == null) node.removeAttribute(attribute);\n\telse if (node.getAttribute(attribute) !== value) node.setAttribute(attribute, value);\n}\n/**\n * List of attributes that should always be set through the attr method,\n * because updating them through the property setter doesn't work reliably.\n * In the example of `width`/`height`, the problem is that the setter only\n * accepts numeric values, but the attribute can also be set to a string like `50%`.\n * If this list becomes too big, rethink this approach.\n */\nconst always_set_through_set_attribute = ['width', 'height'];\n\n/**\n * @param {Element & ElementCSSInlineStyle} node\n * @param {{ [x: string]: string }} attributes\n * @returns {void}\n */\nexport function set_attributes(node, attributes) {\n\t// @ts-ignore\n\tconst descriptors = Object.getOwnPropertyDescriptors(node.__proto__);\n\tfor (const key in attributes) {\n\t\tif (attributes[key] == null) {\n\t\t\tnode.removeAttribute(key);\n\t\t} else if (key === 'style') {\n\t\t\tnode.style.cssText = attributes[key];\n\t\t} else if (key === '__value') {\n\t\t\t/** @type {any} */ (node).value = node[key] = attributes[key];\n\t\t} else if (\n\t\t\tdescriptors[key] &&\n\t\t\tdescriptors[key].set &&\n\t\t\talways_set_through_set_attribute.indexOf(key) === -1\n\t\t) {\n\t\t\tnode[key] = attributes[key];\n\t\t} else {\n\t\t\tattr(node, key, attributes[key]);\n\t\t}\n\t}\n}\n\n/**\n * @param {Element & ElementCSSInlineStyle} node\n * @param {{ [x: string]: string }} attributes\n * @returns {void}\n */\nexport function set_svg_attributes(node, attributes) {\n\tfor (const key in attributes) {\n\t\tattr(node, key, attributes[key]);\n\t}\n}\n\n/**\n * @param {Record<string, unknown>} data_map\n * @returns {void}\n */\nexport function set_custom_element_data_map(node, data_map) {\n\tObject.keys(data_map).forEach((key) => {\n\t\tset_custom_element_data(node, key, data_map[key]);\n\t});\n}\n\n/**\n * @returns {void} */\nexport function set_custom_element_data(node, prop, value) {\n\tconst lower = prop.toLowerCase(); // for backwards compatibility with existing behavior we do lowercase first\n\tif (lower in node) {\n\t\tnode[lower] = typeof node[lower] === 'boolean' && value === '' ? true : value;\n\t} else if (prop in node) {\n\t\tnode[prop] = typeof node[prop] === 'boolean' && value === '' ? true : value;\n\t} else {\n\t\tattr(node, prop, value);\n\t}\n}\n\n/**\n * @param {string} tag\n */\nexport function set_dynamic_element_data(tag) {\n\treturn /-/.test(tag) ? set_custom_element_data_map : set_attributes;\n}\n\n/**\n * @returns {void}\n */\nexport function xlink_attr(node, attribute, value) {\n\tnode.setAttributeNS('http://www.w3.org/1999/xlink', attribute, value);\n}\n\n/**\n * @param {HTMLElement} node\n * @returns {string}\n */\nexport function get_svelte_dataset(node) {\n\treturn node.dataset.svelteH;\n}\n\n/**\n * @returns {unknown[]} */\nexport function get_binding_group_value(group, __value, checked) {\n\tconst value = new Set();\n\tfor (let i = 0; i < group.length; i += 1) {\n\t\tif (group[i].checked) value.add(group[i].__value);\n\t}\n\tif (!checked) {\n\t\tvalue.delete(__value);\n\t}\n\treturn Array.from(value);\n}\n\n/**\n * @param {HTMLInputElement[]} group\n * @returns {{ p(...inputs: HTMLInputElement[]): void; r(): void; }}\n */\nexport function init_binding_group(group) {\n\t/**\n\t * @type {HTMLInputElement[]} */\n\tlet _inputs;\n\treturn {\n\t\t/* push */ p(...inputs) {\n\t\t\t_inputs = inputs;\n\t\t\t_inputs.forEach((input) => group.push(input));\n\t\t},\n\t\t/* remove */ r() {\n\t\t\t_inputs.forEach((input) => group.splice(group.indexOf(input), 1));\n\t\t}\n\t};\n}\n\n/**\n * @param {number[]} indexes\n * @returns {{ u(new_indexes: number[]): void; p(...inputs: HTMLInputElement[]): void; r: () => void; }}\n */\nexport function init_binding_group_dynamic(group, indexes) {\n\t/**\n\t * @type {HTMLInputElement[]} */\n\tlet _group = get_binding_group(group);\n\n\t/**\n\t * @type {HTMLInputElement[]} */\n\tlet _inputs;\n\n\tfunction get_binding_group(group) {\n\t\tfor (let i = 0; i < indexes.length; i++) {\n\t\t\tgroup = group[indexes[i]] = group[indexes[i]] || [];\n\t\t}\n\t\treturn group;\n\t}\n\n\t/**\n\t * @returns {void} */\n\tfunction push() {\n\t\t_inputs.forEach((input) => _group.push(input));\n\t}\n\n\t/**\n\t * @returns {void} */\n\tfunction remove() {\n\t\t_inputs.forEach((input) => _group.splice(_group.indexOf(input), 1));\n\t}\n\treturn {\n\t\t/* update */ u(new_indexes) {\n\t\t\tindexes = new_indexes;\n\t\t\tconst new_group = get_binding_group(group);\n\t\t\tif (new_group !== _group) {\n\t\t\t\tremove();\n\t\t\t\t_group = new_group;\n\t\t\t\tpush();\n\t\t\t}\n\t\t},\n\t\t/* push */ p(...inputs) {\n\t\t\t_inputs = inputs;\n\t\t\tpush();\n\t\t},\n\t\t/* remove */ r: remove\n\t};\n}\n\n/** @returns {number} */\nexport function to_number(value) {\n\treturn value === '' ? null : +value;\n}\n\n/** @returns {any[]} */\nexport function time_ranges_to_array(ranges) {\n\tconst array = [];\n\tfor (let i = 0; i < ranges.length; i += 1) {\n\t\tarray.push({ start: ranges.start(i), end: ranges.end(i) });\n\t}\n\treturn array;\n}\n\n/**\n * @param {Element} element\n * @returns {ChildNode[]}\n */\nexport function children(element) {\n\treturn Array.from(element.childNodes);\n}\n\n/**\n * @param {ChildNodeArray} nodes\n * @returns {void}\n */\nfunction init_claim_info(nodes) {\n\tif (nodes.claim_info === undefined) {\n\t\tnodes.claim_info = { last_index: 0, total_claimed: 0 };\n\t}\n}\n\n/**\n * @template {ChildNodeEx} R\n * @param {ChildNodeArray} nodes\n * @param {(node: ChildNodeEx) => node is R} predicate\n * @param {(node: ChildNodeEx) => ChildNodeEx | undefined} process_node\n * @param {() => R} create_node\n * @param {boolean} dont_update_last_index\n * @returns {R}\n */\nfunction claim_node(nodes, predicate, process_node, create_node, dont_update_last_index = false) {\n\t// Try to find nodes in an order such that we lengthen the longest increasing subsequence\n\tinit_claim_info(nodes);\n\tconst result_node = (() => {\n\t\t// We first try to find an element after the previous one\n\t\tfor (let i = nodes.claim_info.last_index; i < nodes.length; i++) {\n\t\t\tconst node = nodes[i];\n\t\t\tif (predicate(node)) {\n\t\t\t\tconst replacement = process_node(node);\n\t\t\t\tif (replacement === undefined) {\n\t\t\t\t\tnodes.splice(i, 1);\n\t\t\t\t} else {\n\t\t\t\t\tnodes[i] = replacement;\n\t\t\t\t}\n\t\t\t\tif (!dont_update_last_index) {\n\t\t\t\t\tnodes.claim_info.last_index = i;\n\t\t\t\t}\n\t\t\t\treturn node;\n\t\t\t}\n\t\t}\n\t\t// Otherwise, we try to find one before\n\t\t// We iterate in reverse so that we don't go too far back\n\t\tfor (let i = nodes.claim_info.last_index - 1; i >= 0; i--) {\n\t\t\tconst node = nodes[i];\n\t\t\tif (predicate(node)) {\n\t\t\t\tconst replacement = process_node(node);\n\t\t\t\tif (replacement === undefined) {\n\t\t\t\t\tnodes.splice(i, 1);\n\t\t\t\t} else {\n\t\t\t\t\tnodes[i] = replacement;\n\t\t\t\t}\n\t\t\t\tif (!dont_update_last_index) {\n\t\t\t\t\tnodes.claim_info.last_index = i;\n\t\t\t\t} else if (replacement === undefined) {\n\t\t\t\t\t// Since we spliced before the last_index, we decrease it\n\t\t\t\t\tnodes.claim_info.last_index--;\n\t\t\t\t}\n\t\t\t\treturn node;\n\t\t\t}\n\t\t}\n\t\t// If we can't find any matching node, we create a new one\n\t\treturn create_node();\n\t})();\n\tresult_node.claim_order = nodes.claim_info.total_claimed;\n\tnodes.claim_info.total_claimed += 1;\n\treturn result_node;\n}\n\n/**\n * @param {ChildNodeArray} nodes\n * @param {string} name\n * @param {{ [key: string]: boolean }} attributes\n * @param {(name: string) => Element | SVGElement} create_element\n * @returns {Element | SVGElement}\n */\nfunction claim_element_base(nodes, name, attributes, create_element) {\n\treturn claim_node(\n\t\tnodes,\n\t\t/** @returns {node is Element | SVGElement} */\n\t\t(node) => node.nodeName === name,\n\t\t/** @param {Element} node */\n\t\t(node) => {\n\t\t\tconst remove = [];\n\t\t\tfor (let j = 0; j < node.attributes.length; j++) {\n\t\t\t\tconst attribute = node.attributes[j];\n\t\t\t\tif (!attributes[attribute.name]) {\n\t\t\t\t\tremove.push(attribute.name);\n\t\t\t\t}\n\t\t\t}\n\t\t\tremove.forEach((v) => node.removeAttribute(v));\n\t\t\treturn undefined;\n\t\t},\n\t\t() => create_element(name)\n\t);\n}\n\n/**\n * @param {ChildNodeArray} nodes\n * @param {string} name\n * @param {{ [key: string]: boolean }} attributes\n * @returns {Element | SVGElement}\n */\nexport function claim_element(nodes, name, attributes) {\n\treturn claim_element_base(nodes, name, attributes, element);\n}\n\n/**\n * @param {ChildNodeArray} nodes\n * @param {string} name\n * @param {{ [key: string]: boolean }} attributes\n * @returns {Element | SVGElement}\n */\nexport function claim_svg_element(nodes, name, attributes) {\n\treturn claim_element_base(nodes, name, attributes, svg_element);\n}\n\n/**\n * @param {ChildNodeArray} nodes\n * @returns {Text}\n */\nexport function claim_text(nodes, data) {\n\treturn claim_node(\n\t\tnodes,\n\t\t/** @returns {node is Text} */\n\t\t(node) => node.nodeType === 3,\n\t\t/** @param {Text} node */\n\t\t(node) => {\n\t\t\tconst data_str = '' + data;\n\t\t\tif (node.data.startsWith(data_str)) {\n\t\t\t\tif (node.data.length !== data_str.length) {\n\t\t\t\t\treturn node.splitText(data_str.length);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tnode.data = data_str;\n\t\t\t}\n\t\t},\n\t\t() => text(data),\n\t\ttrue // Text nodes should not update last index since it is likely not worth it to eliminate an increasing subsequence of actual elements\n\t);\n}\n\n/**\n * @returns {Text} */\nexport function claim_space(nodes) {\n\treturn claim_text(nodes, ' ');\n}\n\n/**\n * @param {ChildNodeArray} nodes\n * @returns {Comment}\n */\nexport function claim_comment(nodes, data) {\n\treturn claim_node(\n\t\tnodes,\n\t\t/** @returns {node is Comment} */\n\t\t(node) => node.nodeType === 8,\n\t\t/** @param {Comment} node */\n\t\t(node) => {\n\t\t\tnode.data = '' + data;\n\t\t\treturn undefined;\n\t\t},\n\t\t() => comment(data),\n\t\ttrue\n\t);\n}\n\nfunction get_comment_idx(nodes, text, start) {\n\tfor (let i = start; i < nodes.length; i += 1) {\n\t\tconst node = nodes[i];\n\t\tif (node.nodeType === 8 /* comment node */ && node.textContent.trim() === text) {\n\t\t\treturn i;\n\t\t}\n\t}\n\treturn -1;\n}\n\n/**\n * @param {boolean} is_svg\n * @returns {HtmlTagHydration}\n */\nexport function claim_html_tag(nodes, is_svg) {\n\t// find html opening tag\n\tconst start_index = get_comment_idx(nodes, 'HTML_TAG_START', 0);\n\tconst end_index = get_comment_idx(nodes, 'HTML_TAG_END', start_index + 1);\n\tif (start_index === -1 || end_index === -1) {\n\t\treturn new HtmlTagHydration(is_svg);\n\t}\n\n\tinit_claim_info(nodes);\n\tconst html_tag_nodes = nodes.splice(start_index, end_index - start_index + 1);\n\tdetach(html_tag_nodes[0]);\n\tdetach(html_tag_nodes[html_tag_nodes.length - 1]);\n\tconst claimed_nodes = html_tag_nodes.slice(1, html_tag_nodes.length - 1);\n\tif (claimed_nodes.length === 0) {\n\t\treturn new HtmlTagHydration(is_svg);\n\t}\n\tfor (const n of claimed_nodes) {\n\t\tn.claim_order = nodes.claim_info.total_claimed;\n\t\tnodes.claim_info.total_claimed += 1;\n\t}\n\treturn new HtmlTagHydration(is_svg, claimed_nodes);\n}\n\n/**\n * @param {Text} text\n * @param {unknown} data\n * @returns {void}\n */\nexport function set_data(text, data) {\n\tdata = '' + data;\n\tif (text.data === data) return;\n\ttext.data = /** @type {string} */ (data);\n}\n\n/**\n * @param {Text} text\n * @param {unknown} data\n * @returns {void}\n */\nexport function set_data_contenteditable(text, data) {\n\tdata = '' + data;\n\tif (text.wholeText === data) return;\n\ttext.data = /** @type {string} */ (data);\n}\n\n/**\n * @param {Text} text\n * @param {unknown} data\n * @param {string} attr_value\n * @returns {void}\n */\nexport function set_data_maybe_contenteditable(text, data, attr_value) {\n\tif (~contenteditable_truthy_values.indexOf(attr_value)) {\n\t\tset_data_contenteditable(text, data);\n\t} else {\n\t\tset_data(text, data);\n\t}\n}\n\n/**\n * @returns {void} */\nexport function set_input_value(input, value) {\n\tinput.value = value == null ? '' : value;\n}\n\n/**\n * @returns {void} */\nexport function set_input_type(input, type) {\n\ttry {\n\t\tinput.type = type;\n\t} catch (e) {\n\t\t// do nothing\n\t}\n}\n\n/**\n * @returns {void} */\nexport function set_style(node, key, value, important) {\n\tif (value == null) {\n\t\tnode.style.removeProperty(key);\n\t} else {\n\t\tnode.style.setProperty(key, value, important ? 'important' : '');\n\t}\n}\n\n/**\n * @returns {void} */\nexport function select_option(select, value, mounting) {\n\tfor (let i = 0; i < select.options.length; i += 1) {\n\t\tconst option = select.options[i];\n\t\tif (option.__value === value) {\n\t\t\toption.selected = true;\n\t\t\treturn;\n\t\t}\n\t}\n\tif (!mounting || value !== undefined) {\n\t\tselect.selectedIndex = -1; // no option should be selected\n\t}\n}\n\n/**\n * @returns {void} */\nexport function select_options(select, value) {\n\tfor (let i = 0; i < select.options.length; i += 1) {\n\t\tconst option = select.options[i];\n\t\toption.selected = ~value.indexOf(option.__value);\n\t}\n}\n\nexport function select_value(select) {\n\tconst selected_option = select.querySelector(':checked');\n\treturn selected_option && selected_option.__value;\n}\n\nexport function select_multiple_value(select) {\n\treturn [].map.call(select.querySelectorAll(':checked'), (option) => option.__value);\n}\n// unfortunately this can't be a constant as that wouldn't be tree-shakeable\n// so we cache the result instead\n\n/**\n * @type {boolean} */\nlet crossorigin;\n\n/**\n * @returns {boolean} */\nexport function is_crossorigin() {\n\tif (crossorigin === undefined) {\n\t\tcrossorigin = false;\n\t\ttry {\n\t\t\tif (typeof window !== 'undefined' && window.parent) {\n\t\t\t\tvoid window.parent.document;\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tcrossorigin = true;\n\t\t}\n\t}\n\treturn crossorigin;\n}\n\n/**\n * @param {HTMLElement} node\n * @param {() => void} fn\n * @returns {() => void}\n */\nexport function add_iframe_resize_listener(node, fn) {\n\tconst computed_style = getComputedStyle(node);\n\tif (computed_style.position === 'static') {\n\t\tnode.style.position = 'relative';\n\t}\n\tconst iframe = element('iframe');\n\tiframe.setAttribute(\n\t\t'style',\n\t\t'display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%; ' +\n\t\t\t'overflow: hidden; border: 0; opacity: 0; pointer-events: none; z-index: -1;'\n\t);\n\tiframe.setAttribute('aria-hidden', 'true');\n\tiframe.tabIndex = -1;\n\tconst crossorigin = is_crossorigin();\n\n\t/**\n\t * @type {() => void}\n\t */\n\tlet unsubscribe;\n\tif (crossorigin) {\n\t\tiframe.src = \"data:text/html,<script>onresize=function(){parent.postMessage(0,'*')}</script>\";\n\t\tunsubscribe = listen(\n\t\t\twindow,\n\t\t\t'message',\n\t\t\t/** @param {MessageEvent} event */ (event) => {\n\t\t\t\tif (event.source === iframe.contentWindow) fn();\n\t\t\t}\n\t\t);\n\t} else {\n\t\tiframe.src = 'about:blank';\n\t\tiframe.onload = () => {\n\t\t\tunsubscribe = listen(iframe.contentWindow, 'resize', fn);\n\t\t\t// make sure an initial resize event is fired _after_ the iframe is loaded (which is asynchronous)\n\t\t\t// see https://github.com/sveltejs/svelte/issues/4233\n\t\t\tfn();\n\t\t};\n\t}\n\tappend(node, iframe);\n\treturn () => {\n\t\tif (crossorigin) {\n\t\t\tunsubscribe();\n\t\t} else if (unsubscribe && iframe.contentWindow) {\n\t\t\tunsubscribe();\n\t\t}\n\t\tdetach(iframe);\n\t};\n}\nexport const resize_observer_content_box = /* @__PURE__ */ new ResizeObserverSingleton({\n\tbox: 'content-box'\n});\nexport const resize_observer_border_box = /* @__PURE__ */ new ResizeObserverSingleton({\n\tbox: 'border-box'\n});\nexport const resize_observer_device_pixel_content_box = /* @__PURE__ */ new ResizeObserverSingleton(\n\t{ box: 'device-pixel-content-box' }\n);\nexport { ResizeObserverSingleton };\n\n/**\n * @returns {void} */\nexport function toggle_class(element, name, toggle) {\n\t// The `!!` is required because an `undefined` flag means flipping the current state.\n\telement.classList.toggle(name, !!toggle);\n}\n\n/**\n * @template T\n * @param {string} type\n * @param {T} [detail]\n * @param {{ bubbles?: boolean, cancelable?: boolean }} [options]\n * @returns {CustomEvent<T>}\n */\nexport function custom_event(type, detail, { bubbles = false, cancelable = false } = {}) {\n\treturn new CustomEvent(type, { detail, bubbles, cancelable });\n}\n\n/**\n * @param {string} selector\n * @param {HTMLElement} parent\n * @returns {ChildNodeArray}\n */\nexport function query_selector_all(selector, parent = document.body) {\n\treturn Array.from(parent.querySelectorAll(selector));\n}\n\n/**\n * @param {string} nodeId\n * @param {HTMLElement} head\n * @returns {any[]}\n */\nexport function head_selector(nodeId, head) {\n\tconst result = [];\n\tlet started = 0;\n\tfor (const node of head.childNodes) {\n\t\tif (node.nodeType === 8 /* comment node */) {\n\t\t\tconst comment = node.textContent.trim();\n\t\t\tif (comment === `HEAD_${nodeId}_END`) {\n\t\t\t\tstarted -= 1;\n\t\t\t\tresult.push(node);\n\t\t\t} else if (comment === `HEAD_${nodeId}_START`) {\n\t\t\t\tstarted += 1;\n\t\t\t\tresult.push(node);\n\t\t\t}\n\t\t} else if (started > 0) {\n\t\t\tresult.push(node);\n\t\t}\n\t}\n\treturn result;\n}\n/** */\nexport class HtmlTag {\n\t/**\n\t * @private\n\t * @default false\n\t */\n\tis_svg = false;\n\t/** parent for creating node */\n\te = undefined;\n\t/** html tag nodes */\n\tn = undefined;\n\t/** target */\n\tt = undefined;\n\t/** anchor */\n\ta = undefined;\n\tconstructor(is_svg = false) {\n\t\tthis.is_svg = is_svg;\n\t\tthis.e = this.n = null;\n\t}\n\n\t/**\n\t * @param {string} html\n\t * @returns {void}\n\t */\n\tc(html) {\n\t\tthis.h(html);\n\t}\n\n\t/**\n\t * @param {string} html\n\t * @param {HTMLElement | SVGElement} target\n\t * @param {HTMLElement | SVGElement} anchor\n\t * @returns {void}\n\t */\n\tm(html, target, anchor = null) {\n\t\tif (!this.e) {\n\t\t\tif (this.is_svg)\n\t\t\t\tthis.e = svg_element(/** @type {keyof SVGElementTagNameMap} */ (target.nodeName));\n\t\t\t/** #7364 target for <template> may be provided as #document-fragment(11) */ else\n\t\t\t\tthis.e = element(\n\t\t\t\t\t/** @type {keyof HTMLElementTagNameMap} */ (\n\t\t\t\t\t\ttarget.nodeType === 11 ? 'TEMPLATE' : target.nodeName\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\tthis.t =\n\t\t\t\ttarget.tagName !== 'TEMPLATE'\n\t\t\t\t\t? target\n\t\t\t\t\t: /** @type {HTMLTemplateElement} */ (target).content;\n\t\t\tthis.c(html);\n\t\t}\n\t\tthis.i(anchor);\n\t}\n\n\t/**\n\t * @param {string} html\n\t * @returns {void}\n\t */\n\th(html) {\n\t\tthis.e.innerHTML = html;\n\t\tthis.n = Array.from(\n\t\t\tthis.e.nodeName === 'TEMPLATE' ? this.e.content.childNodes : this.e.childNodes\n\t\t);\n\t}\n\n\t/**\n\t * @returns {void} */\n\ti(anchor) {\n\t\tfor (let i = 0; i < this.n.length; i += 1) {\n\t\t\tinsert(this.t, this.n[i], anchor);\n\t\t}\n\t}\n\n\t/**\n\t * @param {string} html\n\t * @returns {void}\n\t */\n\tp(html) {\n\t\tthis.d();\n\t\tthis.h(html);\n\t\tthis.i(this.a);\n\t}\n\n\t/**\n\t * @returns {void} */\n\td() {\n\t\tthis.n.forEach(detach);\n\t}\n}\n\nexport class HtmlTagHydration extends HtmlTag {\n\t/** @type {Element[]} hydration claimed nodes */\n\tl = undefined;\n\n\tconstructor(is_svg = false, claimed_nodes) {\n\t\tsuper(is_svg);\n\t\tthis.e = this.n = null;\n\t\tthis.l = claimed_nodes;\n\t}\n\n\t/**\n\t * @param {string} html\n\t * @returns {void}\n\t */\n\tc(html) {\n\t\tif (this.l) {\n\t\t\tthis.n = this.l;\n\t\t} else {\n\t\t\tsuper.c(html);\n\t\t}\n\t}\n\n\t/**\n\t * @returns {void} */\n\ti(anchor) {\n\t\tfor (let i = 0; i < this.n.length; i += 1) {\n\t\t\tinsert_hydration(this.t, this.n[i], anchor);\n\t\t}\n\t}\n}\n\n/**\n * @param {NamedNodeMap} attributes\n * @returns {{}}\n */\nexport function attribute_to_object(attributes) {\n\tconst result = {};\n\tfor (const attribute of attributes) {\n\t\tresult[attribute.name] = attribute.value;\n\t}\n\treturn result;\n}\n\nconst escaped = {\n\t'\"': '&quot;',\n\t'&': '&amp;',\n\t'<': '&lt;'\n};\n\nconst regex_attribute_characters_to_escape = /[\"&<]/g;\n\n/**\n * Note that the attribute itself should be surrounded in double quotes\n * @param {any} attribute\n */\nfunction escape_attribute(attribute) {\n\treturn String(attribute).replace(regex_attribute_characters_to_escape, (match) => escaped[match]);\n}\n\n/**\n * @param {Record<string, string>} attributes\n */\nexport function stringify_spread(attributes) {\n\tlet str = ' ';\n\tfor (const key in attributes) {\n\t\tif (attributes[key] != null) {\n\t\t\tstr += `${key}=\"${escape_attribute(attributes[key])}\" `;\n\t\t}\n\t}\n\n\treturn str;\n}\n\n/**\n * @param {HTMLElement} element\n * @returns {{}}\n */\nexport function get_custom_elements_slots(element) {\n\tconst result = {};\n\telement.childNodes.forEach(\n\t\t/** @param {Element} node */ (node) => {\n\t\t\tresult[node.slot || 'default'] = true;\n\t\t}\n\t);\n\treturn result;\n}\n\nexport function construct_svelte_component(component, props) {\n\treturn new component(props);\n}\n\n/**\n * @typedef {Node & {\n * \tclaim_order?: number;\n * \thydrate_init?: true;\n * \tactual_end_child?: NodeEx;\n * \tchildNodes: NodeListOf<NodeEx>;\n * }} NodeEx\n */\n\n/** @typedef {ChildNode & NodeEx} ChildNodeEx */\n\n/** @typedef {NodeEx & { claim_order: number }} NodeEx2 */\n\n/**\n * @typedef {ChildNodeEx[] & {\n * \tclaim_info?: {\n * \t\tlast_index: number;\n * \t\ttotal_claimed: number;\n * \t};\n * }} ChildNodeArray\n */\n"],"names":["append","target","node","insert","anchor","detach","element","name","text","data","empty","listen","event","handler","options","attr","attribute","value","children","set_data"],"mappings":"AA8IO,SAASA,EAAOC,GAAQC,GAAM;AACpC,EAAAD,EAAO,YAAYC,CAAI;AACxB;AA8FO,SAASC,EAAOF,GAAQC,GAAME,GAAQ;AAC5C,EAAAH,EAAO,aAAaC,GAAME,KAAU,IAAI;AACzC;AAoBO,SAASC,EAAOH,GAAM;AAC5B,EAAIA,EAAK,cACRA,EAAK,WAAW,YAAYA,CAAI;AAElC;AAeO,SAASI,EAAQC,GAAM;AAC7B,SAAO,SAAS,cAAcA,CAAI;AACnC;AA+CO,SAASC,EAAKC,GAAM;AAC1B,SAAO,SAAS,eAAeA,CAAI;AACpC;AAUO,SAASC,IAAQ;AACvB,SAAOF,EAAK,EAAE;AACf;AAiBO,SAASG,EAAOT,GAAMU,GAAOC,GAASC,GAAS;AACrD,SAAAZ,EAAK,iBAAiBU,GAAOC,GAASC,CAAO,GACtC,MAAMZ,EAAK,oBAAoBU,GAAOC,GAASC,CAAO;AAC9D;AAwDO,SAASC,EAAKb,GAAMc,GAAWC,GAAO;AAC5C,EAAIA,KAAS,OAAMf,EAAK,gBAAgBc,CAAS,IACxCd,EAAK,aAAac,CAAS,MAAMC,KAAOf,EAAK,aAAac,GAAWC,CAAK;AACpF;AAgMO,SAASC,EAASZ,GAAS;AACjC,SAAO,MAAM,KAAKA,EAAQ,UAAU;AACrC;AAiNO,SAASa,EAASX,GAAMC,GAAM;AAEpC,EADAA,IAAO,KAAKA,GACRD,EAAK,SAASC,MAClBD,EAAK;AAAA,EAA8BC;AACpC;","x_google_ignoreList":[0]}
@@ -1,126 +1,32 @@
1
- import { SvelteComponent as H, init as I, safe_not_equal as T, empty as X, insert as P, noop as v, detach as S, component_subscribe as Y, onMount as q, element as x, text as G, attr as L, append as R, action_destroyer as U, listen as _, set_data as z, is_function as B, run_all as F } from "./annotorious-svelte.es8.js";
2
- import { draggable as J } from "./annotorious-svelte.es10.js";
3
- import b from "openseadragon";
4
- import "./annotorious-svelte.es11.js";
5
- function w(n) {
6
- let o, e = (
7
- /*$selection*/
8
- n[0].selected.map(y).join(", ") + ""
9
- ), t, s, a, d;
10
- return {
11
- c() {
12
- o = x("div"), t = G(e), L(o, "class", "a9s-popup a9s-osd-popup svelte-1xuxeat");
13
- },
14
- m(r, l) {
15
- P(r, o, l), R(o, t), a || (d = [
16
- U(s = J.call(null, o, {
17
- position: { x: (
18
- /*left*/
19
- n[1]
20
- ), y: (
21
- /*top*/
22
- n[2]
23
- ) }
24
- })),
25
- _(
26
- o,
27
- "neodrag:start",
28
- /*onDragStart*/
29
- n[4]
30
- ),
31
- _(
32
- o,
33
- "neodrag:end",
34
- /*onDragEnd*/
35
- n[5]
36
- )
37
- ], a = !0);
38
- },
39
- p(r, l) {
40
- l & /*$selection*/
41
- 1 && e !== (e = /*$selection*/
42
- r[0].selected.map(y).join(", ") + "") && z(t, e), s && B(s.update) && l & /*left, top*/
43
- 6 && s.update.call(null, {
44
- position: { x: (
45
- /*left*/
46
- r[1]
47
- ), y: (
48
- /*top*/
49
- r[2]
50
- ) }
51
- });
52
- },
53
- d(r) {
54
- r && S(o), a = !1, F(d);
55
- }
1
+ import { run_all as u } from "./annotorious-svelte.es5.js";
2
+ const r = /* @__PURE__ */ new Set();
3
+ let i;
4
+ function s() {
5
+ i = {
6
+ r: 0,
7
+ c: [],
8
+ p: i
9
+ // parent group
56
10
  };
57
11
  }
58
- function K(n) {
59
- let o, e = (
60
- /*$selection*/
61
- n[0] && w(n)
62
- );
63
- return {
64
- c() {
65
- e && e.c(), o = X();
66
- },
67
- m(t, s) {
68
- e && e.m(t, s), P(t, o, s);
69
- },
70
- p(t, [s]) {
71
- /*$selection*/
72
- t[0] ? e ? e.p(t, s) : (e = w(t), e.c(), e.m(o.parentNode, o)) : e && (e.d(1), e = null);
73
- },
74
- i: v,
75
- o: v,
76
- d(t) {
77
- e && e.d(t), t && S(o);
78
- }
79
- };
12
+ function p() {
13
+ i.r || u(i.c), i = i.p;
80
14
  }
81
- const y = (n) => n.id;
82
- function Q(n, o, e) {
83
- let t, { state: s } = o, { viewer: a } = o, d, r, l = !1, c;
84
- const { selection: m, store: u } = s;
85
- Y(n, m, (i) => e(0, t = i));
86
- const g = (i) => {
87
- var p;
88
- return ((p = i.selected) == null ? void 0 : p.length) > 0;
89
- }, E = () => {
90
- l = !0, a.setMouseNavEnabled(!1);
91
- }, D = () => {
92
- a.setMouseNavEnabled(!0);
93
- }, N = () => {
94
- c && u.unobserve(c), g(t) && (l = !1, f(t), c = (i) => {
95
- l || f(t);
96
- }, u.observe(c, {
97
- annotations: t.selected.map((i) => i.id)
98
- }));
99
- }, f = (i) => {
100
- const p = i.selected[0].id, h = u.getAnnotation(p), { minX: k, minY: A, maxX: C, maxY: M } = h.target.selector.geometry.bounds, O = 14, V = a.viewport.imageToViewerElementCoordinates(new b.Point(k, A)), j = a.viewport.imageToViewerElementCoordinates(new b.Point(C, M));
101
- e(1, d = j.x + O), e(2, r = V.y);
102
- };
103
- return q(() => {
104
- const i = () => {
105
- g(t) && !l && f(t);
106
- };
107
- return a.addHandler("update-viewport", i), () => {
108
- a.removeHandler("update-viewport", i);
109
- };
110
- }), n.$$set = (i) => {
111
- "state" in i && e(6, s = i.state), "viewer" in i && e(7, a = i.viewer);
112
- }, n.$$.update = () => {
113
- n.$$.dirty & /*$selection*/
114
- 1 && N();
115
- }, [t, d, r, m, E, D, s, a];
15
+ function d(t, e) {
16
+ t && t.i && (r.delete(t), t.i(e));
116
17
  }
117
- class W extends H {
118
- constructor(o) {
119
- super(), I(this, o, Q, K, T, { state: 6, viewer: 7 });
120
- }
18
+ function _(t, e, o, n) {
19
+ if (t && t.o) {
20
+ if (r.has(t)) return;
21
+ r.add(t), i.c.push(() => {
22
+ r.delete(t), n && (o && t.d(1), n());
23
+ }), t.o(e);
24
+ } else n && n();
121
25
  }
122
- const oe = W;
123
26
  export {
124
- oe as default
27
+ p as check_outros,
28
+ s as group_outros,
29
+ d as transition_in,
30
+ _ as transition_out
125
31
  };
126
32
  //# sourceMappingURL=annotorious-svelte.es7.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"annotorious-svelte.es7.js","sources":["../src/osd/OpenSeadragonPopup.svelte"],"sourcesContent":["<script lang=\"ts\">\n import { onMount } from 'svelte';\n import { draggable } from '@neodrag/svelte';\n import OpenSeadragon from 'openseadragon';\n import type { Selection, StoreChangeEvent, SvelteAnnotatorState } from '@annotorious/core';\n import type { ImageAnnotation } from '@annotorious/annotorious';\n\n export let state: SvelteAnnotatorState<ImageAnnotation>;\n\n export let viewer: OpenSeadragon.Viewer;\n\n let left: number;\n\n let top: number;\n\n let dragged = false;\n\n let storeObserver: (event: StoreChangeEvent<ImageAnnotation>) => void;\n\n const { selection, store } = state; \n\n const isSelected = (selection: Selection) => selection.selected?.length > 0;\n\n const onDragStart = () => {\n dragged = true;\n viewer.setMouseNavEnabled(false);\n }\n\n const onDragEnd = () => {\n viewer.setMouseNavEnabled(true);\n }\n\n $: $selection, onSelect();\n\n const onSelect = () => {\n if (storeObserver)\n store.unobserve(storeObserver);\n\n if (isSelected($selection)) {\n dragged = false;\n\n setPosition($selection);\n\n storeObserver = (event: StoreChangeEvent<ImageAnnotation>) => {\n if (!dragged)\n setPosition($selection);\n }\n\n store.observe(storeObserver, { annotations: $selection.selected.map(s => s.id) });\n }\n }\n\n const setPosition = (selection: Selection) => {\n // Note: this demo popup only supports a single selection\n const selectedId = selection.selected[0].id;\n const annotation = store.getAnnotation(selectedId);\n\n const { minX, minY, maxX, maxY } = annotation.target.selector.geometry.bounds;\n\n const PADDING = 14;\n\n const topLeft = viewer.viewport.imageToViewerElementCoordinates(new OpenSeadragon.Point(minX, minY));\n const bottomRight = viewer.viewport.imageToViewerElementCoordinates(new OpenSeadragon.Point(maxX, maxY));\n\n // [left, top] = defaultStrategy(annotation, lastPointerDown);\n left = bottomRight.x + PADDING;\n top = topLeft.y;\n }\n\n onMount(() => {\n const onUpdateViewport = () => {\n if (isSelected($selection) && !dragged)\n setPosition($selection);\n }\n\n viewer.addHandler('update-viewport', onUpdateViewport);\n\n return () => {\n viewer.removeHandler('update-viewport', onUpdateViewport);\n }\n });\n</script>\n\n{#if $selection}\n <div \n class=\"a9s-popup a9s-osd-popup\"\n use:draggable={{ position: { x: left, y: top }}}\n on:neodrag:start={onDragStart}\n on:neodrag:end={onDragEnd}>\n {$selection.selected.map(s => s.id).join(', ')}\n </div>\n{/if}\n\n<style>\n .a9s-osd-popup {\n background-color: #fff;\n border: 1px solid #a2a2a2;\n height: 250px;\n position: absolute;\n width: 400px;\n z-index: 1;\n }\n</style>"],"names":["t_value","ctx","func","insert","target","div","anchor","dirty","set_data","create_if_block","s","state","$$props","viewer","left","top","dragged","storeObserver","selection","store","isSelected","_a","onDragStart","onDragEnd","onSelect","$selection","setPosition","event","selectedId","annotation","minX","minY","maxX","maxY","PADDING","topLeft","OpenSeadragon","bottomRight","$$invalidate","onMount","onUpdateViewport"],"mappings":";;;;;SAyFKA;AAAA;AAAA,IAAAC,KAAW,SAAS,IAAeC,CAAA,EAAA,KAAK,IAAI,IAAA;AAAA;;;;;;AAL/C,MAAAC,EAMKC,GAAAC,GAAAC,CAAA;;UAJc,YAAY;AAAA;AAAA,YAAGL,EAAM,CAAA;AAAA,aAAA;AAAA;AAAA,YAAGA,EAAG,CAAA;AAAA,YAAA;AAAA;;;;;UAC1BA,EAAW,CAAA;AAAA,QAAA;AAAA;;;;UACbA,EAAS,CAAA;AAAA,QAAA;AAAA;;;AACxB,MAAAM;AAAA,MAAA,KAAAP,OAAAA;AAAA,MAAAC,KAAW,SAAS,IAAeC,CAAA,EAAA,KAAK,IAAI,IAAA,OAAAM,EAAA,GAAAR,CAAA;;QAH5B,YAAY;AAAA;AAAA,UAAGC,EAAM,CAAA;AAAA,WAAA;AAAA;AAAA,UAAGA,EAAG,CAAA;AAAA,UAAA;AAAA;;;;;;;;;;IAH3CA,EAAU,CAAA,KAAAQ,EAAAR,CAAA;AAAA;;;;;;;;;;MAAVA,EAAU,CAAA;;;;;;;;;UAMc,CAAAS,MAAKA,EAAE;;WAlFvB,OAAAC,EAA4C,IAAAC,KAE5C,QAAAC,EAA4B,IAAAD,GAEnCE,GAEAC,GAEAC,IAAU,IAEVC;UAEI,WAAAC,GAAW,OAAAC,EAAK,IAAKR;;QAEvBS,IAAc,CAAAF,MAAyB;;AAAA,aAAAG,IAAAH,EAAU,aAAV,gBAAAG,EAAoB,UAAS;AAAA,KAEpEC,IAAW,MAAA;AACf,IAAAN,IAAU,IACVH,EAAO,mBAAmB,EAAK;AAAA,KAG3BU,IAAS,MAAA;AACb,IAAAV,EAAO,mBAAmB,EAAI;AAAA,KAK1BW,IAAQ,MAAA;AACR,IAAAP,KACFE,EAAM,UAAUF,CAAa,GAE3BG,EAAWK,CAAU,MACvBT,IAAU,IAEVU,EAAYD,CAAU,GAEtBR,IAAiB,CAAAU,MAAwC;MAClDX,KACHU,EAAYD,CAAU;AAAA,OAG1BN,EAAM,QAAQF,GAAa;AAAA,MAAI,aAAaQ,EAAW,SAAS,IAAI,CAAAf,MAAKA,EAAE,EAAE;AAAA;KAI3EgB,IAAe,CAAAR,MAAoB;AAEjC,UAAAU,IAAaV,EAAU,SAAS,CAAC,EAAE,IACnCW,IAAaV,EAAM,cAAcS,CAAU,GAEzC,EAAA,MAAAE,GAAM,MAAAC,GAAM,MAAAC,GAAM,MAAAC,EAAI,IAAKJ,EAAW,OAAO,SAAS,SAAS,QAEjEK,IAAU,IAEVC,IAAUtB,EAAO,SAAS,gCAAoC,IAAAuB,EAAc,MAAMN,GAAMC,CAAI,CAAA,GAC5FM,IAAcxB,EAAO,SAAS,gCAAoC,IAAAuB,EAAc,MAAMJ,GAAMC,CAAI,CAAA;AAGtG,IAAAK,EAAA,GAAAxB,IAAOuB,EAAY,IAAIH,CAAO,QAC9BnB,IAAMoB,EAAQ,CAAC;AAAA;AAGjB,SAAAI,EAAO,MAAA;UACCC,IAAgB,MAAA;AAChB,MAAApB,EAAWK,CAAU,KAAA,CAAMT,KAC7BU,EAAYD,CAAU;AAAA;AAG1B,WAAAZ,EAAO,WAAW,mBAAmB2B,CAAgB;AAGnD,MAAA3B,EAAO,cAAc,mBAAmB2B,CAAgB;AAAA;;;;;SA9C7ChB,EAAQ;AAAA;;;;;;;;"}
1
+ {"version":3,"file":"annotorious-svelte.es7.js","sources":["../../../node_modules/svelte/src/runtime/internal/transitions.js"],"sourcesContent":["import { identity as linear, is_function, noop, run_all } from './utils.js';\nimport { now } from './environment.js';\nimport { loop } from './loop.js';\nimport { create_rule, delete_rule } from './style_manager.js';\nimport { custom_event } from './dom.js';\nimport { add_render_callback } from './scheduler.js';\n\n/**\n * @type {Promise<void> | null}\n */\nlet promise;\n\n/**\n * @returns {Promise<void>}\n */\nfunction wait() {\n\tif (!promise) {\n\t\tpromise = Promise.resolve();\n\t\tpromise.then(() => {\n\t\t\tpromise = null;\n\t\t});\n\t}\n\treturn promise;\n}\n\n/**\n * @param {Element} node\n * @param {INTRO | OUTRO | boolean} direction\n * @param {'start' | 'end'} kind\n * @returns {void}\n */\nfunction dispatch(node, direction, kind) {\n\tnode.dispatchEvent(custom_event(`${direction ? 'intro' : 'outro'}${kind}`));\n}\n\nconst outroing = new Set();\n\n/**\n * @type {Outro}\n */\nlet outros;\n\n/**\n * @returns {void} */\nexport function group_outros() {\n\toutros = {\n\t\tr: 0,\n\t\tc: [],\n\t\tp: outros // parent group\n\t};\n}\n\n/**\n * @returns {void} */\nexport function check_outros() {\n\tif (!outros.r) {\n\t\trun_all(outros.c);\n\t}\n\toutros = outros.p;\n}\n\n/**\n * @param {import('./private.js').Fragment} block\n * @param {0 | 1} [local]\n * @returns {void}\n */\nexport function transition_in(block, local) {\n\tif (block && block.i) {\n\t\toutroing.delete(block);\n\t\tblock.i(local);\n\t}\n}\n\n/**\n * @param {import('./private.js').Fragment} block\n * @param {0 | 1} local\n * @param {0 | 1} [detach]\n * @param {() => void} [callback]\n * @returns {void}\n */\nexport function transition_out(block, local, detach, callback) {\n\tif (block && block.o) {\n\t\tif (outroing.has(block)) return;\n\t\toutroing.add(block);\n\t\toutros.c.push(() => {\n\t\t\toutroing.delete(block);\n\t\t\tif (callback) {\n\t\t\t\tif (detach) block.d(1);\n\t\t\t\tcallback();\n\t\t\t}\n\t\t});\n\t\tblock.o(local);\n\t} else if (callback) {\n\t\tcallback();\n\t}\n}\n\n/**\n * @type {import('../transition/public.js').TransitionConfig}\n */\nconst null_transition = { duration: 0 };\n\n/**\n * @param {Element & ElementCSSInlineStyle} node\n * @param {TransitionFn} fn\n * @param {any} params\n * @returns {{ start(): void; invalidate(): void; end(): void; }}\n */\nexport function create_in_transition(node, fn, params) {\n\t/**\n\t * @type {TransitionOptions} */\n\tconst options = { direction: 'in' };\n\tlet config = fn(node, params, options);\n\tlet running = false;\n\tlet animation_name;\n\tlet task;\n\tlet uid = 0;\n\n\t/**\n\t * @returns {void} */\n\tfunction cleanup() {\n\t\tif (animation_name) delete_rule(node, animation_name);\n\t}\n\n\t/**\n\t * @returns {void} */\n\tfunction go() {\n\t\tconst {\n\t\t\tdelay = 0,\n\t\t\tduration = 300,\n\t\t\teasing = linear,\n\t\t\ttick = noop,\n\t\t\tcss\n\t\t} = config || null_transition;\n\t\tif (css) animation_name = create_rule(node, 0, 1, duration, delay, easing, css, uid++);\n\t\ttick(0, 1);\n\t\tconst start_time = now() + delay;\n\t\tconst end_time = start_time + duration;\n\t\tif (task) task.abort();\n\t\trunning = true;\n\t\tadd_render_callback(() => dispatch(node, true, 'start'));\n\t\ttask = loop((now) => {\n\t\t\tif (running) {\n\t\t\t\tif (now >= end_time) {\n\t\t\t\t\ttick(1, 0);\n\t\t\t\t\tdispatch(node, true, 'end');\n\t\t\t\t\tcleanup();\n\t\t\t\t\treturn (running = false);\n\t\t\t\t}\n\t\t\t\tif (now >= start_time) {\n\t\t\t\t\tconst t = easing((now - start_time) / duration);\n\t\t\t\t\ttick(t, 1 - t);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn running;\n\t\t});\n\t}\n\tlet started = false;\n\treturn {\n\t\tstart() {\n\t\t\tif (started) return;\n\t\t\tstarted = true;\n\t\t\tdelete_rule(node);\n\t\t\tif (is_function(config)) {\n\t\t\t\tconfig = config(options);\n\t\t\t\twait().then(go);\n\t\t\t} else {\n\t\t\t\tgo();\n\t\t\t}\n\t\t},\n\t\tinvalidate() {\n\t\t\tstarted = false;\n\t\t},\n\t\tend() {\n\t\t\tif (running) {\n\t\t\t\tcleanup();\n\t\t\t\trunning = false;\n\t\t\t}\n\t\t}\n\t};\n}\n\n/**\n * @param {Element & ElementCSSInlineStyle} node\n * @param {TransitionFn} fn\n * @param {any} params\n * @returns {{ end(reset: any): void; }}\n */\nexport function create_out_transition(node, fn, params) {\n\t/** @type {TransitionOptions} */\n\tconst options = { direction: 'out' };\n\tlet config = fn(node, params, options);\n\tlet running = true;\n\tlet animation_name;\n\tconst group = outros;\n\tgroup.r += 1;\n\t/** @type {boolean} */\n\tlet original_inert_value;\n\n\t/**\n\t * @returns {void} */\n\tfunction go() {\n\t\tconst {\n\t\t\tdelay = 0,\n\t\t\tduration = 300,\n\t\t\teasing = linear,\n\t\t\ttick = noop,\n\t\t\tcss\n\t\t} = config || null_transition;\n\n\t\tif (css) animation_name = create_rule(node, 1, 0, duration, delay, easing, css);\n\n\t\tconst start_time = now() + delay;\n\t\tconst end_time = start_time + duration;\n\t\tadd_render_callback(() => dispatch(node, false, 'start'));\n\n\t\tif ('inert' in node) {\n\t\t\toriginal_inert_value = /** @type {HTMLElement} */ (node).inert;\n\t\t\tnode.inert = true;\n\t\t}\n\n\t\tloop((now) => {\n\t\t\tif (running) {\n\t\t\t\tif (now >= end_time) {\n\t\t\t\t\ttick(0, 1);\n\t\t\t\t\tdispatch(node, false, 'end');\n\t\t\t\t\tif (!--group.r) {\n\t\t\t\t\t\t// this will result in `end()` being called,\n\t\t\t\t\t\t// so we don't need to clean up here\n\t\t\t\t\t\trun_all(group.c);\n\t\t\t\t\t}\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tif (now >= start_time) {\n\t\t\t\t\tconst t = easing((now - start_time) / duration);\n\t\t\t\t\ttick(1 - t, t);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn running;\n\t\t});\n\t}\n\n\tif (is_function(config)) {\n\t\twait().then(() => {\n\t\t\t// @ts-ignore\n\t\t\tconfig = config(options);\n\t\t\tgo();\n\t\t});\n\t} else {\n\t\tgo();\n\t}\n\n\treturn {\n\t\tend(reset) {\n\t\t\tif (reset && 'inert' in node) {\n\t\t\t\tnode.inert = original_inert_value;\n\t\t\t}\n\t\t\tif (reset && config.tick) {\n\t\t\t\tconfig.tick(1, 0);\n\t\t\t}\n\t\t\tif (running) {\n\t\t\t\tif (animation_name) delete_rule(node, animation_name);\n\t\t\t\trunning = false;\n\t\t\t}\n\t\t}\n\t};\n}\n\n/**\n * @param {Element & ElementCSSInlineStyle} node\n * @param {TransitionFn} fn\n * @param {any} params\n * @param {boolean} intro\n * @returns {{ run(b: 0 | 1): void; end(): void; }}\n */\nexport function create_bidirectional_transition(node, fn, params, intro) {\n\t/**\n\t * @type {TransitionOptions} */\n\tconst options = { direction: 'both' };\n\tlet config = fn(node, params, options);\n\tlet t = intro ? 0 : 1;\n\n\t/**\n\t * @type {Program | null} */\n\tlet running_program = null;\n\n\t/**\n\t * @type {PendingProgram | null} */\n\tlet pending_program = null;\n\tlet animation_name = null;\n\n\t/** @type {boolean} */\n\tlet original_inert_value;\n\n\t/**\n\t * @returns {void} */\n\tfunction clear_animation() {\n\t\tif (animation_name) delete_rule(node, animation_name);\n\t}\n\n\t/**\n\t * @param {PendingProgram} program\n\t * @param {number} duration\n\t * @returns {Program}\n\t */\n\tfunction init(program, duration) {\n\t\tconst d = /** @type {Program['d']} */ (program.b - t);\n\t\tduration *= Math.abs(d);\n\t\treturn {\n\t\t\ta: t,\n\t\t\tb: program.b,\n\t\t\td,\n\t\t\tduration,\n\t\t\tstart: program.start,\n\t\t\tend: program.start + duration,\n\t\t\tgroup: program.group\n\t\t};\n\t}\n\n\t/**\n\t * @param {INTRO | OUTRO} b\n\t * @returns {void}\n\t */\n\tfunction go(b) {\n\t\tconst {\n\t\t\tdelay = 0,\n\t\t\tduration = 300,\n\t\t\teasing = linear,\n\t\t\ttick = noop,\n\t\t\tcss\n\t\t} = config || null_transition;\n\n\t\t/**\n\t\t * @type {PendingProgram} */\n\t\tconst program = {\n\t\t\tstart: now() + delay,\n\t\t\tb\n\t\t};\n\n\t\tif (!b) {\n\t\t\t// @ts-ignore todo: improve typings\n\t\t\tprogram.group = outros;\n\t\t\toutros.r += 1;\n\t\t}\n\n\t\tif ('inert' in node) {\n\t\t\tif (b) {\n\t\t\t\tif (original_inert_value !== undefined) {\n\t\t\t\t\t// aborted/reversed outro — restore previous inert value\n\t\t\t\t\tnode.inert = original_inert_value;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\toriginal_inert_value = /** @type {HTMLElement} */ (node).inert;\n\t\t\t\tnode.inert = true;\n\t\t\t}\n\t\t}\n\n\t\tif (running_program || pending_program) {\n\t\t\tpending_program = program;\n\t\t} else {\n\t\t\t// if this is an intro, and there's a delay, we need to do\n\t\t\t// an initial tick and/or apply CSS animation immediately\n\t\t\tif (css) {\n\t\t\t\tclear_animation();\n\t\t\t\tanimation_name = create_rule(node, t, b, duration, delay, easing, css);\n\t\t\t}\n\t\t\tif (b) tick(0, 1);\n\t\t\trunning_program = init(program, duration);\n\t\t\tadd_render_callback(() => dispatch(node, b, 'start'));\n\t\t\tloop((now) => {\n\t\t\t\tif (pending_program && now > pending_program.start) {\n\t\t\t\t\trunning_program = init(pending_program, duration);\n\t\t\t\t\tpending_program = null;\n\t\t\t\t\tdispatch(node, running_program.b, 'start');\n\t\t\t\t\tif (css) {\n\t\t\t\t\t\tclear_animation();\n\t\t\t\t\t\tanimation_name = create_rule(\n\t\t\t\t\t\t\tnode,\n\t\t\t\t\t\t\tt,\n\t\t\t\t\t\t\trunning_program.b,\n\t\t\t\t\t\t\trunning_program.duration,\n\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\teasing,\n\t\t\t\t\t\t\tconfig.css\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (running_program) {\n\t\t\t\t\tif (now >= running_program.end) {\n\t\t\t\t\t\ttick((t = running_program.b), 1 - t);\n\t\t\t\t\t\tdispatch(node, running_program.b, 'end');\n\t\t\t\t\t\tif (!pending_program) {\n\t\t\t\t\t\t\t// we're done\n\t\t\t\t\t\t\tif (running_program.b) {\n\t\t\t\t\t\t\t\t// intro — we can tidy up immediately\n\t\t\t\t\t\t\t\tclear_animation();\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t// outro — needs to be coordinated\n\t\t\t\t\t\t\t\tif (!--running_program.group.r) run_all(running_program.group.c);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\trunning_program = null;\n\t\t\t\t\t} else if (now >= running_program.start) {\n\t\t\t\t\t\tconst p = now - running_program.start;\n\t\t\t\t\t\tt = running_program.a + running_program.d * easing(p / running_program.duration);\n\t\t\t\t\t\ttick(t, 1 - t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn !!(running_program || pending_program);\n\t\t\t});\n\t\t}\n\t}\n\treturn {\n\t\trun(b) {\n\t\t\tif (is_function(config)) {\n\t\t\t\twait().then(() => {\n\t\t\t\t\tconst opts = { direction: b ? 'in' : 'out' };\n\t\t\t\t\t// @ts-ignore\n\t\t\t\t\tconfig = config(opts);\n\t\t\t\t\tgo(b);\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tgo(b);\n\t\t\t}\n\t\t},\n\t\tend() {\n\t\t\tclear_animation();\n\t\t\trunning_program = pending_program = null;\n\t\t}\n\t};\n}\n\n/** @typedef {1} INTRO */\n/** @typedef {0} OUTRO */\n/** @typedef {{ direction: 'in' | 'out' | 'both' }} TransitionOptions */\n/** @typedef {(node: Element, params: any, options: TransitionOptions) => import('../transition/public.js').TransitionConfig} TransitionFn */\n\n/**\n * @typedef {Object} Outro\n * @property {number} r\n * @property {Function[]} c\n * @property {Object} p\n */\n\n/**\n * @typedef {Object} PendingProgram\n * @property {number} start\n * @property {INTRO|OUTRO} b\n * @property {Outro} [group]\n */\n\n/**\n * @typedef {Object} Program\n * @property {number} a\n * @property {INTRO|OUTRO} b\n * @property {1|-1} d\n * @property {number} duration\n * @property {number} start\n * @property {number} end\n * @property {Outro} [group]\n */\n"],"names":["outroing","outros","group_outros","check_outros","run_all","transition_in","block","local","transition_out","detach","callback"],"mappings":";AAmCA,MAAMA,IAAW,oBAAI;AAKrB,IAAIC;AAIG,SAASC,IAAe;AAC9B,EAAAD,IAAS;AAAA,IACR,GAAG;AAAA,IACH,GAAG,CAAE;AAAA,IACL,GAAGA;AAAA;AAAA,EACL;AACA;AAIO,SAASE,IAAe;AAC9B,EAAKF,EAAO,KACXG,EAAQH,EAAO,CAAC,GAEjBA,IAASA,EAAO;AACjB;AAOO,SAASI,EAAcC,GAAOC,GAAO;AAC3C,EAAID,KAASA,EAAM,MAClBN,EAAS,OAAOM,CAAK,GACrBA,EAAM,EAAEC,CAAK;AAEf;AASO,SAASC,EAAeF,GAAOC,GAAOE,GAAQC,GAAU;AAC9D,MAAIJ,KAASA,EAAM,GAAG;AACrB,QAAIN,EAAS,IAAIM,CAAK,EAAG;AACzB,IAAAN,EAAS,IAAIM,CAAK,GAClBL,EAAO,EAAE,KAAK,MAAM;AACnB,MAAAD,EAAS,OAAOM,CAAK,GACjBI,MACCD,KAAQH,EAAM,EAAE,CAAC,GACrBI;IAEJ,CAAG,GACDJ,EAAM,EAAEC,CAAK;AAAA,EACb,MAAM,CAAIG,KACVA;AAEF;","x_google_ignoreList":[0]}
@@ -1,316 +1,26 @@
1
- function g() {
1
+ let t;
2
+ function r(n) {
3
+ t = n;
2
4
  }
3
- function B(t, n) {
4
- for (const e in n)
5
- t[e] = n[e];
5
+ function o() {
6
+ if (!t) throw new Error("Function called outside component initialization");
6
7
  return t;
7
8
  }
8
- function S(t) {
9
- return t();
9
+ function u(n) {
10
+ o().$$.on_mount.push(n);
10
11
  }
11
- function N() {
12
- return /* @__PURE__ */ Object.create(null);
12
+ function c(n, e) {
13
+ return o().$$.context.set(n, e), e;
13
14
  }
14
- function p(t) {
15
- t.forEach(S);
16
- }
17
- function E(t) {
18
- return typeof t == "function";
19
- }
20
- function V(t, n) {
21
- return t != t ? n == n : t !== n || t && typeof t == "object" || typeof t == "function";
22
- }
23
- function F(t) {
24
- return Object.keys(t).length === 0;
25
- }
26
- function P(t, ...n) {
27
- if (t == null)
28
- return g;
29
- const e = t.subscribe(...n);
30
- return e.unsubscribe ? () => e.unsubscribe() : e;
31
- }
32
- function W(t, n, e) {
33
- t.$$.on_destroy.push(P(n, e));
34
- }
35
- function X(t, n, e, r) {
36
- if (t) {
37
- const o = L(t, n, e, r);
38
- return t[0](o);
39
- }
40
- }
41
- function L(t, n, e, r) {
42
- return t[1] && r ? B(e.ctx.slice(), t[1](r(n))) : e.ctx;
43
- }
44
- function Y(t, n, e, r) {
45
- if (t[2] && r) {
46
- const o = t[2](r(e));
47
- if (n.dirty === void 0)
48
- return o;
49
- if (typeof o == "object") {
50
- const c = [], i = Math.max(n.dirty.length, o.length);
51
- for (let s = 0; s < i; s += 1)
52
- c[s] = n.dirty[s] | o[s];
53
- return c;
54
- }
55
- return n.dirty | o;
56
- }
57
- return n.dirty;
58
- }
59
- function Z(t, n, e, r, o, c) {
60
- if (o) {
61
- const i = L(n, e, r, c);
62
- t.p(i, o);
63
- }
64
- }
65
- function tt(t) {
66
- if (t.ctx.length > 32) {
67
- const n = [], e = t.ctx.length / 32;
68
- for (let r = 0; r < e; r++)
69
- n[r] = -1;
70
- return n;
71
- }
72
- return -1;
73
- }
74
- function nt(t) {
75
- return t && E(t.destroy) ? t.destroy : g;
76
- }
77
- function et(t, n) {
78
- t.appendChild(n);
79
- }
80
- function rt(t, n, e) {
81
- t.insertBefore(n, e || null);
82
- }
83
- function T(t) {
84
- t.parentNode && t.parentNode.removeChild(t);
85
- }
86
- function ot(t) {
87
- return document.createElement(t);
88
- }
89
- function q(t) {
90
- return document.createTextNode(t);
91
- }
92
- function ut() {
93
- return q("");
94
- }
95
- function it(t, n, e, r) {
96
- return t.addEventListener(n, e, r), () => t.removeEventListener(n, e, r);
97
- }
98
- function ct(t, n, e) {
99
- e == null ? t.removeAttribute(n) : t.getAttribute(n) !== e && t.setAttribute(n, e);
100
- }
101
- function D(t) {
102
- return Array.from(t.childNodes);
103
- }
104
- function ft(t, n) {
105
- n = "" + n, t.data !== n && (t.data = n);
106
- }
107
- let m;
108
- function h(t) {
109
- m = t;
110
- }
111
- function v() {
112
- if (!m)
113
- throw new Error("Function called outside component initialization");
114
- return m;
115
- }
116
- function st(t) {
117
- v().$$.on_mount.push(t);
118
- }
119
- function lt(t, n) {
120
- return v().$$.context.set(t, n), n;
121
- }
122
- function at(t) {
123
- return v().$$.context.get(t);
124
- }
125
- const d = [], O = [];
126
- let _ = [];
127
- const M = [], G = /* @__PURE__ */ Promise.resolve();
128
- let b = !1;
129
- function H() {
130
- b || (b = !0, G.then(z));
131
- }
132
- function w(t) {
133
- _.push(t);
134
- }
135
- const $ = /* @__PURE__ */ new Set();
136
- let a = 0;
137
- function z() {
138
- if (a !== 0)
139
- return;
140
- const t = m;
141
- do {
142
- try {
143
- for (; a < d.length; ) {
144
- const n = d[a];
145
- a++, h(n), I(n.$$);
146
- }
147
- } catch (n) {
148
- throw d.length = 0, a = 0, n;
149
- }
150
- for (h(null), d.length = 0, a = 0; O.length; )
151
- O.pop()();
152
- for (let n = 0; n < _.length; n += 1) {
153
- const e = _[n];
154
- $.has(e) || ($.add(e), e());
155
- }
156
- _.length = 0;
157
- } while (d.length);
158
- for (; M.length; )
159
- M.pop()();
160
- b = !1, $.clear(), h(t);
161
- }
162
- function I(t) {
163
- if (t.fragment !== null) {
164
- t.update(), p(t.before_update);
165
- const n = t.dirty;
166
- t.dirty = [-1], t.fragment && t.fragment.p(t.ctx, n), t.after_update.forEach(w);
167
- }
168
- }
169
- function J(t) {
170
- const n = [], e = [];
171
- _.forEach((r) => t.indexOf(r) === -1 ? n.push(r) : e.push(r)), e.forEach((r) => r()), _ = n;
172
- }
173
- const x = /* @__PURE__ */ new Set();
174
- let l;
175
- function dt() {
176
- l = {
177
- r: 0,
178
- c: [],
179
- p: l
180
- // parent group
181
- };
182
- }
183
- function _t() {
184
- l.r || p(l.c), l = l.p;
185
- }
186
- function K(t, n) {
187
- t && t.i && (x.delete(t), t.i(n));
188
- }
189
- function ht(t, n, e, r) {
190
- if (t && t.o) {
191
- if (x.has(t))
192
- return;
193
- x.add(t), l.c.push(() => {
194
- x.delete(t), r && (e && t.d(1), r());
195
- }), t.o(n);
196
- } else
197
- r && r();
198
- }
199
- function Q(t, n, e, r) {
200
- const { fragment: o, after_update: c } = t.$$;
201
- o && o.m(n, e), r || w(() => {
202
- const i = t.$$.on_mount.map(S).filter(E);
203
- t.$$.on_destroy ? t.$$.on_destroy.push(...i) : p(i), t.$$.on_mount = [];
204
- }), c.forEach(w);
205
- }
206
- function R(t, n) {
207
- const e = t.$$;
208
- e.fragment !== null && (J(e.after_update), p(e.on_destroy), e.fragment && e.fragment.d(n), e.on_destroy = e.fragment = null, e.ctx = []);
209
- }
210
- function U(t, n) {
211
- t.$$.dirty[0] === -1 && (d.push(t), H(), t.$$.dirty.fill(0)), t.$$.dirty[n / 31 | 0] |= 1 << n % 31;
212
- }
213
- function gt(t, n, e, r, o, c, i, s = [-1]) {
214
- const y = m;
215
- h(t);
216
- const u = t.$$ = {
217
- fragment: null,
218
- ctx: [],
219
- // state
220
- props: c,
221
- update: g,
222
- not_equal: o,
223
- bound: N(),
224
- // lifecycle
225
- on_mount: [],
226
- on_destroy: [],
227
- on_disconnect: [],
228
- before_update: [],
229
- after_update: [],
230
- context: new Map(n.context || (y ? y.$$.context : [])),
231
- // everything else
232
- callbacks: N(),
233
- dirty: s,
234
- skip_bound: !1,
235
- root: n.target || y.$$.root
236
- };
237
- i && i(u.root);
238
- let k = !1;
239
- if (u.ctx = e ? e(t, n.props || {}, (f, j, ...C) => {
240
- const A = C.length ? C[0] : j;
241
- return u.ctx && o(u.ctx[f], u.ctx[f] = A) && (!u.skip_bound && u.bound[f] && u.bound[f](A), k && U(t, f)), j;
242
- }) : [], u.update(), k = !0, p(u.before_update), u.fragment = r ? r(u.ctx) : !1, n.target) {
243
- if (n.hydrate) {
244
- const f = D(n.target);
245
- u.fragment && u.fragment.l(f), f.forEach(T);
246
- } else
247
- u.fragment && u.fragment.c();
248
- n.intro && K(t.$$.fragment), Q(t, n.target, n.anchor, n.customElement), z();
249
- }
250
- h(y);
251
- }
252
- class mt {
253
- $destroy() {
254
- R(this, 1), this.$destroy = g;
255
- }
256
- $on(n, e) {
257
- if (!E(e))
258
- return g;
259
- const r = this.$$.callbacks[n] || (this.$$.callbacks[n] = []);
260
- return r.push(e), () => {
261
- const o = r.indexOf(e);
262
- o !== -1 && r.splice(o, 1);
263
- };
264
- }
265
- $set(n) {
266
- this.$$set && !F(n) && (this.$$.skip_bound = !0, this.$$set(n), this.$$.skip_bound = !1);
267
- }
15
+ function i(n) {
16
+ return o().$$.context.get(n);
268
17
  }
269
18
  export {
270
- mt as SvelteComponent,
271
- nt as action_destroyer,
272
- w as add_render_callback,
273
- et as append,
274
- B as assign,
275
- ct as attr,
276
- O as binding_callbacks,
277
- N as blank_object,
278
- _t as check_outros,
279
- D as children,
280
- W as component_subscribe,
281
- X as create_slot,
282
- m as current_component,
283
- R as destroy_component,
284
- T as detach,
285
- d as dirty_components,
286
- ot as element,
287
- ut as empty,
288
- z as flush,
289
- J as flush_render_callbacks,
290
- at as getContext,
291
- tt as get_all_dirty_from_scope,
292
- v as get_current_component,
293
- Y as get_slot_changes,
294
- dt as group_outros,
295
- gt as init,
296
- rt as insert,
297
- F as is_empty,
298
- E as is_function,
299
- it as listen,
300
- Q as mount_component,
301
- g as noop,
302
- st as onMount,
303
- S as run,
304
- p as run_all,
305
- V as safe_not_equal,
306
- H as schedule_update,
307
- lt as setContext,
308
- h as set_current_component,
309
- ft as set_data,
310
- P as subscribe,
311
- q as text,
312
- K as transition_in,
313
- ht as transition_out,
314
- Z as update_slot_base
19
+ t as current_component,
20
+ i as getContext,
21
+ o as get_current_component,
22
+ u as onMount,
23
+ c as setContext,
24
+ r as set_current_component
315
25
  };
316
26
  //# sourceMappingURL=annotorious-svelte.es8.js.map